src/views/Satisfaction/sfstatistics/IndicatorStatistics.vue
@@ -2,7 +2,7 @@ <template> <div class="statistics-main"> <el-tabs v-model="activeTab" @tab-click="handleTabChange"> <el-tab-pane label="满意度统计" name="followup"> <el-tab-pane label="满意度随访统计" name="followup"> <followup-statistics v-if="activeTab === 'followup'" ref="followupRef" src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
@@ -838,23 +838,54 @@ // 构建日期范围字符串 let dateRangeString = ""; let sheetNameSuffix = ""; const isLishuiHospital = this.orgname == "丽水市中医院"; if ( this.queryParams.dateRange && this.queryParams.dateRange.length === 2 ) { const startDateFormatted = this.queryParams.dateRange[0]; const endDateFormatted = this.queryParams.dateRange[1]; dateRangeString = `${startDateFormatted}至${endDateFormatted}`; sheetNameSuffix = `${startDateFormatted}至${endDateFormatted}`; 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}月`; }; 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; dateRangeString = `${currentMonth}月`; sheetNameSuffix = `${currentMonth}月`; const currentYear = now.getFullYear(); if (isLishuiHospital) { // 丽水市中医院:显示年月 dateRangeString = `${currentYear}年${currentMonth}月`; sheetNameSuffix = `${currentYear}年${currentMonth}月`; } else { // 其他医院:显示月份 dateRangeString = `${currentMonth}月`; sheetNameSuffix = `${currentMonth}月`; } } const excelName = `随访统计表_${dateRangeString}.xlsx`; const excelName = `满意度随访统计表_${dateRangeString}.xlsx`; const worksheetName = `随访统计_${sheetNameSuffix}`; // 创建Excel工作簿 @@ -908,7 +939,7 @@ // 添加总标题 worksheet.mergeCells(1, 1, 1, 10); const titleCell = worksheet.getCell(1, 1); titleCell.value = `随访统计表(${sheetNameSuffix})`; titleCell.value = `满意度随访统计表(${sheetNameSuffix})`; titleCell.style = titleStyle; worksheet.getRow(1).height = 35; src/views/Satisfaction/sfstatistics/components/visitStatistics.vue
@@ -837,22 +837,54 @@ let dateRangeString = ""; let sheetNameSuffix = ""; const isLishuiHospital = this.orgname == "丽水市中医院"; if ( this.queryParams.dateRange && this.queryParams.dateRange.length === 2 ) { const startDateFormatted = this.queryParams.dateRange[0]; const endDateFormatted = this.queryParams.dateRange[1]; dateRangeString = `${startDateFormatted}至${endDateFormatted}`; sheetNameSuffix = `${startDateFormatted}至${endDateFormatted}`; 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}月`; }; 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; dateRangeString = `${currentMonth}月`; sheetNameSuffix = `${currentMonth}月`; const currentYear = now.getFullYear(); if (isLishuiHospital) { // 丽水市中医院:显示年月 dateRangeString = `${currentYear}年${currentMonth}月`; sheetNameSuffix = `${currentYear}年${currentMonth}月`; } else { // 其他医院:显示月份 dateRangeString = `${currentMonth}月`; sheetNameSuffix = `${currentMonth}月`; } } const excelName = `随访统计表_${dateRangeString}.xlsx`; const excelName = `复诊通知统计表_${dateRangeString}.xlsx`; const worksheetName = `随访统计_${sheetNameSuffix}`; // 创建Excel工作簿 @@ -906,7 +938,7 @@ // 添加总标题 worksheet.mergeCells(1, 1, 1, 10); const titleCell = worksheet.getCell(1, 1); titleCell.value = `随访统计表(${sheetNameSuffix})`; titleCell.value = `复诊通知统计表(${sheetNameSuffix})`; titleCell.style = titleStyle; worksheet.getRow(1).height = 35; src/views/Satisfaction/sfstatistics/index.vue
@@ -2,13 +2,13 @@ <template> <div class="statistics-main"> <el-tabs v-model="activeTab" @tab-click="handleTabChange"> <el-tab-pane label="随访统计" name="followup"> <el-tab-pane label="满意度随访统计" name="followup"> <followup-statistics v-if="activeTab === 'followup'" ref="followupRef" /> </el-tab-pane> <el-tab-pane label="满意度统计" name="satisfaction"> <el-tab-pane label="满意度明细统计" name="satisfaction"> <satisfaction-statistics v-if="activeTab === 'satisfaction'" ref="satisfactionRef" src/views/followvisit/beHospitalized/followUp.vue
@@ -1306,7 +1306,7 @@ pageNum: 1, pageSize: 10, sendstateView: localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 1, localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 2, sort: localStorage.getItem("orgname") == "丽水市中医院" ? 8 : 2, //0 出院时间(正序) 1 出院时间(倒序) 2 发送时间(正序) 3 发送时间(倒序) 7应随访日期(倒序) 应随访日期(正序) serviceType: 18, searchscope: 3, src/views/followvisit/discharge/index.vue
@@ -1253,7 +1253,7 @@ pageNum: 1, pageSize: 10, sendstateView: localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 1, localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 2, sort: localStorage.getItem("orgname") == "丽水市中医院" ? 8 : 2, //0 出院时间(正序) 1 出院时间(倒序) 2 发送时间(正序) 3 发送时间(倒序) 7应随访日期(倒序) 应随访日期(正序) serviceType: 2, searchscope: 3, src/views/followvisit/operation/index.vue
@@ -1266,7 +1266,7 @@ pageNum: 1, pageSize: 10, sendstateView: localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 1, localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 2, sort: localStorage.getItem("orgname") == "丽水市中医院" ? 8 : 2, //0 手术完成时间(正序) 1 手术完成时间(倒序) 2 发送时间(正序) 3 发送时间(倒序) 7应随访日期(倒序) 应随访日期(正序) serviceType: 19, searchscope: 3, src/views/followvisit/zysatisfaction/index.vue
@@ -1101,7 +1101,7 @@ pageNum: 1, pageSize: 10, sendstateView: localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 1, localStorage.getItem("orgname") == "省立同德翠苑院区" ? null : 2, sort: localStorage.getItem("orgname") == "丽水市中医院" ? 8 : 2, //0 出院时间(正序) 1 出院时间(倒序) 2 发送时间(正序) 3 发送时间(倒序) 7应随访日期(倒序) 应随访日期(正序) serviceType: 6, searchscope: 3, src/views/patient/propaganda/QuestionnaireTask.vue
@@ -428,10 +428,7 @@ placeholder="请点击右侧选择" /> <el-button v-if=" (form.templateid && form.sendState == 1) || !form.templateid " v-if="form.templateid" style="margin-left: 10px" type="primary" icon="el-icon-edit" src/views/patient/propaganda/particty.vue
@@ -449,10 +449,7 @@ placeholder="请点击右侧选择" /> <el-button v-if=" (form.templateid && form.sendState == 1) || !form.templateid " v-if="form.templateid" style="margin-left: 10px" type="primary" icon="el-icon-edit" src/views/sfstatistics/percentage/components/FirstFollowUp.vue
@@ -275,7 +275,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="人工" align="center" key="manual" @@ -299,7 +298,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="语音" align="center" key="voice" @@ -323,7 +321,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="短信" align="center" key="sms" @@ -347,7 +344,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="微信" align="center" key="weChat" @@ -586,7 +582,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="人工" align="center" key="manual" @@ -604,13 +599,7 @@ </el-button> </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="语音" align="center" key="voice" prop="voice" > <el-table-column label="语音" align="center" key="voice" prop="voice"> <template slot-scope="scope"> <el-button size="medium" @@ -623,13 +612,7 @@ </el-button> </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="短信" align="center" key="sms" prop="sms" > <el-table-column label="短信" align="center" key="sms" prop="sms"> <template slot-scope="scope"> <el-button size="medium" @@ -641,7 +624,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="微信" align="center" key="weChat" @@ -719,6 +701,7 @@ <script> import { getSfStatisticsHyperlink } from "@/api/AiCentre/index"; import store from "@/store"; import { getSfStatistics, selectTimelyRate } from "@/api/system/user"; import ExcelJS from "exceljs"; @@ -755,6 +738,7 @@ expands: [], ids: [], patientqueryParams: { pn: 1, ps: 10 }, tasktypes: store.getters.tasktypes, }; }, methods: { @@ -1197,58 +1181,138 @@ }, // 主表导出 async exportTable() { try { let dateRangeString = ""; let sheetNameSuffix = ""; try { let dateRangeString = ""; let sheetNameSuffix = ""; if ( this.queryParams.dateRange && this.queryParams.dateRange.length === 2 ) { const startDateStr = this.queryParams.dateRange[0]; const endDateStr = this.queryParams.dateRange[1]; 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; dateRangeString = `${currentMonth}月`; sheetNameSuffix = `${currentMonth}月`; } // 判断是否是丽水市中医院 const isLishuiHospital = this.orgname == "丽水市中医院"; const excelName = `首次出院随访统计表_${dateRangeString}.xlsx`; const worksheetName = `首次随访统计_${sheetNameSuffix}`; if ( this.queryParams.dateRange && this.queryParams.dateRange.length === 2 ) { const startDateStr = this.queryParams.dateRange[0]; const endDateStr = this.queryParams.dateRange[1]; if (!this.tableData || this.tableData.length === 0) { this.$message.warning("暂无首次随访数据可导出"); 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; 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 = "首次随访"; // 工作表使用的名称(简化版) 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 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) { @@ -1769,7 +1833,6 @@ this.patientqueryParams.serviceTypes = queryParams.serviceType ? queryParams.serviceType.join(",") : null; console.log(2); return selectTimelyRate(this.patientqueryParams); }, src/views/sfstatistics/percentage/components/SecondFollowUp.vue
@@ -253,7 +253,6 @@ prop="followUpRateAgain" /> <el-table-column v-if="orgname != '丽水市中医院'" label="人工" align="center" key="manualAgain" @@ -277,7 +276,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="语音" align="center" key="voiceAgain" @@ -301,7 +299,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="短信" align="center" key="smsAgain" @@ -325,7 +322,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="微信" align="center" key="weChatAgain" @@ -552,7 +548,6 @@ prop="followUpRateAgain" /> <el-table-column v-if="orgname != '丽水市中医院'" label="人工" align="center" key="manualAgain" @@ -575,7 +570,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="语音" align="center" key="voiceAgain" @@ -594,7 +588,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="短信" align="center" key="smsAgain" @@ -617,7 +610,6 @@ </template> </el-table-column> <el-table-column v-if="orgname != '丽水市中医院'" label="微信" align="center" key="weChatAgain" @@ -649,6 +641,7 @@ import { getSfStatistics } from "@/api/system/user"; import ExcelJS from "exceljs"; import { saveAs } from "file-saver"; import store from "@/store"; export default { name: "SecondFollowUp", @@ -680,6 +673,7 @@ loading: false, expands: [], ids: [], tasktypes: store.getters.tasktypes, }; }, methods: { @@ -1113,58 +1107,143 @@ return rate.toFixed(2) + "%"; }, async exportTable() { try { let dateRangeString = ""; let sheetNameSuffix = ""; try { let dateRangeString = ""; let sheetNameSuffix = ""; if ( this.queryParams.dateRange && this.queryParams.dateRange.length === 2 ) { const startDateStr = this.queryParams.dateRange[0]; const endDateStr = this.queryParams.dateRange[1]; 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; dateRangeString = `${currentMonth}月`; sheetNameSuffix = `${currentMonth}月`; } // 判断是否是丽水市中医院 const isLishuiHospital = this.orgname == "丽水市中医院"; const excelName = `再次出院随访统计表_${dateRangeString}.xlsx`; const worksheetName = `再次随访统计_${sheetNameSuffix}`; if ( this.queryParams.dateRange && this.queryParams.dateRange.length === 2 ) { const startDateStr = this.queryParams.dateRange[0]; const endDateStr = this.queryParams.dateRange[1]; if (!this.tableData || this.tableData.length === 0) { this.$message.warning("暂无再次随访数据可导出"); 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; 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 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 { src/views/sfstatistics/percentage/index.vue
@@ -75,10 +75,12 @@ v-model="queryParams.dateRange" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" :picker-options="pickerOptions" /> </el-form-item> @@ -222,10 +224,41 @@ options: this.$store.getters.tasktypes, queryParams: { serviceType: [2], dateRange: [], dateRange: this.getLastMonthRange(), statisticaltype: 1, leavehospitaldistrictcodes: ["all"], deptcodes: [], }, pickerOptions: { shortcuts: [ { text: "最近一周", onClick(picker) { const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); picker.$emit("pick", [start, end]); }, }, { text: "最近一个月", onClick(picker) { const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); picker.$emit("pick", [start, end]); }, }, { text: "最近三个月", onClick(picker) { const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); picker.$emit("pick", [start, end]); }, }, ], }, flatArrayhospit: [], flatArraydept: [], @@ -281,7 +314,29 @@ this.flatArraydept.push({ label: "全部", value: "all" }); this.flatArrayhospit.push({ label: "全部", value: "all" }); }, // 添加获取最近一个月时间范围的方法 getLastMonthRange() { const end = new Date(); const start = new Date(); start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); // 格式化为 yyyy-MM-dd HH:mm:ss const formatDate = (date) => { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); const day = String(date.getDate()).padStart(2, "0"); return `${year}-${month}-${day} 00:00:00`; }; const formatEndDate = (date) => { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); const day = String(date.getDate()).padStart(2, "0"); return `${year}-${month}-${day} 23:59:59`; }; return [formatDate(start), formatEndDate(end)]; }, handleTabClick(tab) { this.activeTab = tab.name; this.loadCurrentTabData();