|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
|
|
|
import dayjs from 'dayjs' |
|
|
|
|
|
|
|
|
|
|
|
const app = getApp<IAppOption>() |
|
|
|
const app = getApp<IAppOption>() |
|
|
|
const echarts = require('@/components/ec-canvas/echarts.js') |
|
|
|
const echarts = require('@/components/ec-canvas/echarts.js') |
|
|
|
|
|
|
|
|
|
|
|
@ -52,13 +54,13 @@ Page({ |
|
|
|
this.ecDataTrendComponent = this.selectComponent('#chart1') |
|
|
|
this.ecDataTrendComponent = this.selectComponent('#chart1') |
|
|
|
this.initChart() |
|
|
|
this.initChart() |
|
|
|
|
|
|
|
|
|
|
|
app.waitLogin({ type: 0 }).then(() => { |
|
|
|
app.waitLogin({ type: 1 }).then(() => { |
|
|
|
this._loaded = true |
|
|
|
this._loaded = true |
|
|
|
if (this.data.tab === 1) { |
|
|
|
if (this.data.tab === 0) { |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartRateList() |
|
|
|
this.getHeartRateList() |
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
} else if (this.data.tab === 1) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -83,11 +85,11 @@ Page({ |
|
|
|
if (query.tab !== undefined) { |
|
|
|
if (query.tab !== undefined) { |
|
|
|
const tab = Number(query.tab) |
|
|
|
const tab = Number(query.tab) |
|
|
|
this.setData({ tab }) |
|
|
|
this.setData({ tab }) |
|
|
|
if (tab === 1) { |
|
|
|
if (tab === 0) { |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartRateList() |
|
|
|
this.getHeartRateList() |
|
|
|
} else if (tab === 2) { |
|
|
|
} else if (tab === 1) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -95,23 +97,23 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (this._loaded) { |
|
|
|
if (this._loaded) { |
|
|
|
if (this.data.tab === 1) { |
|
|
|
if (this.data.tab === 0) { |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartRateList() |
|
|
|
this.getHeartRateList() |
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
} else if (this.data.tab === 1) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onReachBottom() { |
|
|
|
onReachBottom() { |
|
|
|
if (this.data.tab === 1) { |
|
|
|
if (this.data.tab === 0) { |
|
|
|
const { heartRatePagination } = this.data |
|
|
|
const { heartRatePagination } = this.data |
|
|
|
if (heartRatePagination.page < heartRatePagination.pages) { |
|
|
|
if (heartRatePagination.page < heartRatePagination.pages) { |
|
|
|
this.getHeartRateList(heartRatePagination.page + 1, true) |
|
|
|
this.getHeartRateList(heartRatePagination.page + 1, true) |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
} else if (this.data.tab === 1) { |
|
|
|
const { revisitPagination } = this.data |
|
|
|
const { revisitPagination } = this.data |
|
|
|
if (revisitPagination.page < revisitPagination.pages) { |
|
|
|
if (revisitPagination.page < revisitPagination.pages) { |
|
|
|
this.getRevisitList(revisitPagination.page + 1, true) |
|
|
|
this.getRevisitList(revisitPagination.page + 1, true) |
|
|
|
@ -121,11 +123,11 @@ Page({ |
|
|
|
onChange(e: any) { |
|
|
|
onChange(e: any) { |
|
|
|
const { index } = e.detail |
|
|
|
const { index } = e.detail |
|
|
|
this.setData({ tab: index }) |
|
|
|
this.setData({ tab: index }) |
|
|
|
if (index === 1) { |
|
|
|
if (index === 0) { |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartStats() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartRateList() |
|
|
|
this.getHeartRateList() |
|
|
|
} else if (index === 2) { |
|
|
|
} else if (index === 1) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -173,7 +175,7 @@ Page({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
onStartMonthChange(e: any) { |
|
|
|
onStartMonthChange(e: any) { |
|
|
|
this.setData({ startMonth: e.detail.value }) |
|
|
|
this.setData({ startMonth: e.detail.value }) |
|
|
|
if (this.data.tab === 1) { |
|
|
|
if (this.data.tab === 0) { |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartRateList() |
|
|
|
this.getHeartRateList() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -182,7 +184,7 @@ Page({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
onEndMonthChange(e: any) { |
|
|
|
onEndMonthChange(e: any) { |
|
|
|
this.setData({ endMonth: e.detail.value }) |
|
|
|
this.setData({ endMonth: e.detail.value }) |
|
|
|
if (this.data.tab === 1) { |
|
|
|
if (this.data.tab === 0) { |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartChart() |
|
|
|
this.getHeartRateList() |
|
|
|
this.getHeartRateList() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -202,11 +204,11 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleAdd() { |
|
|
|
handleAdd() { |
|
|
|
if (this.data.tab === 1) { |
|
|
|
if (this.data.tab === 0) { |
|
|
|
wx.navigateTo({ |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/heartForm/index', |
|
|
|
url: '/pages/heartForm/index', |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
} else if (this.data.tab === 1) { |
|
|
|
wx.navigateTo({ |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/followForm/index', |
|
|
|
url: '/pages/followForm/index', |
|
|
|
}) |
|
|
|
}) |
|
|
|
@ -224,7 +226,10 @@ Page({ |
|
|
|
endMonth, |
|
|
|
endMonth, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}).then((res: any) => { |
|
|
|
}).then((res: any) => { |
|
|
|
const list = res.list || [] |
|
|
|
const list = (res.list || []).map((item) => { |
|
|
|
|
|
|
|
item.recordDateTime = dayjs(item.recordDateTime).format('YYYY-MM-DD HH:mm') |
|
|
|
|
|
|
|
return item |
|
|
|
|
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
heartRateList: append ? this.data.heartRateList.concat(list) : list, |
|
|
|
heartRateList: append ? this.data.heartRateList.concat(list) : list, |
|
|
|
heartRatePagination: { |
|
|
|
heartRatePagination: { |
|
|
|
@ -266,6 +271,7 @@ Page({ |
|
|
|
const isAttack = Number(item.isPsvtAttack) === 1 |
|
|
|
const isAttack = Number(item.isPsvtAttack) === 1 |
|
|
|
return { |
|
|
|
return { |
|
|
|
value: Number(item.heartRate), |
|
|
|
value: Number(item.heartRate), |
|
|
|
|
|
|
|
isAttack, |
|
|
|
itemStyle: isAttack |
|
|
|
itemStyle: isAttack |
|
|
|
? { color: '#d62828', borderColor: '#fff' } |
|
|
|
? { color: '#d62828', borderColor: '#fff' } |
|
|
|
: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 }, |
|
|
|
: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 }, |
|
|
|
@ -301,6 +307,11 @@ Page({ |
|
|
|
fontSize: 10, |
|
|
|
fontSize: 10, |
|
|
|
}, |
|
|
|
}, |
|
|
|
order: 'seriesDesc', |
|
|
|
order: 'seriesDesc', |
|
|
|
|
|
|
|
formatter: (params: any) => { |
|
|
|
|
|
|
|
const p = params[0] |
|
|
|
|
|
|
|
const name = p.data.isAttack ? '发作心率' : '正常心率' |
|
|
|
|
|
|
|
return `${p.axisValueLabel}\n${p.marker}${name} ${p.value}` |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
legend: { |
|
|
|
legend: { |
|
|
|
bottom: 0, |
|
|
|
bottom: 0, |
|
|
|
|