dssff
This commit is contained in:
parent
96f78218d6
commit
7a79249535
@ -1,6 +1,9 @@
|
||||
import * as echarts from '../../ec-canvas/echarts.min';
|
||||
import request from '~/api/request';
|
||||
import { heightList, weightList } from './heightWeight';
|
||||
import {
|
||||
heightList,
|
||||
weightList
|
||||
} from './heightWeight';
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
@ -8,8 +11,8 @@ Page({
|
||||
return {
|
||||
title: 'ECharts 可以在微信小程序中使用啦!',
|
||||
path: '/pages/index/index',
|
||||
success: function () { },
|
||||
fail: function () { }
|
||||
success: function () {},
|
||||
fail: function () {}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
@ -32,17 +35,19 @@ Page({
|
||||
articlesLength: 0,
|
||||
heightData: [],
|
||||
weightData: [],
|
||||
heightChart: null,
|
||||
weightChart: null,
|
||||
directChart: null,
|
||||
indirectChart: null,
|
||||
|
||||
carList: [],
|
||||
carLength: 0,
|
||||
userInfo: {},
|
||||
totalBilirubin: [],
|
||||
directBilirubin: [],
|
||||
xAxis:[]
|
||||
xAxis: []
|
||||
},
|
||||
|
||||
heightChart: null,
|
||||
weightChart: null,
|
||||
directChart: null,
|
||||
indirectChart: null,
|
||||
standardHeight: [],
|
||||
standardWeight: [],
|
||||
userId: '',
|
||||
@ -52,31 +57,31 @@ Page({
|
||||
return html.replace(/<[^>]*>/g, '');
|
||||
},
|
||||
async getPersonalInfo(id) {
|
||||
const info = await request('doctor/patient/basic/'+id).then((res) => res);
|
||||
const info = await request('doctor/patient/basic/' + id).then((res) => res);
|
||||
info.avatar = info.avatar ? info.avatar : 'https://image-fudan.oss-cn-beijing.aliyuncs.com/mini_images/my/baby.png';
|
||||
this.setData({
|
||||
userInfo: info
|
||||
})
|
||||
if(info.sex == 1){
|
||||
if (info.sex == 1) {
|
||||
this.standardHeight = heightList.boy
|
||||
this.standardWeight = weightList.boy
|
||||
}else{
|
||||
} else {
|
||||
this.standardHeight = heightList.girl
|
||||
this.standardWeight = weightList.girl
|
||||
}
|
||||
this.getChartData()
|
||||
|
||||
},
|
||||
|
||||
|
||||
async getChartData(){
|
||||
const res = await request('doctor/patient/chat/'+this.userId, 'get')
|
||||
|
||||
|
||||
async getChartData() {
|
||||
const res = await request('doctor/patient/chat/' + this.userId, 'get')
|
||||
const heightData = []
|
||||
const weightData = []
|
||||
const totalBilirubin = []
|
||||
const directBilirubin = []
|
||||
const xAxis = []
|
||||
if(res.list.length > 0){
|
||||
if (res.list.length > 0) {
|
||||
res.list.forEach(item => {
|
||||
heightData.push(item.height)
|
||||
weightData.push(item.weight)
|
||||
@ -109,18 +114,18 @@ Page({
|
||||
},
|
||||
|
||||
onReady() {
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
toLink(){
|
||||
toLink() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/followUp/index?userId=' + this.userId
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
changeChart(e) {
|
||||
const index = e.currentTarget.dataset.index;
|
||||
if(index == this.data.activeIndex){
|
||||
if (index == this.data.activeIndex) {
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
@ -135,7 +140,7 @@ Page({
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
onUnload() {
|
||||
// 页面卸载时销毁图表实例
|
||||
@ -163,12 +168,12 @@ Page({
|
||||
|
||||
let totalList = []
|
||||
standardHeight.forEach(item => {
|
||||
this.data.xAxis.forEach(item2 => {
|
||||
if(item.age == item2) {
|
||||
totalList.push(item.value)
|
||||
}
|
||||
|
||||
})
|
||||
this.data.xAxis.forEach(item2 => {
|
||||
if (item.age == item2) {
|
||||
totalList.push(item.value)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -179,11 +184,25 @@ Page({
|
||||
const chartComp = this.selectComponent('#mychart-dom-height');
|
||||
if (chartComp) {
|
||||
chartComp.init((canvas, width, height, dpr) => {
|
||||
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr });
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width,
|
||||
height,
|
||||
devicePixelRatio: dpr
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
chart.setOption({
|
||||
title: { text: '', left: 'left', fontSize: 6 },
|
||||
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' },
|
||||
title: {
|
||||
text: '',
|
||||
left: 'left',
|
||||
fontSize: 6
|
||||
},
|
||||
grid: {
|
||||
containLabel: true,
|
||||
top: '5%',
|
||||
left: '5%',
|
||||
right: '7%',
|
||||
bottom: '3%'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
@ -192,10 +211,21 @@ Page({
|
||||
return `${param.axisValue}\n${param.seriesName}: ${param.value} cm`;
|
||||
}
|
||||
},
|
||||
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis },
|
||||
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } },
|
||||
series: [
|
||||
{
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: this.data.xAxis
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '实际身高',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
@ -206,20 +236,32 @@ Page({
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
data: standardUpper,
|
||||
lineStyle: { opacity: 0 },
|
||||
lineStyle: {
|
||||
opacity: 0
|
||||
},
|
||||
stack: '标准范围',
|
||||
areaStyle: { opacity: 0 },
|
||||
tooltip: { show: true }
|
||||
areaStyle: {
|
||||
opacity: 0
|
||||
},
|
||||
tooltip: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '标准下界',
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
data: standardLower,
|
||||
lineStyle: { opacity: 0 },
|
||||
lineStyle: {
|
||||
opacity: 0
|
||||
},
|
||||
stack: '标准范围',
|
||||
areaStyle: { color: 'rgba(135,206,250,0.3)' },
|
||||
tooltip: { show: true }
|
||||
areaStyle: {
|
||||
color: 'rgba(135,206,250,0.3)'
|
||||
},
|
||||
tooltip: {
|
||||
show: true
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@ -234,12 +276,12 @@ Page({
|
||||
|
||||
let totalList = []
|
||||
standardWeight.forEach(item => {
|
||||
this.data.xAxis.forEach(item2 => {
|
||||
if(item.age == item2) {
|
||||
totalList.push(item.value)
|
||||
}
|
||||
|
||||
})
|
||||
this.data.xAxis.forEach(item2 => {
|
||||
if (item.age == item2) {
|
||||
totalList.push(item.value)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
const standardLower = totalList.map(item => item[0]);
|
||||
const standardUpper = totalList.map(item => item[1]);
|
||||
@ -248,11 +290,25 @@ Page({
|
||||
const chartComp = this.selectComponent('#mychart-dom-weight');
|
||||
if (chartComp) {
|
||||
chartComp.init((canvas, width, height, dpr) => {
|
||||
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr });
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width,
|
||||
height,
|
||||
devicePixelRatio: dpr
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
chart.setOption({
|
||||
title: { text: '', left: 'left', fontSize: 6 },
|
||||
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' },
|
||||
title: {
|
||||
text: '',
|
||||
left: 'left',
|
||||
fontSize: 6
|
||||
},
|
||||
grid: {
|
||||
containLabel: true,
|
||||
top: '5%',
|
||||
left: '5%',
|
||||
right: '7%',
|
||||
bottom: '3%'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
@ -261,10 +317,21 @@ Page({
|
||||
return `${param.axisValue}\n${param.seriesName}: ${param.value} kg`;
|
||||
}
|
||||
},
|
||||
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis },
|
||||
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } },
|
||||
series: [
|
||||
{
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: this.data.xAxis
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '实际体重',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
@ -275,20 +342,32 @@ Page({
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
data: standardUpper,
|
||||
lineStyle: { opacity: 0 },
|
||||
lineStyle: {
|
||||
opacity: 0
|
||||
},
|
||||
stack: '标准范围',
|
||||
areaStyle: { opacity: 0 },
|
||||
tooltip: { show: true }
|
||||
areaStyle: {
|
||||
opacity: 0
|
||||
},
|
||||
tooltip: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '标准下界',
|
||||
type: 'line',
|
||||
symbol: 'none',
|
||||
data: standardLower,
|
||||
lineStyle: { opacity: 0 },
|
||||
lineStyle: {
|
||||
opacity: 0
|
||||
},
|
||||
stack: '标准范围',
|
||||
areaStyle: { color: 'rgba(135,206,250,0.3)' },
|
||||
tooltip: { show: true }
|
||||
areaStyle: {
|
||||
color: 'rgba(135,206,250,0.3)'
|
||||
},
|
||||
tooltip: {
|
||||
show: true
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@ -299,15 +378,29 @@ Page({
|
||||
// 初始化体直接胆红素趋势
|
||||
initDirectChart() {
|
||||
|
||||
|
||||
|
||||
const chartComp = this.selectComponent('#mychart-dom-direct');
|
||||
if (chartComp) {
|
||||
chartComp.init((canvas, width, height, dpr) => {
|
||||
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr });
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width,
|
||||
height,
|
||||
devicePixelRatio: dpr
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
chart.setOption({
|
||||
title: { text: '', left: 'left', fontSize: 6 },
|
||||
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' },
|
||||
title: {
|
||||
text: '',
|
||||
left: 'left',
|
||||
fontSize: 6
|
||||
},
|
||||
grid: {
|
||||
containLabel: true,
|
||||
top: '5%',
|
||||
left: '5%',
|
||||
right: '7%',
|
||||
bottom: '3%'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
@ -316,10 +409,21 @@ Page({
|
||||
return `${param.axisValue}\n${param.seriesName}: ${param.value} μmol/L`;
|
||||
}
|
||||
},
|
||||
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis },
|
||||
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } },
|
||||
series: [
|
||||
{
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: this.data.xAxis
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '总胆红素',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
@ -339,11 +443,25 @@ Page({
|
||||
const chartComp = this.selectComponent('#mychart-dom-indirect');
|
||||
if (chartComp) {
|
||||
chartComp.init((canvas, width, height, dpr) => {
|
||||
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr });
|
||||
const chart = echarts.init(canvas, null, {
|
||||
width,
|
||||
height,
|
||||
devicePixelRatio: dpr
|
||||
});
|
||||
canvas.setChart(chart);
|
||||
chart.setOption({
|
||||
title: { text: '', left: 'left', fontSize: 6 },
|
||||
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' },
|
||||
title: {
|
||||
text: '',
|
||||
left: 'left',
|
||||
fontSize: 6
|
||||
},
|
||||
grid: {
|
||||
containLabel: true,
|
||||
top: '5%',
|
||||
left: '5%',
|
||||
right: '7%',
|
||||
bottom: '3%'
|
||||
},
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
@ -352,10 +470,21 @@ Page({
|
||||
return `${param.axisValue}\n${param.seriesName}: ${param.value} μmol/L`;
|
||||
}
|
||||
},
|
||||
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis },
|
||||
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } },
|
||||
series: [
|
||||
{
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: this.data.xAxis
|
||||
},
|
||||
yAxis: {
|
||||
x: 'center',
|
||||
type: 'value',
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '直接胆红素',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user