From 5187ff1ae34da31c6464d037c2dacf019e31ec08 Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Wed, 21 Jan 2026 13:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=B3=E8=AF=B7=E5=8D=95?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=82=A3=E8=80=85=E4=BF=A1=E6=81=AF=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A1=AB=E5=85=85=E5=A7=93=E5=90=8D=E3=80=81=E5=B0=B1?= =?UTF-8?q?=E8=AF=8A=E5=8D=A1=E5=8F=B7=E3=80=81=E8=B4=B9=E7=94=A8=E6=80=A7?= =?UTF-8?q?=E8=B4=A8,=E4=BB=A5=E5=8F=8A=E7=94=B3=E8=AF=B7=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=92=8C=E7=94=B3=E8=AF=B7=E7=A7=91=E5=AE=A4=E7=9A=84?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E6=A0=BC=E5=BC=8F=EF=BC=8C=20?= =?UTF-8?q?=E4=BE=9D=E6=8D=AE=E7=94=B3=E8=AF=B7=E5=8D=95=E5=92=8C=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=8D=95=E6=98=8E=E7=BB=86=E8=A1=A8=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=8D=95=E5=8F=98=E9=87=8F=E5=90=8D?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection/inspectionApplication.vue | 466 ++++++++++-------- 1 file changed, 262 insertions(+), 204 deletions(-) diff --git a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue index d7ec150e..241d8987 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue @@ -17,7 +17,7 @@ - + - + - + @@ -79,7 +79,7 @@ - +
@@ -88,22 +88,22 @@
- +
- - + +
- - + +
- - + + @@ -115,10 +115,11 @@
+
- +
+
- - - - - - + +
+ +
- - - - - - + +
@@ -164,29 +160,29 @@
请选择执行科室
- +
-
+
-
请输入诊断描述
+
请输入诊断描述
-
+
-
请输入临床诊断
+
请输入临床诊断
@@ -194,29 +190,29 @@
- +
-
+
-
请输入病史摘要
+
请输入病史摘要
-
+
-
请输入检验目的
+
请输入检验目的
@@ -232,7 +228,7 @@
- +
@@ -240,15 +236,14 @@
- - 收费 + + 收费 退费 执行
-
@@ -290,22 +285,22 @@

检验信息详情

- + - + - + - + @@ -371,8 +366,8 @@ @change="toggleInspectionItem(item)" @click.stop /> - {{ item.name }} - ¥{{ item.price }} + {{ item.itemName }} + ¥{{ item.itemPrice }}
@@ -395,8 +390,8 @@ class="selected-tree-item" >
- {{ item.name }} - ¥{{ item.price }} + {{ item.itemName }} + ¥{{ item.itemPrice }} { +// // try { +// const res = await listType({ dictType: 'dept' }); // 按字典类型查询科室 +// console.log('【检验】获取科室字典数据:', res.data) +// deptOptions.value = res.data; +// console.log('【检验】科室字典数据:',deptOptions.value) + + // // 获取当前科室名称(来自患者信息) + // const currentDeptName = props.patientInfo?.organizationName; + // console.log('【检验】当前科室名称:', currentDeptName) + // + // // 根据当前科室名称查找对应的编码 + // const deptItem = res.data.find(item => item.dictLabel === currentDeptName); + // console.log('【检验】找到的科室名称:', deptItem) + // if (deptItem) { + // return deptItem.dictValue; // 返回科室编码 + // } else { + // console.warn(`未找到科室名称为 ${currentDeptName} 的对应编码`); + // return currentDeptName || ''; // 使用原始名称作为默认值,符合防御性编程原则 + // } + // } catch (error) { + // console.error('获取科室字典数据失败:', error); + // return ''; + // } +// } +// 在 onMounted 中调用初始化函数 +onMounted(async () => { + await initData(); + // 设置当前科室编码 + // const currentDeptCode = await getCurrentDeptCode(); + // formData.applyDeptCode = currentDeptCode || ''; +}) // Props const props = defineProps({ @@ -442,6 +474,33 @@ const showForm = ref(false) const loading = ref(false) const total = ref(0) const leftActiveTab = ref('application') +const deptOptions = ref([]) + +// 用户信息store +const userStore = useUserStore() +const { id: userId, name: userName, nickName: userNickName } = storeToRefs(userStore) + +// 修改 initData 函数 +async function initData() { + // 然后执行原有的初始化逻辑 + if (props.patientInfo) { + queryParams.encounterId = props.patientInfo.encounterId + formData.visitNo = props.patientInfo.busNo || '' + formData.patientId = props.patientInfo.patientId || '' + formData.patientName = props.patientInfo.patientName || '' + formData.medicalrecordNumber = props.patientInfo.identifierNo || '' + formData.applyDepartment = props.patientInfo.organizationName || '' + formData.operatorId = userId.value || '' + formData.applyDocName = userNickName.value || userName.value || '' + formData.applyDocCode = userId.value || '' + formData.specimenName = '血液' + } + + // 只有在存在 encounterId 时才调用接口 + if (queryParams.encounterId) { + getInspectionList() + } +} // 查询参数 const queryParams = reactive({ @@ -456,43 +515,49 @@ const inspectionList = ref([]) // 表单数据 const formData = reactive({ applicationId: null, - applicationNo: '202511210001', + applyNo: '202511210001', + patientId:'', patientName: '', - cardNo: '', - feeType: 'self', - applicationDate: new Date(), - departmentName: '', - doctorName: '', + medicalrecordNumber: '', + natureofCost: 'self', + applyTime: new Date(), + applyDepartment: '', + applyDocName: '', executeDepartment: 'medical_lab', - diagnosisDesc: '', - contraindications: '', - clinicalDiagnosis: '', - medicalHistory: '', - inspectionPurpose: '', + clinicDesc: '', + contraindication: '', + clinicDiag: '', + medicalHistorySummary: '', + purposeofInspection: '', physicalExam: '', - inspectionItems: [], + labApplyItemList: [], inspectionItemsText: '', - remark: '', - isUrgent: false, - needCharge: true, + applyRemark: '', + priorityCode: 0, + applyStatus: 1, needRefund: false, needExecute: false, inspectionDoctor: '', inspectionTime: null, auditDoctor: '', - auditTime: null + auditTime: null, + visitNo: '', + applyDocCode:'', + applyDeptCode: '', + operatorId: '', + specimenName: '血液', }) // 表单验证规则 const formRules = { - feeType: [{ required: true, message: '请选择费用性质', trigger: 'change' }], - applicationDate: [{ required: true, message: '请选择申请日期', trigger: 'change' }], + natureofCost: [{ required: true, message: '请选择费用性质', trigger: 'change' }], + applyTime: [{ required: true, message: '请选择申请日期', trigger: 'change' }], executeDepartment: [{ required: true, message: '请选择执行科室', trigger: 'change' }], - diagnosisDesc: [{ required: true, message: '请输入诊断描述', trigger: 'blur' }], - clinicalDiagnosis: [{ required: true, message: '请输入临床诊断', trigger: 'blur' }], - medicalHistory: [{ required: true, message: '请输入病史摘要', trigger: 'blur' }], - inspectionPurpose: [{ required: true, message: '请输入检验目的', trigger: 'blur' }], - inspectionItems: [{ required: true, message: '请至少选择一个检验项目', trigger: 'change' }] + clinicDesc: [{ required: true, message: '请输入诊断描述', trigger: 'blur' }], + clinicDiag: [{ required: true, message: '请输入临床诊断', trigger: 'blur' }], + medicalHistorySummary: [{ required: true, message: '请输入病史摘要', trigger: 'blur' }], + purposeofInspection: [{ required: true, message: '请输入检验目的', trigger: 'blur' }], + labApplyItemList: [{ required: true, message: '请至少选择一个检验项目', trigger: 'change' }] } // 表单引用 @@ -504,11 +569,11 @@ const inspectionTableRef = ref() // 验证错误状态 const validationErrors = reactive({ executeDepartment: false, - diagnosisDesc: false, - clinicalDiagnosis: false, - medicalHistory: false, - inspectionPurpose: false, - inspectionItems: false + clinicDesc: false, + clinicDiag: false, + medicalHistorySummary: false, + purposeofInspection: false, + labApplyItemList: false }) // 已选择的表格行 @@ -524,15 +589,15 @@ const searchKeyword = ref('') const activeCategory = ref('biochemical') // 检验项目分类(树形结构) -const inspectionCategories = ref([ +let inspectionCategories = ref([ { key: 'biochemical', label: '生化', expanded: true, items: [ - { id: 1, name: '肝功能', price: 31, sampleType: '血清', unit: 'U/L', quantity: 1, serviceFee: 0, type: '生化', isSelfPay: false }, - { id: 2, name: '肾功能', price: 28, sampleType: '血清', unit: 'U/L', quantity: 1, serviceFee: 0, type: '生化', isSelfPay: false }, - { id: 3, name: '血糖', price: 15, sampleType: '血清', unit: 'mmol/L', quantity: 1, serviceFee: 0, type: '生化', isSelfPay: false } + { id: 1, itemName: '肝功能', itemPrice: 31, itemAmount: 31, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false }, + { id: 2, itemName: '肾功能', itemPrice: 28, itemAmount: 28, sampleType: '血清', unit: 'U/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false }, + { id: 3, itemName: '血糖', itemPrice: 15, itemAmount: 15, sampleType: '血清', unit: 'mmol/L', itemQty: 1, serviceFee: 0, type: '生化', isSelfPay: false } ] }, { @@ -540,8 +605,8 @@ const inspectionCategories = ref([ label: '临检', expanded: false, items: [ - { id: 4, name: '血常规+crp', price: 50, sampleType: '全血', unit: '×10^9/L', quantity: 1, serviceFee: 0, type: '血液', isSelfPay: false }, - { id: 5, name: '血常规(五分类)', price: 15, sampleType: '全血', unit: '×10^9/L', quantity: 1, serviceFee: 0, type: '血液', isSelfPay: false } + { id: 4, itemName: '血常规+crp', itemPrice: 50, itemAmount: 50, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false }, + { id: 5, itemName: '血常规(五分类)', itemPrice: 15, itemAmount: 15, sampleType: '全血', unit: '×10^9/L', itemQty: 1, serviceFee: 0, type: '血液', isSelfPay: false } ] }, { @@ -549,7 +614,7 @@ const inspectionCategories = ref([ label: '尿液', expanded: false, items: [ - { id: 6, name: '尿常规', price: 20, sampleType: '尿液', unit: '细胞/μl', quantity: 1, serviceFee: 0, type: '尿液', isSelfPay: false } + { id: 6, itemName: '尿常规', itemPrice: 20, itemAmount: 20, sampleType: '尿液', unit: '细胞/μl', itemQty: 1, serviceFee: 0, type: '尿液', isSelfPay: false } ] }, { @@ -557,8 +622,8 @@ const inspectionCategories = ref([ label: '免疫', expanded: false, items: [ - { id: 7, name: '总IgE测定', price: 30, sampleType: '血清', unit: 'IU/ml', quantity: 1, serviceFee: 0, type: '免疫', isSelfPay: false }, - { id: 8, name: '风湿', price: 119, sampleType: '血清', unit: 'U/ml', quantity: 1, serviceFee: 0, type: '免疫', isSelfPay: false } + { id: 7, itemName: '总IgE测定', itemPrice: 30, itemAmount: 30, sampleType: '血清', unit: 'IU/ml', itemQty: 1, serviceFee: 0, type: '免疫', isSelfPay: false }, + { id: 8, itemName: '风湿', itemPrice: 119, itemAmount: 119, sampleType: '血清', unit: 'U/ml', itemQty: 1, serviceFee: 0, type: '免疫', isSelfPay: false } ] } ]) @@ -573,70 +638,39 @@ const getFilteredItems = (categoryKey) => { } return category.items.filter(item => - item.name.toLowerCase().includes(searchKeyword.value.toLowerCase()) + item.itemName.toLowerCase().includes(searchKeyword.value.toLowerCase()) ) } -// 初始化数据 -function initData() { - console.log('检验组件初始化,patientInfo:', props.patientInfo) - if (props.patientInfo) { - // 确保 encounterId 存在且有效,优先使用 encounterId,其次尝试 id,最后尝试 patientId - queryParams.encounterId = props.patientInfo.encounterId || props.patientInfo.id || props.patientInfo.patientId - formData.patientName = props.patientInfo.patientName || '' - formData.cardNo = props.patientInfo.cardNo || '' - formData.departmentName = props.patientInfo.departmentName || '' - formData.doctorName = props.patientInfo.doctorName || '' - } - // 只有在存在有效的 encounterId 时才调用接口 - if (queryParams.encounterId && queryParams.encounterId !== 'undefined' && queryParams.encounterId !== 'null' && queryParams.encounterId !== '') { - getInspectionList() - } else { - console.warn('缺少有效的就诊ID,无法获取检验申请单列表') - inspectionList.value = [] - total.value = 0 - } -} // 获取检验申请单列表 function getInspectionList() { - // 先检查是否有有效的encounterId - if (!queryParams.encounterId || queryParams.encounterId === 'undefined' || queryParams.encounterId === 'null') { - console.warn('缺少有效的就诊ID,无法获取检验申请单列表') - inspectionList.value = [] - total.value = 0 - loading.value = false + // 如果没有encounterId,不调用接口 + if (!queryParams.encounterId) { + // console.warn('【检验】encounterId为空,不调用接口') return } - + loading.value = true // 调用真实的API,只传递 encounterId 参数 + // console.log('【检验】调用API,encounterId:', queryParams.encounterId) getInspectionApplicationList({ encounterId: queryParams.encounterId }).then((res) => { if (res.code === 200) { inspectionList.value = res.data || [] total.value = res.data?.length || 0 + // console.log('【检验】获取数据成功,数量:', inspectionList.value.length) } else { inspectionList.value = [] total.value = 0 - console.error('获取检验申请单列表失败:', res.message || res.msg) - ElMessage.error(res.message || res.msg || '获取检验申请单列表失败') + ElMessage.error('获取检验申请单列表失败') } }).catch((error) => { - console.error('获取检验申请单列表异常:', error) + // console.error('获取检验申请单列表异常:', error) inspectionList.value = [] total.value = 0 - // 提供更友好的错误信息 - let errorMessage = '获取检验申请单列表异常' - if (error.response) { - errorMessage += ` (${error.response.status}): ${error.response.data.message || error.response.statusText}` - } else if (error.request) { - errorMessage += ': 网络请求失败,请检查网络连接' - } else { - errorMessage += `: ${error.message}` - } - ElMessage.error(errorMessage) + ElMessage.error('获取检验申请单列表异常') }).finally(() => { loading.value = false }) @@ -644,10 +678,12 @@ function getInspectionList() { // 新增申请单 function handleNewApplication() { - console.log('点击新增按钮') + // console.log('点击新增按钮') resetForm() // 生成申请单号 - formData.applicationNo = generateApplicationNo() + formData.applyNo = generateApplicationNo() + // 确保申请医生是当前登录医生 + formData.applyDocName = userNickName.value || userName.value || '' leftActiveTab.value = 'application' } @@ -661,30 +697,37 @@ function generateApplicationNo() { return `${year}${month}${day}${String(timestamp).slice(-3)}` } + // 重置表单 -function resetForm() { +async function resetForm() { Object.assign(formData, { applicationId: null, - applicationNo: '', + apply: '', patientName: props.patientInfo.patientName || '', - cardNo: props.patientInfo.cardNo || '', - feeType: 'self', - applicationDate: new Date(), - departmentName: props.patientInfo.departmentName || '', - doctorName: props.patientInfo.doctorName || '', + medicalrecordNumber: props.patientInfo.identifierNo || '', + natureofCost: 'self', + applyTime: new Date(), + applyDepartment: props.patientInfo.organizationName || '', + applyDeptCode: '', + applyDocCode: userId.value || '', + applyDocName: userNickName.value || userName.value || '', + operatorId: userId.value || '', executeDepartment: 'medical_lab', - diagnosisDesc: '', - contraindications: '', - clinicalDiagnosis: '', - medicalHistory: '', - inspectionPurpose: '', + clinicDesc: '', + contraindication: '', + clinicDiag: '', + medicalHistorySummary: '', + purposeofInspection: '', physicalExam: '', - inspectionItems: [], - remark: '', - isUrgent: false, - needCharge: true, + labApplyItemList: [], + applyRemark: '', + priorityCode: 0, + applyStatus: 1, needRefund: false, - needExecute: false + needExecute: false, + patientId: props.patientInfo.patientId || '', + visitNo: '', + specimenName: '血液', }) selectedInspectionItems.value = [] @@ -712,32 +755,43 @@ function handleSave() { let hasErrors = false // 检查必填字段 + // 检查必填字段,执行科室 if (!formData.executeDepartment) { validationErrors.executeDepartment = true hasErrors = true } - if (!formData.diagnosisDesc.trim()) { - validationErrors.diagnosisDesc = true + // 检查必填字段,诊断描述 + if (!formData.clinicDesc.trim()) { + validationErrors.clinicDesc = true hasErrors = true } - if (!formData.clinicalDiagnosis.trim()) { - validationErrors.clinicalDiagnosis = true + // 检查必填字段,临床诊断 + if (!formData.clinicDiag.trim()) { + validationErrors.clinicDiag = true hasErrors = true } - if (!formData.medicalHistory.trim()) { - validationErrors.medicalHistory = true + // 检查必填字段,病史摘要 + if (!formData.medicalHistorySummary.trim()) { + validationErrors.medicalHistorySummary = true hasErrors = true } - if (!formData.inspectionPurpose.trim()) { - validationErrors.inspectionPurpose = true + // 检查必填字段,检验目的 + if (!formData.purposeofInspection.trim()) { + validationErrors.purposeofInspection = true hasErrors = true } + // 检查必填字段,检验项目 if (selectedInspectionItems.value.length === 0) { - validationErrors.inspectionItems = true + validationErrors.labApplyItemList = true hasErrors = true ElMessage.error('请至少选择一项检验项目') return } + // 检查必填字段,申请日期 + if(!formData.applyTime || (typeof formData.applyTime === 'string' && !formData.applyTime.trim())) { + validationErrors.applyTime = true + hasErrors = true + } if (hasErrors) { ElMessage.error('请填写所有必填字段') @@ -747,11 +801,11 @@ function handleSave() { // 准备保存数据 const saveData = { ...formData, - inspectionItems: selectedInspectionItems.value, - inspectionItemsText: selectedInspectionItems.value.map(item => item.name).join('、'), - amount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price, 0), + labApplyItemList: selectedInspectionItems.value, + inspectionItemsText: selectedInspectionItems.value.map(item => item.itemName).join('、'), + amount: selectedInspectionItems.value.reduce((sum, item) => sum + item.itemAmount, 0), serviceFee: selectedInspectionItems.value.reduce((sum, item) => sum + (item.serviceFee || 0), 0), - totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.price + (item.serviceFee || 0), 0) + totalAmount: selectedInspectionItems.value.reduce((sum, item) => sum + item.itemAmount + (item.serviceFee || 0), 0) } console.log('保存检验申请单数据:', saveData) @@ -768,7 +822,7 @@ function handleSave() { ElMessage.error(res.message || '保存失败') } }).catch((error) => { - console.error('保存检验申请单异常:', error) + // console.error('保存检验申请单异常:', error) ElMessage.error('保存异常') }) } @@ -777,8 +831,8 @@ function handleSave() { function handleFormSave() { formRef.value?.validate((valid) => { if (valid) { - formData.inspectionItems = selectedInspectionItems.value.map(item => item.id) - console.log('保存检验申请单表单数据:', formData) + formData.labApplyItemList = selectedInspectionItems.value.map(item => item.id) + // console.log('保存检验申请单表单数据:', formData) ElMessage.success('保存成功') showForm.value = false getInspectionList() @@ -788,7 +842,7 @@ function handleFormSave() { // 查看详情 function handleView(row) { - console.log('点击查看按钮,数据:', row) + // console.log('点击查看按钮,数据:', row) // 加载表单数据 Object.assign(formData, row) @@ -828,7 +882,7 @@ function switchCategory(category) { // 处理搜索 function handleSearch() { // 搜索逻辑已在getFilteredItems中实现,这里可以添加额外的搜索逻辑 - console.log('搜索关键词:', searchKeyword.value) + // console.log('搜索关键词:', searchKeyword.value) } // 处理项目项点击(排除勾选框点击) @@ -847,7 +901,12 @@ function toggleInspectionItem(item) { if (index > -1) { selectedInspectionItems.value.splice(index, 1) } else { - selectedInspectionItems.value.push({ ...item }) + // 创建新对象,包含 itemName 属性(等于 name 属性) + const newItem = { + ...item, + itemName: item.itemName + }; + selectedInspectionItems.value.push(newItem); } } @@ -883,7 +942,7 @@ function handleSelectionChange(selection) { // 打印申请单 function handlePrint(row) { - console.log('打印申请单:', row) + // console.log('打印申请单:', row) // 切换到申请单TAB leftActiveTab.value = 'application' @@ -957,7 +1016,7 @@ function handlePrint(row) { // 删除申请单 function handleDelete(row) { ElMessageBox.confirm( - `确定要删除申请单 "${row.applicationNo}" 吗?此操作不可撤销。`, + `确定要删除申请单 "${row.applyNo}" 吗?此操作不可撤销。`, '删除确认', { confirmButtonText: '确定删除', @@ -966,7 +1025,7 @@ function handleDelete(row) { confirmButtonClass: 'el-button--danger' } ).then(() => { - console.log('删除申请单:', row) + // console.log('删除申请单:', row) // 调用真实的API删除 deleteInspectionApplication(row.applicationId).then((res) => { if (res.code === 200) { @@ -977,7 +1036,7 @@ function handleDelete(row) { ElMessage.error(res.message || '删除失败') } }).catch((error) => { - console.error('删除检验申请单异常:', error) + // console.error('删除检验申请单异常:', error) ElMessage.error('删除异常') }) }).catch(() => { @@ -991,9 +1050,9 @@ function handleCellClick(row, column) { } // 监听activeTab变化 -watch(() => props.activeTab, (newVal) => { +watch(() => props.activeTab, async (newVal) => { if (newVal === 'inspection') { - initData() + await initData() // 默认展开生化分类 activeCategory.value = 'biochemical' inspectionCategories.value.forEach(cat => { @@ -1002,33 +1061,32 @@ watch(() => props.activeTab, (newVal) => { } }) -// 监听patientInfo变化,确保在患者信息更新时也更新检验申请单列表 -watch(() => props.patientInfo, (newPatientInfo) => { - if (newPatientInfo && Object.keys(newPatientInfo).length > 0) { - // 更新encounterId - queryParams.encounterId = newPatientInfo.encounterId || newPatientInfo.id || newPatientInfo.patientId - // 如果有有效的encounterId,则获取检验申请单列表 - if (queryParams.encounterId && queryParams.encounterId !== 'undefined' && queryParams.encounterId !== 'null' && queryParams.encounterId !== '') { - getInspectionList() - } +// 监听patientInfo变化,确保encounterId及时更新 +watch(() => props.patientInfo, async (newVal) => { + // console.log('【检验】patientInfo变化:', newVal) + console.log('【检验】接收到的完整patientInfo:', JSON.stringify(newVal, null, 2)) + if (newVal && newVal.encounterId) { + queryParams.encounterId = newVal.encounterId + // console.log('【检验】更新encounterId:', queryParams.encounterId) + + // 更新科室编码 + // const currentDeptCode = await getCurrentDeptCode(); + // formData.applyDeptCode = currentDeptCode || ''; } -}, { deep: true }) +}, { deep: true, immediate: true }) // 初始化 -onMounted(() => { - initData() +onMounted(async () => { + await initData() }) // 暴露方法 defineExpose({ - getList() { - // 在调用getList时,先检查是否有有效的patientInfo,如果有则更新encounterId - if (props.patientInfo && Object.keys(props.patientInfo).length > 0) { - queryParams.encounterId = props.patientInfo.encounterId || props.patientInfo.id || props.patientInfo.patientId; - } - getInspectionList(); - } + getList: getInspectionList }) + + +