| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="!isTargetHospital" |
| | | label="待随访" |
| | | align="center" |
| | | key="pendingFollowUp" |
| | |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="isTargetHospital" |
| | | label="未完成" |
| | | align="center" |
| | | > |
| | | <el-table-column |
| | | label="待发送" |
| | | align="center" |
| | | key="pendingFollowUpWaitSend" |
| | | prop="pendingFollowUpWaitSend" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'pendingFollowUpWaitSendInfo', |
| | | '待发送列表', |
| | | '1' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.pendingFollowUpWaitSend |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="已发送" |
| | | align="center" |
| | | key="pendingFollowUpSent" |
| | | prop="pendingFollowUpSent" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'pendingFollowUpSentInfo', |
| | | '已发送列表', |
| | | '1' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.pendingFollowUpSent |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="随访成功" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="!isTargetHospital" |
| | | label="随访失败" |
| | | align="center" |
| | | key="followUpFail" |
| | |
| | | type="text" |
| | | @click="handleSeeDetails(scope.row)" |
| | | > |
| | | <span class="button-zx" |
| | | >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span |
| | | > |
| | | <span class="button-zx">{{ |
| | | getTimelyRateText(scope.row) |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | :show-overflow-tooltip="true" |
| | | /> |
| | | <el-table-column |
| | | v-if="!isTongdeOrg" |
| | | label="出院人次" |
| | | align="center" |
| | | key="dischargeCount" |
| | |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="isTongdeOrg" label="出院人次" align="center"> |
| | | <el-table-column |
| | | label="普通" |
| | | align="center" |
| | | width="80" |
| | | key="dischargeCountNormal" |
| | | prop="dischargeCountNormal" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'dischargeCountNormalInfo', |
| | | '出院患者列表-普通' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.dischargeCountNormal |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="日间" |
| | | align="center" |
| | | width="80" |
| | | key="dischargeCountDaytime" |
| | | prop="dischargeCountDaytime" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'dischargeCountDaytimeInfo', |
| | | '出院患者列表-日间' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.dischargeCountDaytime |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="!isTongdeOrg" |
| | | label="无需随访人次" |
| | | align="center" |
| | | width="100" |
| | |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="isTongdeOrg" label="无需随访人次" align="center"> |
| | | <el-table-column |
| | | label="普通" |
| | | align="center" |
| | | width="80" |
| | | key="nonFollowUpNormal" |
| | | prop="nonFollowUpNormal" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'nonFollowUpNormalInfo', |
| | | '无需随访列表-普通' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.nonFollowUpNormal }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="日间" |
| | | align="center" |
| | | width="80" |
| | | key="nonFollowUpDaytime" |
| | | prop="nonFollowUpDaytime" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'nonFollowUpDaytimeInfo', |
| | | '无需随访列表-日间' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.nonFollowUpDaytime |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="!isTongdeOrg" |
| | | label="应随访人次" |
| | | align="center" |
| | | width="100" |
| | |
| | | <span class="button-zx">{{ scope.row.followUpNeeded }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="isTongdeOrg" label="应随访人次" align="center"> |
| | | <el-table-column |
| | | label="普通" |
| | | align="center" |
| | | width="80" |
| | | key="followUpNeededNormal" |
| | | prop="followUpNeededNormal" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'followUpNeededNormalInfo', |
| | | '应随访列表-普通' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.followUpNeededNormal |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="日间" |
| | | align="center" |
| | | width="80" |
| | | key="followUpNeededDaytime" |
| | | prop="followUpNeededDaytime" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'followUpNeededDaytimeInfo', |
| | | '应随访列表-日间' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.followUpNeededDaytime |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | |
| | | <el-table-column align="center" label="首次出院随访"> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="!isTargetHospital" |
| | | label="待随访" |
| | | align="center" |
| | | key="pendingFollowUp" |
| | |
| | | <span class="button-zx">{{ scope.row.pendingFollowUp }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="isTargetHospital" |
| | | label="待随访" |
| | | align="center" |
| | | > |
| | | <el-table-column |
| | | label="待发送" |
| | | align="center" |
| | | key="pendingFollowUpWaitSend" |
| | | prop="pendingFollowUpWaitSend" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'pendingFollowUpWaitSendInfo', |
| | | '待发送列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.pendingFollowUpWaitSend |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="已发送" |
| | | align="center" |
| | | key="pendingFollowUpSent" |
| | | prop="pendingFollowUpSent" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'pendingFollowUpSentInfo', |
| | | '已发送列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.pendingFollowUpSent |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="随访成功" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="!isTargetHospital" |
| | | label="随访失败" |
| | | align="center" |
| | | key="followUpFail" |
| | |
| | | type="text" |
| | | @click="handleSeeDetails(scope.row)" |
| | | > |
| | | <span class="button-zx" |
| | | >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span |
| | | > |
| | | <span class="button-zx">{{ |
| | | getTimelyRateText(scope.row) |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="isTargetHospital" |
| | | label="人工" |
| | | v-if="orgname == '缙云县人民医院'" |
| | | label="及时随访人次" |
| | | align="center" |
| | | key="timelyFollowUp" |
| | | prop="timelyFollowUp" |
| | | width="138" |
| | | > |
| | | <el-table-column |
| | | label="发送完成" |
| | | align="center" |
| | | key="manual" |
| | | prop="manual" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'manualInfo', |
| | | '发送完成人工随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.manual }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | align="center" |
| | | key="manualSuccess" |
| | | prop="manualSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'manualSuccessInfo', |
| | | '最终完成人工随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.manualSuccess |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'timelyFollowUpInfo', |
| | | '及时随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.timelyFollowUp }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="isTargetHospital" |
| | | label="语音" |
| | | align="center" |
| | | > |
| | | <el-table-column v-if="isTargetHospital" label="语音" align="center"> |
| | | <el-table-column |
| | | label="发送完成" |
| | | label="发送数" |
| | | align="center" |
| | | key="voice" |
| | | prop="voice" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | label="成功数" |
| | | align="center" |
| | | key="voiceSuccess" |
| | | prop="voiceSuccess" |
| | |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.voiceSuccess |
| | | }}</span> |
| | | <span class="button-zx">{{ scope.row.voiceSuccess }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="isTargetHospital" |
| | | label="短信" |
| | | align="center" |
| | | > |
| | | <el-table-column v-if="isTargetHospital" label="微信" align="center"> |
| | | <el-table-column |
| | | label="发送完成" |
| | | align="center" |
| | | key="sms" |
| | | prop="sms" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'smsInfo', |
| | | '发送完成短信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.sms }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | align="center" |
| | | key="smsSuccess" |
| | | prop="smsSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'smsSuccessInfo', |
| | | '最终完成短信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.smsSuccess |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="isTargetHospital" |
| | | label="微信" |
| | | align="center" |
| | | > |
| | | <el-table-column |
| | | label="发送完成" |
| | | label="发送数" |
| | | align="center" |
| | | key="weChat" |
| | | prop="weChat" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | label="成功数" |
| | | align="center" |
| | | key="weChatSuccess" |
| | | prop="weChatSuccess" |
| | |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.weChatSuccess |
| | | }}</span> |
| | | <span class="button-zx">{{ scope.row.weChatSuccess }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column v-if="isTargetHospital" label="短信" align="center"> |
| | | <el-table-column |
| | | label="发送数" |
| | | align="center" |
| | | key="sms" |
| | | prop="sms" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'smsInfo', |
| | | '发送完成短信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.sms }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="成功数" |
| | | align="center" |
| | | key="smsSuccess" |
| | | prop="smsSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'smsSuccessInfo', |
| | | '最终完成短信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.smsSuccess }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column v-if="isTargetHospital" label="人工" align="center"> |
| | | <el-table-column |
| | | label="发送数" |
| | | align="center" |
| | | key="manual" |
| | | prop="manual" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'manualInfo', |
| | | '发送完成人工随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.manual }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="成功数" |
| | | align="center" |
| | | key="manualSuccess" |
| | | prop="manualSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="medium" |
| | | type="text" |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'manualSuccessInfo', |
| | | '最终完成人工随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.manualSuccess }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | v-if="!isTargetHospital" |
| | | label="人工" |
| | |
| | | </el-table-column> |
| | | </el-table-column> |
| | | |
| | | <!-- 随访情况列(仅丽水市中医院显示) --> |
| | | <!-- 随访情况列(丽水市中医院已移到综合统计,此处仅景宁畲族自治县人民医院显示) --> |
| | | <el-table-column |
| | | v-if=" |
| | | orgname == '丽水市中医院' || orgname == '景宁畲族自治县人民医院' |
| | | " |
| | | v-if="orgname == '景宁畲族自治县人民医院'" |
| | | align="center" |
| | | label="随访情况" |
| | | > |
| | |
| | | this.orgname == "第一人民医院吴山院区" |
| | | ); |
| | | }, |
| | | // 第一人民医院三个院区:及时率按 及时完成/需随访 计算 |
| | | isDiyiRenmin() { |
| | | return ( |
| | | this.orgname == "第一人民医院湖滨院区" || |
| | | this.orgname == "第一人民医院吴山院区" || |
| | | this.orgname == "第一人民医院城东院区" |
| | | ); |
| | | }, |
| | | }, |
| | | methods: { |
| | | loadData() { |
| | |
| | | delete params.leavehospitaldistrictcodes.all; |
| | | delete params.deptcodes.all; |
| | | params.rateDay = this.orgname == "龙泉市人民医院" ? 21 : 7; |
| | | getSfStatistics(params) |
| | | return getSfStatistics(params) |
| | | .then((response) => { |
| | | this.tableData = this.customSort(response.data); |
| | | }) |
| | |
| | | }, |
| | | |
| | | getRowKey(row) { |
| | | return row.statisticaltype === 1 |
| | | return this.queryParams.statisticaltype === 1 |
| | | ? row.leavehospitaldistrictcode |
| | | : row.deptcode; |
| | | }, |
| | |
| | | const need = Number(needFollowUp) || 0; |
| | | const pending = Number(pendingFollowUp) || 0; |
| | | |
| | | // 分母 = 需随访 - 待随访 |
| | | const denominator = need - pending; |
| | | // 目标医院:成功率 = 随访成功 / 需随访;其他:随访成功 / (需随访 - 待随访) |
| | | const denominator = this.isTargetHospital ? need : need - pending; |
| | | |
| | | if (denominator <= 0) { |
| | | return "0.00%"; |
| | |
| | | |
| | | const rate = (success / denominator) * 100; |
| | | return rate.toFixed(2) + "%"; |
| | | }, |
| | | // 计算及时率(目标医院):(需随访 - 人工规定时间内没打过电话) / 需随访 |
| | | calculateTimelyRate(needFollowUp, manualCallTimeout) { |
| | | const need = Number(needFollowUp) || 0; |
| | | const timeout = Number(manualCallTimeout) || 0; |
| | | if (need <= 0) { |
| | | return "0.00%"; |
| | | } |
| | | const rate = ((need - timeout) / need) * 100; |
| | | return (rate < 0 ? 0 : rate).toFixed(2) + "%"; |
| | | }, |
| | | // 计算及时率(第一人民医院三院区):及时完成 / 需随访 |
| | | calculateTimelyRateByCompletion(timelyFollowUp, needFollowUp) { |
| | | const timely = Number(timelyFollowUp) || 0; |
| | | const need = Number(needFollowUp) || 0; |
| | | if (need <= 0) { |
| | | return "0.00%"; |
| | | } |
| | | const rate = (timely / need) * 100; |
| | | return (rate < 0 ? 0 : rate).toFixed(2) + "%"; |
| | | }, |
| | | // 及时率展示文案:第一人民医院三院区前端按及时完成/需随访,目标医院按(需随访-超时)/需随访,其他用后端 rate 字段 |
| | | getTimelyRateText(row) { |
| | | if (this.isDiyiRenmin) { |
| | | return this.calculateTimelyRateByCompletion( |
| | | row.timelyFollowUp, |
| | | row.needFollowUp |
| | | ); |
| | | } |
| | | if (this.isTargetHospital) { |
| | | return this.calculateTimelyRate( |
| | | row.needFollowUp, |
| | | row.manualCallTimeout |
| | | ); |
| | | } |
| | | return (Number(row.rate) * 100).toFixed(2) + "%"; |
| | | }, |
| | | // 在统计汇总方法中处理成功率 |
| | | getSummaries(param) { |
| | |
| | | return sum + (Number(item.pendingFollowUp) || 0); |
| | | }, 0); |
| | | |
| | | const denominator = totalNeed - totalPending; |
| | | const denominator = this.isTargetHospital |
| | | ? totalNeed |
| | | : totalNeed - totalPending; |
| | | |
| | | if (denominator > 0) { |
| | | sums[index] = ((totalSuccess / denominator) * 100).toFixed(2) + "%"; |
| | | } else { |
| | | sums[index] = "0.00%"; |
| | | } |
| | | } else if ( |
| | | column.property === "followUpRate" || |
| | | column.property === "rate" |
| | | ) { |
| | | } else if (column.property === "rate") { |
| | | if (this.isDiyiRenmin) { |
| | | const totalTimely = data.reduce( |
| | | (sum, item) => sum + (Number(item.timelyFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | const totalNeed = data.reduce( |
| | | (sum, item) => sum + (Number(item.needFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | sums[index] = this.calculateTimelyRateByCompletion( |
| | | totalTimely, |
| | | totalNeed |
| | | ); |
| | | } else if (this.isTargetHospital) { |
| | | const totalNeed = data.reduce( |
| | | (sum, item) => sum + (Number(item.needFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | const totalTimeout = data.reduce( |
| | | (sum, item) => sum + (Number(item.manualCallTimeout) || 0), |
| | | 0 |
| | | ); |
| | | sums[index] = this.calculateTimelyRate(totalNeed, totalTimeout); |
| | | } else { |
| | | const percentageValues = data |
| | | .map((item) => { |
| | | const value = item[column.property]; |
| | | if (!value || value === "-" || value === "0%") return null; |
| | | if (typeof value === "string" && value.includes("%")) { |
| | | const numValue = parseFloat(value.replace("%", "")) / 100; |
| | | return isNaN(numValue) ? null : numValue; |
| | | } else { |
| | | const numValue = parseFloat(value); |
| | | return isNaN(numValue) ? null : numValue; |
| | | } |
| | | }) |
| | | .filter((value) => value !== null && value !== 0); |
| | | |
| | | if (percentageValues.length > 0) { |
| | | const average = |
| | | percentageValues.reduce((sum, value) => sum + value, 0) / |
| | | percentageValues.length; |
| | | sums[index] = (average * 100).toFixed(2) + "%"; |
| | | } else { |
| | | sums[index] = "0.00%"; |
| | | } |
| | | } |
| | | } else if (column.property === "followUpRate") { |
| | | const percentageValues = data |
| | | .map((item) => { |
| | | const value = item[column.property]; |
| | |
| | | "el-tooltip", |
| | | { |
| | | props: { |
| | | content: "随访成功/(需随访-待随访)", |
| | | content: this.isTargetHospital |
| | | ? "随访成功/需随访" |
| | | : "随访成功/(需随访-待随访)", |
| | | placement: "top", |
| | | effect: "dark", |
| | | }, |
| | |
| | | "el-tooltip", |
| | | { |
| | | props: { |
| | | content: |
| | | "(出院时间+任务周期)小于完成时间即为超时;(需随访-超时)/需随访", |
| | | content: this.isDiyiRenmin |
| | | ? "及时率=及时完成/需随访" |
| | | : this.isTargetHospital |
| | | ? "及时率=(需随访-人工规定时间内没打过电话)/需随访" |
| | | : "(出院时间+任务周期)小于完成时间即为超时;(需随访-超时)/需随访", |
| | | placement: "top", |
| | | effect: "dark", |
| | | }, |
| | |
| | | return sum + (Number(item.pendingFollowUp) || 0); |
| | | }, 0); |
| | | |
| | | const denominator = totalNeed - totalPending; |
| | | const denominator = this.isTargetHospital |
| | | ? totalNeed |
| | | : totalNeed - totalPending; |
| | | |
| | | if (denominator > 0) { |
| | | sums[index] = ((totalSuccess / denominator) * 100).toFixed(2) + "%"; |
| | | } else { |
| | | sums[index] = "0.00%"; |
| | | } |
| | | } else if ( |
| | | column.property === "followUpRate" || |
| | | column.property === "rate" |
| | | ) { |
| | | } else if (column.property === "rate") { |
| | | if (this.isDiyiRenmin) { |
| | | const totalTimely = data.reduce( |
| | | (sum, item) => sum + (Number(item.timelyFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | const totalNeed = data.reduce( |
| | | (sum, item) => sum + (Number(item.needFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | sums[index] = this.calculateTimelyRateByCompletion( |
| | | totalTimely, |
| | | totalNeed |
| | | ); |
| | | } else if (this.isTargetHospital) { |
| | | const totalNeed = data.reduce( |
| | | (sum, item) => sum + (Number(item.needFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | const totalTimeout = data.reduce( |
| | | (sum, item) => sum + (Number(item.manualCallTimeout) || 0), |
| | | 0 |
| | | ); |
| | | sums[index] = this.calculateTimelyRate(totalNeed, totalTimeout); |
| | | } else { |
| | | const percentageValues = data |
| | | .map((item) => { |
| | | const value = item[column.property]; |
| | | if (!value || value === "-" || value === "0%") return null; |
| | | if (typeof value === "string" && value.includes("%")) { |
| | | const numValue = parseFloat(value.replace("%", "")) / 100; |
| | | return isNaN(numValue) ? null : numValue; |
| | | } else { |
| | | const numValue = parseFloat(value); |
| | | return isNaN(numValue) ? null : numValue; |
| | | } |
| | | }) |
| | | .filter((value) => value !== null && value !== 0); |
| | | |
| | | if (percentageValues.length > 0) { |
| | | const average = |
| | | percentageValues.reduce((sum, value) => sum + value, 0) / |
| | | percentageValues.length; |
| | | sums[index] = (average * 100).toFixed(2) + "%"; |
| | | } else { |
| | | sums[index] = "0.00%"; |
| | | } |
| | | } |
| | | } else if (column.property === "followUpRate") { |
| | | const percentageValues = data |
| | | .map((item) => { |
| | | const value = item[column.property]; |
| | |
| | | sheetNameSuffix = `${startDateFormatted}至${endDateFormatted}`; |
| | | } |
| | | } else { |
| | | const now = new Date(); |
| | | const currentMonth = now.getMonth() + 1; |
| | | const currentYear = now.getFullYear(); |
| | | |
| | | if (isLishuiHospital) { |
| | | // 丽水市中医院:显示年月 |
| | | dateRangeString = `${currentYear}年${currentMonth}月`; |
| | | sheetNameSuffix = `${currentYear}年${currentMonth}月`; |
| | | } else { |
| | | // 其他医院:显示月份 |
| | | dateRangeString = `${currentMonth}月`; |
| | | sheetNameSuffix = `${currentMonth}月`; |
| | | } |
| | | // 未选择时间:数据未做时间筛选,为全部数据,文件名标注“全部” |
| | | dateRangeString = "全部"; |
| | | sheetNameSuffix = "全部"; |
| | | } |
| | | |
| | | // 根据 serviceType 生成随访类型名称(兼容单选/多选) |
| | |
| | | const end = this.queryParams.dateRange[1].split(" ")[0]; |
| | | dateRangeString = `${start}至${end}`; |
| | | } else { |
| | | dateRangeString = `${new Date().getMonth() + 1}月`; |
| | | // 未选择时间:数据为全部 |
| | | dateRangeString = "全部"; |
| | | } |
| | | |
| | | const fileName = `${areaName}医生随访列表_${dateRangeString}.xlsx`; |
| | |
| | | }, |
| | | }; |
| | | |
| | | // 标题 |
| | | worksheet.mergeCells(1, 1, 1, 10); |
| | | worksheet.getCell(1, 1).value = `${areaName}医生随访列表`; |
| | | worksheet.getCell(1, 1).style = titleStyle; |
| | | worksheet.getRow(1).height = 30; |
| | | const graded = this.isTargetHospital; |
| | | // 成功率:景宁畲族自治县人民医院不展示;及时率:丽水市中医院不展示 |
| | | const showSuccessRate = this.orgname != "景宁畲族自治县人民医院"; |
| | | const showTimelyRate = this.orgname != "丽水市中医院"; |
| | | |
| | | // 表头 |
| | | // 列定义(与展开的医生子表保持一致) |
| | | const headers = [ |
| | | "医生姓名", |
| | | "科室", |
| | |
| | | "无需随访", |
| | | "应随访", |
| | | "需随访", |
| | | "待随访", |
| | | ...(graded ? ["待发送", "已发送"] : ["待随访"]), |
| | | "随访成功", |
| | | "随访失败", |
| | | "成功率", // 新增 |
| | | "随访率", // 原来在成功率位置 |
| | | ...(graded ? [] : ["随访失败"]), |
| | | ...(showSuccessRate ? ["成功率"] : []), |
| | | "随访率", |
| | | ...(showTimelyRate ? ["及时率"] : []), |
| | | "人工", |
| | | "语音", |
| | | "短信", |
| | | "微信", |
| | | ]; |
| | | const totalCols = headers.length; |
| | | |
| | | // 标题 |
| | | worksheet.mergeCells(1, 1, 1, totalCols); |
| | | worksheet.getCell(1, 1).value = `${areaName}医生随访列表`; |
| | | worksheet.getCell(1, 1).style = titleStyle; |
| | | worksheet.getRow(1).height = 30; |
| | | |
| | | // 表头 |
| | | const headerRow = worksheet.addRow(headers); |
| | | headerRow.eachCell((cell) => { |
| | | cell.style = headerStyle; |
| | |
| | | item.nonFollowUp, |
| | | item.followUpNeeded, |
| | | item.needFollowUp, |
| | | item.pendingFollowUp, |
| | | ...(graded |
| | | ? [item.pendingFollowUpWaitSend || 0, item.pendingFollowUpSent || 0] |
| | | : [item.pendingFollowUp || 0]), |
| | | item.followUpSuccess, |
| | | item.followUpFail, |
| | | this.calculateSuccessRate( |
| | | item.followUpSuccess, |
| | | item.needFollowUp, |
| | | item.pendingFollowUp |
| | | ), |
| | | ...(graded ? [] : [item.followUpFail || 0]), |
| | | ...(showSuccessRate |
| | | ? [ |
| | | this.calculateSuccessRate( |
| | | item.followUpSuccess, |
| | | item.needFollowUp, |
| | | item.pendingFollowUp |
| | | ), |
| | | ] |
| | | : []), |
| | | item.followUpRate, |
| | | ...(showTimelyRate ? [this.getTimelyRateText(item)] : []), |
| | | item.manual || 0, |
| | | item.voice || 0, |
| | | item.sms || 0, |
| | | item.weChat || 0, |
| | | ]); |
| | | row.eachCell((cell) => { |
| | | cell.style = cellStyle; |
| | |
| | | }; |
| | | }); |
| | | |
| | | // 列宽 |
| | | worksheet.columns = [ |
| | | { width: 15 }, |
| | | { width: 15 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, // 成功率 |
| | | { width: 12 }, // 随访率 |
| | | ]; |
| | | // 列宽(前两列姓名/科室较宽,其余统一) |
| | | const widths = [15, 15]; |
| | | headers.slice(2).forEach(() => widths.push(12)); |
| | | worksheet.columns = widths.map((width) => ({ width })); |
| | | }, |
| | | getDoctorExportSummary(data) { |
| | | const sums = ["小计"]; |
| | | const graded = this.isTargetHospital; |
| | | const showSuccessRate = this.orgname != "景宁畲族自治县人民医院"; |
| | | const showTimelyRate = this.orgname != "丽水市中医院"; |
| | | |
| | | const keys = [ |
| | | "dischargeCount", |
| | | "nonFollowUp", |
| | | "followUpNeeded", |
| | | "needFollowUp", |
| | | "pendingFollowUp", |
| | | "followUpSuccess", |
| | | "followUpFail", |
| | | ]; |
| | | const sums = ["小计", "-"]; |
| | | |
| | | // 数值列求和 |
| | | const keys = graded |
| | | ? [ |
| | | "dischargeCount", |
| | | "nonFollowUp", |
| | | "followUpNeeded", |
| | | "needFollowUp", |
| | | "pendingFollowUpWaitSend", |
| | | "pendingFollowUpSent", |
| | | "followUpSuccess", |
| | | ] |
| | | : [ |
| | | "dischargeCount", |
| | | "nonFollowUp", |
| | | "followUpNeeded", |
| | | "needFollowUp", |
| | | "pendingFollowUp", |
| | | "followUpSuccess", |
| | | "followUpFail", |
| | | ]; |
| | | |
| | | keys.forEach((key) => { |
| | | sums.push(data.reduce((t, r) => t + (Number(r[key]) || 0), 0)); |
| | | }); |
| | | |
| | | // 成功率(平均值) |
| | | const successRates = data |
| | | .map((item) => { |
| | | const success = Number(item.followUpSuccess) || 0; |
| | | const need = Number(item.needFollowUp) || 0; |
| | | const pending = Number(item.pendingFollowUp) || 0; |
| | | const denominator = need - pending; |
| | | if (denominator <= 0) return 0; |
| | | return success / denominator; |
| | | }) |
| | | .filter((rate) => !isNaN(rate)); |
| | | if (showSuccessRate) { |
| | | const successRates = data |
| | | .map((item) => { |
| | | const success = Number(item.followUpSuccess) || 0; |
| | | const need = Number(item.needFollowUp) || 0; |
| | | const pending = Number(item.pendingFollowUp) || 0; |
| | | const denominator = graded ? need : need - pending; |
| | | if (denominator <= 0) return 0; |
| | | return success / denominator; |
| | | }) |
| | | .filter((rate) => !isNaN(rate)); |
| | | |
| | | sums.push( |
| | | successRates.length |
| | | ? ( |
| | | (successRates.reduce((a, b) => a + b, 0) / successRates.length) * |
| | | 100 |
| | | ).toFixed(2) + "%" |
| | | : "0.00%" |
| | | ); |
| | | sums.push( |
| | | successRates.length |
| | | ? ( |
| | | (successRates.reduce((a, b) => a + b, 0) / |
| | | successRates.length) * |
| | | 100 |
| | | ).toFixed(2) + "%" |
| | | : "0.00%" |
| | | ); |
| | | } |
| | | |
| | | // 随访率(平均值) |
| | | const followUpRates = data |
| | |
| | | ).toFixed(2) + "%" |
| | | : "0.00%" |
| | | ); |
| | | |
| | | // 及时率(第一人民医院三院区按及时完成/需随访,目标医院计算,其他取 rate 平均) |
| | | if (showTimelyRate) { |
| | | if (this.isDiyiRenmin) { |
| | | const totalTimely = data.reduce( |
| | | (s, r) => s + (Number(r.timelyFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | const totalNeed = data.reduce( |
| | | (s, r) => s + (Number(r.needFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | sums.push( |
| | | this.calculateTimelyRateByCompletion(totalTimely, totalNeed) |
| | | ); |
| | | } else if (graded) { |
| | | const totalNeed = data.reduce( |
| | | (s, r) => s + (Number(r.needFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | const totalTimeout = data.reduce( |
| | | (s, r) => s + (Number(r.manualCallTimeout) || 0), |
| | | 0 |
| | | ); |
| | | sums.push(this.calculateTimelyRate(totalNeed, totalTimeout)); |
| | | } else { |
| | | const rateValues = data |
| | | .map((i) => this.extractPercentageValue(i.rate)) |
| | | .filter(Boolean); |
| | | sums.push( |
| | | rateValues.length |
| | | ? ( |
| | | (rateValues.reduce((a, b) => a + b, 0) / rateValues.length) * |
| | | 100 |
| | | ).toFixed(2) + "%" |
| | | : "0.00%" |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 人工/语音/短信/微信 |
| | | ["manual", "voice", "sms", "weChat"].forEach((key) => { |
| | | sums.push(data.reduce((t, r) => t + (Number(r[key]) || 0), 0)); |
| | | }); |
| | | |
| | | return sums; |
| | | }, |
| | |
| | | right: { style: "thin", color: { argb: "FFD0D0D0" } }, |
| | | }, |
| | | }; |
| | | // 是否为目标医院(人工/语音/短信/微信 按 发送完成/最终完成 分级展示) |
| | | // 是否为目标医院(人工/语音/短信/微信 按 发送数/成功数 分级展示) |
| | | const graded = this.isTargetHospital; |
| | | // 缙云县人民医院额外展示“及时随访人次”列 |
| | | const showTimelyFollowUp = this.orgname == "缙云县人民医院"; |
| | | // 同德系列:出院人次/无需随访人次/应随访人次 下分“普通/日间” |
| | | const showTongdeBreakdown = this.isTongdeOrg; |
| | | |
| | | const baseHeaders = [ |
| | | "", |
| | | "出院病区", |
| | | "科室", |
| | | "出院人次", |
| | | "无需随访人次", |
| | | "应随访人次", |
| | | ]; |
| | | const coreHeaders = [ |
| | | "需随访", |
| | | "待随访", |
| | | "随访成功", |
| | | "随访失败", |
| | | "成功率", |
| | | "随访率", |
| | | "及时率", |
| | | ]; |
| | | // 基础列:固定列(空/出院病区/科室)+ 人次分组列(同德系列下分普通/日间) |
| | | const baseFixedHeaders = ["", "出院病区", "科室"]; |
| | | const baseCountGroups = showTongdeBreakdown |
| | | ? [ |
| | | { |
| | | label: "出院人次", |
| | | fields: ["dischargeCountNormal", "dischargeCountDaytime"], |
| | | sub: ["普通", "日间"], |
| | | }, |
| | | { |
| | | label: "无需随访人次", |
| | | fields: ["nonFollowUpNormal", "nonFollowUpDaytime"], |
| | | sub: ["普通", "日间"], |
| | | }, |
| | | { |
| | | label: "应随访人次", |
| | | fields: ["followUpNeededNormal", "followUpNeededDaytime"], |
| | | sub: ["普通", "日间"], |
| | | }, |
| | | ] |
| | | : [ |
| | | { label: "出院人次", fields: ["dischargeCount"], sub: ["出院人次"] }, |
| | | { |
| | | label: "无需随访人次", |
| | | fields: ["nonFollowUp"], |
| | | sub: ["无需随访人次"], |
| | | }, |
| | | { |
| | | label: "应随访人次", |
| | | fields: ["followUpNeeded"], |
| | | sub: ["应随访人次"], |
| | | }, |
| | | ]; |
| | | const baseFields = baseCountGroups.reduce( |
| | | (arr, g) => arr.concat(g.fields), |
| | | [] |
| | | ); |
| | | const coreHeaders = this.isTargetHospital |
| | | ? [ |
| | | "需随访", |
| | | "待发送", |
| | | "已发送", |
| | | "随访成功", |
| | | "成功率", |
| | | "随访率", |
| | | "及时率", |
| | | ] |
| | | : [ |
| | | "需随访", |
| | | "待随访", |
| | | "随访成功", |
| | | "随访失败", |
| | | "成功率", |
| | | "随访率", |
| | | "及时率", |
| | | ...(showTimelyFollowUp ? ["及时随访人次"] : []), |
| | | ]; |
| | | const methodGroups = this.getMethodColumns(); |
| | | |
| | | const baseCount = baseHeaders.length; // 6 |
| | | const coreCount = coreHeaders.length; // 7 |
| | | const baseCount = baseFixedHeaders.length + baseFields.length; // 6 或 9 |
| | | const coreCount = coreHeaders.length; // 7 或 8 |
| | | const methodLeafCount = methodGroups.reduce( |
| | | (sum, g) => sum + g.fields.length, |
| | | 0 |
| | | ); // 8 或 4 |
| | | const totalCols = baseCount + coreCount + methodLeafCount; // 21 或 17 |
| | | const coreStartCol = baseCount + 1; // 7 |
| | | const methodStartCol = baseCount + coreCount + 1; // 14 |
| | | const totalCols = baseCount + coreCount + methodLeafCount; |
| | | const coreStartCol = baseCount + 1; |
| | | const methodStartCol = baseCount + coreCount + 1; |
| | | |
| | | const titleText = `${serviceTypeName}统计表_${sheetNameSuffix}`; |
| | | // 添加标题行 |
| | |
| | | const headerEndRow = 4; |
| | | |
| | | // 第2行:基础列纵向合并 + 随访分组横向合并 |
| | | for (let i = 1; i <= baseCount; i++) { |
| | | for (let i = 1; i <= baseFixedHeaders.length; i++) { |
| | | worksheet.mergeCells(2, i, headerEndRow, i); |
| | | const cell = worksheet.getCell(2, i); |
| | | cell.value = baseHeaders[i - 1]; |
| | | cell.value = baseFixedHeaders[i - 1]; |
| | | cell.style = headerStyle; |
| | | } |
| | | let bCol = baseFixedHeaders.length + 1; |
| | | baseCountGroups.forEach((g) => { |
| | | worksheet.mergeCells(2, bCol, headerEndRow, bCol); |
| | | const cell = worksheet.getCell(2, bCol); |
| | | cell.value = g.label; |
| | | cell.style = headerStyle; |
| | | bCol += g.fields.length; |
| | | }); |
| | | worksheet.mergeCells(2, coreStartCol, 2, totalCols); |
| | | worksheet.getCell(2, coreStartCol).value = serviceTypeName; |
| | | worksheet.getCell(2, coreStartCol).style = headerStyle; |
| | | |
| | | // 第3行:随访核心列纵向合并 + 随访方式分组横向合并 |
| | | for (let k = 0; k < coreCount; k++) { |
| | | const col = coreStartCol + k; |
| | | // 第3行:随访核心列(目标医院“待随访”下嵌套“待发送/已发送”) |
| | | worksheet.mergeCells(3, coreStartCol, headerEndRow, coreStartCol); |
| | | worksheet.getCell(3, coreStartCol).value = "需随访"; |
| | | worksheet.getCell(3, coreStartCol).style = headerStyle; |
| | | |
| | | worksheet.mergeCells(3, coreStartCol + 1, 3, coreStartCol + 2); |
| | | worksheet.getCell(3, coreStartCol + 1).value = "待随访"; |
| | | worksheet.getCell(3, coreStartCol + 1).style = headerStyle; |
| | | |
| | | worksheet.mergeCells( |
| | | 3, |
| | | coreStartCol + 3, |
| | | headerEndRow, |
| | | coreStartCol + 3 |
| | | ); |
| | | worksheet.getCell(3, coreStartCol + 3).value = "随访成功"; |
| | | worksheet.getCell(3, coreStartCol + 3).style = headerStyle; |
| | | |
| | | ["成功率", "随访率", "及时率"].forEach((label, i) => { |
| | | const col = coreStartCol + 4 + i; |
| | | worksheet.mergeCells(3, col, headerEndRow, col); |
| | | const cell = worksheet.getCell(3, col); |
| | | cell.value = coreHeaders[k]; |
| | | cell.style = headerStyle; |
| | | } |
| | | worksheet.getCell(3, col).value = label; |
| | | worksheet.getCell(3, col).style = headerStyle; |
| | | }); |
| | | |
| | | // 第4行:待发送/已发送 子列 |
| | | worksheet.getCell(4, coreStartCol + 1).value = "待发送"; |
| | | worksheet.getCell(4, coreStartCol + 1).style = headerStyle; |
| | | worksheet.getCell(4, coreStartCol + 2).value = "已发送"; |
| | | worksheet.getCell(4, coreStartCol + 2).style = headerStyle; |
| | | |
| | | let mc = methodStartCol; |
| | | methodGroups.forEach((g) => { |
| | | if (g.fields.length > 1) { |
| | |
| | | mc += g.fields.length; |
| | | }); |
| | | |
| | | // 第4行:随访方式子列(发送完成/最终完成) |
| | | // 第4行:随访方式子列(发送数/成功数) |
| | | mc = methodStartCol; |
| | | methodGroups.forEach((g) => { |
| | | g.fields.forEach((field, idx) => { |
| | |
| | | // 表头占 2 行(第2/3行),数据从第4行开始 |
| | | const headerEndRow = 3; |
| | | |
| | | for (let i = 1; i <= baseCount; i++) { |
| | | // 固定列(空/出院病区/科室):纵向合并 |
| | | for (let i = 1; i <= baseFixedHeaders.length; i++) { |
| | | worksheet.mergeCells(2, i, headerEndRow, i); |
| | | const cell = worksheet.getCell(2, i); |
| | | cell.value = baseHeaders[i - 1]; |
| | | cell.value = baseFixedHeaders[i - 1]; |
| | | cell.style = headerStyle; |
| | | } |
| | | // 人次分组列:单级纵向合并;多级(普通/日间)父标签横合、子标签写第3行 |
| | | let bCol = baseFixedHeaders.length + 1; |
| | | baseCountGroups.forEach((g) => { |
| | | if (g.sub.length > 1) { |
| | | worksheet.mergeCells(2, bCol, 2, bCol + g.sub.length - 1); |
| | | const cell = worksheet.getCell(2, bCol); |
| | | cell.value = g.label; |
| | | cell.style = headerStyle; |
| | | g.sub.forEach((sub, idx) => { |
| | | const subCell = worksheet.getCell(3, bCol + idx); |
| | | subCell.value = sub; |
| | | subCell.style = headerStyle; |
| | | }); |
| | | bCol += g.sub.length; |
| | | } else { |
| | | worksheet.mergeCells(2, bCol, headerEndRow, bCol); |
| | | const cell = worksheet.getCell(2, bCol); |
| | | cell.value = g.label; |
| | | cell.style = headerStyle; |
| | | bCol += 1; |
| | | } |
| | | }); |
| | | worksheet.mergeCells(2, coreStartCol, 2, totalCols); |
| | | worksheet.getCell(2, coreStartCol).value = serviceTypeName; |
| | | worksheet.getCell(2, coreStartCol).style = headerStyle; |
| | |
| | | "", |
| | | item.leavehospitaldistrictname || "", |
| | | item.deptname || "", |
| | | item.dischargeCount || 0, |
| | | item.nonFollowUp || 0, |
| | | item.followUpNeeded || 0, |
| | | ...baseFields.map((field) => item[field] || 0), |
| | | item.needFollowUp || 0, |
| | | item.pendingFollowUp || 0, |
| | | // 待随访:目标医院拆为待发送/已发送,其他用待随访 |
| | | ...(this.isTargetHospital |
| | | ? [item.pendingFollowUpWaitSend || 0, item.pendingFollowUpSent || 0] |
| | | : [item.pendingFollowUp || 0]), |
| | | item.followUpSuccess || 0, |
| | | item.followUpFail || 0, |
| | | // 随访失败:目标医院不显示 |
| | | ...(this.isTargetHospital ? [] : [item.followUpFail || 0]), |
| | | // 成功率 - 需要动态计算 |
| | | this.calculateSuccessRate( |
| | | item.followUpSuccess, |
| | |
| | | item.pendingFollowUp |
| | | ), |
| | | item.followUpRate || "0%", // 随访率 |
| | | item.rate ? (Number(item.rate) * 100).toFixed(2) + "%" : "0%", // 及时率 |
| | | this.getTimelyRateText(item), // 及时率 |
| | | ...(showTimelyFollowUp ? [item.timelyFollowUp || 0] : []), // 及时随访人次 |
| | | ]; |
| | | methodGroups.forEach((g) => { |
| | | g.fields.forEach((field) => { |
| | |
| | | summaryRow.height = 28; |
| | | |
| | | // 列宽 |
| | | const widths = [8, 20, 15, 12, 12, 12, 10, 10, 10, 10, 12, 12, 12]; |
| | | const widths = [8, 20, 15]; |
| | | baseCountGroups.forEach((g) => { |
| | | g.sub.forEach(() => widths.push(10)); |
| | | }); |
| | | widths.push(10, 10, 10, 10, 12, 12, 12); |
| | | if (showTimelyFollowUp) { |
| | | widths.push(12); |
| | | } |
| | | methodGroups.forEach((g) => { |
| | | g.fields.forEach(() => widths.push(8)); |
| | | }); |
| | | worksheet.columns = widths.map((width) => ({ width })); |
| | | }, |
| | | getMethodColumns() { |
| | | // 随访方式列配置:目标医院按“发送完成/最终完成”分级展示 |
| | | // 随访方式列配置:目标医院按“发送数/成功数”分级展示 |
| | | if (this.isTargetHospital) { |
| | | return [ |
| | | { label: "人工", fields: ["manual", "manualSuccess"], sub: ["发送完成", "最终完成"] }, |
| | | { label: "语音", fields: ["voice", "voiceSuccess"], sub: ["发送完成", "最终完成"] }, |
| | | { label: "短信", fields: ["sms", "smsSuccess"], sub: ["发送完成", "最终完成"] }, |
| | | { label: "微信", fields: ["weChat", "weChatSuccess"], sub: ["发送完成", "最终完成"] }, |
| | | { |
| | | label: "人工", |
| | | fields: ["manual", "manualSuccess"], |
| | | sub: ["发送数", "成功数"], |
| | | }, |
| | | { |
| | | label: "语音", |
| | | fields: ["voice", "voiceSuccess"], |
| | | sub: ["发送数", "成功数"], |
| | | }, |
| | | { |
| | | label: "短信", |
| | | fields: ["sms", "smsSuccess"], |
| | | sub: ["发送数", "成功数"], |
| | | }, |
| | | { |
| | | label: "微信", |
| | | fields: ["weChat", "weChatSuccess"], |
| | | sub: ["发送数", "成功数"], |
| | | }, |
| | | ]; |
| | | } |
| | | return [ |
| | |
| | | }, |
| | | |
| | | getExportSummaries() { |
| | | const summaries = [ |
| | | "合计", |
| | | "/", |
| | | "/", |
| | | 0, // 3: dischargeCount |
| | | 0, // 4: nonFollowUp |
| | | 0, // 5: followUpNeeded |
| | | 0, // 6: needFollowUp |
| | | 0, // 7: pendingFollowUp |
| | | 0, // 8: followUpSuccess |
| | | 0, // 9: followUpFail |
| | | "0%", // 10: 成功率 |
| | | "0%", // 11: 随访率 |
| | | "0%", // 12: 及时率 |
| | | ]; |
| | | const graded = this.isTargetHospital; |
| | | const showTimelyFollowUp = this.orgname == "缙云县人民医院"; |
| | | const showTongdeBreakdown = this.isTongdeOrg; |
| | | |
| | | const baseFields = showTongdeBreakdown |
| | | ? [ |
| | | "dischargeCountNormal", |
| | | "dischargeCountDaytime", |
| | | "nonFollowUpNormal", |
| | | "nonFollowUpDaytime", |
| | | "followUpNeededNormal", |
| | | "followUpNeededDaytime", |
| | | ] |
| | | : ["dischargeCount", "nonFollowUp", "followUpNeeded"]; |
| | | |
| | | const methodFields = this.getMethodColumns().reduce( |
| | | (arr, g) => arr.concat(g.fields), |
| | | [] |
| | | ); |
| | | const methodStartIndex = 13; |
| | | |
| | | // 列位置:0=合计 1=/ 2=/,随后为基础人次列、核心列、及时随访人次(可选)、随访方式列 |
| | | const baseStart = 3; |
| | | const needIdx = baseStart + baseFields.length; // 需随访 |
| | | const pendingIdx = needIdx + 1; // 待随访 / 待发送 |
| | | const pending2Idx = graded ? pendingIdx + 1 : -1; // 已发送(仅目标医院) |
| | | const successIdx = pending2Idx >= 0 ? pending2Idx + 1 : pendingIdx + 1; // 随访成功 |
| | | const failIdx = graded ? -1 : successIdx + 1; // 随访失败(非目标医院) |
| | | const successRateIdx = (failIdx >= 0 ? failIdx : successIdx) + 1; // 成功率 |
| | | const followUpRateIdx = successRateIdx + 1; // 随访率 |
| | | const timelyRateIdx = followUpRateIdx + 1; // 及时率 |
| | | const timelyFollowUpIdx = showTimelyFollowUp ? timelyRateIdx + 1 : -1; // 及时随访人次 |
| | | const methodStartIndex = |
| | | (timelyFollowUpIdx >= 0 ? timelyFollowUpIdx : timelyRateIdx) + 1; |
| | | |
| | | const summaries = ["合计", "/", "/"]; |
| | | baseFields.forEach(() => summaries.push(0)); |
| | | summaries.push(0); // 需随访 |
| | | summaries.push(0); // 待随访 / 待发送 |
| | | if (graded) summaries.push(0); // 已发送 |
| | | summaries.push(0); // 随访成功 |
| | | if (!graded) summaries.push(0); // 随访失败 |
| | | summaries.push("0%"); // 成功率 |
| | | summaries.push("0%"); // 随访率 |
| | | summaries.push("0%"); // 及时率 |
| | | if (showTimelyFollowUp) summaries.push(0); // 及时随访人次 |
| | | methodFields.forEach(() => summaries.push(0)); |
| | | |
| | | this.tableData.forEach((item) => { |
| | | summaries[3] += Number(item.dischargeCount) || 0; |
| | | summaries[4] += Number(item.nonFollowUp) || 0; |
| | | summaries[5] += Number(item.followUpNeeded) || 0; |
| | | summaries[6] += Number(item.needFollowUp) || 0; |
| | | summaries[7] += Number(item.pendingFollowUp) || 0; |
| | | summaries[8] += Number(item.followUpSuccess) || 0; |
| | | summaries[9] += Number(item.followUpFail) || 0; |
| | | baseFields.forEach((field, i) => { |
| | | summaries[baseStart + i] += Number(item[field]) || 0; |
| | | }); |
| | | summaries[needIdx] += Number(item.needFollowUp) || 0; |
| | | if (graded) { |
| | | summaries[pendingIdx] += Number(item.pendingFollowUpWaitSend) || 0; |
| | | summaries[pending2Idx] += Number(item.pendingFollowUpSent) || 0; |
| | | summaries[successIdx] += Number(item.followUpSuccess) || 0; |
| | | } else { |
| | | summaries[pendingIdx] += Number(item.pendingFollowUp) || 0; |
| | | summaries[successIdx] += Number(item.followUpSuccess) || 0; |
| | | summaries[failIdx] += Number(item.followUpFail) || 0; |
| | | } |
| | | if (showTimelyFollowUp) { |
| | | summaries[timelyFollowUpIdx] += Number(item.timelyFollowUp) || 0; |
| | | } |
| | | methodFields.forEach((field, i) => { |
| | | summaries[methodStartIndex + i] += Number(item[field]) || 0; |
| | | }); |
| | | }); |
| | | |
| | | // 成功率计算 |
| | | const totalSuccess = summaries[8]; // followUpSuccess的总和 |
| | | const totalNeed = summaries[6]; // needFollowUp的总和 |
| | | const totalPending = summaries[7]; // pendingFollowUp的总和 |
| | | const denominator = totalNeed - totalPending; |
| | | // 成功率计算:随访成功 / 需随访(目标医院),否则 随访成功 / (需随访-待随访) |
| | | const totalSuccess = summaries[successIdx]; |
| | | const totalNeed = summaries[needIdx]; |
| | | const totalPending = summaries[pendingIdx]; |
| | | const denominator = graded ? totalNeed : totalNeed - totalPending; |
| | | |
| | | if (denominator > 0) { |
| | | summaries[10] = ((totalSuccess / denominator) * 100).toFixed(2) + "%"; |
| | | summaries[successRateIdx] = |
| | | ((totalSuccess / denominator) * 100).toFixed(2) + "%"; |
| | | } else { |
| | | summaries[10] = "0.00%"; |
| | | summaries[successRateIdx] = "0.00%"; |
| | | } |
| | | |
| | | // 随访率计算 |
| | |
| | | const avgFollowUpRate = |
| | | followUpRateValues.reduce((sum, val) => sum + val, 0) / |
| | | followUpRateValues.length; |
| | | summaries[11] = (avgFollowUpRate * 100).toFixed(2) + "%"; |
| | | summaries[followUpRateIdx] = (avgFollowUpRate * 100).toFixed(2) + "%"; |
| | | } |
| | | |
| | | // 及时率计算 |
| | | const rateValues = this.tableData |
| | | .map((item) => this.extractPercentageValue(item.rate)) |
| | | .filter((value) => value !== null); |
| | | // 及时率计算:第一人民医院三院区按及时完成/需随访,目标医院 (需随访-人工超时)/需随访,其他取后端 rate 平均 |
| | | if (this.isDiyiRenmin) { |
| | | const totalTimely = this.tableData.reduce( |
| | | (sum, item) => sum + (Number(item.timelyFollowUp) || 0), |
| | | 0 |
| | | ); |
| | | summaries[timelyRateIdx] = this.calculateTimelyRateByCompletion( |
| | | totalTimely, |
| | | totalNeed |
| | | ); |
| | | } else if (graded) { |
| | | const totalTimeout = this.tableData.reduce( |
| | | (sum, item) => sum + (Number(item.manualCallTimeout) || 0), |
| | | 0 |
| | | ); |
| | | summaries[timelyRateIdx] = this.calculateTimelyRate( |
| | | totalNeed, |
| | | totalTimeout |
| | | ); |
| | | } else { |
| | | const rateValues = this.tableData |
| | | .map((item) => this.extractPercentageValue(item.rate)) |
| | | .filter((value) => value !== null); |
| | | |
| | | if (rateValues.length > 0) { |
| | | const avgRate = |
| | | rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length; |
| | | summaries[12] = (avgRate * 100).toFixed(2) + "%"; |
| | | if (rateValues.length > 0) { |
| | | const avgRate = |
| | | rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length; |
| | | summaries[timelyRateIdx] = (avgRate * 100).toFixed(2) + "%"; |
| | | } |
| | | } |
| | | |
| | | // 格式化数字 |
| | | const numericIndices = [3, 4, 5, 6, 7, 8, 9].concat( |
| | | methodFields.map((_, i) => methodStartIndex + i) |
| | | ); |
| | | const numericIndices = []; |
| | | for (let i = baseStart; i < baseStart + baseFields.length; i++) { |
| | | numericIndices.push(i); |
| | | } |
| | | numericIndices.push(needIdx, pendingIdx); |
| | | if (graded) numericIndices.push(pending2Idx); |
| | | numericIndices.push(successIdx); |
| | | if (!graded) numericIndices.push(failIdx); |
| | | if (showTimelyFollowUp) numericIndices.push(timelyFollowUpIdx); |
| | | methodFields.forEach((_, i) => numericIndices.push(methodStartIndex + i)); |
| | | |
| | | numericIndices.forEach((index) => { |
| | | summaries[index] = this.formatNumber(summaries[index]); |
| | | }); |
| | |
| | | } |
| | | // 出院时间范围 |
| | | if (queryParams.hospitalEndTime) { |
| | | this.patientqueryParams.hospitalStartTime = |
| | | this.patientqueryParams.startOutHospTime = |
| | | queryParams.hospitalStartTime; |
| | | this.patientqueryParams.hospitalEndTime = queryParams.hospitalEndTime; |
| | | this.patientqueryParams.endOutHospTime = queryParams.hospitalEndTime; |
| | | } else { |
| | | this.patientqueryParams.hospitalStartTime = this.parseTime( |
| | | this.patientqueryParams.startOutHospTime = this.parseTime( |
| | | queryParams.dateRangecy[0] |
| | | ); |
| | | this.patientqueryParams.hospitalEndTime = this.parseTime( |
| | | this.patientqueryParams.endOutHospTime = this.parseTime( |
| | | queryParams.dateRangecy[1] |
| | | ); |
| | | } |