From 2f09efc660bf2cc94cbc5291ad25ca06fc9bdadf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 24 一月 2026 22:03:09 +0800
Subject: [PATCH] feat: 增加OCR测试,车辆

---
 app/pagesTask/components/HospitalSelector.vue |   50 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/app/pagesTask/components/HospitalSelector.vue b/app/pagesTask/components/HospitalSelector.vue
index 6d6443e..fc57c40 100644
--- a/app/pagesTask/components/HospitalSelector.vue
+++ b/app/pagesTask/components/HospitalSelector.vue
@@ -57,7 +57,7 @@
 </template>
 
 <script>
-import { searchHospitals } from "@/api/hospital"
+import { searchHospitals, searchHospitalsByKeywords } from "@/api/hospital"
 import { searchTianDiTuAddress } from "@/api/map"
 
 export default {
@@ -179,15 +179,38 @@
       }, 300)
     },
     
-    // 鎼滅储鍖婚櫌
+    // 鎼滅储鍖婚櫌锛堟櫤鑳介�夋嫨鎺ュ彛锛�
     searchHospital(keyword) {
-      searchHospitals(keyword, this.deptId).then(response => {
-        this.searchResults = response.data || []
-        this.showResults = true
-      }).catch(error => {
-        console.error('鎼滅储鍖婚櫌澶辫触:', error)
-        this.searchResults = []
-      })
+      // 濡傛灉鍏抽敭璇嶄负绌烘垨鑰呮槸"瀹朵腑"锛屼娇鐢ㄥ師鏉ョ殑鎺ュ彛
+      if (!keyword || keyword.trim() === '' || keyword.trim() === '瀹朵腑') {
+        searchHospitals(keyword || '', this.deptId).then(response => {
+          this.searchResults = response.data || []
+          this.showResults = true
+        }).catch(error => {
+          // console.error('鎼滅储鍖婚櫌澶辫触:', error)
+          this.searchResults = []
+          // this.showResults = false
+        })
+      } else {
+        // 鏈夊叧閿瘝鏃讹紝浣跨敤鏂扮殑鍒嗚瘝鍖归厤鎺ュ彛
+        searchHospitalsByKeywords(keyword, this.deptId).then(response => {
+          // 杞崲鏁版嵁鏍煎紡锛氭彁鍙� hospital 瀵硅薄
+          const rawData = response.data || []
+          this.searchResults = rawData.map(item => {
+            // 濡傛灉鏁版嵁缁撴瀯鏄� {hospital: {...}, matchScore: ...}
+            if (item.hospital) {
+              return item.hospital
+            }
+            // 濡傛灉宸茬粡鏄尰闄㈠璞★紝鐩存帴杩斿洖
+            return item
+          })
+          this.showResults = true
+        }).catch(error => {
+          // console.error('鎼滅储鍖婚櫌澶辫触:', error)
+          this.searchResults = []
+          // this.showResults = false
+        })
+      }
     },
     
     // 杈撳叆妗嗚幏寰楃劍鐐�
@@ -208,16 +231,17 @@
       }
     },
     
-    // 鍔犺浇榛樿鍖婚櫌鍒楄〃
+    // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堜娇鐢ㄥ師鏉ョ殑鎺ュ彛锛�
     loadDefaultHospitals() {
+      // 浣跨敤鍘熸潵鐨勬帴鍙e姞杞介粯璁ゅ垪琛�
       searchHospitals('', this.deptId).then(response => {
         this.defaultHospitals = response.data || []
         this.searchResults = this.defaultHospitals
         this.showResults = true
         this.hasLoadedDefault = true
-        console.log('鍔犺浇榛樿鍖婚櫌鍒楄〃锛屾暟閲�:', this.defaultHospitals.length)
+        // console.log('鍔犺浇榛樿鍖婚櫌鍒楄〃锛屾暟閲�:', this.defaultHospitals.length)
       }).catch(error => {
-        console.error('鍔犺浇榛樿鍖婚櫌鍒楄〃澶辫触:', error)
+        // console.error('鍔犺浇榛樿鍖婚櫌鍒楄〃澶辫触:', error)
         this.defaultHospitals = []
       })
     },
@@ -303,7 +327,7 @@
           this.showAddressSuggestions = false
         }
       }).catch(error => {
-        console.error('鎼滅储鍦板潃澶辫触:', error)
+        // console.error('鎼滅储鍦板潃澶辫触:', error)
         this.addressSuggestions = []
         this.showAddressSuggestions = false
       })

--
Gitblit v1.9.1