From fa5ea853099e88be253fca4fb2b0c2b7af5f396e Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 09 十一月 2025 15:57:04 +0800
Subject: [PATCH] feat:微信登录

---
 app/pages/task/create-emergency.vue |  105 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 85 insertions(+), 20 deletions(-)

diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index 7d96be1..4ad6a63 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -189,7 +189,10 @@
               :key="hospital.hospId"
               @click="selectHospitalOut(hospital)"
             >
-              <view class="hospital-name">{{ hospital.hospName }}</view>
+              <view class="hospital-name">
+                {{ hospital.hospName }}
+                <text class="hospital-short" v-if="hospital.hospShort">{{ hospital.hospShort }}</text>
+              </view>
               <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
             </view>
           </view>
@@ -198,12 +201,21 @@
       
       <view class="form-item">
         <view class="form-label required">绉戝</view>
-        <picker mode="selector" :range="departmentOptions" range-key="text" @change="onHospitalOutDepartmentChange">
+        <picker 
+          v-if="taskForm.hospitalOut.name !== '瀹朵腑'"
+          mode="selector" 
+          :range="departmentOptions" 
+          range-key="text" 
+          @change="onHospitalOutDepartmentChange"
+        >
           <view class="form-input picker-input">
             {{ taskForm.hospitalOut.department || '璇烽�夋嫨绉戝' }}
             <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
           </view>
         </picker>
+        <view v-else class="form-input picker-input disabled">
+          鍏跺畠
+        </view>
       </view>
       
       <view class="form-item">
@@ -259,7 +271,10 @@
               :key="hospital.hospId"
               @click="selectHospitalIn(hospital)"
             >
-              <view class="hospital-name">{{ hospital.hospName }}</view>
+              <view class="hospital-name">
+                {{ hospital.hospName }}
+                <text class="hospital-short" v-if="hospital.hospShort">{{ hospital.hospShort }}</text>
+              </view>
               <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
             </view>
           </view>
@@ -268,12 +283,21 @@
       
       <view class="form-item">
         <view class="form-label required">绉戝</view>
-        <picker mode="selector" :range="departmentOptions" range-key="text" @change="onHospitalInDepartmentChange">
+        <picker 
+          v-if="taskForm.hospitalIn.name !== '瀹朵腑'"
+          mode="selector" 
+          :range="departmentOptions" 
+          range-key="text" 
+          @change="onHospitalInDepartmentChange"
+        >
           <view class="form-input picker-input">
             {{ taskForm.hospitalIn.department || '璇烽�夋嫨绉戝' }}
             <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
           </view>
         </picker>
+        <view v-else class="form-input picker-input disabled">
+          鍏跺畠
+        </view>
       </view>
       
       <view class="form-item">
@@ -917,22 +941,30 @@
       })
     },
     
-    // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛
+    // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛锛�"瀹朵腑"濮嬬粓鍦ㄦ渶鍓嶉潰
     sortHospitalsByRegion(hospitals) {
-      if (!this.selectedRegion || !hospitals || hospitals.length === 0) {
+      if (!hospitals || hospitals.length === 0) {
         return hospitals
       }
       
       const region = this.selectedRegion
-      const localHospitals = []
-      const otherHospitals = []
+      const homeHospital = []  // "瀹朵腑"
+      const localHospitals = []  // 鏈湴鍖婚櫌
+      const otherHospitals = []  // 鍏朵粬鍖婚櫌
       
       hospitals.forEach(hospital => {
+        // "瀹朵腑"浼樺厛澶勭悊锛屾斁鍦ㄦ渶鍓嶉潰
+        if (hospital.hospName === '瀹朵腑') {
+          homeHospital.push(hospital)
+          return
+        }
+        
         // 鍒ゆ柇鍖婚櫌鏄惁鍦ㄦ湰鍦板尯鍩燂紙鐪併�佸競銆佸尯浠讳竴鍖呭惈鍦板煙鍏抽敭璇嶏級
-        const isLocal = 
+        const isLocal = region && (
           (hospital.hopsProvince && hospital.hopsProvince.includes(region)) ||
           (hospital.hopsCity && hospital.hopsCity.includes(region)) ||
           (hospital.hopsArea && hospital.hopsArea.includes(region))
+        )
         
         if (isLocal) {
           localHospitals.push(hospital)
@@ -941,8 +973,8 @@
         }
       })
       
-      // 鏈湴鍖婚櫌鍦ㄥ墠锛屽叾浠栧尰闄㈠湪鍚�
-      return [...localHospitals, ...otherHospitals]
+      // "瀹朵腑"鍦ㄦ渶鍓嶏紝鏈湴鍖婚櫌鍏舵锛屽叾浠栧尰闄㈠湪鍚�
+      return [...homeHospital, ...localHospitals, ...otherHospitals]
     },
     
     // 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
@@ -958,23 +990,28 @@
         // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
         if (this.selectedOrganizationServiceOrderClass) {
           getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
-            this.hospitalOutResults = response.data || []
+            const hospitals = response.data || []
+            // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+            this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
             // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
             if (this.hospitalOutResults.length === 0) {
               searchHospitals('', this.selectedRegion).then(res => {
-                this.hospitalOutResults = res.data || []
+                const hospitals = res.data || []
+                this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
               })
             }
           }).catch(error => {
             console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
             searchHospitals('', this.selectedRegion).then(res => {
-              this.hospitalOutResults = res.data || []
+              const hospitals = res.data || []
+              this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
             })
           })
         } else {
           // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
           searchHospitals('', this.selectedRegion).then(response => {
-            this.hospitalOutResults = response.data || []
+            const hospitals = response.data || []
+            this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
           }).catch(error => {
             console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
             this.hospitalOutResults = []
@@ -994,10 +1031,12 @@
         clearTimeout(this.searchTimer)
       }
       
-      // 濡傛灉鍏抽敭璇嶄负绌猴紝鍙樉绀哄綋鍓嶅尯鍩熺殑鍖婚櫌
+      // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず褰撳墠鍖哄煙鐨勫尰闄�
       if (!keyword || keyword.trim() === '') {
         searchHospitals('', this.selectedRegion).then(response => {
-          this.hospitalOutResults = response.data || []
+          const hospitals = response.data || []
+          // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+          this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
         }).catch(error => {
           console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
           this.hospitalOutResults = []
@@ -1016,7 +1055,9 @@
     searchHospitalOut(keyword) {
       // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护锛屽彧鎼滅储褰撳墠鍖哄煙鐨勫尰闄�
       searchHospitals(keyword, this.selectedRegion).then(response => {
-        this.hospitalOutResults = response.data || []
+        const hospitals = response.data || []
+        // 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
+        this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
         this.showHospitalOutResults = true
         console.log('鎼滅储杞嚭鍖婚櫌:', keyword, '鍖哄煙:', this.selectedRegion, '缁撴灉鏁�:', this.hospitalOutResults.length)
       }).catch(error => {
@@ -1032,10 +1073,18 @@
       // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛屾竻绌哄湴鍧�璁╃敤鎴锋墜鍔ㄨ緭鍏ワ紱鍚﹀垯鑷姩濉厖鍦板潃
       if (hospital.hospName === '瀹朵腑') {
         this.taskForm.hospitalOut.address = ''
+        // 绉戝鑷姩璁剧疆涓�"鍏跺畠"
+        this.taskForm.hospitalOut.department = '鍏跺畠'
+        this.taskForm.hospitalOut.departmentId = null
       } else {
         // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
         const fullAddress = this.buildFullAddress(hospital)
         this.taskForm.hospitalOut.address = fullAddress
+        // 娓呯┖绉戝锛岃鐢ㄦ埛閲嶆柊閫夋嫨
+        if (this.taskForm.hospitalOut.department === '鍏跺畠') {
+          this.taskForm.hospitalOut.department = ''
+          this.taskForm.hospitalOut.departmentId = null
+        }
       }
       this.hospitalOutSearchKeyword = hospital.hospName
       this.showHospitalOutResults = false
@@ -1115,7 +1164,7 @@
       if (!keyword || keyword.trim() === '') {
         searchHospitals('', '').then(response => {
           const allHospitals = response.data || []
-          // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+          // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
           this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
         }).catch(error => {
           console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
@@ -1136,7 +1185,7 @@
       // 浼犲叆鍏抽敭璇嶏紝涓嶄紶鍦板煙杩囨护锛堟悳绱㈡墍鏈夊尯鍩燂級
       searchHospitals(keyword, '').then(response => {
         const allHospitals = response.data || []
-        // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+        // 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
         this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
         this.showHospitalInResults = true
         console.log('鎼滅储杞叆鍖婚櫌:', keyword, '缁撴灉鏁�:', this.hospitalInResults.length)
@@ -1153,10 +1202,18 @@
       // 濡傛灉閫夋嫨鐨勬槸"瀹朵腑"锛屾竻绌哄湴鍧�璁╃敤鎴锋墜鍔ㄨ緭鍏ワ紱鍚﹀垯鑷姩濉厖鍦板潃
       if (hospital.hospName === '瀹朵腑') {
         this.taskForm.hospitalIn.address = ''
+        // 绉戝鑷姩璁剧疆涓�"鍏跺畠"
+        this.taskForm.hospitalIn.department = '鍏跺畠'
+        this.taskForm.hospitalIn.departmentId = null
       } else {
         // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
         const fullAddress = this.buildFullAddress(hospital)
         this.taskForm.hospitalIn.address = fullAddress
+        // 娓呯┖绉戝锛岃鐢ㄦ埛閲嶆柊閫夋嫨
+        if (this.taskForm.hospitalIn.department === '鍏跺畠') {
+          this.taskForm.hospitalIn.department = ''
+          this.taskForm.hospitalIn.departmentId = null
+        }
       }
       this.hospitalInSearchKeyword = hospital.hospName
       this.showHospitalInResults = false
@@ -2006,6 +2063,14 @@
               color: #333;
               font-weight: bold;
               margin-bottom: 8rpx;
+              
+              .hospital-short {
+                display: block;
+                font-size: 22rpx;
+                color: #999;
+                font-weight: normal;
+                margin-top: 6rpx;
+              }
             }
             
             .hospital-address {

--
Gitblit v1.9.1