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

---
 src/views/sfstatistics/percentage/components/FirstFollowUp.vue |  848 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 592 insertions(+), 256 deletions(-)

diff --git a/src/views/sfstatistics/percentage/components/FirstFollowUp.vue b/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
index adabf9f..ff4f3c8 100644
--- a/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
+++ b/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
@@ -156,6 +156,7 @@
                   </template>
                 </el-table-column>
                 <el-table-column
+                  v-if="!isTargetHospital"
                   label="寰呴殢璁�"
                   align="center"
                   key="pendingFollowUp"
@@ -179,6 +180,62 @@
                       }}</span>
                     </el-button>
                   </template>
+                </el-table-column>
+                <el-table-column
+                  v-if="isTargetHospital"
+                  label="寰呴殢璁�"
+                  align="center"
+                >
+                  <el-table-column
+                    label="寰呭彂閫�"
+                    align="center"
+                    key="pendingFollowUpWaitSend"
+                    prop="pendingFollowUpWaitSend"
+                  >
+                    <template slot-scope="scope">
+                      <el-button
+                        size="medium"
+                        type="text"
+                        @click="
+                          handleViewDetails(
+                            scope.row,
+                            'pendingFollowUpWaitSendInfo',
+                            '寰呭彂閫佸垪琛�',
+                            '1'
+                          )
+                        "
+                      >
+                        <span class="button-zx">{{
+                          scope.row.pendingFollowUpWaitSend
+                        }}</span>
+                      </el-button>
+                    </template>
+                  </el-table-column>
+                  <el-table-column
+                    label="宸插彂閫�"
+                    align="center"
+                    key="pendingFollowUpSent"
+                    prop="pendingFollowUpSent"
+                  >
+                    <template slot-scope="scope">
+                      <el-button
+                        size="medium"
+                        type="text"
+                        @click="
+                          handleViewDetails(
+                            scope.row,
+                            'pendingFollowUpSentInfo',
+                            '宸插彂閫佸垪琛�',
+                            '1'
+                          )
+                        "
+                      >
+                        <span class="button-zx">{{
+                          scope.row.pendingFollowUpSent
+                        }}</span>
+                      </el-button>
+                    </template>
+                  </el-table-column>
                 </el-table-column>
                 <el-table-column
                   label="闅忚鎴愬姛"
@@ -206,6 +263,7 @@
                   </template>
                 </el-table-column>
                 <el-table-column
+                  v-if="!isTargetHospital"
                   label="闅忚澶辫触"
                   align="center"
                   key="followUpFail"
@@ -272,9 +330,9 @@
                       type="text"
                       @click="handleSeeDetails(scope.row)"
                     >
-                      <span class="button-zx"
-                        >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span
-                      >
+                      <span class="button-zx">{{
+                        getTimelyRateText(scope.row)
+                      }}</span>
                     </el-button>
                   </template>
                 </el-table-column>
@@ -476,6 +534,7 @@
             </template>
           </el-table-column>
           <el-table-column
+            v-if="!isTargetHospital"
             label="寰呴殢璁�"
             align="center"
             key="pendingFollowUp"
@@ -496,6 +555,60 @@
                 <span class="button-zx">{{ scope.row.pendingFollowUp }}</span>
               </el-button>
             </template>
+          </el-table-column>
+          <el-table-column
+            v-if="isTargetHospital"
+            label="寰呴殢璁�"
+            align="center"
+          >
+            <el-table-column
+              label="寰呭彂閫�"
+              align="center"
+              key="pendingFollowUpWaitSend"
+              prop="pendingFollowUpWaitSend"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="medium"
+                  type="text"
+                  @click="
+                    handleViewDetails(
+                      scope.row,
+                      'pendingFollowUpWaitSendInfo',
+                      '寰呭彂閫佸垪琛�'
+                    )
+                  "
+                >
+                  <span class="button-zx">{{
+                    scope.row.pendingFollowUpWaitSend
+                  }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="宸插彂閫�"
+              align="center"
+              key="pendingFollowUpSent"
+              prop="pendingFollowUpSent"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="medium"
+                  type="text"
+                  @click="
+                    handleViewDetails(
+                      scope.row,
+                      'pendingFollowUpSentInfo',
+                      '宸插彂閫佸垪琛�'
+                    )
+                  "
+                >
+                  <span class="button-zx">{{
+                    scope.row.pendingFollowUpSent
+                  }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
           </el-table-column>
           <el-table-column
             label="闅忚鎴愬姛"
@@ -520,6 +633,7 @@
             </template>
           </el-table-column>
           <el-table-column
+            v-if="!isTargetHospital"
             label="闅忚澶辫触"
             align="center"
             key="followUpFail"
@@ -583,73 +697,39 @@
                 type="text"
                 @click="handleSeeDetails(scope.row)"
               >
-                <span class="button-zx"
-                  >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span
-                >
+                <span class="button-zx">{{
+                  getTimelyRateText(scope.row)
+                }}</span>
               </el-button>
             </template>
           </el-table-column>
           <el-table-column
-            v-if="isTargetHospital"
-            label="浜哄伐"
+            v-if="orgname == '缂欎簯鍘夸汉姘戝尰闄�'"
+            label="鍙婃椂闅忚浜烘"
             align="center"
+            key="timelyFollowUp"
+            prop="timelyFollowUp"
+            width="138"
           >
-            <el-table-column
-              label="鍙戦�佸畬鎴�"
-              align="center"
-              key="manual"
-              prop="manual"
-              :render-header="Tooltipfswc"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  size="medium"
-                  type="text"
-                  @click="
-                    handleViewDetails(
-                      scope.row,
-                      'manualInfo',
-                      '鍙戦�佸畬鎴愪汉宸ラ殢璁垮垪琛�'
-                    )
-                  "
-                >
-                  <span class="button-zx">{{ scope.row.manual }}</span>
-                </el-button>
-              </template>
-            </el-table-column>
-            <el-table-column
-              label="鏈�缁堝畬鎴�"
-              align="center"
-              key="manualSuccess"
-              prop="manualSuccess"
-              :render-header="Tooltipzzwc"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  size="medium"
-                  type="text"
-                  @click="
-                    handleViewDetails(
-                      scope.row,
-                      'manualSuccessInfo',
-                      '鏈�缁堝畬鎴愪汉宸ラ殢璁垮垪琛�'
-                    )
-                  "
-                >
-                  <span class="button-zx">{{
-                    scope.row.manualSuccess
-                  }}</span>
-                </el-button>
-              </template>
-            </el-table-column>
+            <template slot-scope="scope">
+              <el-button
+                size="medium"
+                type="text"
+                @click="
+                  handleViewDetails(
+                    scope.row,
+                    'timelyFollowUpInfo',
+                    '鍙婃椂闅忚鍒楄〃'
+                  )
+                "
+              >
+                <span class="button-zx">{{ scope.row.timelyFollowUp }}</span>
+              </el-button>
+            </template>
           </el-table-column>
-          <el-table-column
-            v-if="isTargetHospital"
-            label="璇煶"
-            align="center"
-          >
+          <el-table-column v-if="isTargetHospital" label="璇煶" align="center">
             <el-table-column
-              label="鍙戦�佸畬鎴�"
+              label="鍙戦�佹暟"
               align="center"
               key="voice"
               prop="voice"
@@ -672,7 +752,7 @@
               </template>
             </el-table-column>
             <el-table-column
-              label="鏈�缁堝畬鎴�"
+              label="鎴愬姛鏁�"
               align="center"
               key="voiceSuccess"
               prop="voiceSuccess"
@@ -690,74 +770,14 @@
                     )
                   "
                 >
-                  <span class="button-zx">{{
-                    scope.row.voiceSuccess
-                  }}</span>
+                  <span class="button-zx">{{ scope.row.voiceSuccess }}</span>
                 </el-button>
               </template>
             </el-table-column>
           </el-table-column>
-          <el-table-column
-            v-if="isTargetHospital"
-            label="鐭俊"
-            align="center"
-          >
+          <el-table-column v-if="isTargetHospital" label="寰俊" align="center">
             <el-table-column
-              label="鍙戦�佸畬鎴�"
-              align="center"
-              key="sms"
-              prop="sms"
-              :render-header="Tooltipfswc"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  size="medium"
-                  type="text"
-                  @click="
-                    handleViewDetails(
-                      scope.row,
-                      'smsInfo',
-                      '鍙戦�佸畬鎴愮煭淇¢殢璁垮垪琛�'
-                    )
-                  "
-                >
-                  <span class="button-zx">{{ scope.row.sms }}</span>
-                </el-button>
-              </template>
-            </el-table-column>
-            <el-table-column
-              label="鏈�缁堝畬鎴�"
-              align="center"
-              key="smsSuccess"
-              prop="smsSuccess"
-              :render-header="Tooltipzzwc"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  size="medium"
-                  type="text"
-                  @click="
-                    handleViewDetails(
-                      scope.row,
-                      'smsSuccessInfo',
-                      '鏈�缁堝畬鎴愮煭淇¢殢璁垮垪琛�'
-                    )
-                  "
-                >
-                  <span class="button-zx">{{
-                    scope.row.smsSuccess
-                  }}</span>
-                </el-button>
-              </template>
-            </el-table-column>
-          </el-table-column>
-          <el-table-column
-            v-if="isTargetHospital"
-            label="寰俊"
-            align="center"
-          >
-            <el-table-column
-              label="鍙戦�佸畬鎴�"
+              label="鍙戦�佹暟"
               align="center"
               key="weChat"
               prop="weChat"
@@ -780,7 +800,7 @@
               </template>
             </el-table-column>
             <el-table-column
-              label="鏈�缁堝畬鎴�"
+              label="鎴愬姛鏁�"
               align="center"
               key="weChatSuccess"
               prop="weChatSuccess"
@@ -798,13 +818,108 @@
                     )
                   "
                 >
-                  <span class="button-zx">{{
-                    scope.row.weChatSuccess
-                  }}</span>
+                  <span class="button-zx">{{ scope.row.weChatSuccess }}</span>
                 </el-button>
               </template>
             </el-table-column>
           </el-table-column>
+          <el-table-column v-if="isTargetHospital" label="鐭俊" align="center">
+            <el-table-column
+              label="鍙戦�佹暟"
+              align="center"
+              key="sms"
+              prop="sms"
+              :render-header="Tooltipfswc"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="medium"
+                  type="text"
+                  @click="
+                    handleViewDetails(
+                      scope.row,
+                      'smsInfo',
+                      '鍙戦�佸畬鎴愮煭淇¢殢璁垮垪琛�'
+                    )
+                  "
+                >
+                  <span class="button-zx">{{ scope.row.sms }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="鎴愬姛鏁�"
+              align="center"
+              key="smsSuccess"
+              prop="smsSuccess"
+              :render-header="Tooltipzzwc"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="medium"
+                  type="text"
+                  @click="
+                    handleViewDetails(
+                      scope.row,
+                      'smsSuccessInfo',
+                      '鏈�缁堝畬鎴愮煭淇¢殢璁垮垪琛�'
+                    )
+                  "
+                >
+                  <span class="button-zx">{{ scope.row.smsSuccess }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <el-table-column v-if="isTargetHospital" label="浜哄伐" align="center">
+            <el-table-column
+              label="鍙戦�佹暟"
+              align="center"
+              key="manual"
+              prop="manual"
+              :render-header="Tooltipfswc"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="medium"
+                  type="text"
+                  @click="
+                    handleViewDetails(
+                      scope.row,
+                      'manualInfo',
+                      '鍙戦�佸畬鎴愪汉宸ラ殢璁垮垪琛�'
+                    )
+                  "
+                >
+                  <span class="button-zx">{{ scope.row.manual }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="鎴愬姛鏁�"
+              align="center"
+              key="manualSuccess"
+              prop="manualSuccess"
+              :render-header="Tooltipzzwc"
+            >
+              <template slot-scope="scope">
+                <el-button
+                  size="medium"
+                  type="text"
+                  @click="
+                    handleViewDetails(
+                      scope.row,
+                      'manualSuccessInfo',
+                      '鏈�缁堝畬鎴愪汉宸ラ殢璁垮垪琛�'
+                    )
+                  "
+                >
+                  <span class="button-zx">{{ scope.row.manualSuccess }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table-column>
+
           <el-table-column
             v-if="!isTargetHospital"
             label="浜哄伐"
@@ -881,11 +996,9 @@
           </el-table-column>
         </el-table-column>
 
-        <!-- 闅忚鎯呭喌鍒楋紙浠呬附姘村競涓尰闄㈡樉绀猴級 -->
+        <!-- 闅忚鎯呭喌鍒楋紙涓芥按甯備腑鍖婚櫌宸茬Щ鍒扮患鍚堢粺璁★紝姝ゅ浠呮櫙瀹佺暡鏃忚嚜娌诲幙浜烘皯鍖婚櫌鏄剧ず锛� -->
         <el-table-column
-          v-if="
-            orgname == '涓芥按甯備腑鍖婚櫌' || orgname == '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'
-          "
+          v-if="orgname == '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'"
           align="center"
           label="闅忚鎯呭喌"
         >
@@ -1090,8 +1203,8 @@
       const need = Number(needFollowUp) || 0;
       const pending = Number(pendingFollowUp) || 0;
 
-      // 鍒嗘瘝 = 闇�闅忚 - 寰呴殢璁�
-      const denominator = need - pending;
+      // 鐩爣鍖婚櫌锛氭垚鍔熺巼 = 闅忚鎴愬姛 / 闇�闅忚锛涘叾浠栵細闅忚鎴愬姛 / (闇�闅忚 - 寰呴殢璁�)
+      const denominator = this.isTargetHospital ? need : need - pending;
 
       if (denominator <= 0) {
         return "0.00%";
@@ -1099,6 +1212,26 @@
 
       const rate = (success / denominator) * 100;
       return rate.toFixed(2) + "%";
+    },
+    // 璁$畻鍙婃椂鐜囷紙鐩爣鍖婚櫌锛夛細(闇�闅忚 - 浜哄伐瑙勫畾鏃堕棿鍐呮病鎵撹繃鐢佃瘽) / 闇�闅忚
+    calculateTimelyRate(needFollowUp, manualCallTimeout) {
+      const need = Number(needFollowUp) || 0;
+      const timeout = Number(manualCallTimeout) || 0;
+      if (need <= 0) {
+        return "0.00%";
+      }
+      const rate = ((need - timeout) / need) * 100;
+      return (rate < 0 ? 0 : rate).toFixed(2) + "%";
+    },
+    // 鍙婃椂鐜囧睍绀烘枃妗堬細鐩爣鍖婚櫌鍓嶇璁$畻锛屽叾浠栫敤鍚庣 rate 瀛楁
+    getTimelyRateText(row) {
+      if (this.isTargetHospital) {
+        return this.calculateTimelyRate(
+          row.needFollowUp,
+          row.manualCallTimeout
+        );
+      }
+      return (Number(row.rate) * 100).toFixed(2) + "%";
     },
     // 鍦ㄧ粺璁℃眹鎬绘柟娉曚腑澶勭悊鎴愬姛鐜�
     getSummaries(param) {
@@ -1129,17 +1262,51 @@
             return sum + (Number(item.pendingFollowUp) || 0);
           }, 0);
 
-          const denominator = totalNeed - totalPending;
+          const denominator = this.isTargetHospital
+            ? totalNeed
+            : totalNeed - totalPending;
 
           if (denominator > 0) {
             sums[index] = ((totalSuccess / denominator) * 100).toFixed(2) + "%";
           } else {
             sums[index] = "0.00%";
           }
-        } else if (
-          column.property === "followUpRate" ||
-          column.property === "rate"
-        ) {
+        } else if (column.property === "rate") {
+          if (this.isTargetHospital) {
+            const totalNeed = data.reduce(
+              (sum, item) => sum + (Number(item.needFollowUp) || 0),
+              0
+            );
+            const totalTimeout = data.reduce(
+              (sum, item) => sum + (Number(item.manualCallTimeout) || 0),
+              0
+            );
+            sums[index] = this.calculateTimelyRate(totalNeed, totalTimeout);
+          } else {
+            const percentageValues = data
+              .map((item) => {
+                const value = item[column.property];
+                if (!value || value === "-" || value === "0%") return null;
+                if (typeof value === "string" && value.includes("%")) {
+                  const numValue = parseFloat(value.replace("%", "")) / 100;
+                  return isNaN(numValue) ? null : numValue;
+                } else {
+                  const numValue = parseFloat(value);
+                  return isNaN(numValue) ? null : numValue;
+                }
+              })
+              .filter((value) => value !== null && value !== 0);
+
+            if (percentageValues.length > 0) {
+              const average =
+                percentageValues.reduce((sum, value) => sum + value, 0) /
+                percentageValues.length;
+              sums[index] = (average * 100).toFixed(2) + "%";
+            } else {
+              sums[index] = "0.00%";
+            }
+          }
+        } else if (column.property === "followUpRate") {
           const percentageValues = data
             .map((item) => {
               const value = item[column.property];
@@ -1185,7 +1352,9 @@
         "el-tooltip",
         {
           props: {
-            content: "闅忚鎴愬姛/(闇�闅忚-寰呴殢璁�)",
+            content: this.isTargetHospital
+              ? "闅忚鎴愬姛/闇�闅忚"
+              : "闅忚鎴愬姛/(闇�闅忚-寰呴殢璁�)",
             placement: "top",
             effect: "dark",
           },
@@ -1198,8 +1367,9 @@
         "el-tooltip",
         {
           props: {
-            content:
-              "(鍑洪櫌鏃堕棿+浠诲姟鍛ㄦ湡)灏忎簬瀹屾垚鏃堕棿鍗充负瓒呮椂;(闇�闅忚-瓒呮椂)/闇�闅忚",
+            content: this.isTargetHospital
+              ? "鍙婃椂鐜�=(闇�闅忚-浜哄伐瑙勫畾鏃堕棿鍐呮病鎵撹繃鐢佃瘽)/闇�闅忚"
+              : "(鍑洪櫌鏃堕棿+浠诲姟鍛ㄦ湡)灏忎簬瀹屾垚鏃堕棿鍗充负瓒呮椂;(闇�闅忚-瓒呮椂)/闇�闅忚",
             placement: "top",
             effect: "dark",
           },
@@ -1275,17 +1445,51 @@
             return sum + (Number(item.pendingFollowUp) || 0);
           }, 0);
 
-          const denominator = totalNeed - totalPending;
+          const denominator = this.isTargetHospital
+            ? totalNeed
+            : totalNeed - totalPending;
 
           if (denominator > 0) {
             sums[index] = ((totalSuccess / denominator) * 100).toFixed(2) + "%";
           } else {
             sums[index] = "0.00%";
           }
-        } else if (
-          column.property === "followUpRate" ||
-          column.property === "rate"
-        ) {
+        } else if (column.property === "rate") {
+          if (this.isTargetHospital) {
+            const totalNeed = data.reduce(
+              (sum, item) => sum + (Number(item.needFollowUp) || 0),
+              0
+            );
+            const totalTimeout = data.reduce(
+              (sum, item) => sum + (Number(item.manualCallTimeout) || 0),
+              0
+            );
+            sums[index] = this.calculateTimelyRate(totalNeed, totalTimeout);
+          } else {
+            const percentageValues = data
+              .map((item) => {
+                const value = item[column.property];
+                if (!value || value === "-" || value === "0%") return null;
+                if (typeof value === "string" && value.includes("%")) {
+                  const numValue = parseFloat(value.replace("%", "")) / 100;
+                  return isNaN(numValue) ? null : numValue;
+                } else {
+                  const numValue = parseFloat(value);
+                  return isNaN(numValue) ? null : numValue;
+                }
+              })
+              .filter((value) => value !== null && value !== 0);
+
+            if (percentageValues.length > 0) {
+              const average =
+                percentageValues.reduce((sum, value) => sum + value, 0) /
+                percentageValues.length;
+              sums[index] = (average * 100).toFixed(2) + "%";
+            } else {
+              sums[index] = "0.00%";
+            }
+          }
+        } else if (column.property === "followUpRate") {
           const percentageValues = data
             .map((item) => {
               const value = item[column.property];
@@ -1629,13 +1833,12 @@
         },
       };
 
-      // 鏍囬
-      worksheet.mergeCells(1, 1, 1, 10);
-      worksheet.getCell(1, 1).value = `${areaName}鍖荤敓闅忚鍒楄〃`;
-      worksheet.getCell(1, 1).style = titleStyle;
-      worksheet.getRow(1).height = 30;
+      const graded = this.isTargetHospital;
+      // 鎴愬姛鐜囷細鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄笉灞曠ず锛涘強鏃剁巼锛氫附姘村競涓尰闄笉灞曠ず
+      const showSuccessRate = this.orgname != "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�";
+      const showTimelyRate = this.orgname != "涓芥按甯備腑鍖婚櫌";
 
-      // 琛ㄥご
+      // 鍒楀畾涔夛紙涓庡睍寮�鐨勫尰鐢熷瓙琛ㄤ繚鎸佷竴鑷达級
       const headers = [
         "鍖荤敓濮撳悕",
         "绉戝",
@@ -1643,13 +1846,26 @@
         "鏃犻渶闅忚",
         "搴旈殢璁�",
         "闇�闅忚",
-        "寰呴殢璁�",
+        ...(graded ? ["寰呭彂閫�", "宸插彂閫�"] : ["寰呴殢璁�"]),
         "闅忚鎴愬姛",
-        "闅忚澶辫触",
-        "鎴愬姛鐜�", // 鏂板
-        "闅忚鐜�", // 鍘熸潵鍦ㄦ垚鍔熺巼浣嶇疆
+        ...(graded ? [] : ["闅忚澶辫触"]),
+        ...(showSuccessRate ? ["鎴愬姛鐜�"] : []),
+        "闅忚鐜�",
+        ...(showTimelyRate ? ["鍙婃椂鐜�"] : []),
+        "浜哄伐",
+        "璇煶",
+        "鐭俊",
+        "寰俊",
       ];
+      const totalCols = headers.length;
 
+      // 鏍囬
+      worksheet.mergeCells(1, 1, 1, totalCols);
+      worksheet.getCell(1, 1).value = `${areaName}鍖荤敓闅忚鍒楄〃`;
+      worksheet.getCell(1, 1).style = titleStyle;
+      worksheet.getRow(1).height = 30;
+
+      // 琛ㄥご
       const headerRow = worksheet.addRow(headers);
       headerRow.eachCell((cell) => {
         cell.style = headerStyle;
@@ -1665,15 +1881,26 @@
           item.nonFollowUp,
           item.followUpNeeded,
           item.needFollowUp,
-          item.pendingFollowUp,
+          ...(graded
+            ? [item.pendingFollowUpWaitSend || 0, item.pendingFollowUpSent || 0]
+            : [item.pendingFollowUp || 0]),
           item.followUpSuccess,
-          item.followUpFail,
-          this.calculateSuccessRate(
-            item.followUpSuccess,
-            item.needFollowUp,
-            item.pendingFollowUp
-          ),
+          ...(graded ? [] : [item.followUpFail || 0]),
+          ...(showSuccessRate
+            ? [
+                this.calculateSuccessRate(
+                  item.followUpSuccess,
+                  item.needFollowUp,
+                  item.pendingFollowUp
+                ),
+              ]
+            : []),
           item.followUpRate,
+          ...(showTimelyRate ? [this.getTimelyRateText(item)] : []),
+          item.manual || 0,
+          item.voice || 0,
+          item.sms || 0,
+          item.weChat || 0,
         ]);
         row.eachCell((cell) => {
           cell.style = cellStyle;
@@ -1691,58 +1918,66 @@
         };
       });
 
-      // 鍒楀
-      worksheet.columns = [
-        { width: 15 },
-        { width: 15 },
-        { width: 12 },
-        { width: 12 },
-        { width: 12 },
-        { width: 12 },
-        { width: 12 },
-        { width: 12 },
-        { width: 12 },
-        { width: 12 }, // 鎴愬姛鐜�
-        { width: 12 }, // 闅忚鐜�
-      ];
+      // 鍒楀锛堝墠涓ゅ垪濮撳悕/绉戝杈冨锛屽叾浣欑粺涓�锛�
+      const widths = [15, 15];
+      headers.slice(2).forEach(() => widths.push(12));
+      worksheet.columns = widths.map((width) => ({ width }));
     },
     getDoctorExportSummary(data) {
-      const sums = ["灏忚"];
+      const graded = this.isTargetHospital;
+      const showSuccessRate = this.orgname != "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�";
+      const showTimelyRate = this.orgname != "涓芥按甯備腑鍖婚櫌";
 
-      const keys = [
-        "dischargeCount",
-        "nonFollowUp",
-        "followUpNeeded",
-        "needFollowUp",
-        "pendingFollowUp",
-        "followUpSuccess",
-        "followUpFail",
-      ];
+      const sums = ["灏忚", "-"];
+
+      // 鏁板�煎垪姹傚拰
+      const keys = graded
+        ? [
+            "dischargeCount",
+            "nonFollowUp",
+            "followUpNeeded",
+            "needFollowUp",
+            "pendingFollowUpWaitSend",
+            "pendingFollowUpSent",
+            "followUpSuccess",
+          ]
+        : [
+            "dischargeCount",
+            "nonFollowUp",
+            "followUpNeeded",
+            "needFollowUp",
+            "pendingFollowUp",
+            "followUpSuccess",
+            "followUpFail",
+          ];
 
       keys.forEach((key) => {
         sums.push(data.reduce((t, r) => t + (Number(r[key]) || 0), 0));
       });
 
       // 鎴愬姛鐜囷紙骞冲潎鍊硷級
-      const successRates = data
-        .map((item) => {
-          const success = Number(item.followUpSuccess) || 0;
-          const need = Number(item.needFollowUp) || 0;
-          const pending = Number(item.pendingFollowUp) || 0;
-          const denominator = need - pending;
-          if (denominator <= 0) return 0;
-          return success / denominator;
-        })
-        .filter((rate) => !isNaN(rate));
+      if (showSuccessRate) {
+        const successRates = data
+          .map((item) => {
+            const success = Number(item.followUpSuccess) || 0;
+            const need = Number(item.needFollowUp) || 0;
+            const pending = Number(item.pendingFollowUp) || 0;
+            const denominator = graded ? need : need - pending;
+            if (denominator <= 0) return 0;
+            return success / denominator;
+          })
+          .filter((rate) => !isNaN(rate));
 
-      sums.push(
-        successRates.length
-          ? (
-              (successRates.reduce((a, b) => a + b, 0) / successRates.length) *
-              100
-            ).toFixed(2) + "%"
-          : "0.00%"
-      );
+        sums.push(
+          successRates.length
+            ? (
+                (successRates.reduce((a, b) => a + b, 0) /
+                  successRates.length) *
+                100
+              ).toFixed(2) + "%"
+            : "0.00%"
+        );
+      }
 
       // 闅忚鐜囷紙骞冲潎鍊硷級
       const followUpRates = data
@@ -1758,6 +1993,38 @@
             ).toFixed(2) + "%"
           : "0.00%"
       );
+
+      // 鍙婃椂鐜囷紙鐩爣鍖婚櫌璁$畻锛屽叾浠栧彇 rate 骞冲潎锛�
+      if (showTimelyRate) {
+        if (graded) {
+          const totalNeed = data.reduce(
+            (s, r) => s + (Number(r.needFollowUp) || 0),
+            0
+          );
+          const totalTimeout = data.reduce(
+            (s, r) => s + (Number(r.manualCallTimeout) || 0),
+            0
+          );
+          sums.push(this.calculateTimelyRate(totalNeed, totalTimeout));
+        } else {
+          const rateValues = data
+            .map((i) => this.extractPercentageValue(i.rate))
+            .filter(Boolean);
+          sums.push(
+            rateValues.length
+              ? (
+                  (rateValues.reduce((a, b) => a + b, 0) / rateValues.length) *
+                  100
+                ).toFixed(2) + "%"
+              : "0.00%"
+          );
+        }
+      }
+
+      // 浜哄伐/璇煶/鐭俊/寰俊
+      ["manual", "voice", "sms", "weChat"].forEach((key) => {
+        sums.push(data.reduce((t, r) => t + (Number(r[key]) || 0), 0));
+      });
 
       return sums;
     },
@@ -1835,7 +2102,7 @@
           right: { style: "thin", color: { argb: "FFD0D0D0" } },
         },
       };
-      // 鏄惁涓虹洰鏍囧尰闄紙浜哄伐/璇煶/鐭俊/寰俊 鎸� 鍙戦�佸畬鎴�/鏈�缁堝畬鎴� 鍒嗙骇灞曠ず锛�
+      // 鏄惁涓虹洰鏍囧尰闄紙浜哄伐/璇煶/鐭俊/寰俊 鎸� 鍙戦�佹暟/鎴愬姛鏁� 鍒嗙骇灞曠ず锛�
       const graded = this.isTargetHospital;
 
       const baseHeaders = [
@@ -1846,15 +2113,25 @@
         "鏃犻渶闅忚浜烘",
         "搴旈殢璁夸汉娆�",
       ];
-      const coreHeaders = [
-        "闇�闅忚",
-        "寰呴殢璁�",
-        "闅忚鎴愬姛",
-        "闅忚澶辫触",
-        "鎴愬姛鐜�",
-        "闅忚鐜�",
-        "鍙婃椂鐜�",
-      ];
+      const coreHeaders = this.isTargetHospital
+        ? [
+            "闇�闅忚",
+            "寰呭彂閫�",
+            "宸插彂閫�",
+            "闅忚鎴愬姛",
+            "鎴愬姛鐜�",
+            "闅忚鐜�",
+            "鍙婃椂鐜�",
+          ]
+        : [
+            "闇�闅忚",
+            "寰呴殢璁�",
+            "闅忚鎴愬姛",
+            "闅忚澶辫触",
+            "鎴愬姛鐜�",
+            "闅忚鐜�",
+            "鍙婃椂鐜�",
+          ];
       const methodGroups = this.getMethodColumns();
 
       const baseCount = baseHeaders.length; // 6
@@ -1890,14 +2167,37 @@
         worksheet.getCell(2, coreStartCol).value = serviceTypeName;
         worksheet.getCell(2, coreStartCol).style = headerStyle;
 
-        // 绗�3琛岋細闅忚鏍稿績鍒楃旱鍚戝悎骞� + 闅忚鏂瑰紡鍒嗙粍妯悜鍚堝苟
-        for (let k = 0; k < coreCount; k++) {
-          const col = coreStartCol + k;
+        // 绗�3琛岋細闅忚鏍稿績鍒楋紙鐩爣鍖婚櫌鈥滃緟闅忚鈥濅笅宓屽鈥滃緟鍙戦��/宸插彂閫佲�濓級
+        worksheet.mergeCells(3, coreStartCol, headerEndRow, coreStartCol);
+        worksheet.getCell(3, coreStartCol).value = "闇�闅忚";
+        worksheet.getCell(3, coreStartCol).style = headerStyle;
+
+        worksheet.mergeCells(3, coreStartCol + 1, 3, coreStartCol + 2);
+        worksheet.getCell(3, coreStartCol + 1).value = "寰呴殢璁�";
+        worksheet.getCell(3, coreStartCol + 1).style = headerStyle;
+
+        worksheet.mergeCells(
+          3,
+          coreStartCol + 3,
+          headerEndRow,
+          coreStartCol + 3
+        );
+        worksheet.getCell(3, coreStartCol + 3).value = "闅忚鎴愬姛";
+        worksheet.getCell(3, coreStartCol + 3).style = headerStyle;
+
+        ["鎴愬姛鐜�", "闅忚鐜�", "鍙婃椂鐜�"].forEach((label, i) => {
+          const col = coreStartCol + 4 + i;
           worksheet.mergeCells(3, col, headerEndRow, col);
-          const cell = worksheet.getCell(3, col);
-          cell.value = coreHeaders[k];
-          cell.style = headerStyle;
-        }
+          worksheet.getCell(3, col).value = label;
+          worksheet.getCell(3, col).style = headerStyle;
+        });
+
+        // 绗�4琛岋細寰呭彂閫�/宸插彂閫� 瀛愬垪
+        worksheet.getCell(4, coreStartCol + 1).value = "寰呭彂閫�";
+        worksheet.getCell(4, coreStartCol + 1).style = headerStyle;
+        worksheet.getCell(4, coreStartCol + 2).value = "宸插彂閫�";
+        worksheet.getCell(4, coreStartCol + 2).style = headerStyle;
+
         let mc = methodStartCol;
         methodGroups.forEach((g) => {
           if (g.fields.length > 1) {
@@ -1909,7 +2209,7 @@
           mc += g.fields.length;
         });
 
-        // 绗�4琛岋細闅忚鏂瑰紡瀛愬垪锛堝彂閫佸畬鎴�/鏈�缁堝畬鎴愶級
+        // 绗�4琛岋細闅忚鏂瑰紡瀛愬垪锛堝彂閫佹暟/鎴愬姛鏁帮級
         mc = methodStartCol;
         methodGroups.forEach((g) => {
           g.fields.forEach((field, idx) => {
@@ -1966,9 +2266,13 @@
           item.nonFollowUp || 0,
           item.followUpNeeded || 0,
           item.needFollowUp || 0,
-          item.pendingFollowUp || 0,
+          // 寰呴殢璁匡細鐩爣鍖婚櫌鎷嗕负寰呭彂閫�/宸插彂閫侊紝鍏朵粬鐢ㄥ緟闅忚
+          ...(this.isTargetHospital
+            ? [item.pendingFollowUpWaitSend || 0, item.pendingFollowUpSent || 0]
+            : [item.pendingFollowUp || 0]),
           item.followUpSuccess || 0,
-          item.followUpFail || 0,
+          // 闅忚澶辫触锛氱洰鏍囧尰闄笉鏄剧ず
+          ...(this.isTargetHospital ? [] : [item.followUpFail || 0]),
           // 鎴愬姛鐜� - 闇�瑕佸姩鎬佽绠�
           this.calculateSuccessRate(
             item.followUpSuccess,
@@ -1976,7 +2280,7 @@
             item.pendingFollowUp
           ),
           item.followUpRate || "0%", // 闅忚鐜�
-          item.rate ? (Number(item.rate) * 100).toFixed(2) + "%" : "0%", // 鍙婃椂鐜�
+          this.getTimelyRateText(item), // 鍙婃椂鐜�
         ];
         methodGroups.forEach((g) => {
           g.fields.forEach((field) => {
@@ -2010,13 +2314,29 @@
       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: ["鍙戦�佸畬鎴�", "鏈�缁堝畬鎴�"] },
+          {
+            label: "浜哄伐",
+            fields: ["manual", "manualSuccess"],
+            sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+          },
+          {
+            label: "璇煶",
+            fields: ["voice", "voiceSuccess"],
+            sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+          },
+          {
+            label: "鐭俊",
+            fields: ["sms", "smsSuccess"],
+            sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+          },
+          {
+            label: "寰俊",
+            fields: ["weChat", "weChatSuccess"],
+            sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+          },
         ];
       }
       return [
@@ -2036,9 +2356,9 @@
         0, // 4: nonFollowUp
         0, // 5: followUpNeeded
         0, // 6: needFollowUp
-        0, // 7: pendingFollowUp
-        0, // 8: followUpSuccess
-        0, // 9: followUpFail
+        0, // 7: 寰呭彂閫�/寰呴殢璁�
+        0, // 8: 宸插彂閫�/闅忚鎴愬姛
+        0, // 9: 闅忚鎴愬姛/闅忚澶辫触
         "0%", // 10: 鎴愬姛鐜�
         "0%", // 11: 闅忚鐜�
         "0%", // 12: 鍙婃椂鐜�
@@ -2056,19 +2376,27 @@
         summaries[4] += Number(item.nonFollowUp) || 0;
         summaries[5] += Number(item.followUpNeeded) || 0;
         summaries[6] += Number(item.needFollowUp) || 0;
-        summaries[7] += Number(item.pendingFollowUp) || 0;
-        summaries[8] += Number(item.followUpSuccess) || 0;
-        summaries[9] += Number(item.followUpFail) || 0;
+        if (this.isTargetHospital) {
+          summaries[7] += Number(item.pendingFollowUpWaitSend) || 0;
+          summaries[8] += Number(item.pendingFollowUpSent) || 0;
+          summaries[9] += Number(item.followUpSuccess) || 0;
+        } else {
+          summaries[7] += Number(item.pendingFollowUp) || 0;
+          summaries[8] += Number(item.followUpSuccess) || 0;
+          summaries[9] += Number(item.followUpFail) || 0;
+        }
         methodFields.forEach((field, i) => {
           summaries[methodStartIndex + i] += Number(item[field]) || 0;
         });
       });
 
-      // 鎴愬姛鐜囪绠�
-      const totalSuccess = summaries[8]; // followUpSuccess鐨勬�诲拰
+      // 鎴愬姛鐜囪绠楋細闅忚鎴愬姛 / 闇�闅忚锛堢洰鏍囧尰闄級锛屽惁鍒� 闅忚鎴愬姛 / (闇�闅忚-寰呴殢璁�)
+      const totalSuccess = this.isTargetHospital ? summaries[9] : summaries[8];
       const totalNeed = summaries[6]; // needFollowUp鐨勬�诲拰
-      const totalPending = summaries[7]; // pendingFollowUp鐨勬�诲拰
-      const denominator = totalNeed - totalPending;
+      const totalPending = summaries[7]; // 寰呭彂閫�/寰呴殢璁跨殑鎬诲拰
+      const denominator = this.isTargetHospital
+        ? totalNeed
+        : totalNeed - totalPending;
 
       if (denominator > 0) {
         summaries[10] = ((totalSuccess / denominator) * 100).toFixed(2) + "%";
@@ -2088,15 +2416,23 @@
         summaries[11] = (avgFollowUpRate * 100).toFixed(2) + "%";
       }
 
-      // 鍙婃椂鐜囪绠�
-      const rateValues = this.tableData
-        .map((item) => this.extractPercentageValue(item.rate))
-        .filter((value) => value !== null);
+      // 鍙婃椂鐜囪绠楋細鐩爣鍖婚櫌 (闇�闅忚-浜哄伐瓒呮椂)/闇�闅忚锛屽叾浠栧彇鍚庣 rate 骞冲潎
+      if (this.isTargetHospital) {
+        const totalTimeout = this.tableData.reduce(
+          (sum, item) => sum + (Number(item.manualCallTimeout) || 0),
+          0
+        );
+        summaries[12] = this.calculateTimelyRate(totalNeed, totalTimeout);
+      } else {
+        const rateValues = this.tableData
+          .map((item) => this.extractPercentageValue(item.rate))
+          .filter((value) => value !== null);
 
-      if (rateValues.length > 0) {
-        const avgRate =
-          rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length;
-        summaries[12] = (avgRate * 100).toFixed(2) + "%";
+        if (rateValues.length > 0) {
+          const avgRate =
+            rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length;
+          summaries[12] = (avgRate * 100).toFixed(2) + "%";
+        }
       }
 
       // 鏍煎紡鍖栨暟瀛�
@@ -2137,14 +2473,14 @@
       }
       // 鍑洪櫌鏃堕棿鑼冨洿
       if (queryParams.hospitalEndTime) {
-        this.patientqueryParams.hospitalStartTime =
+        this.patientqueryParams.startOutHospTime =
           queryParams.hospitalStartTime;
-        this.patientqueryParams.hospitalEndTime = queryParams.hospitalEndTime;
+        this.patientqueryParams.endOutHospTime = queryParams.hospitalEndTime;
       } else {
-        this.patientqueryParams.hospitalStartTime = this.parseTime(
+        this.patientqueryParams.startOutHospTime = this.parseTime(
           queryParams.dateRangecy[0]
         );
-        this.patientqueryParams.hospitalEndTime = this.parseTime(
+        this.patientqueryParams.endOutHospTime = this.parseTime(
           queryParams.dateRangecy[1]
         );
       }

--
Gitblit v1.9.3