| | |
| | | <el-table-column |
| | | label="发送完成" |
| | | align="center" |
| | | key="manualSuccess" |
| | | prop="manualSuccess" |
| | | key="manual" |
| | | prop="manual" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'manualSuccessInfo', |
| | | 'manualInfo', |
| | | '发送完成人工随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.manualSuccess }}</span> |
| | | <span class="button-zx">{{ scope.row.manual }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | align="center" |
| | | key="manualAgainSuccess" |
| | | prop="manualAgainSuccess" |
| | | key="manualSuccess" |
| | | prop="manualSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'manualAgainSuccessInfo', |
| | | 'manualSuccessInfo', |
| | | '最终完成人工随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.manualAgainSuccess |
| | | scope.row.manualSuccess |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | |
| | | <el-table-column |
| | | label="发送完成" |
| | | align="center" |
| | | key="voiceSuccess" |
| | | prop="voiceSuccess" |
| | | key="voice" |
| | | prop="voice" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'voiceSuccessInfo', |
| | | 'voiceInfo', |
| | | '发送完成语音随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.voiceSuccess }}</span> |
| | | <span class="button-zx">{{ scope.row.voice }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | align="center" |
| | | key="voiceAgainSuccess" |
| | | prop="voiceAgainSuccess" |
| | | key="voiceSuccess" |
| | | prop="voiceSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'voiceAgainSuccessInfo', |
| | | 'voiceSuccessInfo', |
| | | '最终完成语音随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.voiceAgainSuccess |
| | | scope.row.voiceSuccess |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | |
| | | <el-table-column |
| | | label="发送完成" |
| | | align="center" |
| | | key="smsSuccess" |
| | | prop="smsSuccess" |
| | | key="sms" |
| | | prop="sms" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'smsSuccessInfo', |
| | | 'smsInfo', |
| | | '发送完成短信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.smsSuccess }}</span> |
| | | <span class="button-zx">{{ scope.row.sms }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | align="center" |
| | | key="smsAgainSuccess" |
| | | prop="smsAgainSuccess" |
| | | key="smsSuccess" |
| | | prop="smsSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'smsAgainSuccessInfo', |
| | | 'smsSuccessInfo', |
| | | '最终完成短信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.smsAgainSuccess |
| | | scope.row.smsSuccess |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | |
| | | <el-table-column |
| | | label="发送完成" |
| | | align="center" |
| | | key="weChatSuccess" |
| | | prop="weChatSuccess" |
| | | key="weChat" |
| | | prop="weChat" |
| | | :render-header="Tooltipfswc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'wechatSuccessInfo', |
| | | 'weChatInfo', |
| | | '发送完成微信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ scope.row.weChatSuccess }}</span> |
| | | <span class="button-zx">{{ scope.row.weChat }}</span> |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="最终完成" |
| | | align="center" |
| | | key="weChatAgainSuccess" |
| | | prop="weChatAgainSuccess" |
| | | key="weChatSuccess" |
| | | prop="weChatSuccess" |
| | | :render-header="Tooltipzzwc" |
| | | > |
| | | <template slot-scope="scope"> |
| | |
| | | @click=" |
| | | handleViewDetails( |
| | | scope.row, |
| | | 'wechatAgainSuccessInfo', |
| | | 'weChatSuccessInfo', |
| | | '最终完成微信随访列表' |
| | | ) |
| | | " |
| | | > |
| | | <span class="button-zx">{{ |
| | | scope.row.weChatAgainSuccess |
| | | scope.row.weChatSuccess |
| | | }}</span> |
| | | </el-button> |
| | | </template> |
| | |
| | | right: { style: "thin", color: { argb: "FFD0D0D0" } }, |
| | | }, |
| | | }; |
| | | const titleText = `${serviceTypeName}统计表_${sheetNameSuffix}`; |
| | | // 添加标题行 |
| | | worksheet.mergeCells(1, 1, 1, 16); |
| | | const titleCell = worksheet.getCell(1, 1); |
| | | titleCell.value = titleText; // 使用动态标题 |
| | | titleCell.style = titleStyle; |
| | | worksheet.getRow(1).height = 35; |
| | | // 是否为目标医院(人工/语音/短信/微信 按 发送完成/最终完成 分级展示) |
| | | const graded = this.isTargetHospital; |
| | | |
| | | // 表头 |
| | | const secondRowHeaders = [ |
| | | const baseHeaders = [ |
| | | "", |
| | | "出院病区", |
| | | "科室", |
| | | "出院人次", |
| | | "无需随访人次", |
| | | "应随访人次", |
| | | ]; |
| | | const coreHeaders = [ |
| | | "需随访", |
| | | "待随访", |
| | | "随访成功", |
| | | "随访失败", |
| | | "成功率", // 新增 |
| | | "随访率", // 原位置后移 |
| | | "及时率", // 及时率后移 |
| | | "人工", |
| | | "语音", // 修正:应该是语音 |
| | | "短信", // 短信 |
| | | "微信", // 微信 |
| | | "成功率", |
| | | "随访率", |
| | | "及时率", |
| | | ]; |
| | | const methodGroups = this.getMethodColumns(); |
| | | |
| | | secondRowHeaders.forEach((header, index) => { |
| | | const cell = worksheet.getCell(3, index + 1); |
| | | cell.value = header; |
| | | cell.style = headerStyle; |
| | | }); |
| | | const baseCount = baseHeaders.length; // 6 |
| | | const coreCount = coreHeaders.length; // 7 |
| | | 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 |
| | | |
| | | // 合并单元格 |
| | | for (let i = 1; i <= 6; i++) { |
| | | worksheet.mergeCells(2, i, 3, i); |
| | | const cell = worksheet.getCell(2, i); |
| | | cell.style = headerStyle; |
| | | const titleText = `${serviceTypeName}统计表_${sheetNameSuffix}`; |
| | | // 添加标题行 |
| | | worksheet.mergeCells(1, 1, 1, totalCols); |
| | | const titleCell = worksheet.getCell(1, 1); |
| | | titleCell.value = titleText; |
| | | titleCell.style = titleStyle; |
| | | worksheet.getRow(1).height = 35; |
| | | |
| | | if (graded) { |
| | | // 表头占 3 行(第2/3/4行),数据从第5行开始 |
| | | const headerEndRow = 4; |
| | | |
| | | // 第2行:基础列纵向合并 + 随访分组横向合并 |
| | | for (let i = 1; i <= baseCount; i++) { |
| | | worksheet.mergeCells(2, i, headerEndRow, i); |
| | | const cell = worksheet.getCell(2, i); |
| | | cell.value = baseHeaders[i - 1]; |
| | | cell.style = headerStyle; |
| | | } |
| | | 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; |
| | | worksheet.mergeCells(3, col, headerEndRow, col); |
| | | const cell = worksheet.getCell(3, col); |
| | | cell.value = coreHeaders[k]; |
| | | cell.style = headerStyle; |
| | | } |
| | | let mc = methodStartCol; |
| | | methodGroups.forEach((g) => { |
| | | if (g.fields.length > 1) { |
| | | worksheet.mergeCells(3, mc, 3, mc + g.fields.length - 1); |
| | | } |
| | | const cell = worksheet.getCell(3, mc); |
| | | cell.value = g.label; |
| | | cell.style = headerStyle; |
| | | mc += g.fields.length; |
| | | }); |
| | | |
| | | // 第4行:随访方式子列(发送完成/最终完成) |
| | | mc = methodStartCol; |
| | | methodGroups.forEach((g) => { |
| | | g.fields.forEach((field, idx) => { |
| | | const cell = worksheet.getCell(4, mc + idx); |
| | | cell.value = g.sub[idx]; |
| | | cell.style = headerStyle; |
| | | }); |
| | | mc += g.fields.length; |
| | | }); |
| | | |
| | | worksheet.getRow(2).height = 28; |
| | | worksheet.getRow(3).height = 24; |
| | | worksheet.getRow(4).height = 24; |
| | | } else { |
| | | // 表头占 2 行(第2/3行),数据从第4行开始 |
| | | const headerEndRow = 3; |
| | | |
| | | for (let i = 1; i <= baseCount; i++) { |
| | | worksheet.mergeCells(2, i, headerEndRow, i); |
| | | const cell = worksheet.getCell(2, i); |
| | | cell.value = baseHeaders[i - 1]; |
| | | cell.style = headerStyle; |
| | | } |
| | | 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 cell = worksheet.getCell(3, coreStartCol + k); |
| | | cell.value = coreHeaders[k]; |
| | | cell.style = headerStyle; |
| | | } |
| | | let mc = methodStartCol; |
| | | methodGroups.forEach((g) => { |
| | | const cell = worksheet.getCell(3, mc); |
| | | cell.value = g.label; |
| | | cell.style = headerStyle; |
| | | mc += 1; |
| | | }); |
| | | |
| | | worksheet.getRow(2).height = 28; |
| | | worksheet.getRow(3).height = 25; |
| | | } |
| | | |
| | | worksheet.getCell(2, 1).value = ""; |
| | | worksheet.getCell(2, 2).value = "出院病区"; |
| | | worksheet.getCell(2, 3).value = "科室"; |
| | | worksheet.getCell(2, 4).value = "出院人次"; |
| | | worksheet.getCell(2, 5).value = "无需随访人次"; |
| | | worksheet.getCell(2, 6).value = "应随访人次"; |
| | | |
| | | worksheet.mergeCells(2, 7, 2, 16); // 从7合并到16(原来是7-15) |
| | | worksheet.getCell(2, 7).value = serviceTypeName; // 或适当截取 |
| | | worksheet.getCell(2, 7).style = headerStyle; |
| | | |
| | | worksheet.getRow(2).height = 28; |
| | | worksheet.getRow(3).height = 25; |
| | | |
| | | // 数据行 |
| | | const dataStartRow = graded ? 5 : 4; |
| | | this.tableData.forEach((item, rowIndex) => { |
| | | const dataRow = worksheet.addRow( |
| | | [ |
| | | "", |
| | | item.leavehospitaldistrictname || "", |
| | | item.deptname || "", |
| | | item.dischargeCount || 0, |
| | | item.nonFollowUp || 0, |
| | | item.followUpNeeded || 0, |
| | | item.needFollowUp || 0, |
| | | item.pendingFollowUp || 0, |
| | | item.followUpSuccess || 0, |
| | | item.followUpFail || 0, |
| | | // 成功率 - 需要动态计算 |
| | | this.calculateSuccessRate( |
| | | item.followUpSuccess, |
| | | item.needFollowUp, |
| | | item.pendingFollowUp |
| | | ), |
| | | item.followUpRate || "0%", // 随访率 |
| | | item.rate ? (Number(item.rate) * 100).toFixed(2) + "%" : "0%", // 及时率 |
| | | item.manual || 0, |
| | | item.voice || 0, // 语音 |
| | | item.sms || 0, // 短信 |
| | | item.weChat || 0, // 微信 |
| | | ], |
| | | rowIndex + 4 |
| | | ); |
| | | const rowValues = [ |
| | | "", |
| | | item.leavehospitaldistrictname || "", |
| | | item.deptname || "", |
| | | item.dischargeCount || 0, |
| | | item.nonFollowUp || 0, |
| | | item.followUpNeeded || 0, |
| | | item.needFollowUp || 0, |
| | | item.pendingFollowUp || 0, |
| | | item.followUpSuccess || 0, |
| | | item.followUpFail || 0, |
| | | // 成功率 - 需要动态计算 |
| | | this.calculateSuccessRate( |
| | | item.followUpSuccess, |
| | | item.needFollowUp, |
| | | item.pendingFollowUp |
| | | ), |
| | | item.followUpRate || "0%", // 随访率 |
| | | item.rate ? (Number(item.rate) * 100).toFixed(2) + "%" : "0%", // 及时率 |
| | | ]; |
| | | methodGroups.forEach((g) => { |
| | | g.fields.forEach((field) => { |
| | | rowValues.push(item[field] || 0); |
| | | }); |
| | | }); |
| | | |
| | | const dataRow = worksheet.addRow(rowValues, rowIndex + dataStartRow); |
| | | dataRow.eachCell((cell) => { |
| | | cell.style = cellStyle; |
| | | }); |
| | |
| | | summaryRow.height = 28; |
| | | |
| | | // 列宽 |
| | | worksheet.columns = [ |
| | | { width: 8 }, |
| | | { width: 20 }, |
| | | { width: 15 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 12 }, |
| | | { width: 10 }, |
| | | { width: 10 }, |
| | | { width: 10 }, |
| | | { width: 10 }, |
| | | { width: 12 }, // 成功率 |
| | | { width: 12 }, // 随访率 |
| | | { width: 12 }, // 及时率 |
| | | { width: 8 }, // 人工 |
| | | { width: 8 }, // 语音 |
| | | { width: 8 }, // 短信 |
| | | { width: 8 }, // 微信 |
| | | const widths = [8, 20, 15, 12, 12, 12, 10, 10, 10, 10, 12, 12, 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: ["发送完成", "最终完成"] }, |
| | | ]; |
| | | } |
| | | return [ |
| | | { label: "人工", fields: ["manual"], sub: ["人工"] }, |
| | | { label: "语音", fields: ["voice"], sub: ["语音"] }, |
| | | { label: "短信", fields: ["sms"], sub: ["短信"] }, |
| | | { label: "微信", fields: ["weChat"], sub: ["微信"] }, |
| | | ]; |
| | | }, |
| | | |
| | |
| | | "0%", // 10: 成功率 |
| | | "0%", // 11: 随访率 |
| | | "0%", // 12: 及时率 |
| | | 0, // 13: manual |
| | | 0, // 14: voice |
| | | 0, // 15: sms |
| | | 0, // 16: weChat |
| | | ]; |
| | | |
| | | const methodFields = this.getMethodColumns().reduce( |
| | | (arr, g) => arr.concat(g.fields), |
| | | [] |
| | | ); |
| | | const methodStartIndex = 13; |
| | | methodFields.forEach(() => summaries.push(0)); |
| | | |
| | | this.tableData.forEach((item) => { |
| | | summaries[3] += Number(item.dischargeCount) || 0; |
| | |
| | | summaries[7] += Number(item.pendingFollowUp) || 0; |
| | | summaries[8] += Number(item.followUpSuccess) || 0; |
| | | summaries[9] += Number(item.followUpFail) || 0; |
| | | summaries[13] += Number(item.manual) || 0; |
| | | summaries[14] += Number(item.voice) || 0; |
| | | summaries[15] += Number(item.sms) || 0; |
| | | summaries[16] += Number(item.weChat) || 0; |
| | | methodFields.forEach((field, i) => { |
| | | summaries[methodStartIndex + i] += Number(item[field]) || 0; |
| | | }); |
| | | }); |
| | | |
| | | // 成功率计算 |
| | |
| | | } |
| | | |
| | | // 格式化数字 |
| | | [3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16].forEach((index) => { |
| | | const numericIndices = [3, 4, 5, 6, 7, 8, 9].concat( |
| | | methodFields.map((_, i) => methodStartIndex + i) |
| | | ); |
| | | numericIndices.forEach((index) => { |
| | | summaries[index] = this.formatNumber(summaries[index]); |
| | | }); |
| | | |
| | |
| | | } |
| | | // 出院时间范围 |
| | | if (queryParams.hospitalEndTime) { |
| | | this.patientqueryParams.hospitalstarttime = |
| | | this.patientqueryParams.hospitalStartTime = |
| | | queryParams.hospitalStartTime; |
| | | this.patientqueryParams.hospitalendtime = queryParams.hospitalEndTime; |
| | | this.patientqueryParams.hospitalEndTime = queryParams.hospitalEndTime; |
| | | } else { |
| | | this.patientqueryParams.hospitalstarttime = this.parseTime( |
| | | this.patientqueryParams.hospitalStartTime = this.parseTime( |
| | | queryParams.dateRangecy[0] |
| | | ); |
| | | this.patientqueryParams.hospitalendtime = this.parseTime( |
| | | this.patientqueryParams.hospitalEndTime = this.parseTime( |
| | | queryParams.dateRangecy[1] |
| | | ); |
| | | } |