diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/AGENTS.md b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/AGENTS.md index 34ea6717c..0feef56ed 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/AGENTS.md +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/AGENTS.md @@ -1,6 +1,6 @@ # Web Layer - API Controllers -**Module**: `openhis-application/web` +**Module**: `healthlink-his-application/web` **Role**: API endpoint layer - all REST controllers for frontend communication ## OVERVIEW diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java index 55ec4c0df..3d84e113f 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/appservice/impl/AdviceProcessAppServiceImpl.java @@ -74,13 +74,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"), DateTimeFormatter.ofPattern("yyyy-MM-dd H:mm:ss")); - /** Date → "yyyy-MM-dd HH:mm:ss",与前端 formatDateStr 输出格式一致 */ - private static String formatOccurrenceTime(Date date) { - if (date == null) return ""; - LocalDateTime ldt = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - return ldt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - } - @Resource AssignSeqUtil assignSeqUtil; @@ -184,33 +177,22 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { // 初始化查询参数 String encounterIds = inpatientAdviceParam.getEncounterIds(); inpatientAdviceParam.setEncounterIds(null); - // Bug #715: 提取therapyEnum手动处理,避免自动条件排除therapy_enum为NULL的耗材医嘱 - Integer therapyEnum = inpatientAdviceParam.getTherapyEnum(); - inpatientAdviceParam.setTherapyEnum(null); Integer exeStatus = inpatientAdviceParam.getExeStatus(); inpatientAdviceParam.setExeStatus(null); // 提取requestStatus手动处理,支持COMPLETED(3)和CHECK_VERIFIED(10)同时查询 Integer requestStatus = inpatientAdviceParam.getRequestStatus(); inpatientAdviceParam.setRequestStatus(null); - // Bug #714: 提取deadline手动处理,UNION子查询列名为end_time - String deadline = inpatientAdviceParam.getDeadline(); - inpatientAdviceParam.setDeadline(null); // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null); - // 手动拼接requestStatus条件 - // COMPLETED(3)时同时包含CHECK_VERIFIED(10)和PENDING_RECEIVE(11) - // ACTIVE(2)时同时包含PENDING_STOP(13),以便护士核对停嘱医嘱 + // 手动拼接requestStatus条件:COMPLETED(3)时同时包含CHECK_VERIFIED(10)和PENDING_RECEIVE(11) // UNION查询外层列名为request_status(T1.status_enum AS request_status),不是status_enum if (requestStatus != null) { if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) { queryWrapper.in("request_status", RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(), RequestStatus.PENDING_RECEIVE.getValue()); - } else if (RequestStatus.ACTIVE.getValue().equals(requestStatus)) { - queryWrapper.in("request_status", - RequestStatus.ACTIVE.getValue(), RequestStatus.PENDING_STOP.getValue()); } else { queryWrapper.eq("request_status", requestStatus); } @@ -222,24 +204,11 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { = Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList(); queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList); } - // Bug #715: 手动拼接therapyEnum条件,耗材医嘱(DeviceRequest)无therapy_enum(NULL),需兼容 - if (therapyEnum != null) { - queryWrapper.and(w -> w.eq("therapy_enum", therapyEnum).or().isNull("therapy_enum")); - } - // Bug #714: 手动拼接deadline条件,按医嘱截止时间筛选 - if (deadline != null && !deadline.isEmpty()) { - try { - LocalDateTime deadlineTime = LocalDateTime.parse(deadline, - DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - queryWrapper.le("end_time", deadlineTime); - } catch (DateTimeParseException e) { - // 忽略无效的日期格式 - } - } // 患者医嘱分页列表 Page inpatientAdvicePage = adviceProcessAppMapper.selectInpatientAdvicePage(new Page<>(pageNo, pageSize), queryWrapper, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST, + CommonConstants.TableName.WOR_DEVICE_REQUEST, RequestStatus.DRAFT.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(), ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(), ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(), @@ -283,16 +252,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { e.setTotalAmount(e.getQuantity() + unitStr); } - // 频次/用法组合(直接使用DictUtils翻译,避免DictAspect延迟导致_dictText为空) - String rateLabel = e.getRateCode() != null ? DictUtils.getDictLabel("rate_code", e.getRateCode()) : null; - String methodLabel = e.getMethodCode() != null ? DictUtils.getDictLabel("method_code", e.getMethodCode()) : null; + // 频次/用法组合 StringBuilder freqBuilder = new StringBuilder(); - if (rateLabel != null && !rateLabel.isEmpty()) { - freqBuilder.append(rateLabel); + if (e.getRateCode_dictText() != null && !e.getRateCode_dictText().isEmpty()) { + freqBuilder.append(e.getRateCode_dictText()); } - if (methodLabel != null && !methodLabel.isEmpty()) { + if (e.getMethodCode_dictText() != null && !e.getMethodCode_dictText().isEmpty()) { if (freqBuilder.length() > 0) freqBuilder.append(" "); - freqBuilder.append(methodLabel); + freqBuilder.append(e.getMethodCode_dictText()); } e.setFrequencyUsage(freqBuilder.length() > 0 ? freqBuilder.toString() : null); @@ -354,7 +321,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { if (performRecordList != null && !performRecordList.isEmpty()) { // 按时间分组,处理每个时间点的多条记录 Map> recordsByTime = performRecordList.stream() - .collect(Collectors.groupingBy(record -> formatOccurrenceTime(record.getOccurrenceTime()))); + .collect(Collectors.groupingBy(record -> record.getOccurrenceTime().toString())); for (Map.Entry> entry : recordsByTime.entrySet()) { List records = entry.getValue(); // 按操作顺序排序 @@ -413,14 +380,17 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { */ @Override public R adviceVerify(List performInfoList) { - // 分别创建两个列表来存储不同类型的请求 + // 分别创建列表来存储不同类型的请求 List serviceRequestList = new ArrayList<>(); List medRequestList = new ArrayList<>(); + List deviceRequestList = new ArrayList<>(); for (PerformInfoDto item : performInfoList) { if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())) { serviceRequestList.add(item); } else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) { medRequestList.add(item); + } else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) { + deviceRequestList.add(item); } } Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); @@ -429,29 +399,10 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { List serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList(); // 先查询服务请求,按 categoryEnum 分流:检查类(23)走 CHECK_VERIFIED,其余走 COMPLETED List allServiceRequests = serviceRequestService.listByIds(serviceReqIds); - - // 分离已停嘱(PENDING_STOP)的订单,护士核对后变为已停止(STOPPED) - List pendingStopRequests = allServiceRequests.stream() - .filter(sr -> RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum())) - .toList(); - List normalRequests = allServiceRequests.stream() - .filter(sr -> !RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum())) - .toList(); - - // 已停嘱订单 → 已停止(STOPPED) - if (!pendingStopRequests.isEmpty()) { - List pendingStopIds = pendingStopRequests.stream().map(ServiceRequest::getId).toList(); - serviceRequestService.update(new LambdaUpdateWrapper() - .in(ServiceRequest::getId, pendingStopIds) - .set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue()) - .set(ServiceRequest::getUpdateBy, SecurityUtils.getNickName())); - } - - // 正常订单:检查类 → 已校对(CHECK_VERIFIED=10),其余 → 已完成(COMPLETED=3) - List checkReqIds = normalRequests.stream() + List checkReqIds = allServiceRequests.stream() .filter(sr -> ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum())) .map(ServiceRequest::getId).toList(); - List otherReqIds = normalRequests.stream() + List otherReqIds = allServiceRequests.stream() .filter(sr -> !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum())) .map(ServiceRequest::getId).toList(); // 检查类 → 已校对(CHECK_VERIFIED=10) @@ -463,7 +414,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { serviceRequestService.updateCompleteRequestStatus(otherReqIds, practitionerId, checkDate); } // 处理转科/出院等特殊医嘱 - for (ServiceRequest serviceRequest : normalRequests) { + for (ServiceRequest serviceRequest : allServiceRequests) { if (ActivityDefCategory.TRANSFER.getValue().equals(serviceRequest.getCategoryEnum())) { encounterService.updateEncounterStatus(serviceRequest.getEncounterId(), EncounterZyStatus.PENDING_TRANSFER.getValue()); @@ -474,30 +425,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { } } if (!medRequestList.isEmpty()) { - List medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList(); - // 查询药品请求,分离已停嘱(PENDING_STOP)的订单 - List allMedRequests = medicationRequestService.list( - new LambdaQueryWrapper() - .select(MedicationRequest::getId, MedicationRequest::getStatusEnum) - .in(MedicationRequest::getId, medReqIds)); - List pendingStopMedIds = allMedRequests.stream() - .filter(mr -> RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum())) - .map(MedicationRequest::getId).toList(); - List normalMedIds = allMedRequests.stream() - .filter(mr -> !RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum())) - .map(MedicationRequest::getId).toList(); - - // 已停嘱订单 → 已停止(STOPPED) - if (!pendingStopMedIds.isEmpty()) { - medicationRequestService.update(new LambdaUpdateWrapper() - .in(MedicationRequest::getId, pendingStopMedIds) - .set(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue()) - .set(MedicationRequest::getUpdateBy, SecurityUtils.getNickName())); - } - // 正常订单 → 已完成(COMPLETED) - if (!normalMedIds.isEmpty()) { - medicationRequestService.updateCompletedStatusBatch(normalMedIds, practitionerId, checkDate); - } + // 更新药品请求状态已完成 + medicationRequestService.updateCompletedStatusBatch( + medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate); + } + if (!deviceRequestList.isEmpty()) { + // 更新耗材请求状态已完成 + deviceRequestService.updateCompletedStatusBatch( + deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList()); } return R.ok(null, "校对成功"); } @@ -510,14 +445,17 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { */ @Override public R adviceReject(List performInfoList) { - // 分别创建两个列表来存储不同类型的请求 + // 分别创建列表来存储不同类型的请求 List serviceRequestList = new ArrayList<>(); List medRequestList = new ArrayList<>(); + List deviceRequestList = new ArrayList<>(); for (PerformInfoDto item : performInfoList) { if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())) { serviceRequestList.add(item); } else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) { medRequestList.add(item); + } else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) { + deviceRequestList.add(item); } } // 校验医嘱是否已执行,已执行的医嘱需要先取消执行后才能退回 @@ -567,6 +505,11 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { medicationRequestService.updateDraftStatusBatch( medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate, backReason); } + if (!deviceRequestList.isEmpty()) { + // 更新耗材请求状态待发送 + deviceRequestService.updateDraftStatusBatch( + deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList()); + } return R.ok(null, "退回成功"); } @@ -583,25 +526,12 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { Date exeDate = adviceExecuteParam.getExeDate(); // 医嘱集合 List adviceExecuteDetailList = adviceExecuteParam.getAdviceExecuteDetailList(); - - // 前置校验:确保有待执行的医嘱且 executeTimes 不为空 - if (adviceExecuteDetailList == null || adviceExecuteDetailList.isEmpty()) { - return R.fail("未选择需要执行的医嘱"); - } - adviceExecuteDetailList.removeIf(item -> item.getExecuteTimes() == null || item.getExecuteTimes().isEmpty()); - if (adviceExecuteDetailList.isEmpty()) { - return R.fail("所选医嘱没有可执行的时间点,请勾选预计执行时间后再操作"); - } - // 药品 List medicineList = adviceExecuteDetailList.stream() .filter(e -> CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(e.getAdviceTable())).toList(); // 诊疗 List activityList = adviceExecuteDetailList.stream() .filter(e -> CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(e.getAdviceTable())).toList(); - - int totalCreatedCount = 0; - // -------------------------------------------药品 if (!medicineList.isEmpty()) { // 组装药品请求用于执行的数据结构 @@ -614,14 +544,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { } } // 处理药品执行 - totalCreatedCount += this.exeMedication(medUseExeList, exeDate); + this.exeMedication(medUseExeList, exeDate); } // -------------------------------------------诊疗 if (!activityList.isEmpty()) { // 组装诊疗请求用于执行的数据结构 List actUseExeList = this.assemblyActivity(activityList); // 处理诊疗执行 - totalCreatedCount += this.exeActivity(actUseExeList, exeDate); + this.exeActivity(actUseExeList, exeDate); // 检查类医嘱执行后,状态改为"待接收"(PENDING_RECEIVE=11) List actReqIds = activityList.stream().map(AdviceExecuteDetailParam::getRequestId).toList(); List executedReqs = serviceRequestService.listByIds(actReqIds); @@ -640,11 +570,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { } } - // 后置校验:确认有执行记录被实际创建 - if (totalCreatedCount == 0) { - return R.fail("执行失败,未生成任何执行记录,请检查医嘱状态后重试"); - } - return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"医嘱执行"})); } @@ -655,7 +580,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { * @return 操作结果 */ @Override - @Transactional(rollbackFor = Exception.class) public R adviceCancel(AdviceExecuteParam adviceExecuteParam) { // 获取当前执行时间 Date exeDate = DateUtils.getNowDate(); @@ -702,7 +626,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { longMedDispensedList.add(medicationDispense); } else if (DispenseStatus.EXECUTED.getValue().equals(medicationDispense.getStatusEnum()) || DispenseStatus.SUBMITTED.getValue().equals(medicationDispense.getStatusEnum())) { - longMedDispensedList.add(medicationDispense); longMedUndispenseList.add(medicationDispense); } } @@ -731,7 +654,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { tempMedDispensedList.add(medicationDispense); } else if (DispenseStatus.EXECUTED.getValue().equals(medicationDispense.getStatusEnum()) || DispenseStatus.SUBMITTED.getValue().equals(medicationDispense.getStatusEnum())) { - tempMedDispensedList.add(medicationDispense); tempMedUndispenseList.add(medicationDispense); } } @@ -879,7 +801,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { if (!longMedUndispenseList.isEmpty()) { // 排除已汇总的药品 List medicationDispenseList - = longMedUndispenseList.stream().filter(x -> x.getSummaryNo() == null).toList(); + = tempMedUndispenseList.stream().filter(x -> x.getSummaryNo() == null).toList(); medicationDispenseService .removeByIds(medicationDispenseList.stream().map(MedicationDispense::getId).toList()); } @@ -949,10 +871,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { * * @param medUseExeList 药品医嘱 * @param exeDate 实际执行时间 - * @return 实际创建的执行记录数 */ - private int exeMedication(List medUseExeList, Date exeDate) { - int createdCount = 0; + private void exeMedication(List medUseExeList, Date exeDate) { // 长期医嘱 List longMedication = medUseExeList.stream() .filter(e -> TherapyTimeType.LONG_TERM.getValue().equals(e.getTherapyEnum())).toList(); @@ -975,7 +895,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { MedicationRequest longMedicationRequest; ChargeItem chargeItem; for (MedicationRequestUseExe medicationRequestUseExe : longMedication) { - if (medicationRequestUseExe.getExecuteTimes() == null) continue; for (String executeTime : medicationRequestUseExe.getExecuteTimes()) { longMedicationRequest = new MedicationRequest(); BeanUtils.copyProperties(medicationRequestUseExe, longMedicationRequest); @@ -1005,7 +924,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { CommonConstants.TableName.MED_MEDICATION_REQUEST, EventStatus.COMPLETED, ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, longMedicationRequest.getGroupId(), null); - createdCount++; // 医嘱定价来源 String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE); @@ -1206,7 +1124,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { // 临时 MedicationRequest tempMedicationRequest; for (MedicationRequestUseExe medicationRequestUseExe : tempMedication) { - if (medicationRequestUseExe.getExecuteTimes() == null) continue; for (String executeTime : medicationRequestUseExe.getExecuteTimes()) { tempMedicationRequest = new MedicationRequest(); BeanUtils.copyProperties(medicationRequestUseExe, tempMedicationRequest); @@ -1219,7 +1136,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { CommonConstants.TableName.MED_MEDICATION_REQUEST, EventStatus.COMPLETED, ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, tempMedicationRequest.getGroupId(), null); - createdCount++; // 更新药品放发状态 medicationDispenseService.update(new LambdaUpdateWrapper() @@ -1236,7 +1152,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { } } - return createdCount; } /** @@ -1244,10 +1159,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { * * @param actUseExeList 诊疗医嘱 * @param exeDate 实际执行时间 - * @return 实际创建的执行记录数 */ - private int exeActivity(List actUseExeList, Date exeDate) { - int createdCount = 0; + private void exeActivity(List actUseExeList, Date exeDate) { // 长期医嘱 List longActivity = actUseExeList.stream() .filter(e -> TherapyTimeType.LONG_TERM.getValue().equals(e.getTherapyEnum())).toList(); @@ -1272,7 +1185,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { ServiceRequest longServiceRequest; ChargeItem chargeItem; for (ServiceRequestUseExe serviceRequestUseExe : longActivity) { - if (serviceRequestUseExe.getExecuteTimes() == null) continue; // 查询耗材的取药科室 Long takeDeviceLocationId = doctorStationAdviceAppMapper .getTakeDeviceLocationId(serviceRequestUseExe.getEncounterId(), ItemCategoryCode.DEVICE.getCode()); @@ -1287,7 +1199,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { longServiceRequest.getPatientId(), longServiceRequest.getId(), CommonConstants.TableName.WOR_SERVICE_REQUEST, EventStatus.COMPLETED, ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, null, null); - createdCount++; // 生成账单 chargeItem = new ChargeItem(); @@ -1345,7 +1256,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { // 临时 ServiceRequest tempServiceRequest; for (ServiceRequestUseExe serviceRequestUseExe : tempActivity) { - if (serviceRequestUseExe.getExecuteTimes() == null) continue; // 查询耗材的取药科室 Long takeDeviceLocationId = doctorStationAdviceAppMapper .getTakeDeviceLocationId(serviceRequestUseExe.getEncounterId(), ItemCategoryCode.DEVICE.getCode()); @@ -1360,7 +1270,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { tempServiceRequest.getPatientId(), tempServiceRequest.getId(), CommonConstants.TableName.WOR_SERVICE_REQUEST, EventStatus.COMPLETED, ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, null, null); - createdCount++; // 更新账单状态 chargeItemService.update( @@ -1378,7 +1287,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { } } - return createdCount; } /** diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/mapper/AdviceProcessAppMapper.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/mapper/AdviceProcessAppMapper.java index 591433890..e9affdd62 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/mapper/AdviceProcessAppMapper.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/inhospitalnursestation/mapper/AdviceProcessAppMapper.java @@ -65,7 +65,8 @@ public interface AdviceProcessAppMapper { Page selectInpatientAdvicePage(@Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("medMedicationRequest") String medMedicationRequest, - @Param("worServiceRequest") String worServiceRequest, @Param("draft") Integer draft, + @Param("worServiceRequest") String worServiceRequest, + @Param("worDeviceRequest") String worDeviceRequest, @Param("draft") Integer draft, @Param("active") Integer active, @Param("bed") Integer bed, @Param("admittingDoctor") String admittingDoctor, @Param("personalCashAccount") String personalCashAccount, @Param("billable") Integer billable, @Param("billed") Integer billed, @Param("refunded") Integer refunded, @Param("imp") Integer imp, diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/dto/RequestFormDetailQueryDto.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/dto/RequestFormDetailQueryDto.java index ad3b61d58..ae7ff6f93 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/dto/RequestFormDetailQueryDto.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/regdoctorstation/dto/RequestFormDetailQueryDto.java @@ -14,9 +14,9 @@ import java.math.BigDecimal; public class RequestFormDetailQueryDto { /** - * 诊疗活动定义ID(wor_service_request.activity_id,与开立检验时项目字典的 id / adviceDefinitionId 一致,用于编辑回显) + * 诊疗活动定义ID(wor_service_request.id,与开立检验时项目字典的 id / adviceDefinitionId 一致,用于编辑回显) */ - private Long activityId; + private Long adviceDefinitionId; /** 医嘱名称 */ private String adviceName; diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V2026_0612__fix_clinical_pathway_execution_hisbase_columns.sql b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V2026_0612__fix_clinical_pathway_execution_hisbase_columns.sql new file mode 100644 index 000000000..9db177117 --- /dev/null +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V2026_0612__fix_clinical_pathway_execution_hisbase_columns.sql @@ -0,0 +1,5 @@ +-- Fix Bug #748: clinical_pathway_execution 缺少 HisBaseEntity 列 +-- V43 迁移因版本号低于已执行的 V2026_0608 而被 Flyway 跳过,此处重新添加缺失列 +ALTER TABLE clinical_pathway_execution ADD COLUMN IF NOT EXISTS create_by VARCHAR(64) DEFAULT ''; +ALTER TABLE clinical_pathway_execution ADD COLUMN IF NOT EXISTS update_by VARCHAR(64) DEFAULT ''; +ALTER TABLE clinical_pathway_execution ADD COLUMN IF NOT EXISTS update_time TIMESTAMP; diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml index 41ea84840..bc64c54ef 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/inhospitalnursestation/AdviceProcessAppMapper.xml @@ -207,7 +207,7 @@ NULL::numeric AS unit_price, NULL::numeric AS total_price, NULL::bigint AS stopper_id, - T1.update_by AS stopper_name + NULL::varchar AS stopper_name FROM med_medication_request AS T1 LEFT JOIN med_medication_definition AS T2 ON T2.id = T1.medication_id @@ -353,7 +353,7 @@ NULL::numeric AS unit_price, NULL::numeric AS total_price, NULL::bigint AS stopper_id, - T1.update_by AS stopper_name + NULL::varchar AS stopper_name FROM wor_service_request AS T1 LEFT JOIN wor_activity_definition AS T2 ON T2.id = T1.activity_id @@ -439,6 +439,139 @@ ELSE 1=1 END AND T1.refund_service_id IS NULL ORDER BY T1.status_enum ) + UNION + ( SELECT DISTINCT T1.encounter_id, + T1.tenant_id, + #{worDeviceRequest} AS advice_table, + T1.id AS request_id, + T1.req_authored_time AS start_time, + NULL::timestamp AS end_time, + T1.requester_id AS requester_id, + T1.create_time AS request_time, + NULL::integer AS skin_test_flag, + NULL::integer AS inject_flag, + NULL::bigint AS group_id, + T1.performer_check_id, + T2."name" AS advice_name, + T2.id AS item_id, + NULL::varchar AS volume, + T1.lot_number AS lot_number, + T1.quantity AS quantity, + T1.unit_code AS unit_code, + T1.status_enum AS request_status, + NULL::varchar AS method_code, + T1.rate_code AS rate_code, + NULL::numeric AS dose, + NULL::varchar AS dose_unit_code, + ao1.id AS position_id, + ao1."name" AS position_name, + NULL::integer AS dispense_per_duration, + 1::numeric AS part_percent, + ccd."name" AS condition_definition_name, + NULL::integer AS therapy_enum, + NULL::integer AS sort_number, + T1.quantity AS execute_num, + af.day_times, + ae.bus_no, + ap."name" AS patient_name, + al2."name" AS bed_name, + ap.gender_enum, + ap.birth_date, + ap.id AS patient_id, + fc.contract_name, + diagnosis.condition_names, + pra."name" AS admitting_doctor_name, + personal_account.balance_amount, + personal_account.id AS account_id, + T2.category_code, + NULL::integer AS dispense_status, + NULL::numeric AS unit_price, + NULL::numeric AS total_price, + NULL::bigint AS stopper_id, + NULL::varchar AS stopper_name + FROM wor_device_request AS T1 + LEFT JOIN adm_device_definition AS T2 + ON T2.id = T1.device_def_id + AND T2.delete_flag = '0' + LEFT JOIN adm_organization AS ao1 + ON ao1.id = T1.org_id + AND ao1.delete_flag = '0' + LEFT JOIN cli_condition AS cc + ON cc.id = T1.condition_id + AND cc.delete_flag = '0' + LEFT JOIN cli_condition_definition AS ccd + ON ccd.id = cc.definition_id + AND ccd.delete_flag = '0' + LEFT JOIN adm_encounter ae + ON ae.id = T1.encounter_id + AND ae.class_enum = #{imp} + AND ae.delete_flag = '0' + LEFT JOIN adm_patient ap + ON ae.patient_id = ap.id + AND ap.delete_flag = '0' + LEFT JOIN adm_encounter_location ael + ON ae.id = ael.encounter_id + AND ael.delete_flag = '0' + AND ael.status_enum = #{active} + AND ael.form_enum = #{bed} + LEFT JOIN adm_location al2 + ON ael.location_id = al2.id + AND al2.delete_flag = '0' + LEFT JOIN adm_account aa + ON ae.id = aa.encounter_id + AND aa.encounter_flag = 1 + AND aa.delete_flag = '0' + LEFT JOIN fin_contract fc + ON aa.contract_no = fc.bus_no + AND fc.delete_flag = '0' + LEFT JOIN ( SELECT aed.encounter_id, + STRING_AGG(ccd.name, ', ') AS condition_names + FROM adm_encounter_diagnosis aed + INNER JOIN cli_condition cc + ON cc.id = aed.condition_id + AND cc.delete_flag = '0' + INNER JOIN cli_condition_definition ccd + ON ccd.id = cc.definition_id + AND ccd.delete_flag = '0' + WHERE aed.delete_flag = '0' + GROUP BY aed.encounter_id + ) AS diagnosis + ON ae.id = diagnosis.encounter_id + LEFT JOIN adm_encounter_participant aep + ON ae.id = aep.encounter_id + AND aep.delete_flag = '0' + AND aep.status_enum = #{active} + AND aep.type_code = #{admittingDoctor} + LEFT JOIN adm_practitioner pra + ON aep.practitioner_id = pra.id + AND pra.delete_flag = '0' + LEFT JOIN ( SELECT aa.id, + aa.encounter_id, + (aa.balance_amount - + COALESCE(SUM(CASE WHEN aci.status_enum IN (#{billed}, #{billable}) + THEN aci.total_price ELSE 0 END), 0) + + COALESCE(SUM(CASE WHEN aci.status_enum = #{refunded} + THEN aci.total_price ELSE 0 END), 0)) AS balance_amount + FROM adm_account aa + LEFT JOIN adm_charge_item aci + ON aa.encounter_id = aci.encounter_id + AND aa.delete_flag = '0' + WHERE aa.type_code = #{personalCashAccount} + AND aa.delete_flag = '0' + GROUP BY aa.id, + aa.encounter_id, + aa.balance_amount + ) AS personal_account + ON personal_account.encounter_id = ae.id + LEFT JOIN adm_frequency af + ON af.rate_code = T1.rate_code + AND af.delete_flag = '0' + WHERE T1.delete_flag = '0' + AND T1.generate_source_enum = #{doctorPrescription} + AND CASE WHEN T1.status_enum = #{draft} + THEN FALSE + ELSE TRUE END + ORDER BY T1.status_enum ) ) AS ii ${ew.customSqlSegment} diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml index 46051997d..1361aa607 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml @@ -140,7 +140,7 @@