From 13a31edf7f569cdcf15d3c43a476a2c947f47fbf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 09 十一月 2025 22:33:24 +0800
Subject: [PATCH] feat: 增加hospdata表,同步sqlserver过来
---
app/pages/task/create-emergency.vue | 129 +++++++++++++++++++++----------------------
1 files changed, 63 insertions(+), 66 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index 4ad6a63..9621a62 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -506,7 +506,7 @@
import { addTask } from "@/api/task"
import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
import { calculateDistance, baiduDistanceByAddress, baiduPlaceSuggestion } from "@/api/map"
-import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals } from "@/api/hospital"
+import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals, searchHospitalsByDeptRegion } from "@/api/hospital"
import { listUser } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
@@ -720,11 +720,14 @@
this.selectedOrganizationServiceOrderClass = selected.serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
// 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎鈥滃垎鍏徃鈥濆悗缂�锛�
// 渚嬪锛氣�滃箍宸炲垎鍏徃鈥� -> 鈥滃箍宸炩��
- this.selectedRegion = selected.deptName.replace(/鍒嗗叕鍙�$/g, '').trim()
+ //濡傛灉鍑虹幇骞垮窞鎬诲叕鍙革紝涔熻鍘婚櫎鈥滄�诲叕鍙糕�濆悗缂�
+ this.selectedRegion = this.replaceRegion(selected.deptName);
// 閲嶆柊鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
this.loadDefaultHospitals()
},
-
+ replaceRegion(region){
+ return region.replace(/(鍒嗗叕鍙竱鎬诲叕鍙竱鎬婚儴)$/g, '').trim();
+ },
// 鍔犺浇鍒嗗叕鍙告暟鎹紙parent_id=100鐨勯儴闂級
loadBranchCompanies() {
listBranchCompany().then(response => {
@@ -744,7 +747,7 @@
this.selectedOrganizationId = this.organizationOptions[index].deptId // 淇濆瓨閮ㄩ棬ID
this.selectedOrganizationServiceOrderClass = this.organizationOptions[index].serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
// 鎻愬彇鍦板煙鍏抽敭璇�
- this.selectedRegion = this.selectedOrganization.replace(/鍒嗗叕鍙�$/g, '').trim()
+ this.selectedRegion =this.replaceRegion(this.selectedOrganization);
console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鏈嶅姟鍗曠紪鐮�:', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion)
// 鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
this.loadDefaultHospitals()
@@ -865,57 +868,17 @@
// 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝父鐢ㄥ尰闄級
loadDefaultHospitals() {
- // 妫�鏌ユ槸鍚︽湁鏈嶅姟鍗曠紪鐮�
- if (!this.selectedOrganizationServiceOrderClass) {
- console.warn('鏈壘鍒版湇鍔″崟缂栫爜锛屾棤娉曞姞杞藉父鐢ㄥ尰闄�')
- // 濡傛灉娌℃湁鏈嶅姟鍗曠紪鐮侊紝闄嶇骇涓烘櫘閫氭悳绱紙鎸夊湴鍩熻繃婊わ級
- this.loadDefaultHospitalsByRegion()
+ // 妫�鏌ユ槸鍚︽湁褰掑睘鏈烘瀯ID
+ if (!this.selectedOrganizationId) {
+ console.warn('鏈�夋嫨褰掑睘鏈烘瀯锛屾棤娉曞姞杞藉尰闄㈠垪琛�')
return
}
- // 杞嚭鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍑哄尰闄�
- getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
- this.hospitalOutResults = response.data || []
- console.log('鍔犺浇甯哥敤杞嚭鍖婚櫌锛�', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion, '鏁伴噺:', this.hospitalOutResults.length)
-
- // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
- if (this.hospitalOutResults.length === 0) {
- console.log('鏈壘鍒板父鐢ㄨ浆鍑哄尰闄紝闄嶇骇涓哄湴鍩熸悳绱�')
- searchHospitals('', this.selectedRegion).then(res => {
- this.hospitalOutResults = res.data || []
- })
- }
- }).catch(error => {
- console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
- // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
- searchHospitals('', this.selectedRegion).then(res => {
- this.hospitalOutResults = res.data || []
- })
- })
+ // 杞嚭鍖婚櫌锛氭牴鎹綊灞炴満鏋勭殑鍖哄煙閰嶇疆鍔犺浇
+ this.loadHospitalsByDeptRegion('out')
- // 杞叆鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍏ュ尰闄紙鏈湴鍖哄煙浼樺厛锛�
- getFrequentInHospitals(this.selectedOrganizationServiceOrderClass, '').then(response => {
- const allHospitals = response.data || []
- // 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- console.log('鍔犺浇甯哥敤杞叆鍖婚櫌锛�', this.selectedOrganizationServiceOrderClass, '鏁伴噺:', this.hospitalInResults.length)
-
- // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
- if (this.hospitalInResults.length === 0) {
- console.log('鏈壘鍒板父鐢ㄨ浆鍏ュ尰闄紝闄嶇骇涓哄叏閮ㄥ尰闄�')
- searchHospitals('', '').then(res => {
- const allHospitals = res.data || []
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- })
- }
- }).catch(error => {
- console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
- // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
- searchHospitals('', '').then(res => {
- const allHospitals = res.data || []
- this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
- })
- })
+ // 杞叆鍖婚櫌锛氭牴鎹綊灞炴満鏋勭殑鍖哄煙閰嶇疆鍔犺浇
+ this.loadHospitalsByDeptRegion('in')
},
// 闄嶇骇鍔犺浇鍖婚櫌锛堟寜鍦板煙杩囨护锛�
@@ -938,6 +901,33 @@
}).catch(error => {
console.error('鍔犺浇杞叆鍖婚櫌鍒楄〃澶辫触:', error)
this.hospitalInResults = []
+ })
+ },
+
+ // 鏍规嵁閮ㄩ棬鍖哄煙閰嶇疆鍔犺浇鍖婚櫌
+ loadHospitalsByDeptRegion(type) {
+ const deptId = this.selectedOrganizationId
+ if (!deptId) {
+ console.warn('閮ㄩ棬ID涓嶅瓨鍦�')
+ return
+ }
+
+ // 璋冪敤鍚庣鎺ュ彛锛屾牴鎹儴闂ㄧ殑鍖哄煙閰嶇疆鏌ヨ鍖婚櫌
+ searchHospitalsByDeptRegion('', deptId).then(response => {
+ const hospitals = response.data || []
+
+ if (type === 'out') {
+ this.hospitalOutResults = hospitals
+ console.log('鍔犺浇杞嚭鍖婚櫌锛堝尯鍩熼厤缃級锛氶儴闂�', deptId, '鏁伴噺:', this.hospitalOutResults.length)
+ } else if (type === 'in') {
+ // 杞叆鍖婚櫌鎸夊湴鍩熸帓搴�
+ this.hospitalInResults = this.sortHospitalsByRegion(hospitals)
+ console.log('鍔犺浇杞叆鍖婚櫌锛堝尯鍩熼厤缃級锛氶儴闂�', deptId, '鏁伴噺:', this.hospitalInResults.length)
+ }
+ }).catch(error => {
+ console.error('鍔犺浇鍖婚櫌澶辫触锛堝尯鍩熼厤缃級:', error)
+ // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
+ this.loadDefaultHospitalsByRegion()
})
},
@@ -995,21 +985,21 @@
this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
// 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
if (this.hospitalOutResults.length === 0) {
- searchHospitals('', this.selectedRegion).then(res => {
+ searchHospitals('', this.selectedOrganizationId).then(res => {
const hospitals = res.data || []
this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
})
}
}).catch(error => {
console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
- searchHospitals('', this.selectedRegion).then(res => {
+ searchHospitals('', this.selectedOrganizationId).then(res => {
const hospitals = res.data || []
this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
})
})
} else {
// 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
- searchHospitals('', this.selectedRegion).then(response => {
+ searchHospitals('', this.selectedOrganizationId).then(response => {
const hospitals = response.data || []
this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
}).catch(error => {
@@ -1033,7 +1023,7 @@
// 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず褰撳墠鍖哄煙鐨勫尰闄�
if (!keyword || keyword.trim() === '') {
- searchHospitals('', this.selectedRegion).then(response => {
+ searchHospitals('', this.selectedOrganizationId).then(response => {
const hospitals = response.data || []
// 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
@@ -1053,13 +1043,13 @@
// 鎼滅储杞嚭鍖婚櫌锛堜粎闄愬綋鍓嶅尯鍩燂級
searchHospitalOut(keyword) {
- // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护锛屽彧鎼滅储褰撳墠鍖哄煙鐨勫尰闄�
- searchHospitals(keyword, this.selectedRegion).then(response => {
+ // 浼犲叆鍏抽敭璇嶅拰閮ㄩ棬ID锛屽彧鎼滅储褰撳墠鍖哄煙鐨勫尰闄�
+ searchHospitals(keyword, this.selectedOrganizationId).then(response => {
const hospitals = response.data || []
// 纭繚"瀹朵腑"鍦ㄦ渶鍓嶉潰
this.hospitalOutResults = this.sortHospitalsByRegion(hospitals)
this.showHospitalOutResults = true
- console.log('鎼滅储杞嚭鍖婚櫌:', keyword, '鍖哄煙:', this.selectedRegion, '缁撴灉鏁�:', this.hospitalOutResults.length)
+ console.log('鎼滅储杞嚭鍖婚櫌:', keyword, '閮ㄩ棬ID:', this.selectedOrganizationId, '缁撴灉鏁�:', this.hospitalOutResults.length)
}).catch(error => {
console.error('鎼滅储杞嚭鍖婚櫌澶辫触:', error)
this.hospitalOutResults = []
@@ -1123,21 +1113,21 @@
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
// 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
if (this.hospitalInResults.length === 0) {
- searchHospitals('', '').then(res => {
+ searchHospitals('', null).then(res => {
const allHospitals = res.data || []
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
})
}
}).catch(error => {
console.error('鍔犺浇甯哥敤杞叆鍖婚櫌澶辫触:', error)
- searchHospitals('', '').then(res => {
+ searchHospitals('', null).then(res => {
const allHospitals = res.data || []
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
})
})
} else {
// 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
- searchHospitals('', '').then(response => {
+ searchHospitals('', null).then(response => {
const allHospitals = response.data || []
// 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
@@ -1162,7 +1152,7 @@
// 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず鎵�鏈夊尰闄紙鏈湴鍖哄煙浼樺厛锛�
if (!keyword || keyword.trim() === '') {
- searchHospitals('', '').then(response => {
+ searchHospitals('', null).then(response => {
const allHospitals = response.data || []
// 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
@@ -1182,8 +1172,8 @@
// 鎼滅储杞叆鍖婚櫌锛堜笉闄愬尯鍩燂紝浣嗘湰鍦板尯鍩熶紭鍏堬級
searchHospitalIn(keyword) {
- // 浼犲叆鍏抽敭璇嶏紝涓嶄紶鍦板煙杩囨护锛堟悳绱㈡墍鏈夊尯鍩燂級
- searchHospitals(keyword, '').then(response => {
+ // 浼犲叆鍏抽敭璇嶏紝涓嶄紶閮ㄩ棬ID锛堟悳绱㈡墍鏈夊尯鍩燂級
+ searchHospitals(keyword, null).then(response => {
const allHospitals = response.data || []
// 鎸夊湴鍩熸帓搴忥細"瀹朵腑"鏈�鍓嶏紝鏈湴鍖哄煙浼樺厛
this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
@@ -1888,11 +1878,18 @@
addTask(submitData).then(response => {
this.loading = false
this.$modal.showToast('浠诲姟鍒涘缓鎴愬姛')
+
+ // 寤惰繜璺宠浆锛岃鐢ㄦ埛鐪嬪埌鎴愬姛鎻愮ず
setTimeout(() => {
+ // 璺宠浆鍒颁换鍔″垪琛ㄥ苟瑙﹀彂鍒锋柊
uni.switchTab({
- url: '/pages/task/index'
+ url: '/pages/task/index',
+ success: () => {
+ // 浣跨敤浜嬩欢鎬荤嚎閫氱煡浠诲姟鍒楄〃椤甸潰鍒锋柊
+ uni.$emit('refreshTaskList')
+ }
})
- }, 1500)
+ }, 1000)
}).catch(error => {
this.loading = false
console.error('浠诲姟鍒涘缓澶辫触:', error)
--
Gitblit v1.9.1