diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/check/appservice/impl/CheckPackageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/check/appservice/impl/CheckPackageAppServiceImpl.java index d81edbce..a13da5aa 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/check/appservice/impl/CheckPackageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/check/appservice/impl/CheckPackageAppServiceImpl.java @@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.core.common.core.domain.R; import com.openhis.check.domain.CheckPackage; import com.openhis.check.domain.CheckPackageDetail; +import com.openhis.check.domain.CheckPart; import com.openhis.check.service.ICheckPackageDetailService; import com.openhis.check.service.ICheckPackageService; +import com.openhis.check.service.ICheckPartService; import com.openhis.web.check.appservice.ICheckPackageAppService; import com.openhis.web.check.dto.CheckPackageDetailDto; import com.openhis.web.check.dto.CheckPackageDto; @@ -34,6 +36,7 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService { private final ICheckPackageService checkPackageService; private final ICheckPackageDetailService checkPackageDetailService; + private final ICheckPartService checkPartService; /** * 转换明细 DTO 列表为实体列表 @@ -61,6 +64,25 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService { return details; } + /** + * 同步更新引用此套餐的检查部位价格 + */ + private void syncCheckPartPrice(String packageName, java.math.BigDecimal newPrice) { + if (packageName == null || newPrice == null) { + return; + } + List parts = checkPartService.list( + new LambdaQueryWrapper() + .eq(CheckPart::getPackageName, packageName) + ); + if (parts.isEmpty()) { + return; + } + parts.forEach(part -> part.setPrice(newPrice.doubleValue())); + checkPartService.updateBatchById(parts); + log.info("套餐[{}]价格更新为 {},已同步更新 {} 个检查部位的价格", packageName, newPrice, parts.size()); + } + @Override public R getCheckPackageList() { try { @@ -134,6 +156,9 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService { } } + // 同步更新引用此套餐的检查部位价格 + syncCheckPartPrice(checkPackage.getPackageName(), checkPackage.getPackagePrice()); + return R.ok(checkPackage.getId(), "保存成功"); } catch (Exception e) { log.error("新增检查套餐失败", e); @@ -193,6 +218,9 @@ public class CheckPackageAppServiceImpl implements ICheckPackageAppService { checkPackageDetailService.saveBatch(details); } + // 同步更新引用此套餐的检查部位价格 + syncCheckPartPrice(existPackage.getPackageName(), checkPackage.getPackagePrice()); + return R.ok("更新成功"); } catch (Exception e) { log.error("更新检查套餐失败", e); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java index a77b4ff6..844daa74 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java @@ -303,6 +303,22 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer .eq(TriageQueueItem::getDeleteFlag, "0") ); + // 当天未找到时回退:不限日期查最近一条(防止跨日就诊队列项遗漏更新) + if (queueItem == null) { + queueItem = triageQueueItemService.getOne( + new LambdaQueryWrapper() + .eq(TriageQueueItem::getTenantId, tenantId) + .eq(TriageQueueItem::getEncounterId, encounterId) + .eq(TriageQueueItem::getDeleteFlag, "0") + .orderByDesc(TriageQueueItem::getQueueDate) + .last("LIMIT 1") + ); + if (queueItem != null) { + log.warn("完诊:当天队列项未找到,回退使用最近队列记录 queueDate={}, id={}", + queueItem.getQueueDate(), queueItem.getId()); + } + } + // 如果队列项存在且未完成,更新队列状态为已完成 // 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态 if (queueItem != null && @@ -311,6 +327,9 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer queueItem.setStatus(TriageQueueStatus.COMPLETED.getValue()); queueItem.setUpdateTime(nowLocal); triageQueueItemService.updateById(queueItem); + } else if (queueItem == null) { + log.error("完诊:未找到任何 triage_queue_item 记录,encounterId={}, tenantId={}", + encounterId, tenantId); } // 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录)