fix(doctorstation): 修复处方列表和医嘱处理中的多个问题

- 修复耗材和诊疗类型在setValue后总金额未正确计算的问题
- 修复耗材类型没有价格列表时的默认值处理逻辑
- 修复组套中positionId被医嘱库信息覆盖的问题
- 修复删除耗材医嘱时费用项不存在导致的异常
- 修复处方位置ID查询中组织ID为空时的回退逻辑
This commit is contained in:
2026-03-23 16:29:17 +08:00
parent b5cf685b13
commit 4d2a321999
3 changed files with 52 additions and 9 deletions

View File

@@ -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<ChargeItem> 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<ServiceRequest>()
@@ -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<ChargeItem> 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) {

View File

@@ -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,

View File

@@ -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) {