From f3a294e8fc21a26a1a1eeebbd569142e236eddb5 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 07 十一月 2025 12:02:37 +0800
Subject: [PATCH] fix:优化 评价
---
app/pages/task/create-emergency.vue | 791 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 658 insertions(+), 133 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index df6c704..094a808 100644
--- a/app/pages/task/create-emergency.vue
+++ b/app/pages/task/create-emergency.vue
@@ -4,27 +4,55 @@
<view class="back-btn" @click="goBack">
<uni-icons type="arrowleft" size="20"></uni-icons>
</view>
- <view class="title">鍒涘缓鎬ユ晳杞繍浠诲姟</view>
+ <view class="title">鍒涘缓杞繍浠诲姟</view>
</view>
<view class="form-section">
<view class="form-item">
- <view class="form-label">浠诲姟杞﹁締</view>
- <picker mode="selector" :range="vehicles" @change="onVehicleChange">
+ <view class="form-label required">浠诲姟杞﹁締</view>
+ <picker mode="selector" :range="vehicles" :value="selectedVehicleIndex" @change="onVehicleChange">
<view class="form-input picker-input">
{{ selectedVehicle || '璇烽�夋嫨浠诲姟杞﹁締' }}
<uni-icons type="arrowright" size="16" color="#999"></uni-icons>
</view>
</picker>
</view>
+ <view class="form-item">
+ <view class="form-label required">褰掑睘鏈烘瀯</view>
+ <picker mode="selector" :range="organizations" @change="onOrganizationChange">
+ <view class="form-input picker-input">
+ {{ selectedOrganization || '璇烽�夋嫨褰掑睘鏈烘瀯' }}
+ <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+ </view>
+ </picker>
+ </view>
+ <view class="form-item">
+ <view class="form-label required">浠诲姟绫诲瀷</view>
+ <picker mode="selector" :range="emergencyTaskTypeOptions" range-key="text" @change="onEmergencyTaskTypeChange">
+ <view class="form-input picker-input">
+ {{ selectedEmergencyTaskType || '璇烽�夋嫨浠诲姟绫诲瀷' }}
+ <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+ </view>
+ </picker>
+ </view>
+
+ <view class="form-item">
+ <view class="form-label required">鍗曟嵁绫诲瀷</view>
+ <picker mode="selector" :range="documentTypeOptions" range-key="text" @change="onDocumentTypeChange">
+ <view class="form-input picker-input">
+ {{ selectedDocumentType || '璇烽�夋嫨鍗曟嵁绫诲瀷' }}
+ <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
+ </view>
+ </picker>
+ </view>
<view class="form-item">
<view class="form-label">鎵ц浠诲姟浜哄憳</view>
<view class="staff-list">
<view class="staff-item" v-for="(staff, index) in selectedStaff" :key="staff.userId">
<view class="staff-info">
<text class="staff-name">{{ staff.nickName }}</text>
- <text class="staff-role">({{ staff.postName || staff.roleName || '鏈煡鑱屼綅' }})</text>
+ <text class="staff-role">({{ getUserTypeName(staff.type) || '鏈煡鑱屼綅' }})</text>
</view>
<uni-icons
v-if="index > 0"
@@ -47,28 +75,10 @@
</view>
</view>
- <view class="form-item">
- <view class="form-label">褰掑睘鏈烘瀯</view>
- <picker mode="selector" :range="organizations" @change="onOrganizationChange">
- <view class="form-input picker-input">
- {{ selectedOrganization || '璇烽�夋嫨褰掑睘鏈烘瀯' }}
- <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
- </view>
- </picker>
- </view>
+
<view class="form-item">
- <view class="form-label">浠诲姟绫诲瀷</view>
- <picker mode="selector" :range="emergencyTaskTypes" @change="onEmergencyTaskTypeChange">
- <view class="form-input picker-input">
- {{ selectedEmergencyTaskType || '璇烽�夋嫨浠诲姟绫诲瀷' }}
- <uni-icons type="arrowright" size="16" color="#999"></uni-icons>
- </view>
- </picker>
- </view>
-
- <view class="form-item">
- <view class="form-label">杞繍鏃堕棿</view>
+ <view class="form-label required">杞繍鏃堕棿</view>
<uni-datetime-picker
v-model="taskForm.transferTime"
type="datetime"
@@ -79,7 +89,7 @@
<view class="form-section-title">鎮h�呬俊鎭�</view>
<view class="form-item">
- <view class="form-label">鑱旂郴浜�</view>
+ <view class="form-label required">鑱旂郴浜�</view>
<input
class="form-input"
placeholder="璇疯緭鍏ヨ仈绯讳汉"
@@ -88,7 +98,7 @@
</view>
<view class="form-item">
- <view class="form-label">鑱旂郴鐢佃瘽</view>
+ <view class="form-label required">鑱旂郴鐢佃瘽</view>
<input
class="form-input"
type="number"
@@ -98,7 +108,7 @@
</view>
<view class="form-item">
- <view class="form-label">鎮h�呭鍚�</view>
+ <view class="form-label required">鎮h�呭鍚�</view>
<input
class="form-input"
placeholder="璇疯緭鍏ユ偅鑰呭鍚�"
@@ -163,7 +173,7 @@
<view class="form-section-title">杞嚭鍖婚櫌淇℃伅</view>
<view class="form-item">
- <view class="form-label">鍖婚櫌鍚嶇О</view>
+ <view class="form-label required">鍖婚櫌鍚嶇О</view>
<view class="hospital-search-container">
<input
class="form-input"
@@ -180,15 +190,15 @@
@click="selectHospitalOut(hospital)"
>
<view class="hospital-name">{{ hospital.hospName }}</view>
- <view class="hospital-address">{{ hospital.hospAddress }}</view>
+ <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
</view>
</view>
</view>
</view>
<view class="form-item">
- <view class="form-label">绉戝</view>
- <picker mode="selector" :range="departmentOptions" range-key="dictLabel" @change="onHospitalOutDepartmentChange">
+ <view class="form-label required">绉戝</view>
+ <picker 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>
@@ -214,7 +224,7 @@
<view class="form-section-title">杞叆鍖婚櫌淇℃伅</view>
<view class="form-item">
- <view class="form-label">鍖婚櫌鍚嶇О</view>
+ <view class="form-label required">鍖婚櫌鍚嶇О</view>
<view class="hospital-search-container">
<input
class="form-input"
@@ -231,15 +241,15 @@
@click="selectHospitalIn(hospital)"
>
<view class="hospital-name">{{ hospital.hospName }}</view>
- <view class="hospital-address">{{ hospital.hospAddress }}</view>
+ <view class="hospital-address">{{ buildFullAddress(hospital) }}</view>
</view>
</view>
</view>
</view>
<view class="form-item">
- <view class="form-label">绉戝</view>
- <picker mode="selector" :range="departmentOptions" range-key="dictLabel" @change="onHospitalInDepartmentChange">
+ <view class="form-label required">绉戝</view>
+ <picker 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>
@@ -264,7 +274,7 @@
</view>
<view class="form-item">
- <view class="form-label">杞繍鍏噷鏁�</view>
+ <view class="form-label required">杞繍鍏噷鏁�</view>
<input
class="form-input"
type="digit"
@@ -274,7 +284,7 @@
</view>
<view class="form-item">
- <view class="form-label">鎴愪氦浠�</view>
+ <view class="form-label required">鎴愪氦浠�</view>
<input
class="form-input"
type="digit"
@@ -313,14 +323,14 @@
<view class="staff-filter">
<view
class="filter-item"
- :class="{ active: staffFilterType === 'all' }"
- @click="filterStaff('all')"
- >鍏ㄩ儴</view>
- <view
- class="filter-item"
:class="{ active: staffFilterType === 'driver' }"
@click="filterStaff('driver')"
>鍙告満</view>
+ <view
+ class="filter-item"
+ :class="{ active: staffFilterType === 'doctor' }"
+ @click="filterStaff('doctor')"
+ >鍖荤敓</view>
<view
class="filter-item"
:class="{ active: staffFilterType === 'nurse' }"
@@ -342,7 +352,7 @@
</view>
<view class="staff-detail-row">
<text class="staff-dept">{{ staff.deptName }}</text>
- <text class="staff-post">{{ staff.postName || staff.roleName || '鏈煡鑱屼綅' }}</text>
+ <text class="staff-post">{{ staff.postName || staff.roleName || '鏈煡鑱屼綅' }}</text>
</view>
</view>
<uni-icons
@@ -433,12 +443,14 @@
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
import { addTask } from "@/api/task"
import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
-import { calculateDistance } from "@/api/map"
-import { searchHospitals } from "@/api/hospital"
+import { calculateDistance, baiduDistanceByAddress } from "@/api/map"
+import { searchHospitals, getFrequentOutHospitals, getFrequentInHospitals } from "@/api/hospital"
import { listUser } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
-import { getUserProfile } from "@/api/system/user"
+
import { getDicts } from "@/api/dict"
+import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
+import { listBranchCompany, getDept } from "@/api/system/dept"
import MapSelector from '@/components/map-selector.vue'
export default {
@@ -452,7 +464,13 @@
selectedVehicle: '',
selectedVehicleId: null,
selectedOrganization: '',
- selectedEmergencyTaskType: '',
+ selectedOrganizationId: null, // 褰掑睘鏈烘瀯ID锛堥儴闂↖D锛�
+ selectedOrganizationServiceOrderClass: '', // 褰掑睘鏈烘瀯鐨勬湇鍔″崟缂栫爜
+ selectedRegion: '', // 浠庡綊灞炴満鏋勪腑鎻愬彇鐨勫湴鍩熶俊鎭紙濡傦細骞垮窞銆佹繁鍦崇瓑锛�
+ selectedEmergencyTaskType: '', // 閫変腑鐨勪换鍔$被鍨嬫枃鏈�
+ selectedEmergencyTaskTypeId: null, // 閫変腑鐨勪换鍔$被鍨婭D
+ selectedDocumentType: '', // 閫変腑鐨勫崟鎹被鍨嬫枃鏈�
+ selectedDocumentTypeId: null, // 閫変腑鐨勫崟鎹被鍨婭D
mapSelectorType: '',
// 鍖婚櫌鎼滅储鐩稿叧
hospitalOutSearchKeyword: '',
@@ -468,7 +486,7 @@
allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
filteredStaffList: [], // 杩囨护鍚庣殑浜哄憳鍒楄〃
staffSearchKeyword: '', // 浜哄憳鎼滅储鍏抽敭璇�
- staffFilterType: 'all', // 浜哄憳绛涢�夌被鍨嬶細all/driver/nurse
+ staffFilterType: 'driver', // 浜哄憳绛涢�夌被鍨嬶細driver/doctor/nurse锛岄粯璁ら�変腑鍙告満
// 鐥呮儏閫夋嫨鐩稿叧
selectedDiseases: [], // 宸查�夋嫨鐨勭梾鎯呭垪琛�
tempSelectedDiseases: [], // 涓存椂閫夋嫨鐨勭梾鎯呭垪琛紙鐢ㄤ簬寮圭獥锛�
@@ -486,14 +504,18 @@
condition: ''
},
hospitalOut: {
+ id: null, // 鍖婚櫌ID
name: '',
department: '',
+ departmentId: null, // 绉戝ID
bedNumber: '',
address: ''
},
hospitalIn: {
+ id: null, // 鍖婚櫌ID
name: '',
department: '',
+ departmentId: null, // 绉戝ID
bedNumber: '',
address: ''
},
@@ -502,8 +524,12 @@
},
vehicles: [],
vehicleOptions: [],
- organizations: ['骞垮窞鍒嗗叕鍙�', '娣卞湷鍒嗗叕鍙�', '鐝犳捣鍒嗗叕鍙�', '浣涘北鍒嗗叕鍙�'],
- emergencyTaskTypes: ['鎬ユ晳杞繍', '鑸┖杞繍'],
+ organizations: [], // 褰掑睘鏈烘瀯鍒楄〃锛堜粠鍚庡彴鍔犺浇鍒嗗叕鍙告暟鎹級
+ organizationOptions: [], // 褰掑睘鏈烘瀯閫夐」锛堢敤浜巔icker鏄剧ず锛�
+ emergencyTaskTypes: [], // 浠诲姟绫诲瀷鍒楄〃锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
+ emergencyTaskTypeOptions: [], // 浠诲姟绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
+ documentTypes: [], // 鍗曟嵁绫诲瀷鍒楄〃
+ documentTypeOptions: [], // 鍗曟嵁绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
departmentOptions: [], // 绉戝瀛楀吀鏁版嵁
loading: false,
addressCoordinates: {
@@ -516,40 +542,60 @@
...mapState({
currentUser: state => ({
userId: state.user.userId,
- name: state.user.name || '寮犱笁',
- nickName: state.user.nickName || state.user.name || '寮犱笁',
+ name: state.user.nickName || '寮犱笁',
+ nickName: state.user.nickName || '寮犱笁',
position: '鍙告満',
deptId: state.user.deptId || 100,
phonenumber: state.user.phonenumber || '',
branchCompanyId: state.user.branchCompanyId,
branchCompanyName: state.user.branchCompanyName
})
- })
+ }),
+ // 璁$畻杞﹁締鍦╬icker涓殑绱㈠紩锛岀敤浜庨粯璁ら�変腑
+ selectedVehicleIndex() {
+ if (!this.selectedVehicle || this.vehicles.length === 0) {
+ return 0
+ }
+ const index = this.vehicles.findIndex(v => v === this.selectedVehicle)
+ return index !== -1 ? index : 0
+ }
},
onLoad(options) {
+ // 璁剧疆榛樿杞繍鏃堕棿涓哄綋鍓嶆椂闂�
+ this.setDefaultTransferTime()
+
// 鍏堝姞杞借溅杈嗗垪琛紝鐒跺悗鍔犺浇缁戝畾杞﹁締淇℃伅
this.getAvailableVehicles().then(() => {
this.getUserBoundVehicleInfo()
})
this.initSelectedStaff()
this.loadDeptStaff()
- // 璁剧疆榛樿褰掑睘鏈烘瀯
- if (this.currentUser.branchCompanyName) {
- this.selectedOrganization = this.currentUser.branchCompanyName
- }
- // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝墠100鏉★級
- this.loadDefaultHospitals()
+ // 鍔犺浇鍒嗗叕鍙告暟鎹紙浼氳嚜鍔ㄨ缃粯璁ゅ垎鍏徃骞跺姞杞藉尰闄㈠垪琛級
+ this.loadBranchCompanies()
// 鍔犺浇绉戝瀛楀吀鏁版嵁
this.loadDepartments()
+ // 鍔犺浇浠诲姟绫诲瀷鏁版嵁
+ this.loadEmergencyTaskTypes()
+ // 鍔犺浇鍗曟嵁绫诲瀷鏁版嵁
+ this.loadDocumentTypes()
},
methods: {
// 鑾峰彇鐢ㄦ埛缁戝畾鐨勮溅杈嗕俊鎭�
getUserBoundVehicleInfo() {
- getUserProfile().then(response => {
- const userInfo = response.data || response
- if (userInfo.boundVehicle) {
- const boundVehicleNo = userInfo.boundVehicle.vehicleNumber
- const boundVehicleId = userInfo.boundVehicle.vehicleId
+ const userId = this.currentUser.userId
+ if (!userId) {
+ console.warn('鐢ㄦ埛ID涓嶅瓨鍦紝鏃犳硶鑾峰彇缁戝畾杞﹁締')
+ return
+ }
+
+ getUserBoundVehicle(userId).then(response => {
+ const boundVehicle = response.data
+
+ if (boundVehicle && boundVehicle.vehicleId) {
+ const boundVehicleNo = boundVehicle.vehicleNo
+ const boundVehicleId = boundVehicle.vehicleId
+
+ console.log('鐢ㄦ埛缁戝畾鐨勮溅杈�:', boundVehicleNo, 'ID:', boundVehicleId)
// 鍦ㄨ溅杈嗗垪琛ㄤ腑鏌ユ壘缁戝畾鐨勮溅杈�
const vehicleIndex = this.vehicleOptions.findIndex(v =>
@@ -560,7 +606,12 @@
// 璁剧疆榛樿閫変腑鐨勮溅杈�
this.selectedVehicle = this.vehicleOptions[vehicleIndex].name
this.selectedVehicleId = this.vehicleOptions[vehicleIndex].id
+ console.log('榛樿閫変腑杞﹁締:', this.selectedVehicle)
+ } else {
+ console.warn('缁戝畾鐨勮溅杈嗕笉鍦ㄥ彲鐢ㄨ溅杈嗗垪琛ㄤ腑')
}
+ } else {
+ console.log('鐢ㄦ埛鏈粦瀹氳溅杈�')
}
}).catch(error => {
console.error('鑾峰彇鐢ㄦ埛缁戝畾杞﹁締淇℃伅澶辫触:', error)
@@ -568,17 +619,21 @@
},
getAvailableVehicles() {
- const deptId = this.currentUser.deptId
- return listAvailableVehicles(deptId, 'EMERGENCY').then(response => {
- const vehicleList = response.data || response.rows || []
+ // 鏍规嵁鐢ㄦ埛鏈夋潈闄愮鐞嗙殑鍒嗗叕鍙革紝鏌ヨ鎵�鏈夊彲鐢ㄨ溅杈�
+ return listAvailableVehicles(null, 'EMERGENCY').then(response => {
+ const vehicleList = response.data || []
this.vehicleOptions = vehicleList.map(vehicle => ({
id: vehicle.vehicleId,
name: vehicle.vehicleNo,
type: vehicle.vehicleType,
- status: vehicle.status
+ status: vehicle.status,
+ deptNames: vehicle.deptNames || [] // 杞﹁締褰掑睘鐨勫涓垎鍏徃
}))
+ // 鍙樉绀鸿溅鐗屽彿锛屼笉鏄剧ず鍒嗗叕鍙�
this.vehicles = this.vehicleOptions.map(v => v.name)
- }).catch(() => {
+ console.log('鍔犺浇鍙敤杞﹁締鏁伴噺:', this.vehicles.length)
+ }).catch(error => {
+ console.error('鍔犺浇杞﹁締鍒楄〃澶辫触:', error)
this.vehicles = []
})
},
@@ -590,54 +645,297 @@
},
onOrganizationChange(e) {
- this.selectedOrganization = this.organizations[e.detail.value]
+ const index = e.detail.value
+ const selected = this.organizationOptions[index]
+ this.selectedOrganization = selected.deptName
+ this.selectedOrganizationId = selected.deptId // 淇濆瓨閮ㄩ棬ID
+ this.selectedOrganizationServiceOrderClass = selected.serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
+ // 浠庡綊灞炴満鏋勪腑鎻愬彇鍦板煙鍏抽敭璇嶏紙鍘婚櫎鈥滃垎鍏徃鈥濆悗缂�锛�
+ // 渚嬪锛氣�滃箍宸炲垎鍏徃鈥� -> 鈥滃箍宸炩��
+ this.selectedRegion = selected.deptName.replace(/鍒嗗叕鍙�$/g, '').trim()
+ // 閲嶆柊鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
+ this.loadDefaultHospitals()
},
- onEmergencyTaskTypeChange(e) {
- this.selectedEmergencyTaskType = this.emergencyTaskTypes[e.detail.value]
- },
-
- // 鍔犺浇绉戝瀛楀吀鏁版嵁
- loadDepartments() {
- getDicts('hospital_department').then(response => {
- this.departmentOptions = response.data || []
+ // 鍔犺浇鍒嗗叕鍙告暟鎹紙parent_id=100鐨勯儴闂級
+ loadBranchCompanies() {
+ listBranchCompany().then(response => {
+ const list = response.data || []
+ // 杩囨护鍑� parent_id = 100 鐨勯儴闂紙鍒嗗叕鍙革級
+ this.organizationOptions = list.filter(dept => dept.parentId === 100)
+ // 鐢熸垚picker鐨勬暟鎹簮锛堝彧鏄剧ず鍚嶇О锛�
+ this.organizations = this.organizationOptions.map(dept => dept.deptName)
+
+ // 榛樿璁剧疆涓哄綋鍓嶇敤鎴风殑鍒嗗叕鍙�
+ if (this.currentUser.branchCompanyName) {
+ const index = this.organizationOptions.findIndex(
+ dept => dept.deptName === this.currentUser.branchCompanyName
+ )
+ if (index !== -1) {
+ this.selectedOrganization = this.currentUser.branchCompanyName
+ this.selectedOrganizationId = this.organizationOptions[index].deptId // 淇濆瓨閮ㄩ棬ID
+ this.selectedOrganizationServiceOrderClass = this.organizationOptions[index].serviceOrderClass || '' // 淇濆瓨鏈嶅姟鍗曠紪鐮�
+ // 鎻愬彇鍦板煙鍏抽敭璇�
+ this.selectedRegion = this.selectedOrganization.replace(/鍒嗗叕鍙�$/g, '').trim()
+ console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鏈嶅姟鍗曠紪鐮�:', this.selectedOrganizationServiceOrderClass, '鍦板煙:', this.selectedRegion)
+ // 鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
+ this.loadDefaultHospitals()
+ }
+ }
}).catch(error => {
- console.error('鍔犺浇绉戝瀛楀吀澶辫触:', error)
+ console.error('鍔犺浇鍒嗗叕鍙告暟鎹け璐�:', error)
+ this.organizationOptions = []
+ this.organizations = []
+ })
+ },
+
+ // 鍔犺浇绉戝鏁版嵁锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
+ loadDepartments() {
+ getHospitalDepartments().then(response => {
+ const list = response.data || [];
+ this.departmentOptions = list.map(item => ({
+ id: item.vID,
+ text: item.vtext,
+ dictValue: item.vtext // 涓轰簡淇濇寔鍏煎鎬э紝淇濈暀dictValue瀛楁
+ }));
+ // console.log('绉戝鏁版嵁鍔犺浇鎴愬姛:', this.departmentOptions);
+ }).catch(error => {
+ console.error('鍔犺浇绉戝鏁版嵁澶辫触:', error)
this.departmentOptions = []
})
+ },
+
+ // 鍔犺浇浠诲姟绫诲瀷鏁版嵁锛堜粠 SQL Server锛�
+ loadEmergencyTaskTypes() {
+ getServiceOrderTypes().then(response => {
+ const list = response.data || []
+ this.emergencyTaskTypes = list
+ this.emergencyTaskTypeOptions = list.map(item => ({
+ id: item.vID,
+ text: item.vtext
+ }))
+
+ // 榛樿閫変腑绗竴涓换鍔$被鍨�
+ if (this.emergencyTaskTypeOptions.length > 0) {
+ this.selectedEmergencyTaskType = this.emergencyTaskTypeOptions[0].text
+ this.selectedEmergencyTaskTypeId = this.emergencyTaskTypeOptions[0].id
+ console.log('榛樿閫変腑浠诲姟绫诲瀷:', this.selectedEmergencyTaskType)
+ }
+ }).catch(error => {
+ console.error('鍔犺浇浠诲姟绫诲瀷澶辫触:', error)
+ this.emergencyTaskTypes = []
+ this.emergencyTaskTypeOptions = []
+ })
+ },
+
+ // 浠诲姟绫诲瀷閫夋嫨
+ onEmergencyTaskTypeChange(e) {
+ const index = e.detail.value
+ const selected = this.emergencyTaskTypeOptions[index]
+ this.selectedEmergencyTaskType = selected.text
+ this.selectedEmergencyTaskTypeId = selected.id
+ },
+ getUserTypeName(staffType){
+ switch(staffType){
+ case "nurse":
+ return "鎶ゅ+";
+ case "doctor":
+ return "鍖荤敓";
+ case "driver":
+ return "鍙告満";
+ default:
+ return "鍙告満";
+ }
+ },
+
+ // 鍔犺浇鍗曟嵁绫诲瀷鏁版嵁
+ loadDocumentTypes() {
+ getServiceOrdAreaTypes().then(response => {
+ const list = response.data || []
+ this.documentTypes = list
+ this.documentTypeOptions = list.map(item => ({
+ id: item.vID,
+ text: item.vtext
+ }))
+
+ // 榛樿閫変腑绗竴涓崟鎹被鍨�
+ if (this.documentTypeOptions.length > 0) {
+ this.selectedDocumentType = this.documentTypeOptions[0].text
+ this.selectedDocumentTypeId = this.documentTypeOptions[0].id
+ console.log('榛樿閫変腑鍗曟嵁绫诲瀷:', this.selectedDocumentType)
+ }
+ }).catch(error => {
+ console.error('鍔犺浇鍗曟嵁绫诲瀷澶辫触:', error)
+ this.documentTypes = []
+ this.documentTypeOptions = []
+ })
+ },
+
+ // 鍗曟嵁绫诲瀷閫夋嫨
+ onDocumentTypeChange(e) {
+ const index = e.detail.value
+ const selected = this.documentTypeOptions[index]
+ this.selectedDocumentType = selected.text
+ this.selectedDocumentTypeId = selected.id
},
// 杞嚭鍖婚櫌绉戝閫夋嫨
onHospitalOutDepartmentChange(e) {
const index = e.detail.value
- this.taskForm.hospitalOut.department = this.departmentOptions[index].dictValue
+ const selected = this.departmentOptions[index]
+ this.taskForm.hospitalOut.department = selected.text // 淇濆瓨绉戝鍚嶇О
+ this.taskForm.hospitalOut.departmentId = selected.id // 淇濆瓨绉戝ID
},
// 杞叆鍖婚櫌绉戝閫夋嫨
onHospitalInDepartmentChange(e) {
const index = e.detail.value
- this.taskForm.hospitalIn.department = this.departmentOptions[index].dictValue
+ const selected = this.departmentOptions[index]
+ this.taskForm.hospitalIn.department = selected.text // 淇濆瓨绉戝鍚嶇О
+ this.taskForm.hospitalIn.departmentId = selected.id // 淇濆瓨绉戝ID
},
- // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝墠100鏉★級
+ // 鍔犺浇榛樿鍖婚櫌鍒楄〃锛堝父鐢ㄥ尰闄級
loadDefaultHospitals() {
- // 浼犲叆绌哄瓧绗︿覆鎴栫壒娈婃爣璇嗚幏鍙栧墠100鏉�
- searchHospitals('').then(response => {
- this.defaultHospitals = response.data || []
- // 鍚屾椂鍒濆鍖栦袱涓悳绱㈢粨鏋滀负榛樿鏁版嵁
- this.hospitalOutResults = [...this.defaultHospitals]
- this.hospitalInResults = [...this.defaultHospitals]
+ // 妫�鏌ユ槸鍚︽湁鏈嶅姟鍗曠紪鐮�
+ if (!this.selectedOrganizationServiceOrderClass) {
+ console.warn('鏈壘鍒版湇鍔″崟缂栫爜锛屾棤娉曞姞杞藉父鐢ㄥ尰闄�')
+ // 濡傛灉娌℃湁鏈嶅姟鍗曠紪鐮侊紝闄嶇骇涓烘櫘閫氭悳绱紙鎸夊湴鍩熻繃婊わ級
+ this.loadDefaultHospitalsByRegion()
+ 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)
- this.defaultHospitals = []
+ console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
+ // 澶辫触鍚庨檷绾т负鏅�氭悳绱�
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
})
+
+ // 杞叆鍖婚櫌锛氬姞杞藉綋鍓嶅垎鍏徃鐨勫父鐢ㄨ浆鍏ュ尰闄紙鏈湴鍖哄煙浼樺厛锛�
+ 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)
+ })
+ })
+ },
+
+ // 闄嶇骇鍔犺浇鍖婚櫌锛堟寜鍦板煙杩囨护锛�
+ loadDefaultHospitalsByRegion() {
+ // 杞嚭鍖婚櫌锛氬彧鍔犺浇褰撳墠鍖哄煙鐨勫尰闄紙甯﹀湴鍩熻繃婊わ級
+ searchHospitals('', this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ console.log('鍔犺浇杞嚭鍖婚櫌锛堝綋鍓嶅尯鍩燂級:', this.selectedRegion, '鏁伴噺:', this.hospitalOutResults.length)
+ }).catch(error => {
+ console.error('鍔犺浇杞嚭鍖婚櫌鍒楄〃澶辫触:', error)
+ this.hospitalOutResults = []
+ })
+
+ // 杞叆鍖婚櫌锛氬姞杞芥墍鏈夊尰闄紙涓嶅甫鍦板煙杩囨护锛屽悗缁細鎸夊湴鍩熸帓搴忥級
+ searchHospitals('', '').then(response => {
+ const allHospitals = response.data || []
+ // 灏嗗尰闄㈡寜鍦板煙鎺掑簭锛氭湰鍦板尯鍩熶紭鍏�
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ console.log('鍔犺浇杞叆鍖婚櫌锛堝叏閮ㄥ尯鍩燂級:', '鏁伴噺:', this.hospitalInResults.length)
+ }).catch(error => {
+ console.error('鍔犺浇杞叆鍖婚櫌鍒楄〃澶辫触:', error)
+ this.hospitalInResults = []
+ })
+ },
+
+ // 鎸夊湴鍩熸帓搴忓尰闄細鏈湴鍖哄煙浼樺厛
+ sortHospitalsByRegion(hospitals) {
+ if (!this.selectedRegion || !hospitals || hospitals.length === 0) {
+ return hospitals
+ }
+
+ const region = this.selectedRegion
+ const localHospitals = []
+ const otherHospitals = []
+
+ hospitals.forEach(hospital => {
+ // 鍒ゆ柇鍖婚櫌鏄惁鍦ㄦ湰鍦板尯鍩燂紙鐪併�佸競銆佸尯浠讳竴鍖呭惈鍦板煙鍏抽敭璇嶏級
+ const isLocal =
+ (hospital.hopsProvince && hospital.hopsProvince.includes(region)) ||
+ (hospital.hopsCity && hospital.hopsCity.includes(region)) ||
+ (hospital.hopsArea && hospital.hopsArea.includes(region))
+
+ if (isLocal) {
+ localHospitals.push(hospital)
+ } else {
+ otherHospitals.push(hospital)
+ }
+ })
+
+ // 鏈湴鍖婚櫌鍦ㄥ墠锛屽叾浠栧尰闄㈠湪鍚�
+ return [...localHospitals, ...otherHospitals]
},
// 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
onHospitalOutFocus() {
- // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞嚭鍖婚櫌
if (!this.hospitalOutSearchKeyword || this.hospitalOutSearchKeyword.trim() === '') {
- this.hospitalOutResults = [...this.defaultHospitals]
+ // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
+ if (this.hospitalOutResults.length > 0) {
+ this.showHospitalOutResults = true
+ return
+ }
+
+ // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
+ if (this.selectedOrganizationServiceOrderClass) {
+ getFrequentOutHospitals(this.selectedOrganizationServiceOrderClass, this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+ if (this.hospitalOutResults.length === 0) {
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
+ }
+ }).catch(error => {
+ console.error('鍔犺浇甯哥敤杞嚭鍖婚櫌澶辫触:', error)
+ searchHospitals('', this.selectedRegion).then(res => {
+ this.hospitalOutResults = res.data || []
+ })
+ })
+ } else {
+ // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
+ searchHospitals('', this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ }).catch(error => {
+ console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
+ this.hospitalOutResults = []
+ })
+ }
}
this.showHospitalOutResults = true
},
@@ -652,55 +950,98 @@
clearTimeout(this.searchTimer)
}
- // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鍙樉绀哄綋鍓嶅尯鍩熺殑鍖婚櫌
if (!keyword || keyword.trim() === '') {
- this.hospitalOutResults = [...this.defaultHospitals]
+ searchHospitals('', this.selectedRegion).then(response => {
+ this.hospitalOutResults = response.data || []
+ }).catch(error => {
+ console.error('鍔犺浇杞嚭鍖婚櫌澶辫触:', error)
+ this.hospitalOutResults = []
+ })
this.showHospitalOutResults = true
return
}
- // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
+ // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储锛堜粎闄愬綋鍓嶅尯鍩燂級
this.searchTimer = setTimeout(() => {
this.searchHospitalOut(keyword)
}, 300)
},
- // 鎼滅储杞嚭鍖婚櫌
+ // 鎼滅储杞嚭鍖婚櫌锛堜粎闄愬綋鍓嶅尯鍩燂級
searchHospitalOut(keyword) {
- searchHospitals(keyword).then(response => {
+ // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护锛屽彧鎼滅储褰撳墠鍖哄煙鐨勫尰闄�
+ searchHospitals(keyword, this.selectedRegion).then(response => {
this.hospitalOutResults = response.data || []
this.showHospitalOutResults = true
+ console.log('鎼滅储杞嚭鍖婚櫌:', keyword, '鍖哄煙:', this.selectedRegion, '缁撴灉鏁�:', this.hospitalOutResults.length)
}).catch(error => {
- console.error('鎼滅储鍖婚櫌澶辫触:', error)
+ console.error('鎼滅储杞嚭鍖婚櫌澶辫触:', error)
this.hospitalOutResults = []
})
},
// 閫夋嫨杞嚭鍖婚櫌
selectHospitalOut(hospital) {
+ this.taskForm.hospitalOut.id = hospital.hospId // 淇濆瓨鍖婚櫌ID
this.taskForm.hospitalOut.name = hospital.hospName
- this.taskForm.hospitalOut.address = hospital.hospAddress
+ // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
+ const fullAddress = this.buildFullAddress(hospital)
+ this.taskForm.hospitalOut.address = fullAddress
this.hospitalOutSearchKeyword = hospital.hospName
this.showHospitalOutResults = false
this.hospitalOutResults = []
- // 濡傛灉鏈塆PS鍧愭爣锛屼繚瀛樹笅鏉�
- // 娉ㄦ剰锛欻ospData琛ㄤ腑鍙兘娌℃湁GPS鍧愭爣锛岄渶瑕佹牴鎹湴鍧�杩涜鍦扮悊缂栫爜
- // 杩欓噷鍏堢疆涓簄ull锛屽悗缁彲浠ラ�氳繃鍦板潃瑙f瀽鑾峰彇
- this.addressCoordinates.hospitalOutAddress = null
+ // 淇濆瓨杞嚭鍖婚櫌鐨勫煄甯備俊鎭�
+ this.taskForm.hospitalOut.city = hospital.hopsCity || ''
// 濡傛灉涓や釜鍖婚櫌閮藉凡閫夋嫨锛岃嚜鍔ㄨ绠楄窛绂�
if (this.taskForm.hospitalIn.address) {
- // 杩欓噷鍙互璋冪敤鍦板潃瑙f瀽鍜岃窛绂昏绠�
- // 鏆傛椂鐣欑┖锛岀敱鐢ㄦ埛鎵嬪姩杈撳叆璺濈
+ this.calculateHospitalDistance()
}
},
// 杞叆鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
onHospitalInFocus() {
- // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず甯哥敤杞叆鍖婚櫌
if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') {
- this.hospitalInResults = [...this.defaultHospitals]
+ // 濡傛灉宸茬粡鍔犺浇杩囧父鐢ㄥ尰闄紝鐩存帴鏄剧ず
+ if (this.hospitalInResults.length > 0) {
+ this.showHospitalInResults = true
+ return
+ }
+
+ // 鍚﹀垯閲嶆柊鍔犺浇甯哥敤鍖婚櫌
+ if (this.selectedOrganizationServiceOrderClass) {
+ getFrequentInHospitals(this.selectedOrganizationServiceOrderClass, '').then(response => {
+ const allHospitals = response.data || []
+ // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ // 濡傛灉娌℃湁甯哥敤鍖婚櫌锛岄檷绾т负鏅�氭悳绱�
+ if (this.hospitalInResults.length === 0) {
+ 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)
+ })
+ })
+ } else {
+ // 娌℃湁鏈嶅姟鍗曠紪鐮侊紝浣跨敤鏅�氭悳绱�
+ searchHospitals('', '').then(response => {
+ const allHospitals = response.data || []
+ // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ }).catch(error => {
+ console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
+ this.hospitalInResults = []
+ })
+ }
}
this.showHospitalInResults = true
},
@@ -715,57 +1056,79 @@
clearTimeout(this.searchTimer)
}
- // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず鎵�鏈夊尰闄紙鏈湴鍖哄煙浼樺厛锛�
if (!keyword || keyword.trim() === '') {
- this.hospitalInResults = [...this.defaultHospitals]
+ searchHospitals('', '').then(response => {
+ const allHospitals = response.data || []
+ // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
+ }).catch(error => {
+ console.error('鍔犺浇杞叆鍖婚櫌澶辫触:', error)
+ this.hospitalInResults = []
+ })
this.showHospitalInResults = true
return
}
- // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
+ // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储锛堜笉闄愬尯鍩燂紝浣嗙粨鏋滄寜鍦板煙鎺掑簭锛�
this.searchTimer = setTimeout(() => {
this.searchHospitalIn(keyword)
}, 300)
},
- // 鎼滅储杞叆鍖婚櫌
+ // 鎼滅储杞叆鍖婚櫌锛堜笉闄愬尯鍩燂紝浣嗘湰鍦板尯鍩熶紭鍏堬級
searchHospitalIn(keyword) {
- searchHospitals(keyword).then(response => {
- this.hospitalInResults = response.data || []
+ // 浼犲叆鍏抽敭璇嶏紝涓嶄紶鍦板煙杩囨护锛堟悳绱㈡墍鏈夊尯鍩燂級
+ searchHospitals(keyword, '').then(response => {
+ const allHospitals = response.data || []
+ // 鎸夊湴鍩熸帓搴忥細鏈湴鍖哄煙浼樺厛
+ this.hospitalInResults = this.sortHospitalsByRegion(allHospitals)
this.showHospitalInResults = true
+ console.log('鎼滅储杞叆鍖婚櫌:', keyword, '缁撴灉鏁�:', this.hospitalInResults.length)
}).catch(error => {
- console.error('鎼滅储鍖婚櫌澶辫触:', error)
+ console.error('鎼滅储杞叆鍖婚櫌澶辫触:', error)
this.hospitalInResults = []
})
},
// 閫夋嫨杞叆鍖婚櫌
selectHospitalIn(hospital) {
+ this.taskForm.hospitalIn.id = hospital.hospId // 淇濆瓨鍖婚櫌ID
this.taskForm.hospitalIn.name = hospital.hospName
- this.taskForm.hospitalIn.address = hospital.hospAddress
+ // 鍚堝苟鐪佸競鍖� + 璇︾粏鍦板潃
+ const fullAddress = this.buildFullAddress(hospital)
+ this.taskForm.hospitalIn.address = fullAddress
this.hospitalInSearchKeyword = hospital.hospName
this.showHospitalInResults = false
this.hospitalInResults = []
- // 濡傛灉鏈塆PS鍧愭爣锛屼繚瀛樹笅鏉�
- this.addressCoordinates.hospitalInAddress = null
+ // 淇濆瓨杞叆鍖婚櫌鐨勫煄甯備俊鎭�
+ this.taskForm.hospitalIn.city = hospital.hopsCity || ''
// 濡傛灉涓や釜鍖婚櫌閮藉凡閫夋嫨锛岃嚜鍔ㄨ绠楄窛绂�
if (this.taskForm.hospitalOut.address) {
- // 杩欓噷鍙互璋冪敤鍦板潃瑙f瀽鍜岃窛绂昏绠�
- // 鏆傛椂鐣欑┖锛岀敱鐢ㄦ埛鎵嬪姩杈撳叆璺濈
+ this.calculateHospitalDistance()
}
},
// 鍒濆鍖栭�変腑鐨勪汉鍛橈紙榛樿鍖呭惈褰撳墠鐢ㄦ埛锛�
initSelectedStaff() {
- this.selectedStaff = [{
+ // 鏋勫缓褰撳墠鐢ㄦ埛瀵硅薄锛屽寘鍚畬鏁寸殑瑙掕壊淇℃伅
+ const currentUserStaff = {
userId: this.currentUser.userId,
nickName: this.currentUser.nickName,
phonenumber: this.currentUser.phonenumber,
postName: this.currentUser.position,
- deptId: this.currentUser.deptId
- }]
+ deptId: this.currentUser.deptId,
+ posts: this.currentUser.posts || [],
+ roles: this.currentUser.roles || [],
+ dept: this.currentUser.dept || null
+ }
+
+ // 涓哄綋鍓嶇敤鎴疯缃鑹茬被鍨�
+ currentUserStaff.type = this.getUserType(currentUserStaff)
+
+ this.selectedStaff = [currentUserStaff]
},
// 鍔犺浇褰撳墠鐢ㄦ埛鎵�鍦ㄥ垎鍏徃鐨勬墍鏈変汉鍛�
@@ -811,17 +1174,22 @@
getUserType(user) {
const postName = user.posts && user.posts.length > 0 ? user.posts[0].postName : ''
const roleName = user.roles && user.roles.length > 0 ? user.roles[0].roleName : ''
-
+ const deptName = user.dept?.deptName || ''
+ // console.log("鑾峰彇鐢ㄦ埛绫诲瀷:", postName, roleName,user)
// 鍒ゆ柇鏄惁涓哄徃鏈�
- if (postName.includes('鍙告満') || roleName.includes('鍙告満')) {
+ if (postName.includes('鍙告満') || roleName.includes('鍙告満') || deptName.includes('杞﹂槦') || deptName.includes('鍙告満')) {
return 'driver'
}
+ // 鍒ゆ柇鏄惁涓哄尰鐢�
+ if (postName.includes('鍖荤敓') || roleName.includes('鍖荤敓') || deptName.includes('鍖荤敓')) {
+ return 'doctor'
+ }
// 鍒ゆ柇鏄惁涓烘姢澹�
- if (postName.includes('鎶ゅ+') || roleName.includes('鎶ゅ+')) {
+ if (postName.includes('鎶ゅ+') || roleName.includes('鎶ゅ+') || deptName.includes('鎶ゅ+')) {
return 'nurse'
}
- // 鍏朵粬绫诲瀷
- return 'other'
+ // 鍏朵粬绫诲瀷锛岄粯璁や负鍙告満
+ return 'driver'
},
// 鏄剧ず浜哄憳閫夋嫨寮圭獥
@@ -834,7 +1202,7 @@
closeStaffSelector() {
this.$refs.staffPopup.close()
this.staffSearchKeyword = ''
- this.staffFilterType = 'all'
+ this.staffFilterType = 'driver' // 閲嶇疆涓洪粯璁ょ殑鍙告満绫诲瀷
},
// 浜哄憳鎼滅储
@@ -856,6 +1224,8 @@
// 鎸夌被鍨嬭繃婊�
if (this.staffFilterType === 'driver') {
list = list.filter(staff => staff.type === 'driver')
+ } else if (this.staffFilterType === 'doctor') {
+ list = list.filter(staff => staff.type === 'doctor')
} else if (this.staffFilterType === 'nurse') {
list = list.filter(staff => staff.type === 'nurse')
}
@@ -1016,9 +1386,48 @@
this.selectedDiseases.splice(index, 1)
},
+ // 璁剧疆榛樿杞繍鏃堕棿涓哄綋鍓嶆椂闂�
+ setDefaultTransferTime() {
+ const now = new Date()
+ const year = now.getFullYear()
+ const month = String(now.getMonth() + 1).padStart(2, '0')
+ const day = String(now.getDate()).padStart(2, '0')
+ const hours = String(now.getHours()).padStart(2, '0')
+ const minutes = String(now.getMinutes()).padStart(2, '0')
+ const seconds = String(now.getSeconds()).padStart(2, '0')
+
+ // 鏍煎紡鍖栦负 YYYY-MM-DD HH:mm:ss
+ this.taskForm.transferTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+ },
+
validateForm() {
if (!this.selectedVehicleId) {
this.$modal.showToast('璇烽�夋嫨浠诲姟杞﹁締')
+ return false
+ }
+
+ if (!this.selectedOrganizationId) {
+ this.$modal.showToast('璇烽�夋嫨褰掑睘鏈烘瀯')
+ return false
+ }
+
+ if (!this.selectedEmergencyTaskType) {
+ this.$modal.showToast('璇烽�夋嫨浠诲姟绫诲瀷')
+ return false
+ }
+
+ if (!this.selectedDocumentType) {
+ this.$modal.showToast('璇烽�夋嫨鍗曟嵁绫诲瀷')
+ return false
+ }
+
+ if (!this.taskForm.transferTime) {
+ this.$modal.showToast('璇烽�夋嫨杞繍鏃堕棿')
+ return false
+ }
+
+ if (!this.taskForm.patient.contact) {
+ this.$modal.showToast('璇疯緭鍏ヨ仈绯讳汉')
return false
}
@@ -1037,8 +1446,28 @@
return false
}
+ if (!this.taskForm.hospitalOut.department) {
+ this.$modal.showToast('璇烽�夋嫨杞嚭鍖婚櫌绉戝')
+ return false
+ }
+
if (!this.taskForm.hospitalIn.name) {
this.$modal.showToast('璇疯緭鍏ヨ浆鍏ュ尰闄㈠悕绉�')
+ return false
+ }
+
+ if (!this.taskForm.hospitalIn.department) {
+ this.$modal.showToast('璇烽�夋嫨杞叆鍖婚櫌绉戝')
+ return false
+ }
+
+ if (!this.taskForm.transferDistance) {
+ this.$modal.showToast('璇疯緭鍏ヨ浆杩愬叕閲屾暟')
+ return false
+ }
+
+ if (!this.taskForm.price) {
+ this.$modal.showToast('璇疯緭鍏ユ垚浜や环')
return false
}
@@ -1062,9 +1491,25 @@
const submitData = {
taskType: 'EMERGENCY_TRANSFER',
+ deptId: this.selectedOrganizationId, // 褰掑睘鏈烘瀯ID锛堥儴闂↖D锛�
vehicleIds: this.selectedVehicleId ? [this.selectedVehicleId] : [],
- assigneeIds: this.selectedStaff.map(staff => staff.userId), // 娣诲姞鎵ц浜哄憳ID鍒楄〃
- transferTime: this.taskForm.transferTime,
+ assigneeIds: this.selectedStaff.map(staff => staff.userId), // 鎵ц浜哄憳ID鍒楄〃
+ assigneeId: this.selectedStaff.length > 0 ? this.selectedStaff[0].userId : null, // 涓昏鎵ц浜�
+ // 鎵ц浜哄憳璇︾粏淇℃伅锛堝寘鍚鑹茬被鍨嬶級
+ assignees: this.selectedStaff.map(staff => ({
+ userId: staff.userId,
+ userName: staff.nickName,
+ userType: staff.type // driver/doctor/nurse
+ })),
+ transferTime: this.taskForm.transferTime, // 杞繍鏃堕棿
+ plannedStartTime: this.taskForm.transferTime, // 璁″垝寮�濮嬫椂闂�
+ documentTypeId: this.selectedDocumentTypeId, // 鍗曟嵁绫诲瀷ID
+ taskTypeId: this.selectedEmergencyTaskTypeId, // 浠诲姟绫诲瀷ID
+ // 鐥呮儏ID鍒楄〃锛堢敤浜庡悓姝ヨ皟搴﹀崟鐨凮rdICD_ID鍙傛暟锛�
+ diseaseIds: this.selectedDiseases.map(d => d.id),
+ // 灏嗚浆鍑哄尰闄㈠湴鍧�浣滀负鍑哄彂鍦帮紝杞叆鍖婚櫌鍦板潃浣滀负鐩殑鍦�
+ departureAddress: this.taskForm.hospitalOut.address || '',
+ destinationAddress: this.taskForm.hospitalIn.address || '',
patient: {
...this.taskForm.patient,
condition: conditionText, // 浣跨敤鍚堝苟鍚庣殑鐥呮儏淇℃伅
@@ -1074,22 +1519,33 @@
icdName: d.icdName
}))
},
- hospitalOut: this.taskForm.hospitalOut,
- hospitalIn: this.taskForm.hospitalIn,
+ // 鍖婚櫌淇℃伅锛堝寘鍚尰闄D銆佺瀹ゅ悕绉般�佺瀹D绛夊畬鏁翠俊鎭級
+ hospitalOut: this.taskForm.hospitalOut, // 鍖呭惈: id, name, department, departmentId, bedNumber, address
+ hospitalIn: this.taskForm.hospitalIn, // 鍖呭惈: id, name, department, departmentId, bedNumber, address
transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
price: this.taskForm.price ? parseFloat(this.taskForm.price) : null
}
if (this.addressCoordinates.hospitalOutAddress) {
+ // 杞嚭鍖婚櫌GPS鍧愭爣鍐欏叆鎵╁睍琛�
if (!submitData.hospitalOut) submitData.hospitalOut = {}
submitData.hospitalOut.longitude = this.addressCoordinates.hospitalOutAddress.lng
submitData.hospitalOut.latitude = this.addressCoordinates.hospitalOutAddress.lat
+
+ // 鍚屾椂鍐欏叆涓讳换鍔¤〃鐨勫嚭鍙戝湴缁忕含搴�
+ submitData.departureLongitude = this.addressCoordinates.hospitalOutAddress.lng
+ submitData.departureLatitude = this.addressCoordinates.hospitalOutAddress.lat
}
if (this.addressCoordinates.hospitalInAddress) {
+ // 杞叆鍖婚櫌GPS鍧愭爣鍐欏叆鎵╁睍琛�
if (!submitData.hospitalIn) submitData.hospitalIn = {}
submitData.hospitalIn.longitude = this.addressCoordinates.hospitalInAddress.lng
submitData.hospitalIn.latitude = this.addressCoordinates.hospitalInAddress.lat
+
+ // 鍚屾椂鍐欏叆涓讳换鍔¤〃鐨勭洰鐨勫湴缁忕含搴�
+ submitData.destinationLongitude = this.addressCoordinates.hospitalInAddress.lng
+ submitData.destinationLatitude = this.addressCoordinates.hospitalInAddress.lat
}
return submitData
@@ -1108,7 +1564,7 @@
this.loading = false
this.$modal.showToast('浠诲姟鍒涘缓鎴愬姛')
setTimeout(() => {
- uni.redirectTo({
+ uni.switchTab({
url: '/pages/task/index'
})
}, 1500)
@@ -1122,6 +1578,68 @@
goBack() {
uni.navigateBack()
+ },
+
+ // 鍚堝苟鍖婚櫌鍦板潃锛堢渷 + 甯� + 鍖� + 璇︾粏鍦板潃锛�
+ buildFullAddress(hospital) {
+ const parts = []
+ if (hospital.hopsProvince) {
+ parts.push(hospital.hopsProvince)
+ }
+ if (hospital.hopsCity) {
+ parts.push(hospital.hopsCity)
+ }
+ if (hospital.hopsArea) {
+ parts.push(hospital.hopsArea)
+ }
+ if (hospital.hospAddress) {
+ parts.push(hospital.hospAddress)
+ }
+ return parts.join('')
+ },
+
+ // 鑷姩璁$畻涓や釜鍖婚櫌涔嬮棿鐨勮窛绂�
+ calculateHospitalDistance() {
+ const fromAddress = this.taskForm.hospitalOut.address
+ const fromCity = this.taskForm.hospitalOut.city
+ const toAddress = this.taskForm.hospitalIn.address
+ const toCity = this.taskForm.hospitalIn.city
+
+ if (!fromAddress || !toAddress) {
+ console.log('鍦板潃淇℃伅涓嶅畬鏁达紝鏃犳硶璁$畻璺濈')
+ return
+ }
+
+ console.log('寮�濮嬭绠楄窛绂�:', fromAddress, '->', toAddress)
+
+ // 鏄剧ず鍔犺浇鎻愮ず
+ uni.showLoading({
+ title: '璁$畻璺濈涓�...'
+ })
+
+ // 璋冪敤鐧惧害鍦板浘API璁$畻璺濈
+ baiduDistanceByAddress(fromAddress, fromCity, toAddress, toCity)
+ .then(response => {
+ uni.hideLoading()
+
+ if (response.code === 200 && response.data) {
+ const distanceInMeters = response.data.distance
+ // 杞崲涓哄叕閲岋紝淇濈暀1浣嶅皬鏁�
+ const distanceInKm = (distanceInMeters / 1000).toFixed(1)
+ this.taskForm.transferDistance = distanceInKm
+
+ console.log('璺濈璁$畻鎴愬姛:', distanceInKm, 'km')
+ // this.$modal.showToast(`璺濈璁$畻鎴愬姛: ${distanceInKm}鍏噷`)
+ } else {
+ console.error('璺濈璁$畻澶辫触:', response.msg)
+ this.$modal.showToast('璺濈璁$畻澶辫触锛岃鎵嬪姩杈撳叆')
+ }
+ })
+ .catch(error => {
+ uni.hideLoading()
+ console.error('璺濈璁$畻澶辫触:', error)
+ this.$modal.showToast('璺濈璁$畻澶辫触锛岃鎵嬪姩杈撳叆')
+ })
}
}
}
@@ -1178,6 +1696,13 @@
font-size: 28rpx;
margin-bottom: 15rpx;
color: #333;
+
+ &.required::before {
+ content: '*';
+ color: #ff4d4f;
+ margin-right: 4rpx;
+ font-weight: bold;
+ }
}
.hospital-search-container {
--
Gitblit v1.9.1