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