| | |
| | | <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"> |
| | |
| | | placeholder="请输入医院名称或地址搜索" |
| | | v-model="hospitalOutSearchKeyword" |
| | | @input="onHospitalOutSearch" |
| | | @focus="showHospitalOutResults = true" |
| | | @focus="onHospitalOutFocus" |
| | | /> |
| | | <view class="search-results" v-if="showHospitalOutResults && hospitalOutResults.length > 0"> |
| | | <view |
| | |
| | | |
| | | <view class="form-item"> |
| | | <view class="form-label">科室</view> |
| | | <input |
| | | class="form-input" |
| | | placeholder="请输入科室" |
| | | v-model="taskForm.hospitalOut.department" |
| | | /> |
| | | <picker mode="selector" :range="departmentOptions" range-key="dictLabel" @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"> |
| | |
| | | placeholder="请输入医院名称或地址搜索" |
| | | v-model="hospitalInSearchKeyword" |
| | | @input="onHospitalInSearch" |
| | | @focus="showHospitalInResults = true" |
| | | @focus="onHospitalInFocus" |
| | | /> |
| | | <view class="search-results" v-if="showHospitalInResults && hospitalInResults.length > 0"> |
| | | <view |
| | |
| | | |
| | | <view class="form-item"> |
| | | <view class="form-label">科室</view> |
| | | <input |
| | | class="form-input" |
| | | placeholder="请输入科室" |
| | | v-model="taskForm.hospitalIn.department" |
| | | /> |
| | | <picker mode="selector" :range="departmentOptions" range-key="dictLabel" @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"> |
| | |
| | | <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> |
| | | |
| | |
| | | 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 { getUserProfile } from "@/api/system/user" |
| | | import { getDicts } from "@/api/dict" |
| | | import MapSelector from '@/components/map-selector.vue' |
| | | |
| | | export default { |
| | |
| | | hospitalInResults: [], |
| | | showHospitalInResults: false, |
| | | searchTimer: null, |
| | | defaultHospitals: [], // 默认的100条医院数据 |
| | | // 人员选择相关 |
| | | selectedStaff: [], // 已选择的人员列表 |
| | | allStaffList: [], // 所有人员列表 |
| | |
| | | vehicleOptions: [], |
| | | organizations: ['广州分公司', '深圳分公司', '珠海分公司', '佛山分公司'], |
| | | emergencyTaskTypes: ['急救转运', '航空转运'], |
| | | departmentOptions: [], // 科室字典数据 |
| | | loading: false, |
| | | addressCoordinates: { |
| | | hospitalOutAddress: null, |
| | |
| | | nickName: state.user.nickName || state.user.name || '张三', |
| | | position: '司机', |
| | | deptId: state.user.deptId || 100, |
| | | phonenumber: state.user.phonenumber || '' |
| | | phonenumber: state.user.phonenumber || '', |
| | | branchCompanyId: state.user.branchCompanyId, |
| | | branchCompanyName: state.user.branchCompanyName |
| | | }) |
| | | }) |
| | | }, |
| | | onLoad(options) { |
| | | this.getAvailableVehicles() |
| | | // 先加载车辆列表,然后加载绑定车辆信息 |
| | | this.getAvailableVehicles().then(() => { |
| | | this.getUserBoundVehicleInfo() |
| | | }) |
| | | this.initSelectedStaff() |
| | | this.loadDeptStaff() |
| | | // 设置默认归属机构 |
| | | if (this.currentUser.branchCompanyName) { |
| | | this.selectedOrganization = this.currentUser.branchCompanyName |
| | | } |
| | | // 加载默认医院列表(前100条) |
| | | this.loadDefaultHospitals() |
| | | // 加载科室字典数据 |
| | | this.loadDepartments() |
| | | }, |
| | | methods: { |
| | | // 获取用户绑定的车辆信息 |
| | | getUserBoundVehicleInfo() { |
| | | getUserProfile().then(response => { |
| | | const userInfo = response.data || response |
| | | if (userInfo.boundVehicle) { |
| | | const boundVehicleNo = userInfo.boundVehicle.vehicleNumber |
| | | const boundVehicleId = userInfo.boundVehicle.vehicleId |
| | | |
| | | // 在车辆列表中查找绑定的车辆 |
| | | 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 |
| | | } |
| | | } |
| | | }).catch(error => { |
| | | console.error('获取用户绑定车辆信息失败:', error) |
| | | }) |
| | | }, |
| | | |
| | | getAvailableVehicles() { |
| | | const deptId = this.currentUser.deptId |
| | | return listAvailableVehicles(deptId, 'EMERGENCY').then(response => { |
| | |
| | | this.selectedEmergencyTaskType = this.emergencyTaskTypes[e.detail.value] |
| | | }, |
| | | |
| | | // 加载科室字典数据 |
| | | loadDepartments() { |
| | | getDicts('hospital_department').then(response => { |
| | | this.departmentOptions = response.data || [] |
| | | }).catch(error => { |
| | | console.error('加载科室字典失败:', error) |
| | | this.departmentOptions = [] |
| | | }) |
| | | }, |
| | | |
| | | // 转出医院科室选择 |
| | | onHospitalOutDepartmentChange(e) { |
| | | const index = e.detail.value |
| | | this.taskForm.hospitalOut.department = this.departmentOptions[index].dictValue |
| | | }, |
| | | |
| | | // 转入医院科室选择 |
| | | onHospitalInDepartmentChange(e) { |
| | | const index = e.detail.value |
| | | this.taskForm.hospitalIn.department = this.departmentOptions[index].dictValue |
| | | }, |
| | | |
| | | // 加载默认医院列表(前100条) |
| | | loadDefaultHospitals() { |
| | | // 传入空字符串或特殊标识获取前100条 |
| | | searchHospitals('').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 |
| | | }, |
| | | |
| | | // 转出医院搜索 |
| | | onHospitalOutSearch(e) { |
| | | const keyword = e.detail.value |
| | |
| | | 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) |
| | |
| | | } |
| | | }, |
| | | |
| | | // 转入医院输入框获得焦点 |
| | | onHospitalInFocus() { |
| | | // 如果没有搜索关键词,显示默认的100条数据 |
| | | if (!this.hospitalInSearchKeyword || this.hospitalInSearchKeyword.trim() === '') { |
| | | this.hospitalInResults = [...this.defaultHospitals] |
| | | } |
| | | this.showHospitalInResults = true |
| | | }, |
| | | |
| | | // 转入医院搜索 |
| | | onHospitalInSearch(e) { |
| | | const keyword = e.detail.value |
| | |
| | | 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) |
| | |
| | | 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 => { |
| | |
| | | // 初始化临时选择列表(复制当前已选择的病情) |
| | | this.tempSelectedDiseases = [...this.selectedDiseases] |
| | | this.diseaseSearchKeyword = '' |
| | | this.diseaseSearchResults = [] |
| | | // 默认加载所有病情 |
| | | this.loadAllDiseases() |
| | | this.$refs.diseasePopup.open() |
| | | }, |
| | | |
| | |
| | | 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 = [] |
| | | }) |
| | | }, |
| | | |
| | | // 根据关键词搜索病情 |
| | |
| | | this.loading = false |
| | | this.$modal.showToast('任务创建成功') |
| | | setTimeout(() => { |
| | | this.$tab.navigateTo('/pages/task/index') |
| | | uni.redirectTo({ |
| | | url: '/pages/task/index' |
| | | }) |
| | | }, 1500) |
| | | }).catch(error => { |
| | | this.loading = false |