diff --git a/common/css/common.scss b/common/css/common.scss
index 873efe8..121aa9b 100644
--- a/common/css/common.scss
+++ b/common/css/common.scss
@@ -10,6 +10,9 @@
.flx_ac{
align-items: center;
}
+.flx_ae{
+ align-items: end;
+}
.flx_jc{
justify-content: center;
}
diff --git a/components/cankao/cankao.vue b/components/cankao/cankao.vue
index 7fdc09d..6738681 100644
--- a/components/cankao/cankao.vue
+++ b/components/cankao/cankao.vue
@@ -33,12 +33,15 @@
{{v.name}}
+
+
+
-
+
-
+
{{ idx1 == 1?v.data[idx1-1]:''}}
@@ -48,7 +51,6 @@
-
@@ -121,8 +123,20 @@
font-size: 24rpx;
}
.zzt{
+ position: relative;
padding: 20rpx 0;
width: 60%;
+ .xnz{
+ width: 8rpx;
+ height: 20rpx;
+ background-color: #fff;
+ border-left: 1rpx solid black;
+ border-right: 1rpx solid black;
+ position: absolute;
+ right: 50rpx;
+ top: 19rpx;
+ transform: rotate(15deg);
+ }
.zzt-body{
height: 10rpx;
margin: 2rpx;
diff --git a/components/overview/overview.vue b/components/overview/overview.vue
new file mode 100644
index 0000000..fb97a91
--- /dev/null
+++ b/components/overview/overview.vue
@@ -0,0 +1,67 @@
+
+
+
+
+ {{ overviewData.name }}
+
+
+
+ {{v}}
+
+
+
+
+ {{v.name}}
+
+
+ {{v.value}}
+
+
+ {{v.average}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/pie/pie.vue b/components/pie/pie.vue
new file mode 100644
index 0000000..20bf7ad
--- /dev/null
+++ b/components/pie/pie.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/request.js b/config/request.js
index 2b8bbc4..ed83e82 100644
--- a/config/request.js
+++ b/config/request.js
@@ -80,6 +80,7 @@ export default () => {
}
if (data.code == 7777) {
+ store.commit('api/setApiToken','')
uni.showToast({
mask: true,
title: '请重新登录',
diff --git a/pages/index/echarts.vue b/pages/index/echarts.vue
index 7d5265d..f7ff64f 100644
--- a/pages/index/echarts.vue
+++ b/pages/index/echarts.vue
@@ -12,16 +12,43 @@
-
+
-
+
+
+
+
+ {{ distance }}
+
+
+ 公里
+
+
+
+ 距离
+
+
+
+
+
+
+
+
+ {{ calorie / 10 }}
+
+
+ 千卡
+
+
+
+ 卡路里
+
+
+
+
+
+
+
@@ -43,6 +70,9 @@ import { mapGetters } from "vuex";
export default {
data() {
return {
+ stepCount:0,
+ calorie:0,
+ distance:0,
time: new Date().toISOString().substring(0, 10),
type:'',
desc:'',
@@ -91,6 +121,11 @@ import { mapGetters } from "vuex";
}
]
},
+ step:{
+ name:'每日活动',
+ color:"#29cf6f",
+ unit:'毫摩尔/升',
+ },
bloodOxygen:{
title:'123123',
name:'血氧',
@@ -102,11 +137,18 @@ import { mapGetters } from "vuex";
bodyTemperature:{
title:'bodyTemperature',
name:'体温',
- color:"#bf32fc",
+ color:"#2ec8d8",
+ unit:'℃',
+ cankaoData:false,
+ },
+ bloodPressure:{
+ title:'bloodPressure',
+ name:'血压',
+ color:"#fb8544",
+ color1:"#00c3da",
unit:'℃',
cankaoData:false,
},
-
pulseReat:{
title:'123123',
name:'心率',
@@ -134,6 +176,100 @@ import { mapGetters } from "vuex";
max:1000
},
],
+ },
+ bloodLiquidAll:{
+ title:'123123',
+ name:'血脂',
+
+ unit:'微摩尔/升',
+ overviewData:{
+ name:'血脂概况',
+ tb_head:[
+ '',
+ '范围',
+ '平均值'
+ ],
+ data:[
+ {
+ name:'总胆固醇',
+ value:'0-0',
+ average:0,
+ color:'#46b4ff',
+ bgColor:'#e1f3fd'
+ },
+ {
+ name:'甘油三酯',
+ value:'0-0',
+ average:0,
+ color:'#29cf6c',
+ bgColor:'#e2fff3'
+ },
+ {
+ name:'高密度脂蛋白',
+ value:'0-0',
+ average:0,
+ color:'#fcc05d',
+ bgColor:'#fef5e3'
+ },
+ {
+ name:'低密度脂蛋白',
+ value:'0-0',
+ average:0,
+ color:'#fa4e33',
+ bgColor:'#fee5e1'
+ }
+ ]
+ },
+ cankaoData:[
+ {
+ name:'总胆固醇',
+ data:[
+ 0,2.8,5.17,20
+ ],
+ adjustment:[
+ 0.05,
+ 0.02,
+ -0.05
+ ],
+ max:20
+ },
+ {
+ name:'甘油三酯',
+ data:[
+ 0,0.56,1.7,20
+ ],
+ adjustment:[
+ 0.06,
+ -0.02,
+ -0.04
+ ],
+ max:3
+ },
+ {
+ name:'高密度脂蛋白',
+ data:[
+ 0,0.96,1.15,20
+ ],
+ adjustment:[
+ 0.04,
+ 0.00,
+ -0.04
+ ],
+ max:1.6
+ },
+ {
+ name:'低密度脂蛋白',
+ data:[
+ 0,3.1,20
+ ],
+ adjustment:[
+ 0.04,
+ 0.00,
+ -0.04
+ ],
+ max:20
+ }
+ ]
}
},
option:{
@@ -146,7 +282,6 @@ import { mapGetters } from "vuex";
min:0,
axisLabel: {
show: true,
-
splitNumber:2,
formatter: function(value, index) {
let arr = ['12am', '6am', '12pm', '6pm', '12am']
@@ -180,18 +315,15 @@ import { mapGetters } from "vuex";
symbolSize: 5,
data:
[
-
- // [0.5, 3.5],
- // [1.2, 2.4],
- // [1.4, 2.8],
- // [2.7, 2.4],
- // [3.4, 6],
],
+
markLine: {
data: [
{
+ show:false,
yAxis: 2.5, // 在 y 值为 100 的位置添加水平参考线
- }
+ },
+
],
lineStyle:{
color:'#ccc',
@@ -202,99 +334,20 @@ import { mapGetters } from "vuex";
},
},
type: 'scatter',
- }
- ]
+ },
+
+ ],
+
},
- option2: {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- },
- confine: true
- },
- legend: {
- data: ['热度', '正面', '负面']
- },
- grid: {
- left: 20,
- right: 20,
- bottom: 15,
- top: 40,
- containLabel: true
- },
- xAxis: [
- {
- type: 'value',
- axisLine: {
- lineStyle: {
- color: '#999999'
- }
- },
- axisLabel: {
- color: '#666666',
-
- }
- }
- ],
- yAxis: [
- {
- type: 'category',
- axisTick: { show: false },
- data: ['汽车之家', '今日头条', '百度贴吧', '一点资讯', '微信', '微博', '知乎'],
- axisLine: {
- lineStyle: {
- color: '#999999'
- }
- },
- axisLabel: {
- color: '#666666'
- }
- }
- ],
- series: [
- {
- name: '热度',
- type: 'bar',
- label: {
- normal: {
- show: true,
- position: 'inside'
- }
- },
- data: [300, 270, 340, 344, 300, 320, 310],
- },
- {
- name: '正面',
- type: 'bar',
- stack: '总量',
- label: {
- normal: {
- show: true
- }
- },
- data: [120, 102, 141, 174, 190, 250, 220]
- },
- {
- name: '负面',
- type: 'bar',
- stack: '总量',
- label: {
- normal: {
- show: true,
- position: 'left'
- }
- },
- data: [-20, -32, -21, -34, -90, -130, -110]
- }
- ]
- },
-
+
}
},
onLoad(e) {
this.type = e.type
this.desc = e.desc || ''
+ this.calorie = e.calorie || 0
+ this.stepCount = e.step || 0
+ this.distance = e.distance || 0
// this.getDataList()
},
computed: {
@@ -315,12 +368,18 @@ import { mapGetters } from "vuex";
})
},
goPath(){
+ let type = this.type
+ if(this.type == 'bloodLiquid'){
+ type = 'bloodLiquid&desc=uricAcidVal'
+ }
+ if(this.type == 'bloodLiquidAll'){
+ type = 'bloodLiquid'
+ }
uni.navigateTo({
- url:'./detail?type='+this.type +(this.desc == ''?'':'&desc='+this.desc)
+ url:'./detail?type='+type
})
},
makeHour(hours){
-
return Math.floor(hours/6); // 使用%运算符取余,确保结果是0-4的范围
},
makeMinute(minute){
@@ -333,8 +392,15 @@ import { mapGetters } from "vuex";
return floatData.toFixed(2);
},
async getDataList(){
+ let type = this.type
+ if(this.type == 'step'){
+ type = 'step_split'
+ }
+ if(this.type == 'bloodLiquidAll'){
+ type = 'bloodLiquid'
+ }
let res = await this.$store.dispatch('api/getDeviceListDays', {
- type: (this.type == 'step'?'step_split':this.type),
+ type: type,
// type: (this.type),
device_real_time: this.time,
device_id:this.getActiceDevice.device_id
@@ -342,6 +408,25 @@ import { mapGetters } from "vuex";
return this.makeOptionConfig(res.data);
},
+ getAverage(arr) {
+ if (arr.length === 0) return 0; // 如果数组为空,则返回0
+ const sum = arr.reduce((accumulator, currentValue) => accumulator + currentValue);
+ return sum / arr.length; // 计算平均值
+ },
+ subtractMinutes(timeStr, minutes) {
+ const parts = timeStr.split(':');
+ const hours = parseInt(parts[0], 10);
+ const minutesLeft = parseInt(parts[1], 10);
+
+ const date = new Date();
+ date.setHours(hours, minutesLeft, 0, 0); // 设置时、分、秒、毫秒
+ date.setMinutes(date.getMinutes() - minutes); // 减去指定的分钟数
+
+ // 格式化为HH:MM
+ const newHours = date.getHours().toString().padStart(2, '0');
+ const newMinutes = date.getMinutes().toString().padStart(2, '0');
+ return newHours + ':' + newMinutes;
+ },
makeOptionConfig(data){
let echartsData = [];
let sum = 0;
@@ -349,33 +434,97 @@ import { mapGetters } from "vuex";
let min = 0;
let avg = 0;
let len = 0;
+ let arr = [];
+ let dataArr = {};
+
switch(this.type){
-
+ case 'step':
+ data.map((v,i) => {
+ let timeArr = v.hour_minute.split(':');
+ let key = '';
+ if(timeArr[1] < 30){
+ key = timeArr[0]+':'+'00'
+
+ }else{
+ key = timeArr[0]+':'+'30'
+
+ }
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:v.data_msg.stepCount,
+ from:1
+ }
+ }else{
+ // console.log(dataArr[key].val)
+ dataArr[key].val += v.data_msg.stepCount;
+ }
+
+ })
+ for (let key in dataArr) {
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ echartsData.push({value:[floatData,(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ // console.log(key , dataArr[key]);
+ }
+ }
+ console.log(echartsData)
+ this.option.series[0].data = echartsData
+ this.option.series[0].markLine = []
+ this.option.series[0].type = 'bar'
+ this.option.series[0].barMaxWidth = '10'
+ this.option.title = {
+ text :this.stepCount + '步',
+ // subtext: '毫摩尔/升',
+ left: 'center'
+ };
+ break;
case 'bodyTemperature':
data.map((v,i) => {
let timeArr = v.hour_minute.split(':');
+ let key = timeArr[0]+':'+'00'
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:[parseFloat(v.data_msg)],
+ from:0
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,parseFloat(v.data_msg)];
+ }
let dataMsg = parseFloat(v.data_msg);
- let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
- echartsData.push({value:[floatData,dataMsg],itemStyle: {color: this.dataConfig[this.type].color}})
+ // let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
+ // echartsData.push({value:[floatData,dataMsg],itemStyle: {color: this.dataConfig[this.type].color}})
sum += dataMsg
if(max == 0 || max < dataMsg){
max = dataMsg
}
- if(min == 0 || max > dataMsg){
+ if(min == 0 || min > dataMsg){
min = dataMsg
}
})
avg = sum / data.length
avg = parseFloat(avg.toFixed(2))
+ // console.log(dataArr)
+ for (let key in dataArr) {
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ }
+ }
this.option.series[0].data = echartsData
+ this.option.series[0].type = 'line'
+ this.option.series[0].lineStyle = {}
+ this.option.series[0].lineStyle.color = '#ccc'
this.option.series[0].markLine.data[0].yAxis = avg
this.option.series[0].markLine.lineStyle.color = this.dataConfig[this.type].color
this.option.series[0].markLine.label.color = this.dataConfig[this.type].color
- this.option.yAxis.min = 32;
- this.option.yAxis.max = max + 4;
+ this.option.yAxis.min = parseInt(min)-1;
+ this.option.yAxis.max = parseInt(max) + 1;
+ this.option.yAxis.splitNumber = 1;
this.option.title = {
text :min + '-' + max,
- subtext: '毫摩尔/升',
+ subtext: '℃',
left: 'center'
};
this.dataConfig.bodyTemperature.title = min + '-' + max
@@ -383,45 +532,123 @@ import { mapGetters } from "vuex";
case 'bloodOxygen':
data.map((v,i) => {
let timeArr = v.hour_minute.split(':');
- let dataMsg = parseFloat(v.data_msg);
- let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
- echartsData.push({value:[floatData,dataMsg],itemStyle: {color: this.dataConfig[this.type].color}})
+ let dataMsg = this.getAverage(v.data_msg);
+ if(timeArr[1] % 10 == 0){
+ let key = v.hour_minute
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:v.data_msg.filter(item => item > 0),
+ from:0
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,...v.data_msg.filter(item => item > 0)];
+ }
+ }else{
+
+ let key = timeArr[0]+':'+((timeArr[1] - 5) == 0?'00':(timeArr[1] - 5))
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:v.data_msg.filter(item => item > 0),
+ from:1
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,...v.data_msg.filter(item => item > 0)];
+ }
+
+ }
+
+
sum += dataMsg
- if(max == 0 || max < dataMsg){
- max = dataMsg
- }
- if(min == 0 || max > dataMsg){
- min = dataMsg
- }
+ v.data_msg.map((v2,i2) => {
+ if(v2 > 0){
+ arr.push(v2)
+ }
+
+ })
+
})
+ for (let key in dataArr) {
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ // console.log(key , dataArr[key]);
+ }
+ }
+ if(arr.length > 0){
+ min = Math.min(...arr)
+ max = Math.max(...arr)
+ }
+
avg = sum / data.length
- avg = parseFloat(avg.toFixed(2))
+ avg = parseFloat(avg.toFixed(0))
this.option.series[0].data = echartsData
this.option.series[0].markLine.data[0].yAxis = avg
+ this.option.series[0].markLine.data[0].value = avg
+ this.option.series[0].markLine.symbol = 'none'
+ // this.option.series[0].markLine.data[0].type = 'average'
+ // this.option.series[0].markLine.data[0].name = '平均值'
this.option.series[0].markLine.lineStyle.color = this.dataConfig[this.type].color
this.option.series[0].markLine.label.color = this.dataConfig[this.type].color
+ this.option.series[0].markLine.label.position ='insideEndTop'
+ // this.option.series[0].markLine.label.distance =[10,5]
this.option.title = {
text :min + '-' + max,
subtext: '毫摩尔/升',
left: 'center'
};
+ this.option.yAxis.splitNumber = 2;
this.dataConfig.bodyTemperature.title = min + '-' + max
+ this.option.yAxis.min = 96;
+ this.option.yAxis.max = 100;
break;
case 'bloodGlucose':
data.map((v,i) => {
let timeArr = v.hour_minute.split(':');
- let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
- echartsData.push({value:[floatData,v.data_msg],itemStyle: {color: this.dataConfig[this.type].color}})
+ if(timeArr[1] < 30){
+ let key = timeArr[0]+':'+'00'
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:[v.data_msg],
+ from:0
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,v.data_msg];
+ }
+ }else{
+ let key = timeArr[0]+':'+'30'
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:[v.data_msg],
+ from:1
+ }
+ }else{
+ // console.log(dataArr[key].val)
+ dataArr[key].val = [...dataArr[key].val,v.data_msg];
+ }
+ }
+ // let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
+ // echartsData.push({value:[floatData,v.data_msg],itemStyle: {color: this.dataConfig[this.type].color}})
sum += v.data_msg
+
if(max == 0 || max < v.data_msg){
max = v.data_msg
}
- if(min == 0 || max > v.data_msg){
+ if(min == 0 || min > v.data_msg){
min = v.data_msg
}
})
+
avg = sum / data.length
avg = parseFloat(avg.toFixed(2))
+ for (let key in dataArr) {
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ // console.log(key , dataArr[key]);
+ }
+ }
this.option.series[0].data = echartsData
this.option.series[0].markLine.data[0].yAxis = avg
this.option.series[0].markLine.lineStyle.color = this.dataConfig[this.type].color
@@ -444,13 +671,13 @@ import { mapGetters } from "vuex";
break;
}
len += 1;
- let floatData = this.makeFloatHoursMinutes(timeArr[0],parseInt( timeArr[1]) + i)
- echartsData.push({value:[floatData,real_data],itemStyle: {color: this.dataConfig[this.type].color}})
+ // let floatData = this.makeFloatHoursMinutes(timeArr[0],parseInt( timeArr[1]) + i)
+ // echartsData.push({value:[floatData,real_data],itemStyle: {color: this.dataConfig[this.type].color}})
sum += real_data
if(max == 0 || max < real_data){
max = real_data
}
- if(min == 0 || max > real_data){
+ if(min == 0 || min > real_data){
min = real_data
}
}
@@ -472,36 +699,145 @@ import { mapGetters } from "vuex";
this.option.yAxis.splitNumber = 3;
this.option.yAxis.min = 95;
this.option.yAxis.max = 100;
- break;
+ break;
+ case 'bloodPressure':
+ let max2 = 0;
+ let min2 = 0;
+ let sum2 = 0;
+ let echartsData2 = []
+ data.map((v,i) => {
+ let timeArr = v.hour_minute.split(':');
+ let key = timeArr[0]+':'+'00'
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:[v.data_msg.bloodPressureHigh],
+ val2:[v.data_msg.bloodPressureLow],
+ from:0
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,v.data_msg.bloodPressureHigh];
+ dataArr[key].val = [...dataArr[key].val,v.data_msg.bloodPressureLow];
+ }
+ // let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
+ // echartsData.push({value:[floatData,v.data_msg],itemStyle: {color: this.dataConfig[this.type].color}})
+ sum += v.data_msg.bloodPressureHigh
+ sum2 += v.data_msg.bloodPressureLow
+
+ if(max == 0 || max < v.data_msg.bloodPressureHigh){
+ max = v.data_msg.bloodPressureHigh
+ }
+ if(min == 0 || min > v.data_msg.bloodPressureHigh){
+ min = v.data_msg.bloodPressureHigh
+ }
+ if(max2 == 0 || max2 < v.data_msg.bloodPressureLow){
+ max2 = v.data_msg.bloodPressureLow
+ }
+ if(min2 == 0 || min2 > v.data_msg.bloodPressureLow){
+ min2 = v.data_msg.bloodPressureLow
+ }
+ })
+
+ avg = sum / data.length
+ let avg2 = sum2 / data.length
+ avg = parseFloat(avg.toFixed(2))
+ avg2 = parseFloat(avg2.toFixed(2))
+ for (let key in dataArr) {
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val2)],itemStyle: {color: this.dataConfig[this.type].color1}})
+ // console.log(key , dataArr[key]);
+ }
+ }
+ this.option.series[0].data = echartsData
+ // this.option.series[1].data = echartsData2
+ this.option.series[0].markLine.data[0].yAxis = avg
+ this.option.series[0].markLine.lineStyle.color = this.dataConfig[this.type].color
+ this.option.series[0].markLine.label.color = this.dataConfig[this.type].color
+ this.option.series[0].markLine.data[1] = {}
+ this.option.series[0].markLine.data[1].lineStyle = {}
+ this.option.series[0].markLine.data[1].lineStyle.color = this.dataConfig[this.type].color1
+ this.option.series[0].markLine.data[1].label = {}
+ this.option.series[0].markLine.data[1].label.color = this.dataConfig[this.type].color1
+ this.option.series[0].markLine.data[1].yAxis = avg2
+ // this.option.series[1].markLine.lineStyle.color = this.dataConfig[this.type].color
+ // this.option.series[1].markLine.label.color = this.dataConfig[this.type].color
+ this.option.title = {
+ text :'收缩压'+min + '-' + max + ' '+ '舒张压:' +min2 + '-' + max2,
+ // subtext: '毫摩尔/升',
+ left: 'center'
+ };
+ this.dataConfig.bloodGlucose.title = min + '-' + max
+ break;
+
case 'pulseReat':
+ // [data[0]],
data.map((v,i) => {
let dataMsg = v.data_msg;
let timeArr = v.hour_minute.split(':');
- for(let i = 0;i<1;i++){
+ let maxLength = (dataMsg.length > 5?5:dataMsg.length)
+ let readDataArr = [];
+ for(let i = 0;i= 200)){
+ continue;
}
+
+ readDataArr.push(real_data)
len += 1;
-
- let floatData = this.makeFloatHoursMinutes(timeArr[0],parseInt( timeArr[1]) + i)
-
- echartsData.push({value:[floatData,real_data],itemStyle: {color: this.dataConfig[this.type].color}})
sum += real_data
if(max == 0 || max < real_data){
max = real_data
}
- if(min == 0 || max > real_data){
+ if(min == 0 || min > real_data){
min = real_data
}
}
+ if(timeArr[1] < 30){
+ let key = timeArr[0]+':'+'00'
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:readDataArr.filter(item => (item > 30 || item <= 200)),
+ from:0
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,...readDataArr.filter(item => (item > 30 || item <= 200))];
+ }
+
+ }else{
+ let key = timeArr[0]+':'+'30'
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:readDataArr.filter(item => (item > 30 || item <= 200)),
+ from:0
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,...readDataArr.filter(item => (item > 30 || item <= 200))];
+ }
+
+ }
+
+
+
})
avg = sum / len
avg = parseFloat(avg.toFixed(2))
+ for (let key in dataArr) {
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ // console.log(key , dataArr[key]);
+ }
+ }
+
this.option.series[0].data = echartsData
this.option.series[0].markLine.data[0].yAxis = avg
+
this.option.series[0].markLine.lineStyle.color = this.dataConfig[this.type].color
this.option.series[0].markLine.label.color = this.dataConfig[this.type].color
this.option.title = {
@@ -511,34 +847,79 @@ import { mapGetters } from "vuex";
};
this.dataConfig.bloodGlucose.title = min + '-' + max
// this.option.yAxis.axisLabel.formatter = '{value}%';
- this.option.yAxis.splitNumber = 3;
+ this.option.yAxis.splitNumber = 1;
this.option.yAxis.min = 30;
this.option.yAxis.max = 90;
break;
- case 'bloodLiquid':
+ case 'bloodLiquid':
data.map((v,i) => {
let dataMsg = v.data_msg;
let real_data = dataMsg.uricAcidVal/10
let timeArr = v.hour_minute.split(':');
- let floatData = this.makeFloatHoursMinutes(timeArr[0],timeArr[1])
- echartsData.push({value:[floatData,real_data],itemStyle: {color: this.dataConfig[this.type].color}})
+
+ if(timeArr[1] % 10 == 0){
+ var key = v.hour_minute
+ }else{
+ var key = timeArr[0]+':'+((timeArr[1] - 5) == 0?'00':(timeArr[1] - 5))
+ }
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:[real_data],
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,real_data];
+ }
sum += real_data
if(max == 0 || max < real_data){
max = real_data
}
- if(min == 0 || max > real_data){
+ if(min == 0 || min > real_data){
min = real_data
}
len += 1;
})
+
avg = sum / len
avg = parseFloat(avg.toFixed(2))
+ for (let key in dataArr) {
+
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ let nextKey = this.subtractMinutes(key,10)
+
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)],itemStyle: {color: this.dataConfig[this.type].color}})
+ if(!dataArr.hasOwnProperty(nextKey)){
+ echartsData.push(null)
+ }
+ }
+ }
+
this.option.series[0].data = echartsData
this.option.series[0].markLine.data[0].yAxis = avg
this.option.series[0].markLine.lineStyle.color = this.dataConfig[this.type].color
this.option.series[0].markLine.label.color = this.dataConfig[this.type].color
+ this.option.series[0].type = 'line'
+ this.option.series[0].symbol = 'none',
+ this.option.series[0].smooth = true
+ this.option.series[0].itemStyle= {
+ color: 'rgb(255, 70, 131)'
+ }
+ this.option.series[0].areaStyle = {
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+ {
+ offset: 0,
+ color: 'rgb(254, 174, 173)'
+ },
+ {
+ offset: 1,
+ color: 'rgb(255, 255, 248)'
+ }
+ ])
+ }
+
// this.option.series[0].type = 'this.dataConfig[this.type].color'
this.option.title = {
text :min + '-' + max,
@@ -555,7 +936,137 @@ import { mapGetters } from "vuex";
}
this.option.yAxis.splitNumber = 3;
this.option.yAxis.min = 0;
- this.option.yAxis.max = 330;
+ this.option.yAxis.max = Math.round(max) + 1;
+ break;
+ case 'bloodLiquidAll':
+ let orTotal = {
+ cholesterol:[],
+ highDensity:[],
+ lowDensity:[],
+ triacylglycerol:[],
+ }
+
+ data.map((v,i) => {
+ let dataMsg = v.data_msg;
+ let real_data = {
+ cholesterol:(dataMsg.cholesterol/100).toFixed(2),
+ highDensity:(dataMsg.highDensity/100).toFixed(2),
+ lowDensity:(dataMsg.lowDensity/100).toFixed(2),
+ triacylglycerol:(dataMsg.triacylglycerol/100).toFixed(2)
+ }
+ orTotal.cholesterol.push(parseFloat(real_data.cholesterol))
+ orTotal.highDensity.push(parseFloat(real_data.highDensity))
+ orTotal.lowDensity.push(parseFloat(real_data.lowDensity))
+ orTotal.triacylglycerol.push(parseFloat(real_data.triacylglycerol))
+ let timeArr = v.hour_minute.split(':');
+ if(timeArr[1] % 10 == 0){
+ var key = v.hour_minute
+ }else{
+ var key = timeArr[0]+':'+((timeArr[1] - 5) == 0?'00':(timeArr[1] - 5))
+ }
+ if(dataArr[key] == undefined){
+ dataArr[key] = {
+ val:[real_data.cholesterol],
+ highDensity:[real_data.highDensity],
+ lowDensity:[real_data.lowDensity],
+ triacylglycerol:[real_data.triacylglycerol],
+ }
+ }else{
+ dataArr[key].val = [...dataArr[key].val,real_data.cholesterol];
+ dataArr[key].highDensity = [...dataArr[key].highDensity,real_data.highDensity];
+ dataArr[key].lowDensity = [...dataArr[key].lowDensity,real_data.lowDensity];
+ dataArr[key].triacylglycerol = [...dataArr[key].triacylglycerol,real_data.triacylglycerol];
+ }
+
+
+ })
+
+ let echartsData1 = [];
+ echartsData2 = [];
+ let echartsData3 = [];
+ let echartsData8 = [] // 测试用
+ for (let key in dataArr) {
+
+ if (dataArr.hasOwnProperty(key)) { // 确保key是对象自身的属性
+ let timeArr2 = key.split(':');
+ let floatData = this.makeFloatHoursMinutes(timeArr2[0],timeArr2[1])
+ let nextKey = this.subtractMinutes(key,10)
+
+ echartsData.push({value:[floatData,this.getAverage(dataArr[key].val)]})
+ if(!dataArr.hasOwnProperty(nextKey)){
+ echartsData.push(null)
+ }
+
+ echartsData1.push({value:[floatData,this.getAverage(dataArr[key].highDensity)]})
+ if(!dataArr.hasOwnProperty(nextKey)){
+ echartsData1.push(null)
+ }
+
+ echartsData2.push({value:[floatData,this.getAverage(dataArr[key].lowDensity)]})
+ if( !dataArr.hasOwnProperty(nextKey)){
+ echartsData2.push(null)
+ }
+
+ echartsData3.push({value:[floatData,this.getAverage(dataArr[key].triacylglycerol)]})
+ if( !dataArr.hasOwnProperty(nextKey)){
+ echartsData3.push(null)
+ }
+
+ // console.log(key , dataArr[key]);
+ }
+ }
+ console.log(echartsData8)
+ this.option.legend = {
+ data:['总胆固醇','甘油三酯','高密度脂蛋白','低密度脂蛋白']
+ }
+ // 总胆固醇
+ this.option.series[0].data = echartsData
+ this.option.series[0].type = 'line'
+ this.option.series[0].symbol = 'none',
+ this.option.series[0].smooth = true
+ this.option.series[0].name = this.option.legend.data[0]
+ this.option.series[0].color = this.dataConfig.bloodLiquidAll.overviewData.data[0].color
+ // 甘油三酯
+ this.option.series[1] = {}
+ this.option.series[1].data = echartsData3
+ this.option.series[1].type = 'line'
+ this.option.series[1].symbol = 'none',
+ this.option.series[1].smooth = true
+ this.option.series[1].name = this.option.legend.data[1]
+ this.option.series[1].color = this.dataConfig.bloodLiquidAll.overviewData.data[1].color
+ // 高
+ this.option.series[2] = {}
+ this.option.series[2].data = echartsData1
+ this.option.series[2].type = 'line'
+ this.option.series[2].symbol = 'none',
+ this.option.series[2].smooth = true
+ this.option.series[2].name = this.option.legend.data[2]
+ this.option.series[2].color = this.dataConfig.bloodLiquidAll.overviewData.data[2].color
+ // 低
+ this.option.series[3] = {}
+ this.option.series[3].data = echartsData2
+ this.option.series[3].type = 'line'
+ this.option.series[3].symbol = 'none',
+ this.option.series[3].smooth = true
+ this.option.series[3].name = this.option.legend.data[3]
+ this.option.series[3].color = this.dataConfig.bloodLiquidAll.overviewData.data[3].color
+
+ this.option.series[0].markLine = []
+ this.dataConfig.bloodGlucose.title = min + '-' + max
+ this.dataConfig.bloodLiquidAll.overviewData.data[0].average = this.getAverage(orTotal.cholesterol).toFixed(2)
+ this.dataConfig.bloodLiquidAll.overviewData.data[1].average = this.getAverage(orTotal.triacylglycerol).toFixed(2)
+ this.dataConfig.bloodLiquidAll.overviewData.data[2].average = this.getAverage(orTotal.highDensity).toFixed(2)
+ this.dataConfig.bloodLiquidAll.overviewData.data[3].average = this.getAverage(orTotal.lowDensity).toFixed(2)
+ if(orTotal.cholesterol.length > 0){
+ this.dataConfig.bloodLiquidAll.overviewData.data[0].value = Math.min(...orTotal.cholesterol).toFixed(2) + '-' + Math.max(...orTotal.cholesterol).toFixed(2)
+ this.dataConfig.bloodLiquidAll.overviewData.data[1].value = Math.min(...orTotal.triacylglycerol).toFixed(2) + '-' + Math.max(...orTotal.triacylglycerol).toFixed(2)
+ this.dataConfig.bloodLiquidAll.overviewData.data[2].value = Math.min(...orTotal.highDensity).toFixed(2) + '-' + Math.max(...orTotal.highDensity).toFixed(2)
+ this.dataConfig.bloodLiquidAll.overviewData.data[3].value = Math.min(...orTotal.lowDensity).toFixed(2) + '-' + Math.max(...orTotal.lowDensity).toFixed(2)
+
+ }
+ this.option.yAxis.splitNumber = 3;
+ this.option.yAxis.min = 0;
+ this.option.yAxis.max = 6;
break;
}
return this.option;
@@ -565,6 +1076,16 @@ import { mapGetters } from "vuex";