| | |
| | | width="120" |
| | | key="successRateAgain" |
| | | prop="successRateAgain" |
| | | :render-header="Tooltipcgl" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span class="success-rate">{{ |
| | |
| | | width="120" |
| | | key="followUpRateAgain" |
| | | prop="followUpRateAgain" |
| | | :render-header="Tooltipsfl" |
| | | /> |
| | | <el-table-column |
| | | label="人工" |
| | |
| | | width="120" |
| | | key="successRateAgain" |
| | | prop="successRateAgain" |
| | | :render-header="Tooltipcgl" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span class="success-rate">{{ |
| | |
| | | width="120" |
| | | key="followUpRateAgain" |
| | | prop="followUpRateAgain" |
| | | :render-header="Tooltipsfl" |
| | | /> |
| | | <el-table-column |
| | | label="人工" |
| | |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | Tooltipcgl(h, { column }) { |
| | | return h( |
| | | "el-tooltip", |
| | | { |
| | | props: { |
| | | content: "随访成功/(需随访-待随访)", |
| | | placement: "top", |
| | | effect: "dark", |
| | | }, |
| | | }, |
| | | [h("span", column.label)] |
| | | ); |
| | | }, |
| | | Tooltipjsl(h, { column }) { |
| | | return h( |
| | | "el-tooltip", |
| | | { |
| | | props: { |
| | | content: "(应随访时间+任务周期)小于完成时间即为超时;(需随访-超时)/需随访", |
| | | placement: "top", |
| | | effect: "dark", |
| | | }, |
| | | }, |
| | | [h("span", column.label)] |
| | | ); |
| | | }, |
| | | Tooltipsfl(h, { column }) { |
| | | return h( |
| | | "el-tooltip", |
| | | { |
| | | props: { |
| | | content: "(随访成功+首次随访失败)/首次应随访", |
| | | placement: "top", |
| | | effect: "dark", |
| | | }, |
| | | }, |
| | | [h("span", column.label)] |
| | | ); |
| | | }, |
| | | getAllWardCodes() { |
| | | return this.flatArrayhospit |
| | | .filter((item) => item.value !== "all") |
| | |
| | | return rate.toFixed(2) + "%"; |
| | | }, |
| | | async exportTable() { |
| | | try { |
| | | let dateRangeString = ""; |
| | | let sheetNameSuffix = ""; |
| | | try { |
| | | let dateRangeString = ""; |
| | | let sheetNameSuffix = ""; |
| | | |
| | | // 判断是否是丽水市中医院 |
| | | const isLishuiHospital = this.orgname == "丽水市中医院"; |
| | | // 判断是否是丽水市中医院 |
| | | const isLishuiHospital = this.orgname == "丽水市中医院"; |
| | | |
| | | if ( |
| | | this.queryParams.dateRange && |
| | | this.queryParams.dateRange.length === 2 |
| | | ) { |
| | | const startDateStr = this.queryParams.dateRange[0]; |
| | | const endDateStr = this.queryParams.dateRange[1]; |
| | | if ( |
| | | this.queryParams.dateRange && |
| | | this.queryParams.dateRange.length === 2 |
| | | ) { |
| | | const startDateStr = this.queryParams.dateRange[0]; |
| | | const endDateStr = this.queryParams.dateRange[1]; |
| | | |
| | | if (isLishuiHospital) { |
| | | // 丽水市中医院:只显示年月 |
| | | const formatMonthOnly = (dateTimeStr) => { |
| | | const date = new Date(dateTimeStr); |
| | | const year = date.getFullYear(); |
| | | const month = date.getMonth() + 1; |
| | | return `${year}年${month}月`; |
| | | if (isLishuiHospital) { |
| | | // 丽水市中医院:只显示年月 |
| | | const formatMonthOnly = (dateTimeStr) => { |
| | | const date = new Date(dateTimeStr); |
| | | const year = date.getFullYear(); |
| | | const month = date.getMonth() + 1; |
| | | return `${year}年${month}月`; |
| | | }; |
| | | const startDateFormatted = formatMonthOnly(startDateStr); |
| | | const endDateFormatted = formatMonthOnly(endDateStr); |
| | | dateRangeString = `${startDateFormatted}至${endDateFormatted}`; |
| | | sheetNameSuffix = `${startDateFormatted}至${endDateFormatted}`; |
| | | } else { |
| | | // 其他医院:显示年月日 |
| | | const formatDateForDisplay = (dateTimeStr) => { |
| | | return dateTimeStr.split(" ")[0]; |
| | | }; |
| | | const startDateFormatted = formatDateForDisplay(startDateStr); |
| | | const endDateFormatted = formatDateForDisplay(endDateStr); |
| | | dateRangeString = `${startDateFormatted}至${endDateFormatted}`; |
| | | 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}月`; |
| | | } |
| | | } |
| | | |
| | | // 根据 serviceType 生成随访类型名称 |
| | | let serviceTypeName = "出院随访"; // 文件名使用的名称 |
| | | let sheetTypeName = "再次随访"; // 工作表使用的名称(简化版) |
| | | console.log(this.queryParams.serviceType); |
| | | |
| | | if ( |
| | | this.queryParams.serviceType && |
| | | Array.isArray(this.queryParams.serviceType) && |
| | | this.queryParams.serviceType.length > 0 |
| | | ) { |
| | | if (this.tasktypes && Array.isArray(this.tasktypes)) { |
| | | // 过滤出匹配的随访类型 |
| | | const matchedTypes = this.tasktypes.filter((task) => |
| | | this.queryParams.serviceType.includes(task.value) |
| | | ); |
| | | |
| | | if (matchedTypes.length === 1) { |
| | | // 单个类型 |
| | | const label = matchedTypes[0].label; |
| | | serviceTypeName = label; |
| | | sheetTypeName = label; |
| | | } else if (matchedTypes.length > 1) { |
| | | // 多个类型 |
| | | const typeNames = matchedTypes.map((task) => task.label); |
| | | |
| | | // 文件名:用斜杠分隔 |
| | | serviceTypeName = typeNames.join("/"); |
| | | |
| | | // 工作表名:使用第一个类型或简化名称 |
| | | if (matchedTypes.length <= 2) { |
| | | // 如果只有2个类型,都显示 |
| | | sheetTypeName = `${typeNames[0]}等`; |
| | | } else { |
| | | // 如果超过2个类型,只显示第一个 |
| | | sheetTypeName = `${typeNames[0]}等`; |
| | | } |
| | | } else if (this.queryParams.serviceType.length > 0) { |
| | | // 如果没有匹配的,使用原始值 |
| | | const typeStr = this.queryParams.serviceType.join("/"); |
| | | serviceTypeName = typeStr; |
| | | sheetTypeName = "再次随访"; |
| | | } |
| | | } else if (this.queryParams.serviceType.length > 0) { |
| | | // 如果没有 tasktypes,使用原始值 |
| | | const typeStr = this.queryParams.serviceType.join("/"); |
| | | serviceTypeName = typeStr; |
| | | sheetTypeName = "再次随访"; |
| | | } |
| | | } |
| | | |
| | | const excelName = `再次${serviceTypeName}统计表_${dateRangeString}.xlsx`; |
| | | |
| | | // 清理工作表名称,移除非法字符 |
| | | const cleanSheetName = (name) => { |
| | | // Excel工作表名不能包含的字符: * ? : \ / [ ] |
| | | return name.replace(/[*?:\\/[\]]/g, " "); |
| | | }; |
| | | const startDateFormatted = formatMonthOnly(startDateStr); |
| | | const endDateFormatted = formatMonthOnly(endDateStr); |
| | | dateRangeString = `${startDateFormatted}至${endDateFormatted}`; |
| | | sheetNameSuffix = `${startDateFormatted}至${endDateFormatted}`; |
| | | } else { |
| | | // 其他医院:显示年月日 |
| | | const formatDateForDisplay = (dateTimeStr) => { |
| | | return dateTimeStr.split(" ")[0]; |
| | | }; |
| | | const startDateFormatted = formatDateForDisplay(startDateStr); |
| | | const endDateFormatted = formatDateForDisplay(endDateStr); |
| | | dateRangeString = `${startDateFormatted}至${endDateFormatted}`; |
| | | 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}月`; |
| | | } |
| | | } |
| | | |
| | | // 根据 serviceType 生成随访类型名称 |
| | | let serviceTypeName = "出院随访"; // 文件名使用的名称 |
| | | let sheetTypeName = "再次随访"; // 工作表使用的名称(简化版) |
| | | console.log(this.queryParams.serviceType); |
| | | |
| | | if ( |
| | | this.queryParams.serviceType && |
| | | Array.isArray(this.queryParams.serviceType) && |
| | | this.queryParams.serviceType.length > 0 |
| | | ) { |
| | | if (this.tasktypes && Array.isArray(this.tasktypes)) { |
| | | // 过滤出匹配的随访类型 |
| | | const matchedTypes = this.tasktypes.filter((task) => |
| | | this.queryParams.serviceType.includes(task.value) |
| | | const worksheetName = cleanSheetName( |
| | | `再次${sheetTypeName}统计_${sheetNameSuffix}` |
| | | ); |
| | | |
| | | if (matchedTypes.length === 1) { |
| | | // 单个类型 |
| | | const label = matchedTypes[0].label; |
| | | serviceTypeName = label; |
| | | sheetTypeName = label; |
| | | } else if (matchedTypes.length > 1) { |
| | | // 多个类型 |
| | | const typeNames = matchedTypes.map((task) => task.label); |
| | | |
| | | // 文件名:用斜杠分隔 |
| | | serviceTypeName = typeNames.join("/"); |
| | | |
| | | // 工作表名:使用第一个类型或简化名称 |
| | | if (matchedTypes.length <= 2) { |
| | | // 如果只有2个类型,都显示 |
| | | sheetTypeName = `${typeNames[0]}等`; |
| | | } else { |
| | | // 如果超过2个类型,只显示第一个 |
| | | sheetTypeName = `${typeNames[0]}等`; |
| | | } |
| | | } else if (this.queryParams.serviceType.length > 0) { |
| | | // 如果没有匹配的,使用原始值 |
| | | const typeStr = this.queryParams.serviceType.join("/"); |
| | | serviceTypeName = typeStr; |
| | | sheetTypeName = "再次随访"; |
| | | if (!this.tableData || this.tableData.length === 0) { |
| | | this.$message.warning(`暂无再次${serviceTypeName}数据可导出`); |
| | | return false; |
| | | } |
| | | } else if (this.queryParams.serviceType.length > 0) { |
| | | // 如果没有 tasktypes,使用原始值 |
| | | const typeStr = this.queryParams.serviceType.join("/"); |
| | | serviceTypeName = typeStr; |
| | | sheetTypeName = "再次随访"; |
| | | |
| | | const workbook = new ExcelJS.Workbook(); |
| | | const worksheet = workbook.addWorksheet(worksheetName); |
| | | |
| | | // 构建表格 |
| | | this.buildExportSheet(worksheet, sheetNameSuffix); |
| | | |
| | | const buffer = await workbook.xlsx.writeBuffer(); |
| | | const blob = new Blob([buffer], { |
| | | type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
| | | }); |
| | | saveAs(blob, excelName); |
| | | |
| | | this.$message.success("导出成功"); |
| | | return true; |
| | | } catch (error) { |
| | | console.error("导出失败:", error); |
| | | this.$message.error(`导出失败: ${error.message}`); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | const excelName = `再次${serviceTypeName}统计表_${dateRangeString}.xlsx`; |
| | | |
| | | // 清理工作表名称,移除非法字符 |
| | | const cleanSheetName = (name) => { |
| | | // Excel工作表名不能包含的字符: * ? : \ / [ ] |
| | | return name.replace(/[*?:\\/[\]]/g, ' '); |
| | | }; |
| | | |
| | | const worksheetName = cleanSheetName(`再次${sheetTypeName}统计_${sheetNameSuffix}`); |
| | | |
| | | if (!this.tableData || this.tableData.length === 0) { |
| | | this.$message.warning(`暂无再次${serviceTypeName}数据可导出`); |
| | | return false; |
| | | } |
| | | |
| | | const workbook = new ExcelJS.Workbook(); |
| | | const worksheet = workbook.addWorksheet(worksheetName); |
| | | |
| | | // 构建表格 |
| | | this.buildExportSheet(worksheet, sheetNameSuffix); |
| | | |
| | | const buffer = await workbook.xlsx.writeBuffer(); |
| | | const blob = new Blob([buffer], { |
| | | type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
| | | }); |
| | | saveAs(blob, excelName); |
| | | |
| | | this.$message.success("导出成功"); |
| | | return true; |
| | | } catch (error) { |
| | | console.error("导出失败:", error); |
| | | this.$message.error(`导出失败: ${error.message}`); |
| | | return false; |
| | | } |
| | | }, |
| | | }, |
| | | /** 导出医生子表(再次随访) */ |
| | | async exportDoctorTable(row) { |
| | | try { |