From a90765e9ee65717c6ba9923a90b3fc21c03753c1 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 18 十一月 2026 15:29:51 +0800
Subject: [PATCH] 测试完成

---
 src/views/sfstatistics/percentage/components/FirstFollowUp.vue |  391 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 328 insertions(+), 63 deletions(-)

diff --git a/src/views/sfstatistics/percentage/components/FirstFollowUp.vue b/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
index 1e2b17e..18b247a 100644
--- a/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
+++ b/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
@@ -454,6 +454,7 @@
           :show-overflow-tooltip="true"
         />
         <el-table-column
+          v-if="!isTongdeOrg"
           label="鍑洪櫌浜烘"
           align="center"
           key="dischargeCount"
@@ -475,7 +476,60 @@
             </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',
+                    '鍑洪櫌鎮h�呭垪琛�-鏅��'
+                  )
+                "
+              >
+                <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',
+                    '鍑洪櫌鎮h�呭垪琛�-鏃ラ棿'
+                  )
+                "
+              >
+                <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"
@@ -494,7 +548,58 @@
             </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"
@@ -512,6 +617,58 @@
               <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="棣栨鍑洪櫌闅忚">
@@ -2095,15 +2252,48 @@
       };
       // 鏄惁涓虹洰鏍囧尰闄紙浜哄伐/璇煶/鐭俊/寰俊 鎸� 鍙戦�佹暟/鎴愬姛鏁� 鍒嗙骇灞曠ず锛�
       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
         ? [
             "闇�闅忚",
@@ -2122,18 +2312,19 @@
             "鎴愬姛鐜�",
             "闅忚鐜�",
             "鍙婃椂鐜�",
+            ...(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}`;
       // 娣诲姞鏍囬琛�
@@ -2148,12 +2339,20 @@
         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;
@@ -2218,12 +2417,35 @@
         // 琛ㄥご鍗� 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;
@@ -2253,9 +2475,7 @@
           "",
           item.leavehospitaldistrictname || "",
           item.deptname || "",
-          item.dischargeCount || 0,
-          item.nonFollowUp || 0,
-          item.followUpNeeded || 0,
+          ...baseFields.map((field) => item[field] || 0),
           item.needFollowUp || 0,
           // 寰呴殢璁匡細鐩爣鍖婚櫌鎷嗕负寰呭彂閫�/宸插彂閫侊紝鍏朵粬鐢ㄥ緟闅忚
           ...(this.isTargetHospital
@@ -2272,6 +2492,7 @@
           ),
           item.followUpRate || "0%", // 闅忚鐜�
           this.getTimelyRateText(item), // 鍙婃椂鐜�
+          ...(showTimelyFollowUp ? [item.timelyFollowUp || 0] : []), // 鍙婃椂闅忚浜烘
         ];
         methodGroups.forEach((g) => {
           g.fields.forEach((field) => {
@@ -2298,7 +2519,14 @@
       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));
       });
@@ -2339,42 +2567,69 @@
     },
 
     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;
@@ -2382,17 +2637,16 @@
       });
 
       // 鎴愬姛鐜囪绠楋細闅忚鎴愬姛 / 闇�闅忚锛堢洰鏍囧尰闄級锛屽惁鍒� 闅忚鎴愬姛 / (闇�闅忚-寰呴殢璁�)
-      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%";
       }
 
       // 闅忚鐜囪绠�
@@ -2404,16 +2658,19 @@
         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))
@@ -2422,14 +2679,22 @@
         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]);
       });

--
Gitblit v1.9.3