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/ChartsPanel.vue            |   29 ++++
 src/views/Satisfaction/sfstatistics/components/SatisfactionStatistics.vue |   62 +++++++++-
 vue.config.js                                                             |    4 
 src/views/Satisfaction/sfstatistics/components/DataOverview.vue           |   56 ++++++++-
 src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue     |  107 +++++++++++++----
 src/views/followvisit/zysatisfaction/index.vue                            |   76 ++++++++++++
 6 files changed, 286 insertions(+), 48 deletions(-)

diff --git a/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue b/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
index 93f0164..86c5b41 100644
--- a/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
+++ b/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
@@ -21,6 +21,18 @@
           <el-radio-button label="month">鎸夋湀</el-radio-button>
           <el-radio-button label="year">鎸夊勾</el-radio-button>
         </el-radio-group>
+        <span class="filter-label">婊℃剰搴︾被鍨嬶細</span>
+        <el-select
+          v-model="satisfactionScope"
+          size="small"
+          clearable
+          placeholder="榛樿绂婚櫌"
+          class="filter-scope"
+          @change="refreshAll"
+        >
+          <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+          <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+        </el-select>
         <span class="filter-label">缁熻缁村害锛�</span>
         <el-radio-group v-model="queryParams.dimension" size="small" @change="onDimensionChange">
           <el-radio-button label="ward">鎸夌梾鍖虹粺璁�</el-radio-button>
@@ -170,6 +182,8 @@
   dicts: ['dimensionality_type'],
   data() {
     return {
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙绂婚櫌绉戝/鐥呭尯锛夛紝hospital=鍦ㄩ櫌婊℃剰搴︼紙鍦ㄩ櫌绉戝/鐥呭尯锛�
+      satisfactionScope: 'leave',
       queryParams: {
         dateRange: [],
         interval: 'month',
@@ -226,6 +240,10 @@
     },
     defaultWardCodes() {
       return Array.from(new Set(this.wardCodeList.map((w) => w.districtCode)));
+    },
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勬煡璇紙娓呯┖涓嬫媺鏃舵寜榛樿鐨勭闄㈠彛寰勶級
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope === 'hospital';
     },
     intervalLabel() {
       return { day: '鎸夊ぉ', week: '鎸夊懆', month: '鎸夋湀', year: '鎸夊勾' }[this.queryParams.interval] || '鎸夋湀';
@@ -426,12 +444,17 @@
           questionContent: this.singleQuestionContent,
         };
         const sel = this.singleDeptWards || [];
+        // 绉戝/鐥呭尯鏉′欢闅忋�屾弧鎰忓害绫诲瀷銆嶅垏鎹細鍦ㄩ櫌 => deptcodes/hospitaldistrictcodes锛岀闄� => leaveldeptcodes/leavehospitaldistrictcodes
         if (this.queryParams.dimension === 'dept') {
           const names = sel.map((s) => String(s).replace(/^dept:/, ''));
-          payload.leaveldeptcodes = names.length ? this.mapDeptNames(names) : this.defaultDeptCodes;
+          const codes = names.length ? this.mapDeptNames(names) : this.defaultDeptCodes;
+          if (this.isInHospitalSatisfaction) payload.deptcodes = codes;
+          else payload.leaveldeptcodes = codes;
         } else {
           const names = sel.map((s) => String(s).replace(/^ward:/, ''));
-          payload.leavehospitaldistrictcodes = names.length ? this.mapWardNames(names) : this.defaultWardCodes;
+          const codes = names.length ? this.mapWardNames(names) : this.defaultWardCodes;
+          if (this.isInHospitalSatisfaction) payload.hospitaldistrictcodes = codes;
+          else payload.leavehospitaldistrictcodes = codes;
         }
         const res = await sltdMydTotalByScore(payload);
         console.log('[sltdMydTotalByScore 鍗曢] code=', res && res.code, 'data=', JSON.stringify(res && res.data).slice(0, 1500));
@@ -875,7 +898,7 @@
 
 <style lang="scss" scoped>
 .export-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
-.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; .filter-label { font-size: 13px; color: #606266; } .filter-date { width: 260px; } }
+.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; .filter-label { font-size: 13px; color: #606266; } .filter-date { width: 260px; } .filter-scope { width: 140px; } }
 .chart-card { margin-bottom: 0; }
 .chart-box { width: 100%; height: 360px; }
 .chart-wrap { position: relative; width: 100%; }
diff --git a/src/views/Satisfaction/sfstatistics/components/DataOverview.vue b/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
index d221e0f..f189c1f 100644
--- a/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
+++ b/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
@@ -3,6 +3,19 @@
     <!-- 椤堕儴绛涢�夛細鏃堕棿鑼冨洿 + 绉戝/鐥呭尯锛屾帶鍒舵湰椤垫墍鏈夋暟鎹� -->
     <el-card shadow="never" class="overview-card filter-card">
       <el-form inline class="filter-form">
+        <el-form-item label="婊℃剰搴︾被鍨�">
+          <el-select
+            v-model="satisfactionScope"
+            size="small"
+            style="width: 140px"
+            clearable
+            placeholder="榛樿绂婚櫌"
+            @change="fetchData"
+          >
+            <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+            <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+          </el-select>
+        </el-form-item>
         <el-form-item label="鍑洪櫌鏃ユ湡">
           <el-date-picker
             v-model="queryParams.dateRange"
@@ -497,11 +510,14 @@
   name: "DataOverview",
   data() {
     return {
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙绂婚櫌绉戝/鐥呭尯锛夛紝hospital=鍦ㄩ櫌婊℃剰搴︼紙鍦ㄩ櫌绉戝/鐥呭尯锛�
+      satisfactionScope: "leave",
       // 椤堕儴鍏ㄥ眬绛涢��
       queryParams: {
         dateRange: [],
         deptCodes: [], // 绉戝缂栫爜闆嗗悎 => leaveldeptcodes
-        wardCodes: [], // 鍑洪櫌鐥呭尯缂栫爜闆嗗悎 => leavehospitaldistrictcodes锛堟帴鍙e繀濉級
+        // 鐥呭尯缂栫爜闆嗗悎锛氫綇闄㈡弧鎰忓害鎸夊湪闄㈢梾鍖�(hospitaldistrictcodes)锛屽叾浣欐寜鍑洪櫌鐥呭尯(leavehospitaldistrictcodes)
+        wardCodes: [],
         serviceTypeList: [], // 鏈嶅姟绫诲瀷澶氶�夛紝鎻愪氦鏃剁敤閫楀彿鎷兼帴
         deptOrDistrict: "1", // 绉戝/鐥呭尯缁勫悎鏂瑰紡锛岄粯璁� 1锛氱闄㈢梾鍖� and 绂婚櫌绉戝
         statMode: "ward", // 缁熻缁村害锛歸ard=鎸夌梾鍖虹粺璁� dept=鎸夌瀹ょ粺璁�
@@ -553,6 +569,11 @@
     // 鏈�夌梾鍖烘椂鐨勯粯璁ゆ煡璇㈣寖鍥达細鍏ㄩ儴鐥呭尯缂栫爜
     defaultWardCodes() {
       return Array.from(new Set(this.wardOptions.map((w) => w.value)));
+    },
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勬煡璇細鍦ㄩ櫌婊℃剰搴︾敤 deptcodes/hospitaldistrictcodes锛�
+    // 绂婚櫌婊℃剰搴︼紙浠ュ強娓呯┖涓嬫媺鏃剁殑榛樿鍙e緞锛夌敤 leaveldeptcodes/leavehospitaldistrictcodes
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope === "hospital";
     },
     // 鏈�夌瀹ゆ椂鐨勯粯璁ゆ煡璇㈣寖鍥达細鍏ㄩ儴绉戝缂栫爜
     defaultDeptCodes() {
@@ -828,8 +849,10 @@
         return;
       }
 
-      // 鐥呭尯 => leavehospitaldistrictcodes锛岀瀹� => leaveldeptcodes
-      // 绉戝/鐥呭尯浜掓枼锛氭寜鐥呭尯鍙紶 leavehospitaldistrictcodes锛屾寜绉戝鍙紶 leaveldeptcodes
+      // 绉戝/鐥呭尯鏉′欢闅忋�屾弧鎰忓害绫诲瀷銆嶅垏鎹細
+      // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛堝湪闄㈢瀹ゃ�佸湪闄㈢梾鍖猴級
+      // 绂婚櫌婊℃剰搴� => leaveldeptcodes / leavehospitaldistrictcodes锛堢闄㈢瀹ゃ�佺闄㈢梾鍖猴級
+      // 绉戝/鐥呭尯浜掓枼锛氭寜鐥呭尯鍙紶鐥呭尯缂栫爜锛屾寜绉戝鍙紶绉戝缂栫爜
       const wards = this.queryParams.wardCodes || [];
       const depts = this.queryParams.deptCodes || [];
 
@@ -839,13 +862,23 @@
         endFinishTime: range[1],
       };
       if (this.queryParams.statMode === "dept") {
-        payload.leaveldeptcodes = depts.length
+        const deptCodes = depts.length
           ? Array.from(new Set(depts))
           : this.defaultDeptCodes;
+        if (this.isInHospitalSatisfaction) {
+          payload.deptcodes = deptCodes;
+        } else {
+          payload.leaveldeptcodes = deptCodes;
+        }
       } else {
-        payload.leavehospitaldistrictcodes = wards.length
+        const wardCodes = wards.length
           ? Array.from(new Set(wards))
           : this.defaultWardCodes;
+        if (this.isInHospitalSatisfaction) {
+          payload.hospitaldistrictcodes = wardCodes;
+        } else {
+          payload.leavehospitaldistrictcodes = wardCodes;
+        }
       }
       // 鏈嶅姟绫诲瀷澶氶�夛細閫楀彿鍒嗛殧锛堟帴鍙e瓧娈典负 serviceType 瀛楃涓诧級
       const serviceTypes = this.queryParams.serviceTypeList || [];
@@ -892,10 +925,17 @@
         endFinishTime: range[1],
       };
       try {
-        // 鎸夌瀹ょ粺璁★紙leaveldeptcodes 浼樺厛锛変笌鎸夌梾鍖虹粺璁★紙leavehospitaldistrictcodes锛夊悇鏌ヤ竴娆�
+        // 鎸夌瀹ょ粺璁°�佹寜鐥呭尯缁熻鍚勬煡涓�娆★紝鏉′欢闅忋�屾弧鎰忓害绫诲瀷銆嶅垏鎹細
+        // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛涚闄㈡弧鎰忓害 => leaveldeptcodes / leavehospitaldistrictcodes
+        const deptParam = this.isInHospitalSatisfaction
+          ? { deptcodes: this.defaultDeptCodes }
+          : { leaveldeptcodes: this.defaultDeptCodes };
+        const wardParam = this.isInHospitalSatisfaction
+          ? { hospitaldistrictcodes: this.defaultWardCodes }
+          : { leavehospitaldistrictcodes: this.defaultWardCodes };
         const [deptRes, wardRes] = await Promise.all([
-          statQuestionOptionByKsOrBq({ ...base, leaveldeptcodes: this.defaultDeptCodes }),
-          statQuestionOptionByKsOrBq({ ...base, leavehospitaldistrictcodes: this.defaultWardCodes }),
+          statQuestionOptionByKsOrBq({ ...base, ...deptParam }),
+          statQuestionOptionByKsOrBq({ ...base, ...wardParam }),
         ]);
         // 鎺掓煡鐢細鎵撳嵃鎺ュ彛鍘熷杩斿洖锛屼究浜庢牳瀵逛袱绾у祵濂� Map 缁撴瀯锛堢‘璁ゆ棤璇悗鍙垹闄わ級
         console.log(
diff --git a/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue b/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
index 3f1c13d..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,
@@ -459,6 +479,19 @@
     };
   },
 
+  computed: {
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勭粺璁★細鍦ㄩ櫌鎮h�呮寜鍦ㄩ櫌鐥呭尯(hospitaldistrictcodes)缁熻锛�
+    // 绂婚櫌婊℃剰搴︿粛鎸夊嚭闄㈢梾鍖�(leavehospitaldistrictcodes)缁熻
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope === "hospital";
+    },
+
+    // 鐥呭尯鍒楁爣棰�
+    wardColumnLabel() {
+      return this.isInHospitalSatisfaction ? "鍦ㄩ櫌鐥呭尯" : "鍑洪櫌鐥呭尯";
+    },
+  },
+
   created() {
     this.orgname = localStorage.getItem("orgname");
 
@@ -524,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) {
           // 绉戝缁熻
@@ -560,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 = {
@@ -721,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;
@@ -748,6 +783,12 @@
 
     // 澶勭悊鏌ヨ
     handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+
+    // 鍒囨崲婊℃剰搴︾被鍨嬶紙绂婚櫌/鍦ㄩ櫌锛夊悗閲嶆柊鏌ヨ
+    handleSatisfactionScopeChange() {
       this.queryParams.pageNum = 1;
       this.getList();
     },
@@ -789,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 || "";
     },
 
     // 鏍煎紡鍖栫櫨鍒嗘瘮
@@ -828,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];
@@ -964,7 +1021,7 @@
 
         // 娣诲姞琛ㄥご
         const headers = [
-          this.queryParams.statisticaltype == 1 ? "鍑洪櫌鐥呭尯" : "绉戝",
+          this.queryParams.statisticaltype == 1 ? this.wardColumnLabel : "绉戝",
           "鍑洪櫌浜烘",
           "鏃犻渶闅忚浜烘",
           "搴旈殢璁夸汉娆�",
@@ -985,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,
diff --git a/src/views/Satisfaction/sfstatistics/components/SatisfactionStatistics.vue b/src/views/Satisfaction/sfstatistics/components/SatisfactionStatistics.vue
index 5646d6b..eda31ce 100644
--- a/src/views/Satisfaction/sfstatistics/components/SatisfactionStatistics.vue
+++ b/src/views/Satisfaction/sfstatistics/components/SatisfactionStatistics.vue
@@ -11,6 +11,18 @@
           label-width="100px"
           class="query-form"
         >
+          <el-form-item label="婊℃剰搴︾被鍨�" prop="satisfactionScope">
+            <el-select
+              v-model="satisfactionScope"
+              placeholder="榛樿鍦ㄩ櫌"
+              clearable
+              style="width: 140px"
+              @change="handleSearch"
+            >
+              <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+              <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+            </el-select>
+          </el-form-item>
           <el-form-item label="缁熻绫诲瀷" prop="patientSource">
             <el-select
               v-model="queryParams.type"
@@ -684,6 +696,10 @@
   dicts: ["dimensionality_type"],
   data() {
     return {
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙leaveldeptcodes/leavehospitaldistrictcodes锛夛紝
+      // hospital=鍦ㄩ櫌婊℃剰搴︼紙deptcodes/hospitaldistrictcodes锛�
+      // 榛樿鍦ㄩ櫌锛氫繚鎸佽椤靛師鏈夎姹傚弬鏁颁笉鍙�
+      satisfactionScope: "hospital",
       // 鏌ヨ鍙傛暟
       queryParams: {
         type: 2,
@@ -866,6 +882,11 @@
       const dict = this.dict && this.dict.type && this.dict.type.dimensionality_type;
       return dict ? dict.map((d) => String(d.value)) : [];
     },
+
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勬煡璇紙鏈〉榛樿鍦ㄩ櫌锛屾墍浠ユ竻绌轰笅鎷夋椂浠嶆寜鍦ㄩ櫌澶勭悊锛�
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope !== "leave";
+    },
   },
 
   mounted() {
@@ -892,6 +913,8 @@
     async initData() {
       await this.getDeptList();
       await this.getWardList();
+      // 鎺ュ彛榛樿鎸夈�屽叏閮ㄧ瀹� + 鍏ㄩ儴鐥呭尯 + 鏈�杩�7澶┿�嶆煡璇紝杩欓噷鎶婂疄闄呬娇鐢ㄧ殑鏉′欢鍥炴樉鍒扮瓫閫夋
+      this.echoQueryParams();
       this.initChart();
       await this.loadData();
     },
@@ -920,6 +943,33 @@
         });
         resolve();
       });
+    },
+
+    // 绉戝/鐥呭尯鏉′欢锛�
+    // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛涚闄㈡弧鎰忓害 => leaveldeptcodes / leavehospitaldistrictcodes
+    buildScopeParams() {
+      const deptCodes = this.deptCodes;
+      const wardCodes = this.hospitalDistrictCodes;
+      return this.isInHospitalSatisfaction
+        ? { deptcodes: deptCodes, hospitaldistrictcodes: wardCodes }
+        : { leaveldeptcodes: deptCodes, leavehospitaldistrictcodes: wardCodes };
+    },
+
+    // 鎶婃帴鍙e疄闄呬娇鐢ㄧ殑鏌ヨ鏉′欢鍥炴樉鍒扮瓫閫夋锛�
+    // 绉戝/鐥呭尯鏈�夋椂鎺ュ彛鎸夈�屽叏閮ㄣ�嶆煡锛屾椂闂存湭閫夋椂鎺ュ彛鎸夈�屾渶杩�7澶┿�嶆煡锛岃繖閲屾妸鍚屾牱鐨勫�煎啓鍥炵瓫閫夋
+    echoQueryParams() {
+      if (
+        !this.queryParams.dateRange ||
+        this.queryParams.dateRange.length !== 2
+      ) {
+        this.queryParams.dateRange = [this.startTime, this.endTime];
+      }
+      if (!(this.queryParams.deptCodes || []).length) {
+        this.queryParams.deptCodes = this.deptList.map((dept) => dept.value);
+      }
+      if (!(this.queryParams.wardCodes || []).length) {
+        this.queryParams.wardCodes = this.wardList.map((ward) => ward.value);
+      }
     },
 
     // 鑾峰彇鍥捐〃鏍囬
@@ -963,8 +1013,7 @@
         type: this.queryParams.type,
         startTime: this.startTime,
         endTime: this.endTime,
-        deptcodes: this.deptCodes, // 浣跨敤璁$畻灞炴��
-        hospitaldistrictcodes: this.hospitalDistrictCodes, // 浣跨敤璁$畻灞炴��
+        ...this.buildScopeParams(),
         templateid: this.templateId,
       };
 
@@ -983,8 +1032,7 @@
         type: this.queryParams.type,
         startTime: this.startTime,
         endTime: this.endTime,
-        deptcodes: this.deptCodes, // 浣跨敤璁$畻灞炴��
-        hospitaldistrictcodes: this.hospitalDistrictCodes, // 浣跨敤璁$畻灞炴��
+        ...this.buildScopeParams(),
         templateid: this.templateId,
         questionType: this.queryParams.type || null,
         serviceTypes: this.defaultServiceTypes,
@@ -2012,8 +2060,10 @@
     handleReset() {
       this.$refs.queryForm.resetFields();
       this.queryParams.dateRange = [];
-        this.queryParams.deptCodes = [];  // 閲嶇疆涓烘暟缁�
-  this.queryParams.wardCodes = [];  // 閲嶇疆涓烘暟缁�
+      this.queryParams.deptCodes = []; // 閲嶇疆涓烘暟缁�
+      this.queryParams.wardCodes = []; // 閲嶇疆涓烘暟缁�
+      // 閲嶇疆鍚庢帴鍙d粛鎸夈�屽叏閮ㄧ瀹�/鍏ㄩ儴鐥呭尯 + 鏈�杩�7澶┿�嶆煡璇紝绛涢�夋鍚屾鍥炴樉锛岄伩鍏嶆閲岀┖绌恒�佽姹傞噷鏈夊��
+      this.echoQueryParams();
       this.detailQueryParams.pageNum = 1;
       this.dimensionQueryParams.pageNum = 1;
       this.loadData();
diff --git a/src/views/followvisit/zysatisfaction/index.vue b/src/views/followvisit/zysatisfaction/index.vue
index 05b216f..78603be 100644
--- a/src/views/followvisit/zysatisfaction/index.vue
+++ b/src/views/followvisit/zysatisfaction/index.vue
@@ -15,6 +15,18 @@
         v-show="showSearch"
         label-width="98px"
       >
+        <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="鍑洪櫌鏃堕棿">
           <el-date-picker
             v-model="dateRange"
@@ -82,12 +94,16 @@
             </el-option>
           </el-select>
         </el-form-item> -->
+        <!-- 澶勭悊鐘舵�侊細淇濈暀绾ц仈鑱斿姩锛堜竴绾уぇ绫� 鈫� 浜岀骇鍏蜂綋鐘舵�侊級锛�
+             闈㈡澘鎸傚湪鏈粍浠跺唴(popper-append-to-body=false)锛岄伩鍏嶄笅鎷夎窇鍒板埆澶� -->
         <el-form-item label="澶勭悊鐘舵��" prop="status">
           <el-cascader
             v-model="serviceStatusValue"
             placeholder="璇烽�夋嫨"
             :options="serviceStatusOptions"
             :props="cascaderProps"
+            :popper-append-to-body="false"
+            style="width: 180px"
             @change="handleServiceStatusChange"
             clearable
           ></el-cascader>
@@ -375,17 +391,21 @@
           label="绉戝"
           align="center"
           key="leaveldeptname"
-          prop="leaveldeptname"
           width="120"
         >
+          <template slot-scope="scope">
+            {{ deptNameOf(scope.row) }}
+          </template>
         </el-table-column>
         <el-table-column
           label="鐥呭尯"
           align="center"
           key="leavehospitaldistrictname"
-          prop="leavehospitaldistrictname"
           width="120"
         >
+          <template slot-scope="scope">
+            {{ wardNameOf(scope.row) }}
+          </template>
         </el-table-column>
 
         <el-table-column
@@ -1089,6 +1109,8 @@
           label: "搴旈殢璁挎棩鏈�(鍊掑簭)",
         },
       ],
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙鎸夌闄㈢瀹�/鐥呭尯鏌ワ級锛宧ospital=鍦ㄩ櫌婊℃剰搴︼紙鎸夊湪闄㈢瀹�/鐥呭尯鏌ワ級
+      satisfactionScope: "leave",
       // 鏌ヨ鍙傛暟
       topqueryParams: {
         pageNum: 1,
@@ -1264,7 +1286,7 @@
         this.$message.warning("鏈厤缃瀹�/鐥呭尯鐩稿叧鏉冮檺涓嶅彲鏌ヨ");
         return Promise.reject(new Error("鏃犳潈闄愭煡璇�"));
       }
-      getTaskservelist(this.topqueryParams).then((response) => {
+      getTaskservelist(this.buildScopePayload(this.topqueryParams)).then((response) => {
         this.userList = response.rows[0].serviceSubtaskList;
         this.total = response.total;
         if (refresh) {
@@ -1309,6 +1331,47 @@
         this.total = response.total;
       });
     },
+
+    // 鍒囨崲婊℃剰搴︾被鍨嬶紙绂婚櫌/鍦ㄩ櫌锛夊悗閲嶆柊鏌ヨ
+    handleSatisfactionScopeChange() {
+      this.topqueryParams.pageNum = 1;
+      this.getList(1);
+    },
+
+    // 鎸夋弧鎰忓害绫诲瀷缁勮绉戝/鐥呭尯鏉′欢锛�
+    // 绂婚櫌婊℃剰搴� => leaveldeptcodes / leavehospitaldistrictcodes锛�
+    // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛堝湪闄㈢瀹ゃ�佸湪闄㈢梾鍖猴級
+    buildScopePayload(params) {
+      const payload = { ...params };
+      if (this.satisfactionScope === "hospital") {
+        payload.deptcodes = params.leaveldeptcodes || [];
+        payload.hospitaldistrictcodes = params.leavehospitaldistrictcodes || [];
+        delete payload.leaveldeptcodes;
+        delete payload.leavehospitaldistrictcodes;
+      }
+      return payload;
+    },
+
+    // 绉戝鍚嶇О锛氬湪闄㈡弧鎰忓害浼樺厛鍙栧湪闄㈢瀹わ紝鍏朵綑鍙栧嚭闄㈢瀹�
+    deptNameOf(row) {
+      if (!row) return "-";
+      return (
+        (this.satisfactionScope === "hospital"
+          ? row.deptname || row.leaveldeptname
+          : row.leaveldeptname || row.deptname) || "-"
+      );
+    },
+
+    // 鐥呭尯鍚嶇О锛氬湪闄㈡弧鎰忓害浼樺厛鍙栧湪闄㈢梾鍖猴紝鍏朵綑鍙栧嚭闄㈢梾鍖�
+    wardNameOf(row) {
+      if (!row) return "-";
+      return (
+        (this.satisfactionScope === "hospital"
+          ? row.hospitaldistrictname || row.leavehospitaldistrictname
+          : row.leavehospitaldistrictname || row.hospitaldistrictname) || "-"
+      );
+    },
+
     // 鏈嶅姟鐘舵�佸彉鏇村鐞�
     handleServiceStatusChange(value) {
       // 娓呯┖閫夋嫨
@@ -1841,7 +1904,7 @@
       this.download(
         "smartor/serviceSubtask/patItemExport",
         {
-          ...this.topqueryParams,
+          ...this.buildScopePayload(this.topqueryParams),
         },
         `user_${new Date().getTime()}.xlsx`
       );
@@ -2085,6 +2148,11 @@
   box-shadow: 0 2px 12px rgba(31, 45, 61, 0.05);
 }
 
+/* 绾ц仈涓嬫媺鎸傚湪鏈粍浠跺唴鏃讹紝浠ユ墍鍦ㄨ〃鍗曢」涓哄畾浣嶅熀鍑嗭紝閬垮厤闈㈡澘璺戝埌椤甸潰鍒 */
+::v-deep .el-form--inline .el-form-item {
+  position: relative;
+}
+
 /* 闅愯棌鍒嗗壊绾� */
 ::v-deep .el-divider {
   display: none;
diff --git a/vue.config.js b/vue.config.js
index 414e500..fe4bda0 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -40,10 +40,10 @@
         // target: `http://192.168.100.10:8094`,//鐪佺珛鍚屽痉
         // target: `http://192.168.100.10:8095`,//鏂板崕
         // target: `http://192.168.100.10:8098`,//甯備竴
-        // target:`http://localhost:8095`,
+        target:`http://localhost:8095`,
         // target:`http://35z1t16164.qicp.vip`,
         // target: `http://192.168.100.172:8095`,
-        target: `http://192.168.100.10:8089`,//鍗楀崕
+        // target: `http://192.168.100.10:8089`,//鍗楀崕
         // target: `https://9.208.38.93:8092/`,
         changeOrigin: true,
         pathRewrite: {

--
Gitblit v1.9.3