| | |
| | | :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="首次出院随访"> |
| | |
| | | }; |
| | | // 是否为目标医院(人工/语音/短信/微信 按 发送数/成功数 分级展示) |
| | | const graded = this.isTargetHospital; |
| | | // 缙云县人民医院额外展示“及时随访人次”列 |
| | | const showTimelyFollowUp = this.orgname == "缙云县人民医院"; |
| | | // 同德系列:出院人次/无需随访人次/应随访人次 下分“普通/日间” |
| | | const showTongdeBreakdown = this.isTongdeOrg; |
| | | |
| | | const baseHeaders = [ |
| | | "", |
| | | "出院病区", |
| | | "科室", |
| | | "出院人次", |
| | | "无需随访人次", |
| | | "应随访人次", |
| | | ]; |
| | | // 基础列:固定列(空/出院病区/科室)+ 人次分组列(同德系列下分普通/日间) |
| | | 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; |
| | |
| | | // 表头占 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, |
| | | // 待随访:目标医院拆为待发送/已发送,其他用待随访 |
| | | ...(this.isTargetHospital |
| | |
| | | ), |
| | | item.followUpRate || "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)); |
| | | }); |
| | |
| | | }, |
| | | |
| | | getExportSummaries() { |
| | | const summaries = [ |
| | | "合计", |
| | | "/", |
| | | "/", |
| | | 0, // 3: dischargeCount |
| | | 0, // 4: nonFollowUp |
| | | 0, // 5: followUpNeeded |
| | | 0, // 6: needFollowUp |
| | | 0, // 7: 待发送/待随访 |
| | | 0, // 8: 已发送/随访成功 |
| | | 0, // 9: 随访成功/随访失败 |
| | | "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; |
| | | if (this.isTargetHospital) { |
| | | summaries[7] += Number(item.pendingFollowUpWaitSend) || 0; |
| | | summaries[8] += Number(item.pendingFollowUpSent) || 0; |
| | | summaries[9] += Number(item.followUpSuccess) || 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[7] += Number(item.pendingFollowUp) || 0; |
| | | summaries[8] += Number(item.followUpSuccess) || 0; |
| | | summaries[9] += Number(item.followUpFail) || 0; |
| | | 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 = this.isTargetHospital ? summaries[9] : summaries[8]; |
| | | const totalNeed = summaries[6]; // needFollowUp的总和 |
| | | const totalPending = summaries[7]; // 待发送/待随访的总和 |
| | | const denominator = this.isTargetHospital |
| | | ? totalNeed |
| | | : 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) + "%"; |
| | | } |
| | | |
| | | // 及时率计算:目标医院 (需随访-人工超时)/需随访,其他取后端 rate 平均 |
| | | if (this.isTargetHospital) { |
| | | if (graded) { |
| | | const totalTimeout = this.tableData.reduce( |
| | | (sum, item) => sum + (Number(item.manualCallTimeout) || 0), |
| | | 0 |
| | | ); |
| | | summaries[12] = this.calculateTimelyRate(totalNeed, totalTimeout); |
| | | summaries[timelyRateIdx] = this.calculateTimelyRate( |
| | | totalNeed, |
| | | totalTimeout |
| | | ); |
| | | } else { |
| | | const rateValues = this.tableData |
| | | .map((item) => this.extractPercentageValue(item.rate)) |
| | |
| | | if (rateValues.length > 0) { |
| | | const avgRate = |
| | | rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length; |
| | | summaries[12] = (avgRate * 100).toFixed(2) + "%"; |
| | | 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]); |
| | | }); |