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 6e17e4f1..43cd7344 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue @@ -2063,15 +2063,20 @@ watch(() => props.patientInfo, async (newVal) => { } }, { deep: true, immediate: true }) -// Bug #329: 监听已选择的检验项目,自动更新检验项目文本并设置默认执行科室 +// Bug #329/#466: 监听已选择的检验项目,自动更新检验项目文本并设置默认执行科室、标本类型 watch(() => selectedInspectionItems.value, async (newVal) => { if (newVal && newVal.length > 0) { formData.inspectionItemsText = newVal.map(item => item.itemName).join('+') + const firstItem = newVal[0] + + // Bug #466: 如果标本类型为空或仍为初始化默认值,根据第一个检验项目的 sampleType 自动设置默认标本类型 + if ((!formData.specimenName || formData.specimenName === '血液') && firstItem.sampleType) { + formData.specimenName = firstItem.sampleType + } + // Bug #329: 如果执行科室为空,根据第一个检验项目的检验类型自动设置默认执行科室 if (!formData.executeDepartment) { - const firstItem = newVal[0] - // 根据检验项目的 inspectionTypeId 获取默认执行科室 if (firstItem.inspectionTypeId) { const defaultDeptCode = await getDefaultPerformDeptCode(firstItem.inspectionTypeId) @@ -2081,9 +2086,10 @@ watch(() => selectedInspectionItems.value, async (newVal) => { } } } else { - // Bug #329: 当项目被清空时,同时清空执行科室(下次选择项目时会重新自动设置) + // Bug #329: 当项目被清空时,同时清空执行科室和标本类型(下次选择项目时会重新自动设置) formData.inspectionItemsText = '' formData.executeDepartment = '' + formData.specimenName = '' } }, { deep: true })