diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java index 35bbee7d..908517e2 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java @@ -604,9 +604,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp iMedicationRequestService.removeById(adviceSaveDto.getRequestId()); // 删除已经产生的药品发放信息 iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId()); - // 删除费用项 - iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.MED_MEDICATION_REQUEST, - adviceSaveDto.getRequestId()); + // 🔧 Bug Fix #219: 删除费用项前查询确认 + Long requestId = adviceSaveDto.getRequestId(); + String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST; + // 先查询费用项是否存在 + List existingChargeItems = iChargeItemService.getChargeItemInfoByReqId(Arrays.asList(requestId)); + if (existingChargeItems == null || existingChargeItems.isEmpty()) { + log.warn("BugFix#219: 删除药品医嘱时未找到费用项, requestId={}, serviceTable={}", requestId, serviceTable); + } else { + log.info("BugFix#219: 找到 {} 个费用项, 准备删除, requestId={}, serviceTable={}", + existingChargeItems.size(), requestId, serviceTable); + // 删除费用项 + iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); + log.info("BugFix#219: 费用项删除完成, requestId={}", requestId); + } // 删除基于这个药品生成的需要执行的诊疗请求 iServiceRequestService.remove( new LambdaQueryWrapper() @@ -883,9 +894,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp iDeviceRequestService.removeById(adviceSaveDto.getRequestId()); // 删除已经产生的耗材发放信息 iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId()); - // 删除费用项 - iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_DEVICE_REQUEST, - adviceSaveDto.getRequestId()); + // 🔧 Bug Fix #219: 删除费用项前查询确认 + Long requestId = adviceSaveDto.getRequestId(); + String serviceTable = CommonConstants.TableName.WOR_DEVICE_REQUEST; + // 先查询费用项是否存在 + List existingChargeItems = iChargeItemService.getChargeItemInfoByReqId(Arrays.asList(requestId)); + if (existingChargeItems == null || existingChargeItems.isEmpty()) { + log.warn("BugFix#219: 删除耗材医嘱时未找到费用项, requestId={}, serviceTable={}", requestId, serviceTable); + } else { + log.info("BugFix#219: 找到 {} 个费用项, 准备删除, requestId={}, serviceTable={}", + existingChargeItems.size(), requestId, serviceTable); + // 删除费用项 + iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); + log.info("BugFix#219: 费用项删除完成, requestId={}", requestId); + } } for (AdviceSaveDto adviceSaveDto : insertOrUpdateList) { diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml index 9e69c007..939c8c80 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml @@ -226,7 +226,7 @@ '' AS manufacturer, T2.ID AS charge_item_definition_id, T2.instance_table AS advice_table_name, - T3.organization_id AS position_id, + COALESCE(T3.organization_id, T1.org_id) AS position_id, 0 AS restricted_flag, '' AS restricted_scope, '' AS dosage_instruction, diff --git a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue index 41b289c6..60d2b97a 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/prescription/prescriptionlist.vue @@ -1902,6 +1902,13 @@ function selectAdviceBase(key, row) { setValue(row); + // 🔧 Bug #220 修复:确保在setValue之后重新计算耗材类型的总金额 + // 耗材(adviceType=4)和诊疗(adviceType=3)需要重新计算以确保显示正确 + const currentRow = prescriptionList.value[rowIndex.value]; + if (currentRow && (currentRow.adviceType == 3 || currentRow.adviceType == 4)) { + calculateTotalPrice(currentRow, rowIndex.value); + } + // 确保在setValue之后再次设置showPopover为false,防止被覆盖 prescriptionList.value[rowIndex.value].showPopover = false; @@ -3035,8 +3042,20 @@ function setValue(row) { const finalLocationId = row.positionId || props.patientInfo.orgId; prescriptionList.value[rowIndex.value].locationId = finalLocationId; prescriptionList.value[rowIndex.value].positionId = finalLocationId; - } } else { + // 🔧 Bug #220 修复:耗材类型没有priceList时的默认处理 + console.warn('耗材价格列表为空:', row.adviceName || '未知耗材'); + prescriptionList.value[rowIndex.value].unitPrice = 0; + prescriptionList.value[rowIndex.value].unitTempPrice = 0; + prescriptionList.value[rowIndex.value].minUnitPrice = 0; + prescriptionList.value[rowIndex.value].quantity = row.quantity || 1; + prescriptionList.value[rowIndex.value].totalPrice = 0; + prescriptionList.value[rowIndex.value].positionName = row.positionName || ''; + const finalLocationId = row.positionId || props.patientInfo.orgId; + prescriptionList.value[rowIndex.value].locationId = finalLocationId; + prescriptionList.value[rowIndex.value].positionId = finalLocationId; + } + } else { getOrgList(); // 会诊类型(adviceType == 5)和诊疗类型(adviceType == 3)的处理 if (row.adviceType == 5) { @@ -3771,7 +3790,9 @@ async function checkOrderGroupAvailability(detailList) { // 🔧 Bug Fix: 将医嘱库信息保存到 item 中,供后续使用 item.orderDetailInfos = adviceInfo; item.adviceType = adviceInfo.adviceType; - item.positionId = adviceInfo.positionId; + // 🔧 Bug #218 修复:保留组套中维护的positionId,如果组套中没有则使用医嘱库的 + // 检查收费项目(adviceType=3)的科室应该从组套数据中获取 + item.positionId = item.positionId || adviceInfo.positionId; if (adviceInfo.adviceType != 3) { if (!adviceInfo.positionId) {