|
|
|
@ -18,13 +18,15 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
// 待处理患者数
|
|
|
|
// 待处理患者数
|
|
|
|
pendingCount: 0, |
|
|
|
pendingCount: 0, |
|
|
|
|
|
|
|
jumpPendingCount: 0, |
|
|
|
|
|
|
|
enrollPendingCount: 0, |
|
|
|
|
|
|
|
|
|
|
|
// 统计数据
|
|
|
|
// 累计统计数据
|
|
|
|
invitePatientCount: 0, |
|
|
|
invitePatientCount: 0, |
|
|
|
jumpPatientCount: 0, |
|
|
|
jumpPatientCount: 0, |
|
|
|
enrollPatientCount: 0, |
|
|
|
enrollPatientCount: 0, |
|
|
|
|
|
|
|
|
|
|
|
// 适应症统计
|
|
|
|
// 累计适应症统计
|
|
|
|
indicationStats: [] as Array<{ |
|
|
|
indicationStats: [] as Array<{ |
|
|
|
indicationId: number |
|
|
|
indicationId: number |
|
|
|
indicationName: string |
|
|
|
indicationName: string |
|
|
|
@ -33,8 +35,27 @@ Page({ |
|
|
|
enrollPatientCount: number |
|
|
|
enrollPatientCount: number |
|
|
|
}>, |
|
|
|
}>, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 日/月度统计数据
|
|
|
|
|
|
|
|
dailyInvitePatientCount: 0, |
|
|
|
|
|
|
|
dailyJumpPatientCount: 0, |
|
|
|
|
|
|
|
dailyEnrollPatientCount: 0, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 日/月度适应症统计
|
|
|
|
|
|
|
|
dailyIndicationStats: [] as Array<{ |
|
|
|
|
|
|
|
indicationId: number |
|
|
|
|
|
|
|
indicationName: string |
|
|
|
|
|
|
|
invitePatientCount: number |
|
|
|
|
|
|
|
jumpPatientCount: number |
|
|
|
|
|
|
|
enrollPatientCount: number |
|
|
|
|
|
|
|
}>, |
|
|
|
|
|
|
|
|
|
|
|
// 图表数据
|
|
|
|
// 图表数据
|
|
|
|
chartData: [] as Array<{ date: string; count: number }>, |
|
|
|
chartData: [] as Array<{ |
|
|
|
|
|
|
|
date: string |
|
|
|
|
|
|
|
invitePatientCount: number |
|
|
|
|
|
|
|
jumpPatientCount: number |
|
|
|
|
|
|
|
enrollPatientCount: number |
|
|
|
|
|
|
|
}>, |
|
|
|
|
|
|
|
|
|
|
|
// 日期范围 - 邀约患者统计卡片(单日)
|
|
|
|
// 日期范围 - 邀约患者统计卡片(单日)
|
|
|
|
startDate: '', |
|
|
|
startDate: '', |
|
|
|
@ -131,7 +152,8 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
// 获取其他数据
|
|
|
|
// 获取其他数据
|
|
|
|
this.getPendingCount() |
|
|
|
this.getPendingCount() |
|
|
|
this.getStatistics() |
|
|
|
this.getTotalStatistics() |
|
|
|
|
|
|
|
this.getDailyStatistics() |
|
|
|
this.getPatientChart() |
|
|
|
this.getPatientChart() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -158,7 +180,8 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 重新加载数据
|
|
|
|
// 重新加载数据
|
|
|
|
this.getPendingCount() |
|
|
|
this.getPendingCount() |
|
|
|
this.getStatistics() |
|
|
|
this.getTotalStatistics() |
|
|
|
|
|
|
|
this.getDailyStatistics() |
|
|
|
this.getPatientChart() |
|
|
|
this.getPatientChart() |
|
|
|
wx.showToast({ |
|
|
|
wx.showToast({ |
|
|
|
title: '切换成功', |
|
|
|
title: '切换成功', |
|
|
|
@ -182,19 +205,23 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then((res: any) => { |
|
|
|
.then((res: any) => { |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
pendingCount: res.count || 0, |
|
|
|
pendingCount: res.totalPendingCount || 0, |
|
|
|
|
|
|
|
jumpPendingCount: res.jumpPendingCount || 0, |
|
|
|
|
|
|
|
enrollPendingCount: res.enrollPendingCount || 0, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
.catch(() => { |
|
|
|
// 接口失败时使用模拟数据
|
|
|
|
// 接口失败时使用默认值
|
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
pendingCount: 12, |
|
|
|
pendingCount: 0, |
|
|
|
|
|
|
|
jumpPendingCount: 0, |
|
|
|
|
|
|
|
enrollPendingCount: 0, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取统计数据看板
|
|
|
|
// 获取累计统计数据看板
|
|
|
|
getStatistics() { |
|
|
|
getTotalStatistics() { |
|
|
|
wx.ajax({ |
|
|
|
wx.ajax({ |
|
|
|
method: 'GET', |
|
|
|
method: 'GET', |
|
|
|
url: '/app/pharmacist/pharmacist/statistics', |
|
|
|
url: '/app/pharmacist/pharmacist/statistics', |
|
|
|
@ -208,6 +235,31 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取日/月度统计数据看板
|
|
|
|
|
|
|
|
getDailyStatistics() { |
|
|
|
|
|
|
|
// 根据统计类型格式化日期
|
|
|
|
|
|
|
|
const statDate = |
|
|
|
|
|
|
|
this.data.statType === 'month' |
|
|
|
|
|
|
|
? this.data.startMonth // YYYY-MM
|
|
|
|
|
|
|
|
: this.data.startDate // YYYY-MM-DD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wx.ajax({ |
|
|
|
|
|
|
|
method: 'GET', |
|
|
|
|
|
|
|
url: '/app/pharmacist/pharmacist/patient-statistics', |
|
|
|
|
|
|
|
data: { |
|
|
|
|
|
|
|
statDate, |
|
|
|
|
|
|
|
type: this.data.statType, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}).then((res: any) => { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
dailyInvitePatientCount: res.invitePatientCount || 0, |
|
|
|
|
|
|
|
dailyJumpPatientCount: res.jumpPatientCount || 0, |
|
|
|
|
|
|
|
dailyEnrollPatientCount: res.enrollPatientCount || 0, |
|
|
|
|
|
|
|
dailyIndicationStats: res.indicationStats || [], |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获取邀约患者统计图表(使用 chart 的日期范围)
|
|
|
|
// 获取邀约患者统计图表(使用 chart 的日期范围)
|
|
|
|
getPatientChart() { |
|
|
|
getPatientChart() { |
|
|
|
// 根据统计类型格式化日期
|
|
|
|
// 根据统计类型格式化日期
|
|
|
|
@ -232,8 +284,10 @@ Page({ |
|
|
|
const list = res || [] |
|
|
|
const list = res || [] |
|
|
|
// 转换为图表需要的格式
|
|
|
|
// 转换为图表需要的格式
|
|
|
|
const chartData = list.map((item: any) => ({ |
|
|
|
const chartData = list.map((item: any) => ({ |
|
|
|
date: item.statDate || item.date, |
|
|
|
date: item.statDate, |
|
|
|
count: item.invitePatientCount || item.count || 0, |
|
|
|
invitePatientCount: item.invitePatientCount || 0, |
|
|
|
|
|
|
|
jumpPatientCount: item.jumpPatientCount || 0, |
|
|
|
|
|
|
|
enrollPatientCount: item.enrollPatientCount || 0, |
|
|
|
})) |
|
|
|
})) |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
chartData, |
|
|
|
chartData, |
|
|
|
@ -284,7 +338,7 @@ Page({ |
|
|
|
chartStartMonth, |
|
|
|
chartStartMonth, |
|
|
|
chartEndMonth, |
|
|
|
chartEndMonth, |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.getStatistics() |
|
|
|
this.getDailyStatistics() |
|
|
|
this.getPatientChart() |
|
|
|
this.getPatientChart() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
@ -301,8 +355,8 @@ Page({ |
|
|
|
startDate: fullDate, |
|
|
|
startDate: fullDate, |
|
|
|
startMonth: monthValue, |
|
|
|
startMonth: monthValue, |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 重新加载统计数据
|
|
|
|
// 重新加载日/月度统计数据
|
|
|
|
this.getStatistics() |
|
|
|
this.getDailyStatistics() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 切换到上一天/上月
|
|
|
|
// 切换到上一天/上月
|
|
|
|
@ -327,8 +381,8 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.setData({ startDate, startMonth }) |
|
|
|
this.setData({ startDate, startMonth }) |
|
|
|
// 重新加载统计数据
|
|
|
|
// 重新加载日/月度统计数据
|
|
|
|
this.getStatistics() |
|
|
|
this.getDailyStatistics() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 切换到下一天/下月
|
|
|
|
// 切换到下一天/下月
|
|
|
|
@ -375,8 +429,8 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.setData({ startDate, startMonth }) |
|
|
|
this.setData({ startDate, startMonth }) |
|
|
|
// 重新加载统计数据
|
|
|
|
// 重新加载日/月度统计数据
|
|
|
|
this.getStatistics() |
|
|
|
this.getDailyStatistics() |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 图表日期选择变化(开始日期)
|
|
|
|
// 图表日期选择变化(开始日期)
|
|
|
|
@ -442,10 +496,14 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
canvas.setChart(chart) |
|
|
|
canvas.setChart(chart) |
|
|
|
const x: string[] = [] |
|
|
|
const x: string[] = [] |
|
|
|
const y1: string[] = [] |
|
|
|
const y1: number[] = [] |
|
|
|
|
|
|
|
const y2: number[] = [] |
|
|
|
|
|
|
|
const y3: number[] = [] |
|
|
|
list.forEach((item) => { |
|
|
|
list.forEach((item) => { |
|
|
|
x.push(item.date || item.StatMonth) |
|
|
|
x.push(item.date) |
|
|
|
y1.push(item.count || item.MonthInvitePCount) |
|
|
|
y1.push(item.enrollPatientCount) |
|
|
|
|
|
|
|
y2.push(item.jumpPatientCount) |
|
|
|
|
|
|
|
y3.push(item.invitePatientCount) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const option = { |
|
|
|
const option = { |
|
|
|
@ -519,7 +577,7 @@ Page({ |
|
|
|
stack: 'a', |
|
|
|
stack: 'a', |
|
|
|
color: '#FF8A4C', |
|
|
|
color: '#FF8A4C', |
|
|
|
barWidth: 12, |
|
|
|
barWidth: 12, |
|
|
|
data: y1, |
|
|
|
data: y2, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
name: '邀约患者数', |
|
|
|
name: '邀约患者数', |
|
|
|
@ -528,7 +586,7 @@ Page({ |
|
|
|
width: 4, |
|
|
|
width: 4, |
|
|
|
color: '#FFA64D', |
|
|
|
color: '#FFA64D', |
|
|
|
barWidth: 12, |
|
|
|
barWidth: 12, |
|
|
|
data: y1, |
|
|
|
data: y3, |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
dataZoom: { |
|
|
|
dataZoom: { |
|
|
|
@ -553,8 +611,9 @@ Page({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
handleStat() { |
|
|
|
handleStat() { |
|
|
|
|
|
|
|
const { chartStartDate, chartEndDate, statType } = this.data |
|
|
|
wx.navigateTo({ |
|
|
|
wx.navigateTo({ |
|
|
|
url: '/doctor/pages/stat/index', |
|
|
|
url: `/doctor/pages/stat/index?startDate=${chartStartDate}&endDate=${chartEndDate}&type=${statType}`, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|