import dayjs from 'dayjs' import Dialog from '@vant/weapp/dialog/dialog' const app = getApp() let echarts: any = null Page({ data: { fold4: false, fold5: false, top: 0, bottom: 0, ec: { lazyLoad: true, }, startData: dayjs('2025').format('YYYY'), endDate: dayjs().format('YYYY'), doctor: {}, hospital: {}, detail: {}, tab1: 0, tab2: 0, tab3: 0, year1: dayjs().format('YYYY'), year2: dayjs().format('YYYY'), year3: dayjs().format('YYYY'), adlReadStatus: false, statDate: '', }, ecDataTrendComponent1_1: null as any, ecDataTrendComponent1_2: null as any, ecDataTrendComponent2_1: null as any, ecDataTrendComponent2_2: null as any, ecDataTrendComponent3_1: null as any, ecDataTrendComponent3_2: null as any, ecDataTrendComponent4_1: null as any, ecDataTrendComponent5_1: null as any, async onLoad() { const SystemInfo = app.globalSystemInfo if (SystemInfo) { const { top, bottom } = SystemInfo.capsulePosition this.setData({ top, bottom, }) } echarts = await require.async('../../../resource/components/echart/echarts.js') app.waitLogin().then((_res) => { app.mpBehavior({ doctor: true, PageName: 'PG_DOCTORHOME' }) this.getDoctorInfo() this.getDetail() this.getList1_1() this.getList2_1() this.getList3_1() this.getList4_1() this.getList5_1() this.getAdlStatus() }) }, getDoctorInfo() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/account/info', data: {}, }).then((res) => { this.setData({ hospital: res.hospital, doctor: res.doctor, }) }) }, getDetail() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-last-month', data: {}, }).then((res) => { this.setData({ detail: { ...res, year: dayjs(res.StatMonth).format('YYYY'), yr: dayjs(res.StatMonth).format('YY'), }, }) }) }, handleTab1(e) { const { index } = e.currentTarget.dataset this.setData({ tab1: index, }) if (index === 0) { this.getList1_1() } else if (index === 1) { this.getList1_2() } }, handleSelectYear1() { this.handleTab1({ currentTarget: { dataset: { index: this.data.tab1, }, }, }) }, getList1_1() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: { statYear: this.data.year1, }, }).then(async (res) => { this.initChart1_1(res.list) }) }, getList1_2() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: { statYear: this.data.year1, }, }).then((res) => { this.initChart1_2(res.list) }) }, initChart1_1(list: any[]) { return new Promise((reslove) => { this.ecDataTrendComponent1_1 = this.selectComponent('#chart1_1') this.ecDataTrendComponent1_1.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.MonthInvitePCount) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: 'rgba(103, 113, 114, 1)', fontSize: '12', }, data: [], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return Math.abs(value) }, }, }, ], series: [ { name: '患者数', type: 'bar', stack: 'a', label: { show: true, color: '#000', fontSize: 10, overflow: 'truncate', width: 30, position: 'top', }, color: 'rgba(103, 186, 202, 1)', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) reslove(chart) return chart }) }) }, initChart1_2(list: any[]) { this.ecDataTrendComponent1_2 = this.selectComponent('#chart1_2') this.ecDataTrendComponent1_2.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.InvitePCount) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: 'rgba(103, 113, 114, 1)', fontSize: '12', }, data: [], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return Math.abs(value) }, }, }, ], series: [ { name: '患者数', type: 'bar', stack: 'a', label: { show: true, color: '#000', fontSize: 10, overflow: 'truncate', width: 30, position: 'top', }, color: 'rgba(103, 186, 202, 1)', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) return chart }) }, handleTab2(e) { const { index } = e.currentTarget.dataset this.setData({ tab2: index, }) if (index === 0) { this.getList2_1() } else if (index === 1) { this.getList2_2() } }, handleSelectYear2() { this.handleTab2({ currentTarget: { dataset: { index: this.data.tab2, }, }, }) }, getList2_1() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: { statYear: this.data.year2, }, }).then(async (res) => { this.initChart2_1(res.list) }) }, getList2_2() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: { statYear: this.data.year2, }, }).then((res) => { this.initChart2_2(res.list) }) }, initChart2_1(list: any[]) { return new Promise((reslove) => { this.ecDataTrendComponent2_1 = this.selectComponent('#chart2_1') this.ecDataTrendComponent2_1.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.MonthActivePCount) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: 'rgba(103, 113, 114, 1)', fontSize: '12', }, data: [], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return Math.abs(value) }, }, }, ], series: [ { name: '患者数', type: 'bar', stack: 'a', label: { show: true, color: '#000', fontSize: 10, overflow: 'truncate', width: 30, position: 'top', }, color: 'rgba(103, 186, 202, 1)', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) reslove(chart) return chart }) }) }, initChart2_2(list: any[]) { this.ecDataTrendComponent2_2 = this.selectComponent('#chart2_2') this.ecDataTrendComponent2_2.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.YearActivePCount) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: 'rgba(103, 113, 114, 1)', fontSize: '12', }, data: [], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return Math.abs(value) }, }, }, ], series: [ { name: '患者数', type: 'bar', stack: 'a', label: { show: true, color: '#000', fontSize: 10, overflow: 'truncate', width: 30, position: 'top', }, color: 'rgba(103, 186, 202, 1)', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) return chart }) }, handleTab3(e) { const { index } = e.currentTarget.dataset this.setData({ tab3: index, }) if (index === 0) { this.getList3_1() } else if (index === 1) { this.getList3_2() } }, handleSelectYear3() { this.handleTab3({ currentTarget: { dataset: { index: this.data.tab3, }, }, }) }, getList3_1() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: { statYear: this.data.year3, }, }).then(async (res) => { this.initChart3_1(res.list) }) }, getList3_2() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: { statYear: this.data.year3, }, }).then((res) => { this.initChart3_2(res.list) }) }, initChart3_1(list: any[]) { return new Promise((reslove) => { this.ecDataTrendComponent3_1 = this.selectComponent('#chart3_1') this.ecDataTrendComponent3_1.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.MonthRegularAssessPCount) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: 'rgba(103, 113, 114, 1)', fontSize: '12', }, data: [], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return Math.abs(value) }, }, }, ], series: [ { name: '患者数', type: 'bar', stack: 'a', label: { show: true, color: '#000', fontSize: 10, overflow: 'truncate', width: 30, position: 'top', }, color: 'rgba(103, 186, 202, 1)', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) reslove(chart) return chart }) }) }, initChart3_2(list: any[]) { this.ecDataTrendComponent3_2 = this.selectComponent('#chart3_2') this.ecDataTrendComponent3_2.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.RegularAssessPCount) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: 'rgba(103, 113, 114, 1)', fontSize: '12', }, data: [], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return Math.abs(value) }, }, }, ], series: [ { name: '患者数', type: 'bar', stack: 'a', label: { show: true, color: '#000', fontSize: 10, overflow: 'truncate', width: 30, position: 'top', }, color: 'rgba(103, 186, 202, 1)', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) return chart }) }, getList4_1() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: {}, }).then((res) => { this.initChart4_1(res.list) }) }, initChart4_1(list: any[]) { this.ecDataTrendComponent4_1 = this.selectComponent('#chart4_1') this.ecDataTrendComponent4_1.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.YearAdlStandardRate) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: '#283031', fontSize: '12', fontWeight: 'bold', }, data: [ { name: '疗效达标率', }, ], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, splitNumber: 5, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return `${Math.abs(value)}%` }, }, }, ], series: [ { name: '疗效达标率', type: 'line', stack: '', color: 'rgba(226, 219, 65, 1)', label: { normal: { show: true, position: 'top', color: 'rgba(40, 48, 49, 1)', fontSize: 10, formatter: '{c}%', }, }, barGap: '-100%', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) return chart }) }, getList5_1() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-month-list', data: {}, }).then((res) => { this.initChart5_1(res.list) }) }, initChart5_1(list: any[]) { this.ecDataTrendComponent5_1 = this.selectComponent('#chart5_1') this.ecDataTrendComponent5_1.init((canvas, width, height, dpr) => { const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr, // new }) canvas.setChart(chart) const x: string[] = [] const y1: string[] = [] list.forEach((item) => { x.push(item.StatMonth) y1.push(item.YearDoubleStandardRate) }) const option = { legend: { bottom: 0, itemWidth: 8, itemHeight: 8, icon: 'circle', lineStyle: { width: '0', }, textStyle: { color: '#283031', fontSize: '12', fontWeight: 'bold', }, data: [ { name: '双达标率', }, ], }, grid: { top: '10%', left: '3%', right: '4%', bottom: '30', containLabel: true, }, xAxis: [ { type: 'category', axisTick: { show: false, }, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', }, data: x, }, ], yAxis: [ { type: 'value', minInterval: 1, splitNumber: 5, axisLabel: { fontSize: 10, color: 'rgba(40, 48, 49, 1)', formatter(value) { return `${Math.abs(value)}%` }, }, }, ], series: [ { name: '双达标率', type: 'line', stack: '', color: 'rgba(226, 219, 65, 1)', label: { normal: { show: true, position: 'top', color: 'rgba(40, 48, 49, 1)', fontSize: 10, formatter: '{c}%', }, }, barGap: '-100%', data: y1, }, ], dataZoom: { type: 'inside', // 有type这个属性,滚动条在最下面,也可以不行,写y:36,这表示距离顶端36px,一般就是在图上面。 startValue: x.length - 6, endValue: x.length - 1, filterMode: 'none', }, } chart.setOption(option) return chart }) }, handleQuestion(e) { const { id } = e.currentTarget.dataset const toastParams = { 1: { content: `累计邀约患者数`, title: '累计邀约', }, 2: { content: `今年至少完成 1 次ADL 测评的患者数`, title: `${dayjs().format('YY')}年激活`, }, 3: { content: `本月新邀约患者数`, title: '本月新增', }, 4: { content: `今年末次ADL评估:\n①ADL增加≥2分;\n②ADL总分≥5分;\n③ADL总分2-4分,延髓评分+呼吸评分≥2分;\n④激素≥20mg/d,以上条件任意满足一条的患者数;`, title: '需随访', }, 5: { content: `1.数据统计截至到上月月底 \n 2.近 3 个月内完成ADL 测评≥3 次患者数/今年激活患者数`, title: 'ADL规律评估率', }, 6: { content: `单月复诊患者数/今年需随访患者数`, title: '复诊率', }, 7: { content: `今年末次ADL测评为 0 或1 患者数/今年激活患者数`, title: '疗效达标率', }, 8: { content: `今年末次ADL 测评为 0 或 1 且激素用量≤5mg/d患者数/今年激活患者数`, title: '双达标率', }, }[id] Dialog.alert({ title: toastParams.title || '提示说明', messageAlign: 'left', message: toastParams.content, zIndex: 10000, confirmButtonColor: '#62bed0', } as any) }, handleFoldToggle4() { this.setData({ fold4: !this.data.fold4, }) }, handleFoldToggle5() { this.setData({ fold5: !this.data.fold5, }) }, handleExport() { app.mpBehavior({ doctor: true, PageName: 'BTN_DOCTORADLREPORTENTRY' }) wx.navigateTo({ url: '/doctor/pages/d_exportList/index', }) }, getAdlStatus() { wx.ajax({ method: 'GET', url: '?r=igg4/doctor/doctor-stat/get-last-week', data: {} }).then((res) => { if (!res) return this.setData({ adlReadStatus: res.readStatus == 0, statDate: res.statDate, }) }) }, handlePatient(e) { const { type, name } = e.currentTarget.dataset wx.navigateTo({ url: `/doctor/pages/d_patientList/index?type=${type}&name=${name}`, }) }, handleTransfer() { app.mpBehavior({ doctor: true, PageName: 'BTN_DOCTORHOMEPAGERECOMMENDEDREFERRAL' }) wx.navigateTo({ url: '/doctor/pages/d_transfer/index', }) }, handleTransferLog() { wx.navigateTo({ url: '/doctor/pages/d_transferLog/index', }) }, })