From a5b842f1f6ab32f1af39f4bcb7e45217e94db761 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 25 十月 2025 18:14:44 +0800
Subject: [PATCH] fix:完成任务状态,任务同步,高度同步等工作
---
app/pages/task/create-emergency.vue | 572 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 479 insertions(+), 93 deletions(-)
diff --git a/app/pages/task/create-emergency.vue b/app/pages/task/create-emergency.vue
index cefe5b2..1810257 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">褰掑睘鏈烘瀯</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,25 +75,7 @@
</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>
@@ -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,14 +173,14 @@
<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"
placeholder="璇疯緭鍏ュ尰闄㈠悕绉版垨鍦板潃鎼滅储"
v-model="hospitalOutSearchKeyword"
@input="onHospitalOutSearch"
- @focus="showHospitalOutResults = true"
+ @focus="onHospitalOutFocus"
/>
<view class="search-results" v-if="showHospitalOutResults && hospitalOutResults.length > 0">
<view
@@ -180,19 +190,20 @@
@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>
- <input
- class="form-input"
- placeholder="璇疯緭鍏ョ瀹�"
- v-model="taskForm.hospitalOut.department"
- />
+ <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>
+ </view>
+ </picker>
</view>
<view class="form-item">
@@ -213,14 +224,14 @@
<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"
placeholder="璇疯緭鍏ュ尰闄㈠悕绉版垨鍦板潃鎼滅储"
v-model="hospitalInSearchKeyword"
@input="onHospitalInSearch"
- @focus="showHospitalInResults = true"
+ @focus="onHospitalInFocus"
/>
<view class="search-results" v-if="showHospitalInResults && hospitalInResults.length > 0">
<view
@@ -230,19 +241,20 @@
@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>
- <input
- class="form-input"
- placeholder="璇疯緭鍏ョ瀹�"
- v-model="taskForm.hospitalIn.department"
- />
+ <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>
+ </view>
+ </picker>
</view>
<view class="form-item">
@@ -311,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' }"
@@ -340,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
@@ -410,14 +422,9 @@
<view v-else class="checkbox-empty"></view>
</view>
- <view class="no-data" v-if="diseaseSearchResults.length === 0 && diseaseSearchKeyword">
+ <view class="no-data" v-if="diseaseSearchResults.length === 0">
<uni-icons type="info" size="40" color="#ccc"></uni-icons>
- <text>鏈壘鍒扮浉鍏崇柧鐥�</text>
- </view>
-
- <view class="no-data" v-if="diseaseSearchResults.length === 0 && !diseaseSearchKeyword">
- <uni-icons type="search" size="40" color="#ccc"></uni-icons>
- <text>璇疯緭鍏ュ叧閿瘝鎼滅储鐤剧梾</text>
+ <text>{{ diseaseSearchKeyword ? '鏈壘鍒扮浉鍏崇柧鐥�' : '鏆傛棤鐥呮儏鏁版嵁' }}</text>
</view>
</scroll-view>
@@ -435,11 +442,15 @@
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
import { addTask } from "@/api/task"
-import { listAvailableVehicles } from "@/api/vehicle"
+import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
import { calculateDistance } from "@/api/map"
import { searchHospitals } from "@/api/hospital"
import { listUser } from "@/api/system/user"
import { searchIcd10 } from "@/api/icd10"
+
+import { getDicts } from "@/api/dict"
+import { getServiceOrdAreaTypes, getServiceOrderTypes, getHospitalDepartments } from "@/api/dictionary"
+import { listBranchCompany } from "@/api/system/dept"
import MapSelector from '@/components/map-selector.vue'
export default {
@@ -453,7 +464,12 @@
selectedVehicle: '',
selectedVehicleId: null,
selectedOrganization: '',
- selectedEmergencyTaskType: '',
+ selectedOrganizationId: null, // 褰掑睘鏈烘瀯ID锛堥儴闂↖D锛�
+ selectedRegion: '', // 浠庡綊灞炴満鏋勪腑鎻愬彇鐨勫湴鍩熶俊鎭紙濡傦細骞垮窞銆佹繁鍦崇瓑锛�
+ selectedEmergencyTaskType: '', // 閫変腑鐨勪换鍔$被鍨嬫枃鏈�
+ selectedEmergencyTaskTypeId: null, // 閫変腑鐨勪换鍔$被鍨婭D
+ selectedDocumentType: '', // 閫変腑鐨勫崟鎹被鍨嬫枃鏈�
+ selectedDocumentTypeId: null, // 閫変腑鐨勫崟鎹被鍨婭D
mapSelectorType: '',
// 鍖婚櫌鎼滅储鐩稿叧
hospitalOutSearchKeyword: '',
@@ -463,12 +479,13 @@
hospitalInResults: [],
showHospitalInResults: false,
searchTimer: null,
+ defaultHospitals: [], // 榛樿鐨�100鏉″尰闄㈡暟鎹�
// 浜哄憳閫夋嫨鐩稿叧
selectedStaff: [], // 宸查�夋嫨鐨勪汉鍛樺垪琛�
allStaffList: [], // 鎵�鏈変汉鍛樺垪琛�
filteredStaffList: [], // 杩囨护鍚庣殑浜哄憳鍒楄〃
staffSearchKeyword: '', // 浜哄憳鎼滅储鍏抽敭璇�
- staffFilterType: 'all', // 浜哄憳绛涢�夌被鍨嬶細all/driver/nurse
+ staffFilterType: 'driver', // 浜哄憳绛涢�夌被鍨嬶細driver/doctor/nurse锛岄粯璁ら�変腑鍙告満
// 鐥呮儏閫夋嫨鐩稿叧
selectedDiseases: [], // 宸查�夋嫨鐨勭梾鎯呭垪琛�
tempSelectedDiseases: [], // 涓存椂閫夋嫨鐨勭梾鎯呭垪琛紙鐢ㄤ簬寮圭獥锛�
@@ -486,14 +503,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 +523,13 @@
},
vehicles: [],
vehicleOptions: [],
- organizations: ['骞垮窞鍒嗗叕鍙�', '娣卞湷鍒嗗叕鍙�', '鐝犳捣鍒嗗叕鍙�', '浣涘北鍒嗗叕鍙�'],
- emergencyTaskTypes: ['鎬ユ晳杞繍', '鑸┖杞繍'],
+ organizations: [], // 褰掑睘鏈烘瀯鍒楄〃锛堜粠鍚庡彴鍔犺浇鍒嗗叕鍙告暟鎹級
+ organizationOptions: [], // 褰掑睘鏈烘瀯閫夐」锛堢敤浜巔icker鏄剧ず锛�
+ emergencyTaskTypes: [], // 浠诲姟绫诲瀷鍒楄〃锛堜粠 SQL Server 鍔ㄦ�佸姞杞斤級
+ emergencyTaskTypeOptions: [], // 浠诲姟绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
+ documentTypes: [], // 鍗曟嵁绫诲瀷鍒楄〃
+ documentTypeOptions: [], // 鍗曟嵁绫诲瀷閫夐」锛堢敤浜巔icker鏄剧ず锛�
+ departmentOptions: [], // 绉戝瀛楀吀鏁版嵁
loading: false,
addressCoordinates: {
hospitalOutAddress: null,
@@ -515,20 +541,79 @@
...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 || ''
+ 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.getAvailableVehicles()
+ // 鍏堝姞杞借溅杈嗗垪琛紝鐒跺悗鍔犺浇缁戝畾杞﹁締淇℃伅
+ this.getAvailableVehicles().then(() => {
+ this.getUserBoundVehicleInfo()
+ })
this.initSelectedStaff()
this.loadDeptStaff()
+ // 鍔犺浇鍒嗗叕鍙告暟鎹紙浼氳嚜鍔ㄨ缃粯璁ゅ垎鍏徃骞跺姞杞藉尰闄㈠垪琛級
+ this.loadBranchCompanies()
+ // 鍔犺浇绉戝瀛楀吀鏁版嵁
+ this.loadDepartments()
+ // 鍔犺浇浠诲姟绫诲瀷鏁版嵁
+ this.loadEmergencyTaskTypes()
+ // 鍔犺浇鍗曟嵁绫诲瀷鏁版嵁
+ this.loadDocumentTypes()
},
methods: {
+ // 鑾峰彇鐢ㄦ埛缁戝畾鐨勮溅杈嗕俊鎭�
+ getUserBoundVehicleInfo() {
+ 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 =>
+ v.id === boundVehicleId || v.name === boundVehicleNo
+ )
+
+ if (vehicleIndex !== -1) {
+ // 璁剧疆榛樿閫変腑鐨勮溅杈�
+ 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)
+ })
+ },
+
getAvailableVehicles() {
const deptId = this.currentUser.deptId
return listAvailableVehicles(deptId, 'EMERGENCY').then(response => {
@@ -552,11 +637,175 @@
},
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.selectedRegion = selected.deptName.replace(/鍒嗗叕鍙�$/g, '').trim()
+ // 閲嶆柊鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
+ this.loadDefaultHospitals()
},
+ // 鍔犺浇鍒嗗叕鍙告暟鎹紙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.selectedRegion = this.selectedOrganization.replace(/鍒嗗叕鍙�$/g, '').trim()
+ console.log('榛樿閫変腑褰掑睘鏈烘瀯:', this.selectedOrganization, '閮ㄩ棬ID:', this.selectedOrganizationId, '鍦板煙:', this.selectedRegion)
+ // 鍔犺浇鍖婚櫌鍒楄〃锛堝甫鍦板煙杩囨护锛�
+ this.loadDefaultHospitals()
+ }
+ }
+ }).catch(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) {
- this.selectedEmergencyTaskType = this.emergencyTaskTypes[e.detail.value]
+ 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
+ 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
+ const selected = this.departmentOptions[index]
+ this.taskForm.hospitalIn.department = selected.text // 淇濆瓨绉戝鍚嶇О
+ this.taskForm.hospitalIn.departmentId = selected.id // 淇濆瓨绉戝ID
+ },
+
+ // 鍔犺浇榛樿鍖洪櫌鍒楄〃锛堝墠100鏉★級
+ loadDefaultHospitals() {
+ // 浼犲叆绌哄瓧绗︿覆鎴栫壒娈婃爣璇嗚幏鍙栧墠100鏉★紝鍚屾椂浼犲叆鍦板煙杩囨护
+ searchHospitals('', this.selectedRegion).then(response => {
+ this.defaultHospitals = response.data || []
+ // 鍚屾椂鍒濆鍖栦袱涓悳绱㈢粨鏋滀负榛樿鏁版嵁
+ this.hospitalOutResults = [...this.defaultHospitals]
+ this.hospitalInResults = [...this.defaultHospitals]
+ }).catch(error => {
+ console.error('鍔犺浇榛樿鍖洪櫌鍒楄〃澶辫触:', error)
+ this.defaultHospitals = []
+ })
+ },
+
+ // 杞嚭鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
+ onHospitalOutFocus() {
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+ if (!this.hospitalOutSearchKeyword || this.hospitalOutSearchKeyword.trim() === '') {
+ this.hospitalOutResults = [...this.defaultHospitals]
+ }
+ this.showHospitalOutResults = true
},
// 杞嚭鍖婚櫌鎼滅储
@@ -569,11 +818,14 @@
clearTimeout(this.searchTimer)
}
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
if (!keyword || keyword.trim() === '') {
- this.hospitalOutResults = []
+ this.hospitalOutResults = [...this.defaultHospitals]
+ this.showHospitalOutResults = true
return
}
+ // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
this.searchTimer = setTimeout(() => {
this.searchHospitalOut(keyword)
}, 300)
@@ -581,7 +833,8 @@
// 鎼滅储杞嚭鍖婚櫌
searchHospitalOut(keyword) {
- searchHospitals(keyword).then(response => {
+ // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护
+ searchHospitals(keyword, this.selectedRegion).then(response => {
this.hospitalOutResults = response.data || []
this.showHospitalOutResults = true
}).catch(error => {
@@ -592,8 +845,11 @@
// 閫夋嫨杞嚭鍖婚櫌
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 = []
@@ -610,6 +866,15 @@
}
},
+ // 杞叆鍖婚櫌杈撳叆妗嗚幏寰楃劍鐐�
+ onHospitalInFocus() {
+ // 濡傛灉娌℃湁鎼滅储鍏抽敭璇嶏紝鏄剧ず榛樿鐨�100鏉℃暟鎹�
+ if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') {
+ this.hospitalInResults = [...this.defaultHospitals]
+ }
+ this.showHospitalInResults = true
+ },
+
// 杞叆鍖婚櫌鎼滅储
onHospitalInSearch(e) {
const keyword = e.detail.value
@@ -620,11 +885,14 @@
clearTimeout(this.searchTimer)
}
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鏄剧ず榛樿100鏉�
if (!keyword || keyword.trim() === '') {
- this.hospitalInResults = []
+ this.hospitalInResults = [...this.defaultHospitals]
+ this.showHospitalInResults = true
return
}
+ // 鏈夊叧閿瘝鏃讹紝鍘绘湇鍔$鎼滅储
this.searchTimer = setTimeout(() => {
this.searchHospitalIn(keyword)
}, 300)
@@ -632,7 +900,8 @@
// 鎼滅储杞叆鍖婚櫌
searchHospitalIn(keyword) {
- searchHospitals(keyword).then(response => {
+ // 浼犲叆鍏抽敭璇嶅拰鍦板煙杩囨护
+ searchHospitals(keyword, this.selectedRegion).then(response => {
this.hospitalInResults = response.data || []
this.showHospitalInResults = true
}).catch(error => {
@@ -643,8 +912,11 @@
// 閫夋嫨杞叆鍖婚櫌
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 = []
@@ -661,13 +933,22 @@
// 鍒濆鍖栭�変腑鐨勪汉鍛橈紙榛樿鍖呭惈褰撳墠鐢ㄦ埛锛�
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]
},
// 鍔犺浇褰撳墠鐢ㄦ埛鎵�鍦ㄥ垎鍏徃鐨勬墍鏈変汉鍛�
@@ -675,13 +956,17 @@
const deptId = this.currentUser.deptId
if (!deptId) {
console.error('鏃犳硶鑾峰彇褰撳墠鐢ㄦ埛鎵�鍦ㄩ儴闂�')
+ this.$modal.showToast('鏃犳硶鑾峰彇鎵�鍦ㄩ儴闂ㄤ俊鎭�')
return
}
- // 鏌ヨ褰撳墠閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴凤紙鍙告満銆佹姢澹級
+ // 鐩存帴鏌ヨ褰撳墠鐢ㄦ埛閮ㄩ棬涓嬬殑鎵�鏈夌敤鎴�
+ // 鍚庣SQL浼氳嚜鍔ㄥ鐞嗭細濡傛灉浼犲叆鐨勬槸瀛愰儴闂紝浼氭煡鎵惧叾鎵�灞炵殑鍒嗗叕鍙稿強鍏舵墍鏈夊瓙閮ㄩ棬鐨勭敤鎴�
const queryParams = {
deptId: deptId,
- status: '0' // 鍙煡璇㈡甯哥姸鎬佺殑鐢ㄦ埛
+ status: '0', // 鍙煡璇㈡甯哥姸鎬佺殑鐢ㄦ埛
+ pageNum: 1,
+ pageSize: 10000 // 璁剧疆瓒冲澶х殑椤甸潰澶у皬锛岃幏鍙栨墍鏈夌敤鎴�
}
listUser(queryParams).then(response => {
@@ -709,17 +994,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'
},
// 鏄剧ず浜哄憳閫夋嫨寮圭獥
@@ -732,7 +1022,7 @@
closeStaffSelector() {
this.$refs.staffPopup.close()
this.staffSearchKeyword = ''
- this.staffFilterType = 'all'
+ this.staffFilterType = 'driver' // 閲嶇疆涓洪粯璁ょ殑鍙告満绫诲瀷
},
// 浜哄憳鎼滅储
@@ -754,6 +1044,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')
}
@@ -822,7 +1114,8 @@
// 鍒濆鍖栦复鏃堕�夋嫨鍒楄〃锛堝鍒跺綋鍓嶅凡閫夋嫨鐨勭梾鎯咃級
this.tempSelectedDiseases = [...this.selectedDiseases]
this.diseaseSearchKeyword = ''
- this.diseaseSearchResults = []
+ // 榛樿鍔犺浇鎵�鏈夌梾鎯�
+ this.loadAllDiseases()
this.$refs.diseasePopup.open()
},
@@ -844,14 +1137,28 @@
clearTimeout(this.diseaseSearchTimer)
}
+ // 濡傛灉鍏抽敭璇嶄负绌猴紝鍔犺浇鎵�鏈夌梾鎯�
if (!keyword || keyword.trim() === '') {
- this.diseaseSearchResults = []
+ this.loadAllDiseases()
return
}
+ // 鏈夊叧閿瘝鏃惰繘琛屾悳绱�
this.diseaseSearchTimer = setTimeout(() => {
this.searchDiseaseByKeyword(keyword)
}, 300)
+ },
+
+ // 鍔犺浇鎵�鏈夌梾鎯咃紙榛樿鏄剧ず锛�
+ loadAllDiseases() {
+ // 浣跨敤绌哄瓧绗︿覆鎴栫壒娈婃爣璇嗙鏉ヨ幏鍙栨墍鏈夌梾鎯�
+ // 濡傛灉鍚庣涓嶆敮鎸佺┖鏌ヨ锛屽彲浠ヤ紶鍏ヤ竴涓�氶厤绗﹀'%'鎴栬�呬慨鏀瑰悗绔帴鍙�
+ searchIcd10('').then(response => {
+ this.diseaseSearchResults = response.data || []
+ }).catch(error => {
+ console.error('鍔犺浇鐥呮儏鍒楄〃澶辫触:', error)
+ this.diseaseSearchResults = []
+ })
},
// 鏍规嵁鍏抽敭璇嶆悳绱㈢梾鎯�
@@ -905,6 +1212,21 @@
return false
}
+ if (!this.selectedEmergencyTaskType) {
+ this.$modal.showToast('璇烽�夋嫨浠诲姟绫诲瀷')
+ return false
+ }
+
+ if (!this.selectedDocumentType) {
+ this.$modal.showToast('璇烽�夋嫨鍗曟嵁绫诲瀷')
+ return false
+ }
+
+ if (!this.taskForm.patient.contact) {
+ this.$modal.showToast('璇疯緭鍏ヨ仈绯讳汉')
+ return false
+ }
+
if (!this.taskForm.patient.name) {
this.$modal.showToast('璇疯緭鍏ユ偅鑰呭鍚�')
return false
@@ -920,8 +1242,18 @@
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
}
@@ -945,9 +1277,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, // 浣跨敤鍚堝苟鍚庣殑鐥呮儏淇℃伅
@@ -957,22 +1305,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
@@ -991,7 +1350,9 @@
this.loading = false
this.$modal.showToast('浠诲姟鍒涘缓鎴愬姛')
setTimeout(() => {
- this.$tab.navigateTo('/pages/task/index')
+ uni.switchTab({
+ url: '/pages/task/index'
+ })
}, 1500)
}).catch(error => {
this.loading = false
@@ -1003,6 +1364,24 @@
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('')
}
}
}
@@ -1059,6 +1438,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