|
|
|
@ -6,12 +6,12 @@ const PAGE_SIZE = 10 |
|
|
|
Page({ |
|
|
|
Page({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
popupShow: false, |
|
|
|
popupShow: false, |
|
|
|
popupType: '', |
|
|
|
popupType: 'popup1', |
|
|
|
popupParams: { |
|
|
|
popupParams: { |
|
|
|
position: 'bottom', |
|
|
|
close: true, |
|
|
|
} as any, |
|
|
|
} as any, |
|
|
|
|
|
|
|
|
|
|
|
tab: 2, |
|
|
|
tab: 0, |
|
|
|
offsetTop: 0, |
|
|
|
offsetTop: 0, |
|
|
|
|
|
|
|
|
|
|
|
// 复诊记录
|
|
|
|
// 复诊记录
|
|
|
|
@ -21,10 +21,24 @@ Page({ |
|
|
|
pages: 1, |
|
|
|
pages: 1, |
|
|
|
count: 0, |
|
|
|
count: 0, |
|
|
|
}, |
|
|
|
}, |
|
|
|
startMonth: '', |
|
|
|
|
|
|
|
endMonth: '', |
|
|
|
|
|
|
|
daysSinceLastRevisit: 0, |
|
|
|
daysSinceLastRevisit: 0, |
|
|
|
totalRevisits: 0, |
|
|
|
totalRevisits: 0, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startMonth: '', |
|
|
|
|
|
|
|
endMonth: '', |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 心率记录
|
|
|
|
|
|
|
|
heartRateList: [] as any[], |
|
|
|
|
|
|
|
heartRatePagination: { |
|
|
|
|
|
|
|
page: 1, |
|
|
|
|
|
|
|
pages: 1, |
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
heartStats: { |
|
|
|
|
|
|
|
lastHeartRate: 0, |
|
|
|
|
|
|
|
attackCount: 0, |
|
|
|
|
|
|
|
maxHeartRate: 0, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
ecDataTrendComponent: null as any, |
|
|
|
ecDataTrendComponent: null as any, |
|
|
|
_loaded: false, |
|
|
|
_loaded: false, |
|
|
|
@ -40,8 +54,14 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
app.waitLogin({ type: 0 }).then(() => { |
|
|
|
app.waitLogin({ type: 0 }).then(() => { |
|
|
|
this._loaded = true |
|
|
|
this._loaded = true |
|
|
|
|
|
|
|
if (this.data.tab === 1) { |
|
|
|
|
|
|
|
this.getHeartStats() |
|
|
|
|
|
|
|
this.getHeartChart() |
|
|
|
|
|
|
|
this.getHeartRateList() |
|
|
|
|
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
onReady() { |
|
|
|
onReady() { |
|
|
|
@ -63,20 +83,35 @@ 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 === 2) { |
|
|
|
if (tab === 1) { |
|
|
|
|
|
|
|
this.getHeartStats() |
|
|
|
|
|
|
|
this.getHeartChart() |
|
|
|
|
|
|
|
this.getHeartRateList() |
|
|
|
|
|
|
|
} else if (tab === 2) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (this._loaded && this.data.tab === 2) { |
|
|
|
if (this._loaded) { |
|
|
|
|
|
|
|
if (this.data.tab === 1) { |
|
|
|
|
|
|
|
this.getHeartStats() |
|
|
|
|
|
|
|
this.getHeartChart() |
|
|
|
|
|
|
|
this.getHeartRateList() |
|
|
|
|
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onReachBottom() { |
|
|
|
onReachBottom() { |
|
|
|
if (this.data.tab === 2) { |
|
|
|
if (this.data.tab === 1) { |
|
|
|
|
|
|
|
const { heartRatePagination } = this.data |
|
|
|
|
|
|
|
if (heartRatePagination.page < heartRatePagination.pages) { |
|
|
|
|
|
|
|
this.getHeartRateList(heartRatePagination.page + 1, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
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) |
|
|
|
@ -86,7 +121,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 === 2) { |
|
|
|
if (index === 1) { |
|
|
|
|
|
|
|
this.getHeartStats() |
|
|
|
|
|
|
|
this.getHeartChart() |
|
|
|
|
|
|
|
this.getHeartRateList() |
|
|
|
|
|
|
|
} else if (index === 2) { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
this.getLastRevisit() |
|
|
|
this.getLastRevisit() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -134,11 +173,21 @@ Page({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
onStartMonthChange(e: any) { |
|
|
|
onStartMonthChange(e: any) { |
|
|
|
this.setData({ startMonth: e.detail.value }) |
|
|
|
this.setData({ startMonth: e.detail.value }) |
|
|
|
|
|
|
|
if (this.data.tab === 1) { |
|
|
|
|
|
|
|
this.getHeartChart() |
|
|
|
|
|
|
|
this.getHeartRateList() |
|
|
|
|
|
|
|
} else { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onEndMonthChange(e: any) { |
|
|
|
onEndMonthChange(e: any) { |
|
|
|
this.setData({ endMonth: e.detail.value }) |
|
|
|
this.setData({ endMonth: e.detail.value }) |
|
|
|
|
|
|
|
if (this.data.tab === 1) { |
|
|
|
|
|
|
|
this.getHeartChart() |
|
|
|
|
|
|
|
this.getHeartRateList() |
|
|
|
|
|
|
|
} else { |
|
|
|
this.getRevisitList() |
|
|
|
this.getRevisitList() |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleRevisitTap(e: any) { |
|
|
|
handleRevisitTap(e: any) { |
|
|
|
const { id } = e.currentTarget.dataset |
|
|
|
const { id } = e.currentTarget.dataset |
|
|
|
@ -146,13 +195,83 @@ Page({ |
|
|
|
url: `/pages/followDetail/index?id=${id}`, |
|
|
|
url: `/pages/followDetail/index?id=${id}`, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleAddRevisit() { |
|
|
|
handleHeartTap(e: any) { |
|
|
|
|
|
|
|
const { id } = e.currentTarget.dataset |
|
|
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
|
|
url: `/pages/heartDetail/index?id=${id}`, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleAdd() { |
|
|
|
|
|
|
|
if (this.data.tab === 1) { |
|
|
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
|
|
url: '/pages/heartForm/index', |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else if (this.data.tab === 2) { |
|
|
|
wx.navigateTo({ |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/pages/followForm/index', |
|
|
|
url: '/pages/followForm/index', |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
initChart() { |
|
|
|
getHeartRateList(page = 1, append = false) { |
|
|
|
const arr = ['2026-06-01', '2026-06-02', '2026-06-03', '2026-06-04', '2026-06-05', '2026-06-06', '2026-06-07'] |
|
|
|
const { startMonth, endMonth } = this.data |
|
|
|
|
|
|
|
wx.ajax({ |
|
|
|
|
|
|
|
method: 'GET', |
|
|
|
|
|
|
|
url: '?r=psvt/heart-rate-record/list', |
|
|
|
|
|
|
|
data: { |
|
|
|
|
|
|
|
page, |
|
|
|
|
|
|
|
count: PAGE_SIZE, |
|
|
|
|
|
|
|
startMonth, |
|
|
|
|
|
|
|
endMonth, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}).then((res: any) => { |
|
|
|
|
|
|
|
const list = res.list || [] |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
heartRateList: append ? this.data.heartRateList.concat(list) : list, |
|
|
|
|
|
|
|
heartRatePagination: { |
|
|
|
|
|
|
|
page: res.page || 1, |
|
|
|
|
|
|
|
pages: res.pages || 1, |
|
|
|
|
|
|
|
count: res.count || 0, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getHeartStats() { |
|
|
|
|
|
|
|
wx.ajax({ |
|
|
|
|
|
|
|
method: 'GET', |
|
|
|
|
|
|
|
url: '?r=psvt/heart-rate-record/statistics', |
|
|
|
|
|
|
|
}).then((res: any) => { |
|
|
|
|
|
|
|
const lastRecord = res?.lastRecord || {} |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
heartStats: { |
|
|
|
|
|
|
|
lastHeartRate: lastRecord.heartRate || 0, |
|
|
|
|
|
|
|
attackCount: res?.attackCount || 0, |
|
|
|
|
|
|
|
maxHeartRate: res?.maxHeartRate || 0, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getHeartChart() { |
|
|
|
|
|
|
|
const { startMonth, endMonth } = this.data |
|
|
|
|
|
|
|
wx.ajax({ |
|
|
|
|
|
|
|
method: 'GET', |
|
|
|
|
|
|
|
url: '?r=psvt/heart-rate-record/chart-data', |
|
|
|
|
|
|
|
data: { startMonth, endMonth }, |
|
|
|
|
|
|
|
}).then((res: any) => { |
|
|
|
|
|
|
|
this.initChart(res || []) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
initChart(chartData: any[] = []) { |
|
|
|
|
|
|
|
const xAxisData = chartData.map((item: any) => item.recordDateTime) |
|
|
|
|
|
|
|
const seriesData = chartData.map((item: any) => { |
|
|
|
|
|
|
|
const isAttack = Number(item.isPsvtAttack) === 1 |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
value: Number(item.heartRate), |
|
|
|
|
|
|
|
itemStyle: isAttack |
|
|
|
|
|
|
|
? { color: '#d62828', borderColor: '#fff' } |
|
|
|
|
|
|
|
: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 }, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.ecDataTrendComponent.init((canvas, width, height, dpr) => { |
|
|
|
this.ecDataTrendComponent.init((canvas, width, height, dpr) => { |
|
|
|
const chart = echarts.init(canvas, null, { |
|
|
|
const chart = echarts.init(canvas, null, { |
|
|
|
width, |
|
|
|
width, |
|
|
|
@ -166,7 +285,7 @@ Page({ |
|
|
|
{ |
|
|
|
{ |
|
|
|
type: 'inside', |
|
|
|
type: 'inside', |
|
|
|
startValue: 0, |
|
|
|
startValue: 0, |
|
|
|
endValue: 6, |
|
|
|
endValue: Math.max(chartData.length - 1, 6), |
|
|
|
xAxisIndex: [0], |
|
|
|
xAxisIndex: [0], |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
@ -222,8 +341,11 @@ Page({ |
|
|
|
type: 'category', |
|
|
|
type: 'category', |
|
|
|
axisLabel: { |
|
|
|
axisLabel: { |
|
|
|
color: 'rgba(148, 163, 184, 1)', |
|
|
|
color: 'rgba(148, 163, 184, 1)', |
|
|
|
formatter: function (value) { |
|
|
|
formatter: (value) => { |
|
|
|
const [_year, month, day] = value.split('-') |
|
|
|
if (!value) return '' |
|
|
|
|
|
|
|
const parts = value.split(' ') |
|
|
|
|
|
|
|
const datePart = parts[0] || '' |
|
|
|
|
|
|
|
const [_year, month, day] = datePart.split('-') |
|
|
|
return `${month}/${day}` |
|
|
|
return `${month}/${day}` |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -236,7 +358,7 @@ Page({ |
|
|
|
splitLine: { |
|
|
|
splitLine: { |
|
|
|
show: false, |
|
|
|
show: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data: arr, |
|
|
|
data: xAxisData, |
|
|
|
}, |
|
|
|
}, |
|
|
|
yAxis: [ |
|
|
|
yAxis: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -265,15 +387,22 @@ Page({ |
|
|
|
symbol: 'circle', |
|
|
|
symbol: 'circle', |
|
|
|
symbolSize: 8, |
|
|
|
symbolSize: 8, |
|
|
|
lineStyle: { color: '#46bc70', width: 2 }, |
|
|
|
lineStyle: { color: '#46bc70', width: 2 }, |
|
|
|
|
|
|
|
data: seriesData, |
|
|
|
|
|
|
|
markArea: { |
|
|
|
|
|
|
|
itemStyle: { |
|
|
|
|
|
|
|
color: 'rgba(45, 190, 141, 0.07)', |
|
|
|
|
|
|
|
}, |
|
|
|
data: [ |
|
|
|
data: [ |
|
|
|
{ value: 62, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
[ |
|
|
|
{ value: 60, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
{ |
|
|
|
{ value: 61, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
yAxis: 60, |
|
|
|
{ value: 66, itemStyle: { color: '#d62828', borderColor: '#fff' } }, |
|
|
|
}, |
|
|
|
{ value: 63, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
{ |
|
|
|
{ value: 69, itemStyle: { color: '#d62828', borderColor: '#fff' } }, |
|
|
|
yAxis: 100, |
|
|
|
{ value: 64, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
} |
|
|
|
} |
|
|
|
|