diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java index 8ef35d22..5a80e0a1 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java @@ -3,8 +3,6 @@ package com.openhis.web.outpatientmanage.appservice; import java.util.List; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.openhis.administration.domain.Practitioner; -import com.openhis.administration.domain.PractitionerRole; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; @@ -45,15 +43,6 @@ public interface IOutpatientInfusionRecordService { List getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto); - /** - * 执行单个患者门诊输液 - * - * @param exeCount 执行记录数 - * @param outpatientInfusionRecordDto 患者输液信息 - * @return 修改成功/失败 - */ - boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto, Long exeCount); - /** * 执行单个患者门诊输液 * @@ -71,12 +60,13 @@ public interface IOutpatientInfusionRecordService { boolean editPatientInfusionTime(OutpatientInfusionRecordDto outpatientInfusionRecordDto); /** - * 显示门诊输液执行记录查询 + * 门诊输液执行历史记录查询 * * @param beginTime 开始时间 * @param endTime 结束时间 + * @param historyFlag 查询的是否为执行履历 * @return 门诊输液记录列表 */ - List getPatientInfusionPerformRecord(String beginTime, String endTime); + List getPatientInfusionPerformRecord(String beginTime, String endTime,boolean historyFlag); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java index d8e98b12..3c431f0b 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java @@ -1,11 +1,7 @@ package com.openhis.web.outpatientmanage.appservice.impl; -import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -80,39 +76,10 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR OutpatientInfusionInitDto initDto = new OutpatientInfusionInitDto(); // 获取皮试结果 - List statusEnumOptions2 = Stream.of(ClinicalStatus.values()) + List statusEnumOptions = Stream.of(ClinicalStatus.values()) .map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo())) .collect(Collectors.toList()); - initDto.setClinicalStatus(statusEnumOptions2); - - // 获取当天日期 - LocalDateTime beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true); - LocalDateTime endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false); - // 创建查询包装器 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.ge(OutpatientInfusionRecordDto::getOccurrenceStartTime, beginTime); - queryWrapper.le(OutpatientInfusionRecordDto::getOccurrenceEndTime, endTime); - - // 从数据库获取输液记录列表 - List infusionList = - outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); - // 遍历列表并处理每个记录 - infusionList.forEach(e -> { - // 性别 - e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); - // 药品状态 - e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); - // 皮试标志 - e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag())); - // 只有皮试药品才显示皮试结果 - if (e.getSkinTestFlag() == Whether.YES.getValue()) { - // 皮试结果 - e.setMedicationStatusEnum_enumText( - EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum())); - } - }); - - initDto.setInfusionList(infusionList); + initDto.setClinicalStatus(statusEnumOptions); return initDto; } @@ -154,13 +121,14 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)), null); // based_on_id 是为空的 - queryWrapper.eq("based_on_id", null); + queryWrapper.eq(CommonConstants.FieldName.basedOnId, null); // 状态是未完成的 - queryWrapper.in("service_status", EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue()); + queryWrapper.in(CommonConstants.FieldName.requestStatus, EventStatus.IN_PROGRESS.getValue(), + EventStatus.NOT_DONE.getValue()); // 添加时间段查询条件 if (beginTime != null && endTime != null) { - queryWrapper.ge("create_time", beginTime); - queryWrapper.le("create_time", endTime); + queryWrapper.ge(CommonConstants.FieldName.createTime, beginTime); + queryWrapper.le(CommonConstants.FieldName.createTime, endTime); } IPage outpatientInfusionPatientDto = @@ -177,10 +145,10 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR } /** - * 查询单个患者门诊输液记录查询 + * 查询单个患者门诊输液待执行记录 * * @param outpatientInfusionPatientDto 患者输液信息 - * @return 门诊输液记录列表 + * @return 患者待输液记录列表 */ @Override public List @@ -195,7 +163,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR // based_on_id 是为空的 queryWrapper.eq(OutpatientInfusionRecordDto::getBasedOnId, null); // 状态是未完成的 - queryWrapper.in(OutpatientInfusionRecordDto::getServiceStatus, EventStatus.IN_PROGRESS.getValue(), + queryWrapper.in(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue()); // 从数据库获取输液记录列表 List infusionList = @@ -204,91 +172,18 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR return infusionList; } - /** - * 执行单个患者门诊输液 - * - * @param exeCount 执行记录数 - * @param outpatientInfusionRecordDto 患者输液信息 - * @return 门诊输液记录列表 - */ - @Override - public boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto, Long exeCount) { - - // 根据执行人ID,通过登录userId获取 - Practitioner practitioner = - practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); - // 以执行人ID,获取执行人的身份类别 - PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitioner.getId()); - if (practitioner == null || practitionerRole == null) { - return false; - } - - String busNo = AssignSeqUtil.formatString(outpatientInfusionRecordDto.getBusNo(), exeCount, 3); - // 当输液未被全部执行时,可以修改继续执行,生成一条执行记录 - if ((BigDecimal.valueOf(exeCount)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) < 0) { - // 当 exeCount 小于 medicationAntity 时,执行这里的代码 - ServiceRequest serviceRequest = new ServiceRequest(); - serviceRequest.setPrescriptionNo(outpatientInfusionRecordDto.getPrescriptionNo()) - // 设置busNo,原来的服务请求编码为基础.执行次数 - .setBusNo(busNo) - // 基于service_request的id - .setBasedOnId(outpatientInfusionRecordDto.getServiceId()) - // 设置状态完成 - .setStatusEnum(EventStatus.COMPLETED.getValue()) - // 设置请求code 和原来一致 - .setActivityId(outpatientInfusionRecordDto.getActivityId()) - // 患者id - .setPatientId(outpatientInfusionRecordDto.getPatientId()) - // 就诊id - .setEncounterId(outpatientInfusionRecordDto.getEncounterId()) - // 执行人id,通过登录userId获取 - .setPerformerId(practitioner.getId()) - // 设置执行人身份类别 - .setPerformerTypeCode(practitionerRole.getRoleCode()) - // 设置执行日期为当前时间 - .setOccurrenceStartTime(DateUtils.getNowDate()) - // 默认执行时间加30min结束 - .setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30)); - - boolean result = serviceRequestService.save(serviceRequest); - if (!result) { - return false; - } - - // 判断如果是执行该患者最后一次记录,更新原来的服请求状态 - if ((BigDecimal.valueOf(exeCount + 1)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) == 0) { - // 以id为主条件更新服务申请管理表 - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(ServiceRequest::getId, outpatientInfusionRecordDto.getServiceId()) - .set(ServiceRequest::getStatusEnum, EventStatus.COMPLETED.getValue()) - .set(ServiceRequest::getPerformerTypeCode, practitionerRole.getRoleCode()) - .set(ServiceRequest::getPerformerId, practitioner.getId()) - .set(ServiceRequest::getOccurrenceStartTime, DateUtils.getNowDate()) - .set(ServiceRequest::getOccurrenceEndTime, DateUtils.getNowDate()); - int countUpdate = serviceRequestMapper.update(null, updateWrapper); - if (countUpdate < 0) { - return false; - } - } - return true; - } - - return false; - } - /** * 执行患者门诊输液 * - * @param outpatientInfusionRecordDtoList 输液记录 - * @return 修改成功/失败 + * @param outpatientInfusionRecordDtoList 输液记录列表 + * @return 执行成功/失败 */ @Override public boolean batchEditPatientInfusionRecord(List outpatientInfusionRecordDtoList) { - // 根据执行人ID,通过登录userId获取 Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId()); - // 根具执行人ID,获取执行人身份类型 + // 根据执行人ID,获取执行人身份类型 PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitioner.getId()); if (practitioner == null || practitionerRole == null) { return false; @@ -300,60 +195,58 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR // 遍历每个分组 for (Map.Entry> entry : groupedRecords.entrySet()) { - // Long groupId = entry.getKey(); List groupRecords = entry.getValue(); - // 获取执行次数 - Long exeCount = serviceRequestService.countServiceRequestByBasedOnId(groupRecords.get(0).getBasedOnId()); - - // 批量处理每个分组中的记录 - for (OutpatientInfusionRecordDto record : groupRecords) { - boolean result = editSingleRecord(record, exeCount, practitioner, practitionerRole); - if (!result) { - return false; // 如果某个记录执行失败,返回 false - } - } - - // 更新分组中每个记录的状态 - for (OutpatientInfusionRecordDto record : groupRecords) { - - if (!updateRecordStatus(record.getServiceId(), practitioner, practitionerRole)) { - return false; // 如果更新状态失败,返回 false - } - } - } - - return true; // 所有分组都执行成功 - } - - /** - * 处理单个记录的执行逻辑 - * - * @param record 输液记录 - * @param practitioner 执行人 - * @param practitionerRole 执行人身份类型 - * @return 执行成功/失败 - */ - public boolean editSingleRecord(OutpatientInfusionRecordDto record, Long exeCount, Practitioner practitioner, - PractitionerRole practitionerRole) { - - String busNo = AssignSeqUtil.formatString(record.getBusNo(), exeCount, 3); - - if ((BigDecimal.valueOf(exeCount)).compareTo(record.getMedicationAntity()) < 0) { - ServiceRequest serviceRequest = new ServiceRequest(); - serviceRequest.setPrescriptionNo(record.getPrescriptionNo()).setBusNo(busNo) - .setBasedOnId(record.getServiceId()).setStatusEnum(EventStatus.COMPLETED.getValue()) - .setActivityId(record.getActivityId()).setPatientId(record.getPatientId()) - .setEncounterId(record.getEncounterId()).setPerformerId(practitioner.getId()) - .setPerformerTypeCode(practitionerRole.getRoleCode()).setOccurrenceStartTime(DateUtils.getNowDate()) - .setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30)); - - boolean result = serviceRequestService.save(serviceRequest); - if (!result) { + // 获取组内药品个数 + Long groupCount = outpatientManageMapper.countMedicationExecuteNum(groupRecords.get(0).getServiceId(), null, + groupRecords.get(0).getGroupId(), false); + // 检查组内药品是否全部选中 + if (groupCount != groupRecords.size()) { return false; } - } + // 构造批量插入的 ServiceRequest 列表 + List serviceRequests = new ArrayList<>(); + for (OutpatientInfusionRecordDto record : groupRecords) { + String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId(); + // 获取执行次数 + Long exeCount = + outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true); + + if (exeCount < record.getExecuteNum()) { + ServiceRequest serviceRequest = new ServiceRequest(); + serviceRequest.setPrescriptionNo(record.getPrescriptionNo()) + .setBusNo(AssignSeqUtil.formatString(prefixBusNo, exeCount, 3)) + .setBasedOnId(record.getServiceId()).setStatusEnum(EventStatus.COMPLETED.getValue()) + .setActivityId(record.getActivityId()).setPatientId(record.getPatientId()) + .setEncounterId(record.getEncounterId()).setPerformerId(practitioner.getId()) + .setPerformerTypeCode(practitionerRole.getRoleCode()) + .setOccurrenceStartTime(DateUtils.getNowDate()) + .setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30)); + + serviceRequests.add(serviceRequest); + } + } + // 使用 MyBatis-Plus 的 saveBatch 方法批量插入 + if (!serviceRequestService.saveBatch(serviceRequests)) { + return false; // 如果批量插入失败,返回 false + } + // 更新分组中每个记录的状态 + for (OutpatientInfusionRecordDto record : groupRecords) { + String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId(); + // 获取执行次数 + Long exeCount = + outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true); + + // 执行完毕后,更新执行服务请求表的状态 + if (exeCount.equals(record.getExecuteNum())) { + if (!updateRecordStatus(record.getServiceId())) { + return false; // 如果更新状态失败,返回 false + } + } + } + } + // 所有分组都执行成功 return true; } @@ -361,18 +254,12 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR * 更新执行状态 * * @param serviceId 服务请求ID - * @param practitioner 执行人 - * @param practitionerRole 执行人身份类型 * @return 修改成功/失败 */ - public boolean updateRecordStatus(Long serviceId, Practitioner practitioner, PractitionerRole practitionerRole) { + public boolean updateRecordStatus(Long serviceId) { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(ServiceRequest::getId, serviceId) - .set(ServiceRequest::getStatusEnum, EventStatus.COMPLETED.getValue()) - .set(ServiceRequest::getPerformerTypeCode, practitionerRole.getRoleCode()) - .set(ServiceRequest::getPerformerId, practitioner.getId()) - .set(ServiceRequest::getOccurrenceStartTime, DateUtils.getNowDate()) - .set(ServiceRequest::getOccurrenceEndTime, DateUtils.getNowDate()); + updateWrapper.eq(ServiceRequest::getId, serviceId).set(ServiceRequest::getStatusEnum, + EventStatus.COMPLETED.getValue()); int countUpdate = serviceRequestMapper.update(null, updateWrapper); return countUpdate > 0; @@ -402,10 +289,11 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR * * @param beginTime 开始时间 * @param endTime 结束时间 + * @param historyFlag 查询的是否为执行履历 * @return 门诊输液执行记录查询 */ @Override - public List getPatientInfusionPerformRecord(String beginTime, String endTime) { + public List getPatientInfusionPerformRecord(String beginTime, String endTime,boolean historyFlag) { LocalDateTime beginDateTime; LocalDateTime endDateTime; @@ -420,10 +308,20 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR // 创建查询包装器 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - // based_on_id 不为空 - queryWrapper.isNotNull(OutpatientInfusionRecordDto::getBasedOnId); - // 状态是已完成 - queryWrapper.eq(OutpatientInfusionRecordDto::getServiceStatus, EventStatus.COMPLETED.getValue()); + //执行历史查询的条件 + if(historyFlag){ + // based_on_id 不为空,此条件筛选出执行履历 + queryWrapper.isNotNull(OutpatientInfusionRecordDto::getBasedOnId); + // 状态是已完成 + queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.COMPLETED.getValue()); + + //门诊输液待执行记录查询 + }else{ + // based_on_id 为空,此条件筛选控制不显示执行履历 + queryWrapper.isNull(OutpatientInfusionRecordDto::getBasedOnId); + // 状态是进行中 + queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue()); + } // 时间筛选 queryWrapper.ge(OutpatientInfusionRecordDto::getCreateTime, beginDateTime); queryWrapper.le(OutpatientInfusionRecordDto::getCreateTime, endDateTime); @@ -432,6 +330,22 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR List infusionPerformList = outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); + // 遍历列表并处理每个记录 + infusionPerformList.forEach(e -> { + // 性别 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 药品状态 + e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); + // 皮试标志 + e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag())); + // 只有皮试药品才显示皮试结果 + if (e.getSkinTestFlag() == Whether.YES.getValue()) { + // 皮试结果 + e.setMedicationStatusEnum_enumText( + EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum())); + } + }); + return infusionPerformList; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java index bbddaec6..8b0968a0 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java @@ -12,8 +12,6 @@ import com.openhis.common.constant.PromptMsgConstant; import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; -import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam; -import com.openhis.workflow.service.IServiceRequestService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -33,9 +31,6 @@ public class OutpatientInfusionRecordController { @Autowired IOutpatientInfusionRecordService outpatientInfusionRecordService; - @Autowired - IServiceRequestService serviceRequestService; - /** * 门诊输液记录初期数据 * @@ -48,24 +43,7 @@ public class OutpatientInfusionRecordController { } /** - * 查询门诊输液患者列表 - * - * @param outpatientInfusionSearchParam 查询参数 - * @param pageNo 当前页 - * @param pageSize 每页多少条 - * @return 就诊患者信息 - */ - @GetMapping(value = "/patients") - public R getOutpatientInfusionPatient(OutpatientInfusionSearchParam outpatientInfusionSearchParam, - @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - - return R.ok(outpatientInfusionRecordService.getOutpatientInfusionPatient(outpatientInfusionSearchParam, pageNo, - pageSize)); - } - - /** - * 查询单个患者门诊输液记录查询 + * 查询单个患者的门诊输液记录 * * @param outpatientInfusionPatientDto 患者输液信息 * @return 门诊输液记录列表 @@ -76,25 +54,6 @@ public class OutpatientInfusionRecordController { return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto)); } - // /** - // * 执行单个患者门诊输液 - // * - // * @param outpatientInfusionRecordDto 患者输液信息 - // * @return 门诊输液记录列表 - // */ - // @PutMapping("/infusion-perform") - // public R - // editPatientInfusionRecord(@Validated @RequestBody OutpatientInfusionRecordDto outpatientInfusionRecordDto) { - // // 获取执行次数 - // Long exeCount = - // serviceRequestService.countServiceRequestByBasedOnId(outpatientInfusionRecordDto.getServiceId()); - // boolean res = outpatientInfusionRecordService.editPatientInfusionRecord(outpatientInfusionRecordDto, exeCount); - // if (!res) { - // return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); - // } - // return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"})); - // } - /** * 批量执行患者门诊输液 * @@ -104,14 +63,11 @@ public class OutpatientInfusionRecordController { @PutMapping("/infusion-perform/batch") public R batchEditPatientInfusionRecord( @Validated @RequestBody List outpatientInfusionRecordDtoList) { - // 获取执行次数 - for (OutpatientInfusionRecordDto dto : outpatientInfusionRecordDtoList) { - Long exeCount = serviceRequestService.countServiceRequestByBasedOnId(dto.getServiceId()); - boolean res = outpatientInfusionRecordService.editPatientInfusionRecord(dto, exeCount); - if (!res) { - return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); - } + + if (!outpatientInfusionRecordService.batchEditPatientInfusionRecord(outpatientInfusionRecordDtoList)) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"})); } @@ -131,17 +87,31 @@ public class OutpatientInfusionRecordController { } /** - * 显示门诊输液执行记录查询 + * 门诊输液待执行记录查询 * * @param beginTime 开始时间 * @param endTime 结束时间 - * @return 门诊输液记录列表 + * @return 门诊输液待执行记录列表 */ - @GetMapping(value = "/infusion-perform-Record") + @GetMapping(value = "/infusion-wait-perform-record") + public R getPatientInfusionRecords(@RequestParam(required = false) String beginTime, + @RequestParam(required = false) String endTime) { + + return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, false)); + } + + /** + * 门诊输液执行历史记录查询 + * + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return 门诊输液执行历史记录列表 + */ + @GetMapping(value = "/infusion-perform-record") public R getPatientInfusionPerformRecord(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime) { - return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime,endTime)); + return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, true)); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionInitDto.java index 9ce247eb..ade484c9 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionInitDto.java @@ -19,8 +19,6 @@ public class OutpatientInfusionInitDto { //皮试结果 private List clinicalStatus; - //当天位执行的输液记录 - private List infusionList; /** * 状态 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java index 128494df..d53f37a1 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java @@ -1,15 +1,15 @@ package com.openhis.web.outpatientmanage.dto; +import java.math.BigDecimal; +import java.util.Date; + import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.openhis.common.annotation.Dict; -import com.sun.jna.platform.win32.OaIdl; + import lombok.Data; import lombok.experimental.Accessors; -import java.math.BigDecimal; -import java.util.Date; - /** * 门诊输液记录Dto * @@ -25,7 +25,7 @@ public class OutpatientInfusionRecordDto { private Long serviceId; /** 服务申请状态 */ - private Integer serviceStatus; + private Integer requestStatus; /** 请求基于什么的ID */ @JsonSerialize(using = ToStringSerializer.class) @@ -61,7 +61,7 @@ public class OutpatientInfusionRecordDto { private Integer genderEnum; private String genderEnum_enumText; - /** 已执行数量 */ + /** 住院执行次数 */ private Integer executeNum; /** 分组id */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java index 8776c3cd..e5bd3d49 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java @@ -63,4 +63,16 @@ public interface OutpatientManageMapper { List getOutpatientInfusionRecord( @Param(Constants.WRAPPER) LambdaQueryWrapper queryWrapper); + /** + * 查询药品已执行数量/查询同组内药品数量 + * + * @param paramId baseOnId/服务请求ID + * @param prefixBusNo 服务请求编码 + * @param groupId 分组ID + * @param flag 控制查询条件 + * @return 查询个数 + */ + long countMedicationExecuteNum(@Param("paramId") Long paramId, @Param("prefixBusNo") String prefixBusNo, + @Param("groupId") Long groupId, @Param("flag") boolean flag); + } diff --git a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml index 9281bfe5..bff580d1 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml @@ -179,7 +179,7 @@ resultType="com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto"> SELECT T1.service_id, - T1.service_status, + T1.request_status, T1.bus_no, T1.execute_num, T1.based_on_id, @@ -216,7 +216,7 @@ sr.prescription_no, --处方号 sr.encounter_id , --就诊ID sr.tenant_id, - sr.status_enum AS service_status, --服务状态 + sr.status_enum AS request_status, --服务请求状态 e.bus_no AS encounter_busNo, --就诊ID(前台显示用) pt.name AS patient_name, --病人姓名 pt.bus_no AS patient_busNo, --病人ID(前台显示用) @@ -250,7 +250,7 @@ LEFT JOIN med_medication_definition md ON md.id = m.medication_def_id LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id - ad.bus_no = 'sy001' -- 皮试检查的编号,todo:编号未定,后期修改 + ad.bus_no = 'sy001' -- 输液检查的编号,todo:编号未定,后期修改 AND mr.infusion_flag = 1 AND md.infusion_flag = 1 @@ -261,4 +261,40 @@ ${ew.customSqlSegment} + + + \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java index 29afa93c..bd9005a0 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java @@ -112,6 +112,21 @@ public class CommonConstants { * 患者姓名 */ String PatientName = "patient_name"; + + /** + * 请求状态 + */ + String requestStatus = "request_status"; + + /** + * 创建时间 + */ + String createTime = "create_time"; + + /** + * 请求基于什么的ID + */ + String basedOnId = "based_on_id"; } /**