From 4277a369d26bef0abbcee5768518a9397f8e714a Mon Sep 17 00:00:00 2001 From: chenqi Date: Thu, 12 Mar 2026 12:42:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(order):=20=E8=A7=A3=E5=86=B3=E5=8C=BB?= =?UTF-8?q?=E5=98=B1=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化了JSON解析逻辑,避免重复解析contentJson字段 - 确保therapyEnum字段正确传递,默认值设置为长期医嘱('1') - 修复了医嘱保存和签发过程中类型字段丢失的问题 - 统一了前后端therapyEnum字段的默认值处理逻辑 - 添加了必要的注释说明字段处理规则 --- .../web/doctorstation/dto/AdviceSaveDto.java | 3 +- .../impl/AdviceManageAppServiceImpl.java | 1 + .../home/components/order/index.vue | 34 ++++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java index 9bb6802a..95d0d774 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java @@ -250,7 +250,8 @@ public class AdviceSaveDto { */ public AdviceSaveDto() { this.chineseHerbsDoseQuantity = new BigDecimal("1"); - this.therapyEnum = TherapyTimeType.TEMPORARY.getValue(); + // 默认设置为长期医嘱,但前端应该明确传递正确的值 + this.therapyEnum = TherapyTimeType.LONG_TERM.getValue(); this.practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); this.founderOrgId = SecurityUtils.getLoginUser().getOrgId(); // 开方人科室 } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java index b34da1b3..c87deb98 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java @@ -167,6 +167,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { Long organizationId = regAdviceSaveParam.getOrganizationId(); // 医嘱分类信息 List regAdviceSaveList = regAdviceSaveParam.getRegAdviceSaveList(); + // 药品 List medicineList = regAdviceSaveList.stream() .filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue index fd4dd612..e02135e2 100644 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue @@ -541,11 +541,14 @@ function getListInfo(addNewRow) { loadingInstance.close(); prescriptionList.value = res.data .map((item) => { + const parsedContent = JSON.parse(item.contentJson); return { - ...JSON.parse(item.contentJson), + ...parsedContent, ...item, - doseQuantity: JSON.parse(item.contentJson)?.doseQuantity, - doseUnitCode_dictText: JSON.parse(item.contentJson)?.doseUnitCode_dictText, + doseQuantity: parsedContent?.doseQuantity, + doseUnitCode_dictText: parsedContent?.doseUnitCode_dictText, + // 确保 therapyEnum 被正确设置,优先使用 contentJson 中的值 + therapyEnum: String(parsedContent?.therapyEnum ?? item.therapyEnum ?? '1'), }; }) .sort((a, b) => { @@ -604,7 +607,7 @@ function handleAddPrescription() { showPopover: false, isEdit: true, statusEnum: 1, - therapyEnum: '1', + therapyEnum: '1', // 默认为长期医嘱 }); getGroupMarkers(); nextTick(() => { @@ -641,8 +644,8 @@ function clickRowDb(row, column, event) { } row.showPopover = false; if (row.statusEnum == 1) { - // 确保治疗类型为字符串,方便与单选框 label 对齐 - row.therapyEnum = String(row.therapyEnum ?? ''); + // 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1') + row.therapyEnum = String(row.therapyEnum ?? '1'); row.isEdit = true; const index = prescriptionList.value.findIndex((item) => item.uniqueKey === row.uniqueKey); prescriptionList.value[index] = row; @@ -879,13 +882,16 @@ function handleSave() { // 此处签发处方和单行保存处方传参相同,后台已经将传参存为JSON字符串,此处直接转换为JSON即可 loading.value = true; let list = saveList.map((item) => { + const parsedContent = JSON.parse(item.contentJson); return { - ...JSON.parse(item.contentJson), + ...parsedContent, adviceType: item.adviceType, requestId: item.requestId, dbOpType: '1', groupId: item.groupId, uniqueKey: undefined, + // 确保 therapyEnum 被正确传递 + therapyEnum: parsedContent.therapyEnum || item.therapyEnum || '1', }; }); // 保存签发按钮 @@ -1059,6 +1065,8 @@ function handleSaveSign(row, index) { row.conditionDefinitionId = conditionDefinitionId.value; row.encounterDiagnosisId = encounterDiagnosisId.value; row.diagnosisName = diagnosisName.value; + // 确保 therapyEnum 被正确设置,默认为长期医嘱('1') + row.therapyEnum = row.therapyEnum || '1'; if (row.injectFlag == 1) { row.sortNumber = row.sortNumber ? row.sortNumber : prescriptionList.value.length; } @@ -1098,8 +1106,11 @@ function handleSaveBatch() { return item.statusEnum == 1 && !item.requestId; }) .map((item) => { + // 确保 therapyEnum 被正确传递,默认为长期医嘱('1') + const therapyEnum = item.therapyEnum || '1'; return { ...item, + therapyEnum: therapyEnum, dbOpType: item.requestId ? '2' : '1', }; }); @@ -1246,6 +1257,8 @@ function handleSaveGroup(orderGroupList) { conditionId: conditionId.value, // 诊断id conditionDefinitionId: conditionDefinitionId.value, // 诊断定义id encounterDiagnosisId: encounterDiagnosisId.value, // 就诊诊断id + // 确保 therapyEnum 被正确设置,默认为长期医嘱('1') + therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || '1', }; // 计算价格和总量 @@ -1278,7 +1291,12 @@ function handleSaveHistory(value) { conditionId: conditionId.value, conditionDefinitionId: conditionDefinitionId.value, encounterDiagnosisId: encounterDiagnosisId.value, - contentJson: JSON.stringify(value), + // 确保 therapyEnum 被正确传递,默认为长期医嘱('1') + therapyEnum: value.therapyEnum || '1', + contentJson: JSON.stringify({ + ...value, + therapyEnum: value.therapyEnum || '1', + }), }; savePrescription({ adviceSaveList: [saveRow], regAdviceSaveList: [saveRow] }).then((res) => { if (res.code === 200) {