fix(surgery): 解决手术申请中的数据绑定和字段映射问题
- 修复了手术申请组件中 userStore 初始化问题,确保 applyDoctorName 和 applyDeptName 正确赋值 - 添加了 surgeryApplication 组件的 saved 事件发射,用于通知父组件刷新医嘱列表 - 修复了手术项目选择变更时 surgeryName 的正确设置和空值处理 - 添加了手术名称和编码的验证逻辑,防止提交时出现空值错误 - 修复了手术排班页面中就诊卡号字段的属性映射(visitId 改为 patientCardNo) - 在后端 DTO 中添加了 patientCardNo 字段支持 - 修复了数据库查询中就诊卡号的关联查询逻辑,通过患者标识表获取正确的就诊卡号 - 优化了手术医嘱的 contentJson 设置,确保手术名称和编码正确存储
This commit is contained in:
@@ -505,7 +505,8 @@ import { useDict } from '@/utils/dict'
|
||||
const { surgery_type, surgery_level, incision_level, anesthesia_type } = useDict('surgery_type', 'surgery_level', 'incision_level', 'anesthesia_type')
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
const userStore = useUserStore() // 🔧 BugFix: 初始化 userStore,否则 applyDoctorName 和 applyDeptName 会是 undefined
|
||||
const emit = defineEmits(['saved'])
|
||||
const props = defineProps({
|
||||
patientInfo: {
|
||||
type: Object,
|
||||
@@ -963,9 +964,13 @@ function doSearchAnesthesia(query) {
|
||||
|
||||
// 手术项目选择变更
|
||||
function handleSurgeryChange(val) {
|
||||
// 🔧 BugFix#318: 确保 surgeryName 被正确设置
|
||||
form.value.surgeryName = val
|
||||
const selected = surgeryNameList.value.find(item => item.name === val)
|
||||
if (selected) {
|
||||
form.value.surgeryCode = selected.busNo
|
||||
// 🔧 BugFix#318: 确保 surgeryName 从选中项获取(避免空值)
|
||||
form.value.surgeryName = selected.name
|
||||
// 设置手术费用 (增加对多种字段名和类型的兼容)
|
||||
const price = selected.retailPrice ?? selected.retail_price ?? selected.price ?? selected.salePrice ?? 0
|
||||
form.value.surgeryFee = parseFloat(price)
|
||||
@@ -1050,6 +1055,27 @@ function submitForm() {
|
||||
console.log('【提交表单】完整表单数据:', JSON.parse(JSON.stringify(form.value)))
|
||||
console.log('【提交表单】手术指征字段值:', form.value.surgeryIndication)
|
||||
console.log('【提交表单】手术指征字段类型:', typeof form.value.surgeryIndication)
|
||||
|
||||
// 🔧 BugFix#318: 验证 surgeryName 和 surgeryCode
|
||||
if (!form.value.surgeryName) {
|
||||
console.error('【提交表单】错误: surgeryName 为空!')
|
||||
proxy.$modal.msgError('手术名称不能为空,请重新选择手术项目')
|
||||
return
|
||||
}
|
||||
if (!form.value.surgeryCode) {
|
||||
console.error('【提交表单】错误: surgeryCode 为空!')
|
||||
// 尝试从 surgeryNameList 获取
|
||||
const selected = surgeryNameList.value.find(item => item.name === form.value.surgeryName)
|
||||
if (selected) {
|
||||
form.value.surgeryCode = selected.busNo
|
||||
console.log('【提交表单】自动填充 surgeryCode:', form.value.surgeryCode)
|
||||
} else {
|
||||
proxy.$modal.msgError('手术编码不能为空,请重新选择手术项目')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
console.log('【提交表单】最终数据 - surgeryName:', form.value.surgeryName, 'surgeryCode:', form.value.surgeryCode)
|
||||
|
||||
if (form.value.id == undefined) {
|
||||
// 新增手术
|
||||
@@ -1060,6 +1086,7 @@ function submitForm() {
|
||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||
open.value = false
|
||||
getList()
|
||||
emit('saved') // 🔧 触发保存事件,通知父组件刷新医嘱列表
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
||||
}
|
||||
@@ -1076,6 +1103,7 @@ function submitForm() {
|
||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||
open.value = false
|
||||
getList()
|
||||
emit('saved') // 🔧 触发保存事件,通知父组件刷新医嘱列表
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
||||
}
|
||||
|
||||
@@ -150,7 +150,8 @@
|
||||
@saved="() => prescriptionRef?.getListInfo()" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="手术申请" name="surgery">
|
||||
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef" />
|
||||
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
||||
@saved="() => prescriptionRef?.getListInfo()" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="电子处方" name="eprescription">
|
||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="卫生机构" align="center" prop="orgName" width="120" show-overflow-tooltip />
|
||||
<el-table-column label="姓名" align="center" prop="patientName" width="100" />
|
||||
<el-table-column label="就诊卡号" align="center" prop="visitId" width="120" />
|
||||
<el-table-column label="就诊卡号" align="center" prop="patientCardNo" width="120" />
|
||||
<el-table-column label="手术名称" align="center" prop="operName" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="申请科室" align="center" prop="applyDeptName" width="100" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
@@ -161,9 +161,9 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="就诊卡号" prop="visitId">
|
||||
<el-tooltip :content="form.visitId" placement="top" :disabled="!form.visitId">
|
||||
<el-input v-model="form.visitId" :disabled="true" style="width: 100%" />
|
||||
<el-form-item label="就诊卡号" prop="patientCardNo">
|
||||
<el-tooltip :content="form.patientCardNo" placement="top" :disabled="!form.patientCardNo">
|
||||
<el-input v-model="form.patientCardNo" :disabled="true" style="width: 100%" />
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -1783,6 +1783,7 @@ function confirmApply() {
|
||||
form.applyId=selectedRow.applyId// 手术申请id
|
||||
form.patientId = selectedRow.patientId// 患者id
|
||||
form.visitId = selectedRow.encounterId // id对应填入就诊id
|
||||
form.patientCardNo = selectedRow.patientCardNo // 就诊卡号
|
||||
form.operCode = selectedRow.surgeryNo // 手术单号作为手术编码
|
||||
form.operName = selectedRow.descJson?.surgeryName//手术名称
|
||||
form.preoperativeDiagnosis = selectedRow.preoperativeDiagnosis || selectedRow.descJson?.preoperativeDiagnosis
|
||||
|
||||
Reference in New Issue
Block a user