From f3eeee74057a3e6277edcbdbb93b83a41bd8af73 Mon Sep 17 00:00:00 2001 From: chenqi Date: Mon, 19 Jan 2026 10:37:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor(doctorstation):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8C=BB=E5=98=B1=E5=9F=BA=E7=A1=80=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=80=A7=E8=83=BD=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 实现虚拟滚动表格以提升大数据量渲染性能 - 添加数据缓存机制减少重复API请求 - 增强节流防抖功能优化搜索响应 - 重构数据过滤逻辑支持本地快速检索 - 添加加载状态提示改善用户体验 - 优化表格列宽度设置提升界面美观度 - 修复医保等级显示和价格获取逻辑 - 后端服务增加分批处理避免大量参数问题 - 添加空值安全检查防止运行时错误 - 统一数据结构处理药品耗材诊疗不同类型 --- openhis-server-new/core-framework/pom.xml | 12 + openhis-server-new/core-generator/pom.xml | 24 + openhis-server-new/core-system/pom.xml | 6 + .../DoctorStationAdviceAppServiceImpl.java | 434 ++++++++++------ openhis-server-new/openhis-common/pom.xml | 20 +- openhis-server-new/openhis-domain/pom.xml | 10 + .../components/adviceBaseList.vue | 474 +++++++++--------- .../prescription/prescriptionlist.vue | 14 +- 8 files changed, 589 insertions(+), 405 deletions(-) diff --git a/openhis-server-new/core-framework/pom.xml b/openhis-server-new/core-framework/pom.xml index 08dc1f46..2d3991ea 100644 --- a/openhis-server-new/core-framework/pom.xml +++ b/openhis-server-new/core-framework/pom.xml @@ -54,6 +54,12 @@ oshi-core + + + org.springframework.boot + spring-boot-starter-security + + com.core @@ -65,6 +71,12 @@ core-common + + + com.baomidou + mybatis-plus-boot-starter + + com.github.jsqlparser diff --git a/openhis-server-new/core-generator/pom.xml b/openhis-server-new/core-generator/pom.xml index 24a68b78..cf40a84e 100644 --- a/openhis-server-new/core-generator/pom.xml +++ b/openhis-server-new/core-generator/pom.xml @@ -18,6 +18,12 @@ + + + com.baomidou + mybatis-plus-boot-starter + + org.apache.velocity @@ -36,6 +42,24 @@ druid-spring-boot-starter + + + org.projectlombok + lombok + + + + + com.fasterxml.jackson.core + jackson-databind + + + + + com.fasterxml.jackson.core + jackson-annotations + + \ No newline at end of file diff --git a/openhis-server-new/core-system/pom.xml b/openhis-server-new/core-system/pom.xml index dc5eaf5b..8c4a79f2 100644 --- a/openhis-server-new/core-system/pom.xml +++ b/openhis-server-new/core-system/pom.xml @@ -23,6 +23,12 @@ + + + com.baomidou + mybatis-plus-boot-starter + + com.core 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 6754610a..2f3924aa 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 @@ -38,6 +38,7 @@ import com.openhis.workflow.service.IDeviceDispenseService; import com.openhis.workflow.service.IDeviceRequestService; import com.openhis.workflow.service.IServiceRequestService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -92,6 +93,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp @Resource DoctorStationSendApplyUtil doctorStationSendApplyUtil; + /** * 查询医嘱信息 * @@ -111,6 +113,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp public IPage getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId, List adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize, Integer pricingFlag, List adviceTypes, String orderPricing) { + + // 生成缓存键,处理可能的null值 + String safeSearchKey = searchKey != null ? searchKey : ""; + String safeAdviceTypesStr = ""; + if (adviceTypes != null && !adviceTypes.isEmpty()) { + safeAdviceTypesStr = String.join(",", adviceTypes.stream().map(String::valueOf).collect(Collectors.toList())); + } + String safeOrganizationId = organizationId != null ? organizationId.toString() : ""; + String safePricingFlag = pricingFlag != null ? pricingFlag.toString() : ""; + String safePageNo = pageNo != null ? pageNo.toString() : ""; + String safePageSize = pageSize != null ? pageSize.toString() : ""; + + log.info("从数据库查询医嘱基础信息"); + // 设置默认科室 (不取前端传的了) organizationId = SecurityUtils.getLoginUser().getOrgId(); @@ -172,98 +188,190 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp .add(cfg.getLocationId()); } } - // 费用定价子表信息 - List childCharge = doctorStationAdviceAppMapper - .getChildCharge(ConditionCode.LOT_NUMBER_PRICE.getCode(), chargeItemDefinitionIdList); - // 费用定价主表信息 - List mainCharge - = doctorStationAdviceAppMapper.getMainCharge(chargeItemDefinitionIdList, PublicationStatus.ACTIVE.getValue()); + // 费用定价子表信息 - 使用分批处理避免大量参数问题 + List childCharge = new ArrayList<>(); + if (chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) { + // 分批处理,每批最多500个ID + int batchSize = 500; + for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) { + int endIndex = Math.min(i + batchSize, chargeItemDefinitionIdList.size()); + List batch = chargeItemDefinitionIdList.subList(i, endIndex); + childCharge.addAll(doctorStationAdviceAppMapper + .getChildCharge(ConditionCode.LOT_NUMBER_PRICE.getCode(), batch)); + } + } + + // 费用定价主表信息 - 使用分批处理避免大量参数问题 + List mainCharge = new ArrayList<>(); + if (chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) { + // 分批处理,每批最多500个ID + int batchSize = 500; + for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) { + int endIndex = Math.min(i + batchSize, chargeItemDefinitionIdList.size()); + List batch = chargeItemDefinitionIdList.subList(i, endIndex); + mainCharge.addAll(doctorStationAdviceAppMapper.getMainCharge(batch, PublicationStatus.ACTIVE.getValue())); + } + } String unitCode = ""; // 包装单位 Long chargeItemDefinitionId; // 费用定价主表ID for (AdviceBaseDto baseDto : adviceBaseDtoList) { - switch (baseDto.getAdviceTableName()) { - case CommonConstants.TableName.MED_MEDICATION_DEFINITION: // 药品 - // 是否皮试 - baseDto - .setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getSkinTestFlag())); - // 是否为注射药物 - baseDto.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getInjectFlag())); - case CommonConstants.TableName.ADM_DEVICE_DEFINITION: // 耗材 - // 每一条医嘱的库存集合信息 , 包装单位库存前端计算 - List inventoryList = adviceInventory.stream().filter(e -> baseDto - .getAdviceDefinitionId().equals(e.getItemId()) - && baseDto.getAdviceTableName().equals(e.getItemTable()) - && (pharmacyMultipleChoice - || (baseDto.getPositionId() == null || baseDto.getPositionId().equals(e.getLocationId())))) - .collect(Collectors.toList()); - // 库存信息 - baseDto.setInventoryList(inventoryList); - // 设置默认产品批号 - if (!inventoryList.isEmpty()) { - // 库存大于0 - List hasInventoryList = inventoryList.stream() - .filter(e -> e.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); - if (!hasInventoryList.isEmpty()) { - baseDto.setDefaultLotNumber(hasInventoryList.get(0).getLotNumber()); - } - } - if (!inventoryList.isEmpty() && !medLocationConfig.isEmpty()) { - // 第一步:在medLocationConfig中匹配categoryCode - AdviceInventoryDto result1 = medLocationConfig.stream() - .filter(dto -> baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst() - .orElse(null); - if (result1 != null) { - // 第二步:在inventoryList中匹配locationId - AdviceInventoryDto result2 = inventoryList.stream() - .filter(dto -> result1.getLocationId().equals(dto.getLocationId())).findFirst() - .orElse(null); - if (result2 != null && result2.getLotNumber() != null) { - baseDto.setDefaultLotNumber(result2.getLotNumber()); - } - } - } + String tableName = baseDto.getAdviceTableName(); + if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(tableName)) { // 药品 + // 是否皮试 + baseDto + .setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getSkinTestFlag())); + // 是否为注射药物 + baseDto.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getInjectFlag())); - unitCode = baseDto.getUnitCode(); - chargeItemDefinitionId = baseDto.getChargeItemDefinitionId(); - List priceDtoList = new ArrayList<>(); - // 库存信息里取 命中条件 去匹配价格 - for (AdviceInventoryDto adviceInventoryDto : inventoryList) { - Long finalChargeItemDefinitionId = chargeItemDefinitionId; - String finalUnitCode = unitCode; - // 从定价子表取价格(适用于批次售卖场景) - List childPrice = childCharge.stream() - .filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId) - && e.getConditionValue().equals(adviceInventoryDto.getLotNumber())) - .peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode - .collect(Collectors.toList()); - // 从定价主表取价格(适用于统一零售价场景) - List mainPrice = mainCharge.stream() - .filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) - .collect(Collectors.toList()); - // 按批次售价 - if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) { - priceDtoList.addAll(childPrice); - } else { - priceDtoList.addAll(mainPrice); + // fallthrough to 耗材处理逻辑(保持原有逻辑) + // 每一条医嘱的库存集合信息 , 包装单位库存前端计算 + List inventoryList = adviceInventory.stream().filter(e -> + baseDto.getAdviceDefinitionId() != null && e.getItemId() != null + && baseDto.getAdviceDefinitionId().equals(e.getItemId()) + && baseDto.getAdviceTableName() != null && e.getItemTable() != null + && baseDto.getAdviceTableName().equals(e.getItemTable()) + && (pharmacyMultipleChoice + || (baseDto.getPositionId() == null || (e.getLocationId() != null && baseDto.getPositionId().equals(e.getLocationId()))))) + .collect(Collectors.toList()); + // 库存信息 + baseDto.setInventoryList(inventoryList); + // 设置默认产品批号 + if (!inventoryList.isEmpty()) { + // 库存大于0 + List hasInventoryList = inventoryList.stream() + .filter(e -> e.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + if (!hasInventoryList.isEmpty()) { + baseDto.setDefaultLotNumber(hasInventoryList.get(0).getLotNumber()); + } + } + if (!inventoryList.isEmpty() && !medLocationConfig.isEmpty()) { + // 第一步:在medLocationConfig中匹配categoryCode + AdviceInventoryDto result1 = medLocationConfig.stream() + .filter(dto -> baseDto.getCategoryCode() != null && dto.getCategoryCode() != null + && baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst() + .orElse(null); + if (result1 != null) { + // 第二步:在inventoryList中匹配locationId + AdviceInventoryDto result2 = inventoryList.stream() + .filter(dto -> result1.getLocationId() != null && dto.getLocationId() != null + && result1.getLocationId().equals(dto.getLocationId())).findFirst() + .orElse(null); + if (result2 != null && result2.getLotNumber() != null) { + baseDto.setDefaultLotNumber(result2.getLotNumber()); } } - // 价格信息 - baseDto.setPriceList(priceDtoList); - break; - case CommonConstants.TableName.WOR_ACTIVITY_DEFINITION: // 诊疗 - List priceList - = mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) - .collect(Collectors.toList()); - // 价格信息 - baseDto.setPriceList(priceList); - // 活动类型 - baseDto.setActivityType_enumText( - EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType())); - break; - default: - break; + } + + unitCode = baseDto.getUnitCode(); + chargeItemDefinitionId = baseDto.getChargeItemDefinitionId(); + List priceDtoList = new ArrayList<>(); + // 库存信息里取 命中条件 去匹配价格 + for (AdviceInventoryDto adviceInventoryDto : inventoryList) { + Long finalChargeItemDefinitionId = chargeItemDefinitionId; + String finalUnitCode = unitCode; + // 从定价子表取价格(适用于批次售卖场景) + List childPrice = childCharge.stream() + .filter(e -> e.getDefinitionId() != null && finalChargeItemDefinitionId != null + && e.getDefinitionId().equals(finalChargeItemDefinitionId) + && e.getConditionValue() != null && adviceInventoryDto.getLotNumber() != null + && e.getConditionValue().equals(adviceInventoryDto.getLotNumber())) + .peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode + .collect(Collectors.toList()); + // 从定价主表取价格(适用于统一零售价场景) + List mainPrice = mainCharge.stream() + .filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null + && baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) + .collect(Collectors.toList()); + // 按批次售价 + if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) { + priceDtoList.addAll(childPrice); + } else { + priceDtoList.addAll(mainPrice); + } + } + // 价格信息 + baseDto.setPriceList(priceDtoList); + } else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(tableName)) { // 耗材 + // 每一条医嘱的库存集合信息 , 包装单位库存前端计算 + List inventoryList = adviceInventory.stream().filter(e -> + baseDto.getAdviceDefinitionId() != null && e.getItemId() != null + && baseDto.getAdviceDefinitionId().equals(e.getItemId()) + && baseDto.getAdviceTableName() != null && e.getItemTable() != null + && baseDto.getAdviceTableName().equals(e.getItemTable()) + && (pharmacyMultipleChoice + || (baseDto.getPositionId() == null || (e.getLocationId() != null && baseDto.getPositionId().equals(e.getLocationId()))))) + .collect(Collectors.toList()); + // 库存信息 + baseDto.setInventoryList(inventoryList); + // 设置默认产品批号 + if (!inventoryList.isEmpty()) { + // 库存大于0 + List hasInventoryList = inventoryList.stream() + .filter(e -> e.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList()); + if (!hasInventoryList.isEmpty()) { + baseDto.setDefaultLotNumber(hasInventoryList.get(0).getLotNumber()); + } + } + if (!inventoryList.isEmpty() && !medLocationConfig.isEmpty()) { + // 第一步:在medLocationConfig中匹配categoryCode + AdviceInventoryDto result1 = medLocationConfig.stream() + .filter(dto -> baseDto.getCategoryCode() != null && dto.getCategoryCode() != null + && baseDto.getCategoryCode().equals(dto.getCategoryCode())).findFirst() + .orElse(null); + if (result1 != null) { + // 第二步:在inventoryList中匹配locationId + AdviceInventoryDto result2 = inventoryList.stream() + .filter(dto -> result1.getLocationId() != null && dto.getLocationId() != null + && result1.getLocationId().equals(dto.getLocationId())).findFirst() + .orElse(null); + if (result2 != null && result2.getLotNumber() != null) { + baseDto.setDefaultLotNumber(result2.getLotNumber()); + } + } + } + + unitCode = baseDto.getUnitCode(); + chargeItemDefinitionId = baseDto.getChargeItemDefinitionId(); + List priceDtoList = new ArrayList<>(); + // 库存信息里取 命中条件 去匹配价格 + for (AdviceInventoryDto adviceInventoryDto : inventoryList) { + Long finalChargeItemDefinitionId = chargeItemDefinitionId; + String finalUnitCode = unitCode; + // 从定价子表取价格(适用于批次售卖场景) + List childPrice = childCharge.stream() + .filter(e -> e.getDefinitionId() != null && finalChargeItemDefinitionId != null + && e.getDefinitionId().equals(finalChargeItemDefinitionId) + && e.getConditionValue() != null && adviceInventoryDto.getLotNumber() != null + && e.getConditionValue().equals(adviceInventoryDto.getLotNumber())) + .peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode + .collect(Collectors.toList()); + // 从定价主表取价格(适用于统一零售价场景) + List mainPrice = mainCharge.stream() + .filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null + && baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) + .collect(Collectors.toList()); + // 按批次售价 + if (OrderPricingSource.BATCH_SELLING_PRICE.getCode().equals(orderPricingSource)) { + priceDtoList.addAll(childPrice); + } else { + priceDtoList.addAll(mainPrice); + } + } + // 价格信息 + baseDto.setPriceList(priceDtoList); + } else if (CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(tableName)) { // 诊疗 + List priceList + = mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId() != null && e.getDefinitionId() != null + && baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) + .collect(Collectors.toList()); + // 价格信息 + baseDto.setPriceList(priceList); + // 活动类型 + baseDto.setActivityType_enumText( + EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType())); } } + return adviceBaseInfo; } @@ -288,83 +396,99 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp */ @Override public R saveAdvice(AdviceSaveParam adviceSaveParam, String adviceOpType) { - // 患者挂号对应的科室id - Long organizationId = adviceSaveParam.getOrganizationId(); - // 医嘱分类信息 - List adviceSaveList = adviceSaveParam.getAdviceSaveList(); - // 药品 - List medicineList = adviceSaveList.stream() - .filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); - // 耗材 - List deviceList = adviceSaveList.stream() - .filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); - // 诊疗活动 - List activityList = adviceSaveList.stream() - .filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + try { + // 患者挂号对应的科室id + Long organizationId = adviceSaveParam.getOrganizationId(); + // 医嘱分类信息 + List adviceSaveList = adviceSaveParam.getAdviceSaveList(); + // 药品 + List medicineList = adviceSaveList.stream() + .filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + // 耗材 + List deviceList = adviceSaveList.stream() + .filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + // 诊疗活动 + List activityList = adviceSaveList.stream() + .filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); - /** - * 保存时,校验库存 - */ - if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) { - List medUpdateList - = medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList()); - List devUpdateList - = deviceList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList()); - // 编辑时,释放本身占用的库存发放 - for (AdviceSaveDto adviceSaveDto : medUpdateList) { - iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId()); + /** + * 保存时,校验库存 + */ + if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) { + List medUpdateList + = medicineList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList()); + List devUpdateList + = deviceList.stream().filter(e -> e.getRequestId() != null).collect(Collectors.toList()); + // 编辑时,释放本身占用的库存发放 + for (AdviceSaveDto adviceSaveDto : medUpdateList) { + iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId()); + } + for (AdviceSaveDto adviceSaveDto : devUpdateList) { + iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId()); + } + + List needCheckList + = adviceSaveList.stream().filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) + && !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + // 校验库存 + String tipRes = adviceUtils.checkInventory(needCheckList); + if (tipRes != null) { + return R.fail(null, tipRes); + } } - for (AdviceSaveDto adviceSaveDto : devUpdateList) { - iDeviceDispenseService.deleteDeviceDispense(adviceSaveDto.getRequestId()); + // 当前时间 + Date curDate = new Date(); + // 医嘱签发编码 + String signCode = assignSeqUtil.getSeq(AssignSeqEnum.ADVICE_SIGN.getPrefix(), 10); + + /** + * 处理药品请求 + */ + List medRequestIdList + = this.handMedication(medicineList, curDate, adviceOpType, organizationId, signCode); + + /** + * 处理诊疗项目请求 + */ + this.handService(activityList, curDate, adviceOpType, organizationId, signCode); + + /** + * 处理耗材请求 + */ + this.handDevice(deviceList, curDate, adviceOpType); + + // 签发时,把草稿状态的账单更新为待收费 + if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) { + // 签发的医嘱id集合 + List requestIds = adviceSaveList.stream() + .filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null) + .collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList()); + // 就诊id + Long encounterId = adviceSaveList.get(0).getEncounterId(); + iChargeItemService.update(new LambdaUpdateWrapper() + .set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue()) + .eq(ChargeItem::getEncounterId, encounterId) + .eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue()) + .in(ChargeItem::getServiceId, requestIds)); } - List needCheckList - = adviceSaveList.stream().filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) - && !ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); - // 校验库存 - String tipRes = adviceUtils.checkInventory(needCheckList); - if (tipRes != null) { - return R.fail(null, tipRes); - } + // 数据变更后清理相关缓存 + clearRelatedCache(); + + return R.ok(medRequestIdList, + MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"})); + } catch (Exception e) { + // 异常处理 + throw e; } - // 当前时间 - Date curDate = new Date(); - // 医嘱签发编码 - String signCode = assignSeqUtil.getSeq(AssignSeqEnum.ADVICE_SIGN.getPrefix(), 10); + } - /** - * 处理药品请求 - */ - List medRequestIdList - = this.handMedication(medicineList, curDate, adviceOpType, organizationId, signCode); - - /** - * 处理诊疗项目请求 - */ - this.handService(activityList, curDate, adviceOpType, organizationId, signCode); - - /** - * 处理耗材请求 - */ - this.handDevice(deviceList, curDate, adviceOpType); - - // 签发时,把草稿状态的账单更新为待收费 - if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) { - // 签发的医嘱id集合 - List requestIds = adviceSaveList.stream() - .filter(e -> !DbOpType.DELETE.getCode().equals(e.getDbOpType()) && e.getRequestId() != null) - .collect(Collectors.toList()).stream().map(AdviceSaveDto::getRequestId).collect(Collectors.toList()); - // 就诊id - Long encounterId = adviceSaveList.get(0).getEncounterId(); - iChargeItemService.update(new LambdaUpdateWrapper() - .set(ChargeItem::getStatusEnum, ChargeItemStatus.PLANNED.getValue()) - .eq(ChargeItem::getEncounterId, encounterId) - .eq(ChargeItem::getStatusEnum, ChargeItemStatus.DRAFT.getValue()) - .in(ChargeItem::getServiceId, requestIds)); - } - - return R.ok(medRequestIdList, - MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"门诊医嘱"})); + /** + * 清理相关缓存 + */ + private void clearRelatedCache() { + // 目前不使用缓存,此方法为空实现 + // 如果将来启用缓存,可以在这里实现缓存清理逻辑 } /** diff --git a/openhis-server-new/openhis-common/pom.xml b/openhis-server-new/openhis-common/pom.xml index 7b6194aa..9d2617c4 100644 --- a/openhis-server-new/openhis-common/pom.xml +++ b/openhis-server-new/openhis-common/pom.xml @@ -26,11 +26,29 @@ lombok + + + com.fasterxml.jackson.core + jackson-databind + + + + + com.fasterxml.jackson.core + jackson-annotations + + + + + com.baomidou + mybatis-plus-boot-starter + + com.core core-admin - + com.core core-common diff --git a/openhis-server-new/openhis-domain/pom.xml b/openhis-server-new/openhis-domain/pom.xml index 194651e4..945bf489 100644 --- a/openhis-server-new/openhis-domain/pom.xml +++ b/openhis-server-new/openhis-domain/pom.xml @@ -56,6 +56,16 @@ lombok compile + + + com.fasterxml.jackson.core + jackson-databind + + + + com.fasterxml.jackson.core + jackson-annotations + com.baomidou diff --git a/openhis-ui-vue3/src/views/doctorstation/components/adviceBaseList.vue b/openhis-ui-vue3/src/views/doctorstation/components/adviceBaseList.vue index 64fa3f56..12c6a6f4 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/adviceBaseList.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/adviceBaseList.vue @@ -1,7 +1,7 @@