liusheng
2026-10-30 d725dc65cf7f74df3aa3f5a0297fd6f8b767cdbc
src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
@@ -401,8 +401,8 @@
  data() {
    return {
      // 满意度类型:leave=离院满意度(按出院病区统计),hospital=在院满意度(按在院病区统计)
      // 默认在院满意度
      satisfactionScope: "hospital",
      // 默认离院满意度
      satisfactionScope: "leave",
      // 查询参数
      queryParams: {
@@ -432,7 +432,7 @@
      options: [
        {
          value: 6,
          label: "住院满意度",
          label: "出入院满意度",
          raw: {
            cssClass: "",
            listClass: "",
@@ -539,8 +539,11 @@
    // 获取科室树
    getDeptTree() {
      // 获取服务类型
      this.options = this.$store.getters.tasktypes || [];
      // 获取服务类型(字典里的「住院满意度」在本页显示为「出入院满意度」)
      const labelFix = { 住院满意度: "出入院满意度" };
      this.options = (this.$store.getters.tasktypes || []).map((o) =>
        labelFix[o.label] ? { ...o, label: labelFix[o.label] } : o
      );
      // 获取科室列表
      this.flatArraydept = (this.$store.getters.belongDepts || []).map(
@@ -854,9 +857,9 @@
      this.getList();
    },
    // 重置查询(恢复默认:在院满意度 + 服务类型 6)
    // 重置查询(恢复默认:离院满意度 + 服务类型 6)
    resetQuery() {
      this.satisfactionScope = "hospital";
      this.satisfactionScope = "leave";
      this.queryParams = {
        statisticaltype: 1,
        leavehospitaldistrictcodes: [],
@@ -1087,15 +1090,9 @@
          },
        };
        // 添加总标题(两列维度 + 八个指标列,共 10 列)
        worksheet.mergeCells(1, 1, 1, 10);
        const titleCell = worksheet.getCell(1, 1);
        titleCell.value = `满意度随访统计表(${sheetNameSuffix})`;
        titleCell.style = titleStyle;
        worksheet.getRow(1).height = 35;
        // 添加表头(科室统计导出在院科室+离院科室,病区统计导出在院病区+离院病区)
        // 表头按页面列动态生成:科室/病区统计列不同,「及时率」只有景宁院区页面才显示
        const isWardStatistics = this.queryParams.statisticaltype == 1;
        const showTimelyRate = this.orgname === "景宁畲族自治县人民医院";
        const headers = [
          isWardStatistics ? "在院病区" : "在院科室",
          isWardStatistics ? "离院病区" : "离院科室",
@@ -1103,11 +1100,19 @@
          "无需随访人次",
          "应随访人次",
          "随访率",
          "及时率",
          "满意度题目总量",
          "满意度填报量",
          "完成比率",
        ];
        if (showTimelyRate) {
          headers.push("及时率");
        }
        headers.push("满意度题目总量", "满意度填报量", "完成比率");
        const colCount = headers.length;
        // 添加总标题
        worksheet.mergeCells(1, 1, 1, colCount);
        const titleCell = worksheet.getCell(1, 1);
        titleCell.value = `满意度随访统计表(${sheetNameSuffix})`;
        titleCell.style = titleStyle;
        worksheet.getRow(1).height = 35;
        const headerRow = worksheet.addRow(headers);
        headerRow.eachCell((cell) => {
@@ -1115,9 +1120,13 @@
        });
        headerRow.height = 25;
        // 添加数据行
        // 添加数据行(空值统一显示“-”,与页面保持一致)
        const dash = (v, formatter) => {
          if (v === null || v === undefined || v === "") return "-";
          return formatter ? formatter(v) : v;
        };
        this.userList.forEach((item) => {
          const dataRow = worksheet.addRow([
          const rowData = [
            isWardStatistics
              ? item.hospitaldistrictname || "-"
              : item.hospitaldeptname || "-",
@@ -1127,12 +1136,17 @@
            item.dischargeCount || 0,
            item.nonFollowUp || 0,
            item.followUpNeeded || 0,
            item.followUpRate || "0%",
            item.rate ? this.formatPercent(item.rate) : "0%",
            dash(item.followUpRate),
          ];
          if (showTimelyRate) {
            rowData.push(dash(item.rate, (v) => this.formatPercent(v)));
          }
          rowData.push(
            item.joyAllCount || 0,
            item.joyCount || 0,
            item.joyTotal ? this.formatPercent(item.joyTotal) : "0%",
          ]);
            dash(item.joyTotal, (v) => this.formatPercent(v))
          );
          const dataRow = worksheet.addRow(rowData);
          dataRow.eachCell((cell) => {
            cell.style = cellStyle;
@@ -1140,19 +1154,10 @@
          dataRow.height = 22;
        });
        // 设置列宽
        worksheet.columns = [
          { width: 20 },
          { width: 20 },
          { width: 12 },
          { width: 12 },
          { width: 12 },
          { width: 12 },
          { width: 12 },
          { width: 15 },
          { width: 15 },
          { width: 12 },
        ];
        // 设置列宽(跟列数一致)
        worksheet.columns = headers.map((h, i) => ({
          width: i < 2 ? 20 : h.length > 6 ? 15 : 12,
        }));
        // 生成并下载文件
        const buffer = await workbook.xlsx.writeBuffer();