From bbbc478129f72b26e2ec4a2e981ed8698a96880c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 22 十月 2026 00:28:18 +0800
Subject: [PATCH] 当service_type=6时,需要根据传入的入院还是离院病区(病区)去后端查询

---
 src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue |  127 +++++++++++++++++++++++++++++++++--------
 1 files changed, 101 insertions(+), 26 deletions(-)

diff --git a/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue b/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
index 80f1160..e5eb304 100644
--- a/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
+++ b/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
@@ -9,6 +9,19 @@
         label-width="100px"
         class="query-form"
       >
+        <el-form-item label="婊℃剰搴︾被鍨�" prop="satisfactionScope">
+          <el-select
+            v-model="satisfactionScope"
+            placeholder="榛樿绂婚櫌"
+            clearable
+            style="width: 150px"
+            @change="handleSatisfactionScopeChange"
+          >
+            <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+            <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+          </el-select>
+        </el-form-item>
+
         <el-form-item label="缁熻绫诲瀷" prop="statisticaltype">
           <el-select
             v-model="queryParams.statisticaltype"
@@ -137,10 +150,10 @@
         @selection-change="handleSelectionChange"
         :row-key="getRowKey"
       >
-        <!-- 鐥呭尯鍒� -->
+        <!-- 鐥呭尯鍒楋細浣忛櫌婊℃剰搴︾粺璁″湪闄㈢梾鍖猴紝鍏朵綑缁熻鍑洪櫌鐥呭尯 -->
         <el-table-column
           v-if="queryParams.statisticaltype == 1"
-          label="鍑洪櫌鐥呭尯"
+          :label="wardColumnLabel"
           align="center"
           sortable
           key="leavehospitaldistrictname"
@@ -148,7 +161,11 @@
           :show-overflow-tooltip="true"
           :sort-method="sortChineseNumber"
           min-width="120"
-        />
+        >
+          <template slot-scope="scope">
+            {{ getWardName(scope.row) || "-" }}
+          </template>
+        </el-table-column>
 
         <!-- 绉戝鍒� -->
         <el-table-column
@@ -349,6 +366,9 @@
   },
   data() {
     return {
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙鎸夊嚭闄㈢梾鍖虹粺璁★級锛宧ospital=鍦ㄩ櫌婊℃剰搴︼紙鎸夊湪闄㈢梾鍖虹粺璁★級
+      satisfactionScope: "leave",
+
       // 鏌ヨ鍙傛暟
       queryParams: {
         statisticaltype: 1,
@@ -373,7 +393,25 @@
       flatArraydept: [],
 
       // 鏈嶅姟绫诲瀷閫夐」
-      options: [],
+      options: [
+        {
+          value: 6,
+          label: "浣忛櫌婊℃剰搴�",
+          raw: {
+            cssClass: "",
+            listClass: "",
+          },
+        },
+
+        {
+          value: 14,
+          label: "闂ㄨ瘖婊℃剰搴�",
+          raw: {
+            cssClass: "",
+            listClass: "",
+          },
+        },
+      ],
 
       // 琛ㄦ牸鏁版嵁
       userList: [],
@@ -441,6 +479,19 @@
     };
   },
 
+  computed: {
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勭粺璁★細鍦ㄩ櫌鎮h�呮寜鍦ㄩ櫌鐥呭尯(hospitaldistrictcodes)缁熻锛�
+    // 绂婚櫌婊℃剰搴︿粛鎸夊嚭闄㈢梾鍖�(leavehospitaldistrictcodes)缁熻
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope === "hospital";
+    },
+
+    // 鐥呭尯鍒楁爣棰�
+    wardColumnLabel() {
+      return this.isInHospitalSatisfaction ? "鍦ㄩ櫌鐥呭尯" : "鍑洪櫌鐥呭尯";
+    },
+  },
+
   created() {
     this.orgname = localStorage.getItem("orgname");
 
@@ -506,16 +557,20 @@
         // 澶勭悊鐥呭尯/绉戝閫夋嫨
         if (params.statisticaltype == 1) {
           // 鐥呭尯缁熻
-          if (params.leavehospitaldistrictcodes.includes("all")) {
-            // 濡傛灉閫夋嫨浜�"鍏ㄩ儴"锛屽垯绉婚櫎"all"鍊�
-            params.leavehospitaldistrictcodes =
-              params.leavehospitaldistrictcodes.filter(
-                (item) => item !== "all"
-              );
-            // 濡傛灉闇�瑕佷紶鎵�鏈夌梾鍖轰唬鐮侊紝鍙互浠巗tore涓幏鍙�
-            params.leavehospitaldistrictcodes = (
-              this.$store.getters.belongWards || []
-            ).map((ward) => ward.districtCode);
+          let wardCodes = params.leavehospitaldistrictcodes || [];
+          if (wardCodes.includes("all")) {
+            // 濡傛灉閫夋嫨浜�"鍏ㄩ儴"锛屽垯浣跨敤褰撳墠鐢ㄦ埛鎵�灞炵殑鍏ㄩ儴鐥呭尯
+            wardCodes = (this.$store.getters.belongWards || []).map(
+              (ward) => ward.districtCode
+            );
+          }
+          // 浣忛櫌婊℃剰搴﹂拡瀵瑰湪闄㈡偅鑰咃紝鎸夊湪闄㈢梾鍖�(hospitaldistrictcodes)缁熻锛�
+          // 鍑洪櫌闅忚绛夊叾浠栨湇鍔$被鍨嬩粛鎸夊嚭闄㈢梾鍖�(leavehospitaldistrictcodes)缁熻
+          delete params.leavehospitaldistrictcodes;
+          if (this.isInHospitalSatisfaction) {
+            params.hospitaldistrictcodes = wardCodes;
+          } else {
+            params.leavehospitaldistrictcodes = wardCodes;
           }
         } else if (params.statisticaltype == 2) {
           // 绉戝缁熻
@@ -542,8 +597,8 @@
       }
     },
     sortChineseNumber(aRow, bRow) {
-      const a = aRow.leavehospitaldistrictname;
-      const b = bRow.leavehospitaldistrictname;
+      const a = this.getWardName(aRow);
+      const b = this.getWardName(bRow);
 
       // 涓枃鏁板瓧鍒伴樋鎷変集鏁板瓧鐨勬槧灏勶紙鎵╁睍鍒�45锛�
       const chineseNumMap = {
@@ -703,14 +758,12 @@
           return -1;
         };
 
-        const indexA = getIndex(a.leavehospitaldistrictname);
-        const indexB = getIndex(b.leavehospitaldistrictname);
+        const indexA = getIndex(this.getWardName(a));
+        const indexB = getIndex(this.getWardName(b));
 
         // 鎺掑簭閫昏緫
         if (indexA === -1 && indexB === -1) {
-          return (a.leavehospitaldistrictname || "").localeCompare(
-            b.leavehospitaldistrictname || ""
-          );
+          return this.getWardName(a).localeCompare(this.getWardName(b));
         }
         if (indexA === -1) return 1;
         if (indexB === -1) return -1;
@@ -730,6 +783,12 @@
 
     // 澶勭悊鏌ヨ
     handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+
+    // 鍒囨崲婊℃剰搴︾被鍨嬶紙绂婚櫌/鍦ㄩ櫌锛夊悗閲嶆柊鏌ヨ
+    handleSatisfactionScopeChange() {
       this.queryParams.pageNum = 1;
       this.getList();
     },
@@ -771,8 +830,14 @@
     // 鑾峰彇琛宬ey
     getRowKey(row) {
       return row.statisticaltype === 1
-        ? row.leavehospitaldistrictcode
+        ? row.hospitaldistrictcode || row.leavehospitaldistrictcode
         : row.deptcode;
+    },
+
+    // 鐥呭尯鍚嶇О锛氫綇闄㈡弧鎰忓害鎺ュ彛杩斿洖鍦ㄩ櫌鐥呭尯瀛楁锛屽叾浣欒繑鍥炲嚭闄㈢梾鍖哄瓧娈�
+    getWardName(row) {
+      if (!row) return "";
+      return row.hospitaldistrictname || row.leavehospitaldistrictname || "";
     },
 
     // 鏍煎紡鍖栫櫨鍒嗘瘮
@@ -810,8 +875,18 @@
         }
 
         if (this.queryParams.statisticaltype == 1) {
-          this.topicvalue.name = row.leavehospitaldistrictname;
-          params.leavehospitaldistrictcodes = [row.leavehospitaldistrictcode];
+          this.topicvalue.name = this.getWardName(row);
+          // 浣忛櫌婊℃剰搴︽寜鍦ㄩ櫌鐥呭尯缁熻锛屽叾浣欐寜鍑洪櫌鐥呭尯缁熻
+          if (this.isInHospitalSatisfaction) {
+            delete params.leavehospitaldistrictcodes;
+            params.hospitaldistrictcodes = [
+              row.hospitaldistrictcode || row.leavehospitaldistrictcode,
+            ];
+          } else {
+            params.leavehospitaldistrictcodes = [
+              row.leavehospitaldistrictcode,
+            ];
+          }
         } else {
           this.topicvalue.name = row.deptname;
           params.deptcodes = [row.deptcode];
@@ -946,7 +1021,7 @@
 
         // 娣诲姞琛ㄥご
         const headers = [
-          this.queryParams.statisticaltype == 1 ? "鍑洪櫌鐥呭尯" : "绉戝",
+          this.queryParams.statisticaltype == 1 ? this.wardColumnLabel : "绉戝",
           "鍑洪櫌浜烘",
           "鏃犻渶闅忚浜烘",
           "搴旈殢璁夸汉娆�",
@@ -967,7 +1042,7 @@
         this.userList.forEach((item) => {
           const dataRow = worksheet.addRow([
             this.queryParams.statisticaltype == 1
-              ? item.leavehospitaldistrictname
+              ? this.getWardName(item)
               : item.deptname,
             item.dischargeCount || 0,
             item.nonFollowUp || 0,

--
Gitblit v1.9.3