|
|
|
|
@ -1,6 +1,8 @@
@@ -1,6 +1,8 @@
|
|
|
|
|
const app = getApp<IAppOption>() |
|
|
|
|
const echarts = require('@/components/ec-canvas/echarts.js') |
|
|
|
|
|
|
|
|
|
const PAGE_SIZE = 10 |
|
|
|
|
|
|
|
|
|
Page({ |
|
|
|
|
data: { |
|
|
|
|
popupShow: false, |
|
|
|
|
@ -9,36 +11,142 @@ Page({
@@ -9,36 +11,142 @@ Page({
|
|
|
|
|
position: 'bottom', |
|
|
|
|
} as any, |
|
|
|
|
|
|
|
|
|
tab: 1, |
|
|
|
|
tab: 2, |
|
|
|
|
offsetTop: 0, |
|
|
|
|
|
|
|
|
|
// 复诊记录
|
|
|
|
|
revisitList: [] as any[], |
|
|
|
|
revisitPagination: { |
|
|
|
|
page: 1, |
|
|
|
|
pages: 1, |
|
|
|
|
count: 0, |
|
|
|
|
}, |
|
|
|
|
startMonth: '', |
|
|
|
|
endMonth: '', |
|
|
|
|
daysSinceLastRevisit: 0, |
|
|
|
|
totalRevisits: 0, |
|
|
|
|
}, |
|
|
|
|
ecDataTrendComponent: null as any, |
|
|
|
|
_loaded: false, |
|
|
|
|
onLoad() { |
|
|
|
|
const now = new Date() |
|
|
|
|
const endMonth = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}` |
|
|
|
|
const startDate = new Date(now.getFullYear(), now.getMonth() - 6, 1) |
|
|
|
|
const startMonth = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}` |
|
|
|
|
this.setData({ startMonth, endMonth }) |
|
|
|
|
|
|
|
|
|
this.ecDataTrendComponent = this.selectComponent('#chart1') |
|
|
|
|
this.initChart() |
|
|
|
|
app.waitLogin({ type: 0 }).then(() => {}) |
|
|
|
|
|
|
|
|
|
app.waitLogin({ type: 0 }).then(() => { |
|
|
|
|
this._loaded = true |
|
|
|
|
this.getRevisitList() |
|
|
|
|
this.getLastRevisit() |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
|
const { statusBarHeight } = wx.getSystemInfoSync() |
|
|
|
|
const navBarHeight = 44 |
|
|
|
|
this.setData({ offsetTop: statusBarHeight + navBarHeight }) |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
if (this._loaded && this.data.tab === 2) { |
|
|
|
|
this.getRevisitList() |
|
|
|
|
this.getLastRevisit() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onReachBottom() { |
|
|
|
|
if (this.data.tab === 2) { |
|
|
|
|
const { revisitPagination } = this.data |
|
|
|
|
if (revisitPagination.page < revisitPagination.pages) { |
|
|
|
|
this.getRevisitList(revisitPagination.page + 1, true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onChange(e: any) { |
|
|
|
|
const { index } = e.detail |
|
|
|
|
this.setData({ tab: index }) |
|
|
|
|
if (index === 2) { |
|
|
|
|
this.getRevisitList() |
|
|
|
|
this.getLastRevisit() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getRevisitList(page = 1, append = false) { |
|
|
|
|
const { startMonth, endMonth } = this.data |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'GET', |
|
|
|
|
url: '?r=psvt/revisit-record/list', |
|
|
|
|
data: { |
|
|
|
|
page, |
|
|
|
|
count: PAGE_SIZE, |
|
|
|
|
startMonth, |
|
|
|
|
endMonth, |
|
|
|
|
}, |
|
|
|
|
}).then((res: any) => { |
|
|
|
|
const totalCount = Number(res.count) || 0 |
|
|
|
|
const list = (res.list || []).map((item: any, index: number) => { |
|
|
|
|
const globalIndex = (page - 1) * PAGE_SIZE + index |
|
|
|
|
return { |
|
|
|
|
...item, |
|
|
|
|
seqNum: globalIndex + 1, |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.setData({ |
|
|
|
|
revisitList: append ? this.data.revisitList.concat(list) : list, |
|
|
|
|
revisitPagination: { |
|
|
|
|
page: res.page || 1, |
|
|
|
|
pages: res.pages || 1, |
|
|
|
|
count: totalCount, |
|
|
|
|
}, |
|
|
|
|
totalRevisits: totalCount, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getLastRevisit() { |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'GET', |
|
|
|
|
url: '?r=psvt/revisit-record/last-revisit', |
|
|
|
|
}).then((res: any) => { |
|
|
|
|
this.setData({ |
|
|
|
|
daysSinceLastRevisit: res?.daysSinceLastRevisit ?? 0, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
onStartMonthChange(e: any) { |
|
|
|
|
this.setData({ startMonth: e.detail.value }) |
|
|
|
|
this.getRevisitList() |
|
|
|
|
}, |
|
|
|
|
onEndMonthChange(e: any) { |
|
|
|
|
this.setData({ endMonth: e.detail.value }) |
|
|
|
|
this.getRevisitList() |
|
|
|
|
}, |
|
|
|
|
handleRevisitTap(e: any) { |
|
|
|
|
const { id } = e.currentTarget.dataset |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: `/pages/followDetail/index?id=${id}`, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleAddRevisit() { |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: '/pages/followForm/index', |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
initChart() { |
|
|
|
|
const arr = ['2026-06-01', '2026-06-02', '2026-06-03', '2026-06-04', '2026-06-05', '2026-06-06', '2026-06-07'] |
|
|
|
|
this.ecDataTrendComponent.init((canvas, width, height, dpr) => { |
|
|
|
|
let chart = echarts.init(canvas, null, { |
|
|
|
|
width: width, |
|
|
|
|
height: height, |
|
|
|
|
const chart = echarts.init(canvas, null, { |
|
|
|
|
width, |
|
|
|
|
height, |
|
|
|
|
devicePixelRatio: dpr, |
|
|
|
|
}) |
|
|
|
|
canvas.setChart(chart) |
|
|
|
|
|
|
|
|
|
var option = { |
|
|
|
|
const option = { |
|
|
|
|
dataZoom: [ |
|
|
|
|
{ |
|
|
|
|
type: 'inside', |
|
|
|
|
startValue: 0, |
|
|
|
|
endValue: 6, // 修正:数组下标0~6,原来7会越界
|
|
|
|
|
endValue: 6, |
|
|
|
|
xAxisIndex: [0], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
@ -55,7 +163,6 @@ Page({
@@ -55,7 +163,6 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
order: 'seriesDesc', |
|
|
|
|
}, |
|
|
|
|
// 双图例自定义样式,匹配原图空心绿圈+实心红点
|
|
|
|
|
legend: { |
|
|
|
|
bottom: 0, |
|
|
|
|
padding: 0, |
|
|
|
|
@ -133,20 +240,18 @@ Page({
@@ -133,20 +240,18 @@ Page({
|
|
|
|
|
], |
|
|
|
|
series: [ |
|
|
|
|
{ |
|
|
|
|
// 单条主线,所有点位都有数值,折线完整连续无断点
|
|
|
|
|
name: '心率', |
|
|
|
|
type: 'line', |
|
|
|
|
symbol: 'circle', |
|
|
|
|
symbolSize: 8, |
|
|
|
|
lineStyle: { color: '#46bc70', width: 2 }, |
|
|
|
|
// 每个点位单独配置样式,发作点红色实心,其余白色空心绿边框
|
|
|
|
|
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 } }, |
|
|
|
|
{ value: 66, itemStyle: { color: '#d62828', borderColor: '#fff' } }, // 发作红点
|
|
|
|
|
{ value: 66, itemStyle: { color: '#d62828', borderColor: '#fff' } }, |
|
|
|
|
{ value: 63, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
|
{ value: 69, itemStyle: { color: '#d62828', borderColor: '#fff' } }, // 发作红点
|
|
|
|
|
{ value: 69, itemStyle: { color: '#d62828', borderColor: '#fff' } }, |
|
|
|
|
{ value: 64, itemStyle: { color: '#fff', borderColor: '#46bc70', borderWidth: 2 } }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
@ -215,11 +320,6 @@ Page({
@@ -215,11 +320,6 @@ Page({
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleDetail() { |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: '/pages/wallDetail/index', |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
export {} |
|
|
|
|
|