fix: 修复部分问题

This commit is contained in:
white 2024-10-11 11:39:02 +08:00
parent b910acd435
commit f2d1f60941
14 changed files with 1017 additions and 1030 deletions

View File

@ -24,7 +24,7 @@
<view class="data">
<image src="https://img.agrimedia.cn/apptest/%E6%89%8B%E8%A1%A8-%E7%BA%BF%E6%80%A73-0.png" mode="widthFix"></image>
<view v-if="activeType == 'stepIndex'">
步数{{item.data_msg.step}}
步数{{item.data_msg.stepCount}}
</view>
<view v-if="activeType == 'bloodPressure'">
{{item.data_msg.bloodPressureHigh}}/{{item.data_msg.bloodPressureLow}} mmHg
@ -187,13 +187,9 @@
getArrMaxValue,
queryList() {
let type = '';
if (this.activeType == 'step') {
if (this.activeType == 'stepIndex') {
type = 'step_split'
} else {
type = this.activeType
};
if (this.activeType == 'bloodLiquidAll') {
} else if (this.activeType == 'bloodLiquidAll') {
type = 'bloodLiquid'
} else {
type = this.activeType

View File

@ -447,7 +447,6 @@ import { mapGetters } from "vuex";
this.option.series[0].markLine.symbol = 'none'
this.option.series[0].markLine.label.position ='insideEndTop'
console.log(this.pageData.type, '900000000000')
switch(this.pageData.type){
case 'stepIndex':
console.log('步数')

View File

@ -171,12 +171,17 @@
SleepDatas: "睡眠",
bloodOxygen: "血氧",
bloodPressure: '血压',
bloodLiquid: "血脂",
meiTuo: '梅脱',
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成份',
stepIndex: '运动'
bloodLiquid: '血液',
bloodLiquid: '血脂',
bloodLiquid: '尿酸',
bodyData: '身体成分',
stepIndex: '运动',
stepIndex: '步数',
stepIndex: '运动步数',
};
var videoElement = document.getElementById('myVideo');
@ -297,9 +302,8 @@
// 3秒钟内没有说话就自动关闭
if (text) {
statusTxt.value = '正在听…';
clearTimeout(times);
if (!isCallbackExecuted) {
clearTimeout(times);
times = setTimeout(() => {
this.stop();
statusTxt.value = '正在说话';
@ -307,10 +311,13 @@
const params = { msg: text };
// 判断关键字是否存在
console.log('判断')
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(result, '判断关键字是否存在')
if (result) {
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
DetailDay(result.dataKey, result.date).then(res => {
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
@ -326,7 +333,7 @@
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
item.data_msg.highDensity = item.data_msg.highDensity/100;
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
})
}
@ -435,7 +442,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话`},
{"role": "user", "content": params.msg}
]
})
@ -722,6 +729,7 @@
}
}
// 解析文字
function parseHealthQuery(query, demoData) {
if (!demoData) {
@ -734,13 +742,9 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bloodLiquid: {
'血脂': true,
'血液成分': true,
'尿酸': true
},
bloodLiquid: ['血脂', '血液', '尿酸'],
bodyData: '身体成分',
stepIndex: '运动'
stepIndex: ['运动', '步数']
};
}
@ -764,19 +768,14 @@
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
for (let value in bloodLiquidData) {
if (value.includes(query)) {
return true;
}
}
return false;
return bloodLiquidData.some(element => query.includes(element))
}
// 在查询逻辑中使用这个辅助函数
for (let key in demoData) {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
if (isBloodLiquidMatch(demoData[key], query)) {
const formattedDate = new Date().toISOString().split('T')[0];
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
return {
dataKey: key,
date: formattedDate

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,12 +171,17 @@
SleepDatas: "睡眠",
bloodOxygen: "血氧",
bloodPressure: '血压',
bloodLiquid: "血脂",
meiTuo: '梅脱',
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成份',
stepIndex: '运动'
bloodLiquid: '血液',
bloodLiquid: '血脂',
bloodLiquid: '尿酸',
bodyData: '身体成分',
stepIndex: '运动',
stepIndex: '步数',
stepIndex: '运动步数',
};
var videoElement = document.getElementById('myVideo');
@ -297,9 +302,8 @@
// 3秒钟内没有说话就自动关闭
if (text) {
statusTxt.value = '正在听…';
clearTimeout(times);
if (!isCallbackExecuted) {
clearTimeout(times);
times = setTimeout(() => {
this.stop();
statusTxt.value = '正在说话';
@ -307,10 +311,13 @@
const params = { msg: text };
// 判断关键字是否存在
console.log('判断')
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(result, '判断关键字是否存在')
if (result) {
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
DetailDay(result.dataKey, result.date).then(res => {
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
@ -326,7 +333,7 @@
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
item.data_msg.highDensity = item.data_msg.highDensity/100;
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
})
}
@ -435,7 +442,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话`},
{"role": "user", "content": params.msg}
]
})
@ -722,6 +729,7 @@
}
}
// 解析文字
function parseHealthQuery(query, demoData) {
if (!demoData) {
@ -734,13 +742,9 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bloodLiquid: {
'血脂': true,
'血液成分': true,
'尿酸': true
},
bloodLiquid: ['血脂', '血液', '尿酸'],
bodyData: '身体成分',
stepIndex: '运动'
stepIndex: ['运动', '步数']
};
}
@ -764,19 +768,14 @@
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
for (let value in bloodLiquidData) {
if (value.includes(query)) {
return true;
}
}
return false;
return bloodLiquidData.some(element => query.includes(element))
}
// 在查询逻辑中使用这个辅助函数
for (let key in demoData) {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
if (isBloodLiquidMatch(demoData[key], query)) {
const formattedDate = new Date().toISOString().split('T')[0];
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
return {
dataKey: key,
date: formattedDate

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,12 +171,17 @@
SleepDatas: "睡眠",
bloodOxygen: "血氧",
bloodPressure: '血压',
bloodLiquid: "血脂",
meiTuo: '梅脱',
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成份',
stepIndex: '运动'
bloodLiquid: '血液',
bloodLiquid: '血脂',
bloodLiquid: '尿酸',
bodyData: '身体成分',
stepIndex: '运动',
stepIndex: '步数',
stepIndex: '运动步数',
};
var videoElement = document.getElementById('myVideo');
@ -297,9 +302,8 @@
// 3秒钟内没有说话就自动关闭
if (text) {
statusTxt.value = '正在听…';
clearTimeout(times);
if (!isCallbackExecuted) {
clearTimeout(times);
times = setTimeout(() => {
this.stop();
statusTxt.value = '正在说话';
@ -307,10 +311,13 @@
const params = { msg: text };
// 判断关键字是否存在
console.log('判断')
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(result, '判断关键字是否存在')
if (result) {
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
DetailDay(result.dataKey, result.date).then(res => {
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
@ -326,7 +333,7 @@
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
item.data_msg.highDensity = item.data_msg.highDensity/100;
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/1000;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
})
}
@ -435,7 +442,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": `请模仿全科医生的口吻与我对话` + params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话`},
{"role": "user", "content": params.msg}
]
})
@ -722,6 +729,7 @@
}
}
// 解析文字
function parseHealthQuery(query, demoData) {
if (!demoData) {
@ -734,13 +742,9 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bloodLiquid: {
'血脂': true,
'血液成分': true,
'尿酸': true
},
bloodLiquid: ['血脂', '血液', '尿酸'],
bodyData: '身体成分',
stepIndex: '运动'
stepIndex: ['运动', '步数']
};
}
@ -764,19 +768,14 @@
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
for (let value in bloodLiquidData) {
if (value.includes(query)) {
return true;
}
}
return false;
return bloodLiquidData.some(element => query.includes(element))
}
// 在查询逻辑中使用这个辅助函数
for (let key in demoData) {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
if (isBloodLiquidMatch(demoData[key], query)) {
const formattedDate = new Date().toISOString().split('T')[0];
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
return {
dataKey: key,
date: formattedDate

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,12 +171,17 @@
SleepDatas: "睡眠",
bloodOxygen: "血氧",
bloodPressure: '血压',
bloodLiquid: "血脂",
meiTuo: '梅脱',
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bodyData: '身体成份',
stepIndex: '运动'
bloodLiquid: '血液',
bloodLiquid: '血脂',
bloodLiquid: '尿酸',
bodyData: '身体成分',
stepIndex: '运动',
stepIndex: '步数',
stepIndex: '运动步数',
};
var videoElement = document.getElementById('myVideo');
@ -297,9 +302,8 @@
// 3秒钟内没有说话就自动关闭
if (text) {
statusTxt.value = '正在听…';
clearTimeout(times);
if (!isCallbackExecuted) {
clearTimeout(times);
times = setTimeout(() => {
this.stop();
statusTxt.value = '正在说话';
@ -307,10 +311,13 @@
const params = { msg: text };
// 判断关键字是否存在
console.log('判断')
const result = parseHealthQuery(params.msg);
isCallbackExecuted = true;
console.log(result, '判断关键字是否存在')
if (result) {
console.log(result.dataKey, result.date, '参数++++++++++++++++++++++++++++++++++++++++')
DetailDay(result.dataKey, result.date).then(res => {
let TargetData = res.data.data;
var QSindex = containsKeywordRegex(params.msg);
@ -321,6 +328,15 @@
delete item.data_msg.list;
})
}
if (result.dataKey == 'bloodLiquid') {
TargetData.map(item => {
item.data_msg.cholesterol = item.data_msg.cholesterol/100;
item.data_msg.highDensity = item.data_msg.highDensity/100;
item.data_msg.triacylglycerol = item.data_msg.triacylglycerol/100;
item.data_msg.uricAcidVal = item.data_msg.uricAcidVal/10000;
item.data_msg.lowDensity = item.data_msg.lowDensity/100;
})
}
Question = `请模仿全科医生的口吻与我: ${user}对话,我最近测量的${result.dataKey}数据为${JSON.stringify(TargetData)}, #提示data_msg为值hour_minute为检测时间。#提示:“[]”表示数据为空,请在小程序上传数据。#限制:回复不要带英文,要都转化成汉语。#限制回复内容控制在150字。#限制:忽略“压力指数、疲劳指数、心肌炎风险、冠心病风险和动脉硬化”等数据。`
@ -340,8 +356,7 @@
{"role": "system", "content": Question},
{"role": "user", "content": `请问我${params.msg}正常吗`}
]
})
console.log(data, '问题问题问题问题问题问题问题问题')
});
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
@ -427,7 +442,7 @@
xhr.open('POST', 'http://sc2.agrimedia.cn:8787/api/user/ask', true);
var data = JSON.stringify({
"messages": [
{"role": "system", "content": params.msg},
{"role": "system", "content": `请模仿全科医生的口吻与我对话`},
{"role": "user", "content": params.msg}
]
})
@ -714,6 +729,7 @@
}
}
// 解析文字
function parseHealthQuery(query, demoData) {
if (!demoData) {
@ -726,13 +742,9 @@
pulseReat: '心率',
bodyTemperature: '体温',
ECGData: '心电图',
bloodLiquid: {
'血脂': true,
'血液成分': true,
'尿酸': true
},
bloodLiquid: ['血脂', '血液', '尿酸'],
bodyData: '身体成分',
stepIndex: '运动'
stepIndex: ['运动', '步数']
};
}
@ -756,26 +768,20 @@
// 创建一个辅助函数来检查 bloodLiquid 对象是否包含查询字符串
function isBloodLiquidMatch(bloodLiquidData, query) {
for (let value in bloodLiquidData) {
if (value.includes(query)) {
return true;
}
}
return false;
return bloodLiquidData.some(element => query.includes(element))
}
// 在查询逻辑中使用这个辅助函数
for (let key in demoData) {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid') {
if (typeof demoData[key] === 'object' && key === 'bloodLiquid' || typeof demoData[key] === 'object' && key === 'stepIndex' ) {
if (isBloodLiquidMatch(demoData[key], query)) {
const formattedDate = new Date().toISOString().split('T')[0];
key === 'stepIndex'? key = 'step_split' : ''; // 修改步数参数
return {
dataKey: key,
date: formattedDate
};
}
} else if (typeof demoData[key] === 'string' && demoData[key].includes(query)) {
const formattedDate = new Date().toISOString().split('T')[0];
} else if (query.includes(demoData[key])) {
return {
dataKey: key,
date: formattedDate

Binary file not shown.