From cd04bca322b23408b4d0c9c8471efbc438ac0d32 Mon Sep 17 00:00:00 2001 From: liuhongrui Date: Sat, 15 Mar 2025 16:06:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E8=AF=8A=E5=92=8C=E7=9A=AE=E8=AF=95?= =?UTF-8?q?=E5=92=8C=E7=97=85=E4=BA=BA=E4=BF=A1=E6=81=AF=E7=9A=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IOutpatientInfusionRecordService.java | 4 +- .../IOutpatientSkinTestRecordService.java | 11 -- .../OutpatientInfusionRecordServiceImpl.java | 38 ++-- .../OutpatientSkinTestRecordServiceImpl.java | 23 +-- .../OutpatientInfusionRecordController.java | 49 ++--- .../dto/OutpatientInfusionInitDto.java | 2 - .../dto/OutpatientInfusionRecordDto.java | 4 + .../dto/OutpatientSkinTestInitDto.java | 5 +- .../appservice/IOutpatientRecordService.java | 35 ++++ .../IPatientInformationService.java | 19 ++ .../impl/OutpatientRecordServiceImpl.java | 74 +++++++ .../impl/PatientInformationServiceImpl.java | 68 +++++++ .../OutpatientRecordController.java | 45 ++--- .../PatientInformationController.java | 185 +++++------------- .../patientmanage/dto/PatientInfoInitDto.java | 46 +++++ .../web/patientmanage/dto/PatientListDto.java | 16 -- .../OutpatientManageMapper.xml | 18 +- 17 files changed, 376 insertions(+), 266 deletions(-) create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IOutpatientRecordService.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IPatientInformationService.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/OutpatientRecordServiceImpl.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInfoInitDto.java delete mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientListDto.java 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 4ab030a4..2d2484a3 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 @@ -68,8 +68,10 @@ public interface IOutpatientInfusionRecordService { /** * 显示门诊输液执行记录查询 * + * @param beginTime 开始时间 + * @param endTime 结束时间 * @return 门诊输液记录列表 */ - List getPatientInfusionPerformRecord(); + List getPatientInfusionPerformRecord(String beginTime,String endTime); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java index 8cd6b60b..6f0dcb0e 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientSkinTestRecordService.java @@ -2,14 +2,12 @@ package com.openhis.web.outpatientmanage.appservice; import java.util.List; -import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestInitDto; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam; -import com.openhis.web.patientmanage.dto.PatientListDto; /** * 门诊管理 应用实现类 @@ -49,15 +47,6 @@ public interface IOutpatientSkinTestRecordService { @Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam, @Param("pageSize") Integer pageSize, @Param("offset") Integer offset); - /** - * 统计门诊皮试记录数的方法 - * - * @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数 - * @return 分页查询 - */ - long countOutpatientSkinTestRecords( - @Param("OutpatientSkinTestRecordSearchParam") OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam); - /** * 护士确认执行皮试后,更新皮试记录信息(服务申请管理与过敏与不耐受的相关字段更新) * 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 085bd73a..c662006d 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 @@ -3,6 +3,7 @@ package com.openhis.web.outpatientmanage.appservice.impl; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Arrays; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; @@ -72,11 +73,6 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR */ public OutpatientInfusionInitDto getOutpatientInfusionInit() { OutpatientInfusionInitDto initDto = new OutpatientInfusionInitDto(); - // 获取药品状态 - List statusEnumOptions = Stream.of(EventStatus.values()) - .map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo())) - .collect(Collectors.toList()); - initDto.setMedicationStatus(statusEnumOptions); // 获取皮试结果 List statusEnumOptions2 = Stream.of(ClinicalStatus.values()) @@ -126,7 +122,8 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR String searchKey; LocalDateTime beginTime; LocalDateTime endTime; - if (outpatientInfusionSearchParam == null) { + if (outpatientInfusionSearchParam == null || outpatientInfusionSearchParam.getBeginTime() == null + || outpatientInfusionSearchParam.getEndTime() == null) { searchKey = null; beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true); endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false); @@ -138,9 +135,9 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey, - new HashSet<>(Arrays.asList("patient_busNo", "encounter_busNo", "patient_name")), null); + new HashSet<>(Arrays.asList("patient_bus_no", "encounter_bus_no", "patient_name")), null); // based_on_id 是为空的 - queryWrapper.eq("based_on_id",null); + queryWrapper.eq("based_on_id", null); // 状态是未完成的 queryWrapper.in("status_enum", EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue()); // 添加时间段查询条件 @@ -179,7 +176,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("patient_id", outpatientInfusionPatientDto.getPatientId()); // based_on_id 是为空的 - queryWrapper.eq("based_on_id",null); + queryWrapper.eq("based_on_id", null); // 状态是未完成的 queryWrapper.in("status_enum", EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue()); // 从数据库获取输液记录列表 @@ -249,8 +246,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR updateWrapper.eq("id", outpatientInfusionRecordDto.getServiceId()) .set("status_enum", EventStatus.COMPLETED.getValue()) .set("performer_type_code", practitionerRole.getRoleCode()) - .set("performer_id", practitioner.getId()) - .set("occurrence_start_time", DateUtils.getNowDate()) + .set("performer_id", practitioner.getId()).set("occurrence_start_time", DateUtils.getNowDate()) .set("occurrence_end_time", DateUtils.getNowDate()); int countUpdate = serviceRequestMapper.update(null, updateWrapper); if (countUpdate < 0) { @@ -286,17 +282,33 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR /** * 显示门诊输液执行记录查询 * + * @param beginTime 开始时间 + * @param endTime 结束时间 * @return 门诊输液记录列表 */ @Override - public List getPatientInfusionPerformRecord() { + public List getPatientInfusionPerformRecord(String beginTime, String endTime) { + + LocalDateTime beginDateTime; + LocalDateTime endDateTime; + //筛选时间不传,默认当天记录 + if (beginTime == null || endTime == null) { + beginDateTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true); + endDateTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false); + } else { + beginDateTime = DateUtils.startDayOrEndDay(beginTime, true); + endDateTime = DateUtils.startDayOrEndDay(endTime, false); + } + // 创建查询包装器 QueryWrapper queryWrapper = new QueryWrapper<>(); // based_on_id 不为空 queryWrapper.isNotNull("based_on_id"); // 状态是已完成 queryWrapper.eq("status_enum", EventStatus.COMPLETED.getValue()); - + // 时间筛选 + queryWrapper.ge("begin_time", beginDateTime); + queryWrapper.le("end_time", endDateTime); // 从数据库获取输液记录列表 List infusionPerformList = outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java index e13b3f68..5bec341a 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientSkinTestRecordServiceImpl.java @@ -1,7 +1,5 @@ package com.openhis.web.outpatientmanage.appservice.impl; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -37,7 +35,6 @@ import com.openhis.web.outpatientmanage.appservice.IOutpatientSkinTestRecordServ import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordSearchParam; import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper; -import com.openhis.web.patientmanage.dto.PatientListDto; import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.mapper.ServiceRequestMapper; import com.openhis.workflow.service.IServiceRequestService; @@ -87,14 +84,14 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR @Override public OutpatientSkinTestInitDto getOutpatientSkinTestInit() { OutpatientSkinTestInitDto initDto = new OutpatientSkinTestInitDto(); //获取皮试状态 - List statusEnumOptions1 = Stream.of(VerificationStatus.values()) - .map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo())) + List statusEnumOptions1 = Stream.of(VerificationStatus.values()) + .map(status -> new OutpatientSkinTestInitDto.statusEnumOption(status.getValue(), status.getInfo())) .collect(Collectors.toList()); initDto.setVerificationStatus(statusEnumOptions1); // 获取皮试结果 - List statusEnumOptions2 = Stream.of(ClinicalStatus.values()) - .map(status -> new OutpatientInfusionInitDto.statusEnumOption(status.getValue(), status.getInfo())) + List statusEnumOptions2 = Stream.of(ClinicalStatus.values()) + .map(status -> new OutpatientSkinTestInitDto.statusEnumOption(status.getValue(), status.getInfo())) .collect(Collectors.toList()); initDto.setClinicalStatus(statusEnumOptions2); @@ -150,18 +147,6 @@ public class OutpatientSkinTestRecordServiceImpl implements IOutpatientSkinTestR offset); } - /** - * 统计门诊皮试记录数的方法 - * - * @param outpatientSkinTestRecordSearchParam 门诊皮试记录查询参数 - * @return 分页查询 - */ - @Override - public long - countOutpatientSkinTestRecords(OutpatientSkinTestRecordSearchParam outpatientSkinTestRecordSearchParam) { - return outpatientManageMapper.countOutpatientSkinTestRecords(outpatientSkinTestRecordSearchParam); - } - /** * 护士确认执行皮试后,更新皮试记录信息(服务申请管理与过敏与不耐受的相关字段更新) * 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 dccae7bb..7b239bfd 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 @@ -1,5 +1,7 @@ package com.openhis.web.outpatientmanage.controller; +import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -16,8 +18,6 @@ import com.openhis.workflow.service.IServiceRequestService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import java.util.List; - /** * 门诊输液记录 * @@ -76,24 +76,24 @@ 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[] {"患者门诊输液执行"})); - } + // /** + // * 执行单个患者门诊输液 + // * + // * @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[] {"患者门诊输液执行"})); + // } /** * 批量执行患者门诊输液 @@ -132,13 +132,16 @@ public class OutpatientInfusionRecordController { /** * 显示门诊输液执行记录查询 - * + * + * @param beginTime 开始时间 + * @param endTime 结束时间 * @return 门诊输液记录列表 */ @GetMapping(value = "/infusion-perform-Record") - public R getPatientInfusionPerformRecord() { + public R getPatientInfusionPerformRecord(@RequestParam(required = false) String beginTime, + @RequestParam(required = false) String endTime) { - return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord()); + return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime,endTime)); } } 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 77faf729..9ce247eb 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 @@ -17,8 +17,6 @@ import java.util.List; @Accessors(chain = true) public class OutpatientInfusionInitDto { - //发药状态 - private List medicationStatus; //皮试结果 private List clinicalStatus; //当天位执行的输液记录 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 70b85060..5fe66475 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 @@ -60,6 +60,10 @@ public class OutpatientInfusionRecordDto { @JsonSerialize(using = ToStringSerializer.class) private Long executionCount; + /** 分组id */ + @JsonSerialize(using = ToStringSerializer.class) + private Long groupId; + /** 执行护士 */ @Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name") @JsonSerialize(using = ToStringSerializer.class) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestInitDto.java index b2e2e3ed..ecc7a4a3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientSkinTestInitDto.java @@ -14,10 +14,11 @@ import java.util.List; @Data @Accessors(chain = true) public class OutpatientSkinTestInitDto { + //皮试检查项目状态 - private List VerificationStatus; + private List verificationStatus; //皮试结果 - private List clinicalStatus; + private List clinicalStatus; /** * 状态 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IOutpatientRecordService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IOutpatientRecordService.java new file mode 100644 index 00000000..d44aff53 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IOutpatientRecordService.java @@ -0,0 +1,35 @@ +package com.openhis.web.patientmanage.appservice; + +import java.util.List; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.patientmanage.dto.OutpatientRecordDto; +import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam; + +/** + * 门诊记录查询 + * + * @author Wuser + * @date 2025/3/15 + */ +public interface IOutpatientRecordService { + + /** + * 获取门诊记录初期数据列表 + * + * @return 门诊记录初期数据列表 + */ + List getOutpatientRecordInit(); + + /** + * 分页查询门诊记录 + * + * @param outpatientRecordSearchParam 门诊录查询参数 + * @param pageNo 页码(默认为1) + * @param pageSize 每页大小(默认为10) + * @return 分页查询 + */ + Page getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam, Integer pageNo, + Integer pageSize); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IPatientInformationService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IPatientInformationService.java new file mode 100644 index 00000000..73eefdd9 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/IPatientInformationService.java @@ -0,0 +1,19 @@ +package com.openhis.web.patientmanage.appservice; + +import com.openhis.web.patientmanage.dto.PatientInfoInitDto; + +/** + * 病人管理——病人信息 + * + * @author Wuser + * @date 2025/3/15 + */ +public interface IPatientInformationService { + + /** + * 获取病人信息记录初期数据列表 + * + * @return 病人信息记录初期数据列表 + */ + PatientInfoInitDto getPatientInfoInit(); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/OutpatientRecordServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/OutpatientRecordServiceImpl.java new file mode 100644 index 00000000..107064cb --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/OutpatientRecordServiceImpl.java @@ -0,0 +1,74 @@ +package com.openhis.web.patientmanage.appservice.impl; + +import java.util.List; + +import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.common.enums.AdministrativeGender; +import com.openhis.common.enums.EncounterSubjectStatus; +import com.openhis.common.utils.EnumUtils; +import com.openhis.web.patientmanage.appservice.IOutpatientRecordService; +import com.openhis.web.patientmanage.dto.OutpatientRecordDto; +import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam; +import com.openhis.web.patientmanage.mapper.PatientManageMapper; + +/** + * 门诊记录查询 应用实现 + * + * @author Wuser + * @date 2025/3/15 + */ +@Service +public class OutpatientRecordServiceImpl implements IOutpatientRecordService { + + @Autowired + PatientManageMapper patientManageMapper; + + /** + * 获取门诊记录初期数据列表 + * + * @return 门诊记录初期数据列表 + */ + @Override + public List getOutpatientRecordInit() { + // 获取医生名字列表 + List listDoctorNames = patientManageMapper.getDoctorNames(); + + return listDoctorNames; + } + + /** + * 分页查询门诊记录 + * + * @param outpatientRecordSearchParam 门诊录查询参数 + * @param pageNo 页码(默认为1) + * @param pageSize 每页大小(默认为10) + * @return 分页查询 + */ + public Page getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam, Integer pageNo, + Integer pageSize) { + + // 跳过的记录数 + Integer offset = (pageNo - 1) * pageSize; + // 连表查询患者信息 + List listOutpatientRecords = + patientManageMapper.getOutpatientRecord(outpatientRecordSearchParam, pageSize, offset); + // 查询总记录数 + long total = patientManageMapper.countOutpatientRecords(outpatientRecordSearchParam); + // 创建Page对象并设置属性 + Page outpatientRecordPage = new Page<>(pageNo, pageSize, total); + outpatientRecordPage.setRecords(listOutpatientRecords); + outpatientRecordPage.getRecords().forEach(e -> { + // 性别枚举类回显赋值 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 就诊对象状态枚举类回显赋值 + e.setSubjectStatusEnum_enumText( + EnumUtils.getInfoByValue(EncounterSubjectStatus.class, e.getSubjectStatusEnum())); + }); + return outpatientRecordPage; + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java new file mode 100644 index 00000000..4265493a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java @@ -0,0 +1,68 @@ +package com.openhis.web.patientmanage.appservice.impl; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.openhis.common.enums.*; +import com.openhis.web.patientmanage.appservice.IPatientInformationService; +import com.openhis.web.patientmanage.dto.PatientInfoInitDto; +import org.springframework.stereotype.Service; + +/** + * 门诊患者 + * + * @author liuhr + * @date 2025/3/15 + */ +@Service +public class PatientInformationServiceImpl implements IPatientInformationService { + + /** + * 获取病人信息记录初期数据列表 + * + * @return 病人信息记录初期数据列表 + */ + @Override + public PatientInfoInitDto getPatientInfoInit() { + PatientInfoInitDto initDto = new PatientInfoInitDto(); + // 获取婚姻状态列表 + List statusEnumOptions1 = Stream.of(MaritalStatus.values()) + .map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + initDto.setMaritalStatus(statusEnumOptions1); + + // 获取职业编码列表 + List statusEnumOptions2 = Stream.of(OccupationType.values()) + .map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + initDto.setOccupationType(statusEnumOptions2); + + // 获取性别列表 + List statusEnumOptions3 = Stream.of(AdministrativeGender.values()) + .map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + initDto.setAdministrativeGender(statusEnumOptions3); + + // 获取ABO血型列表 + List statusEnumOptions4 = Stream.of(BloodTypeABO.values()) + .map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + initDto.setBloodTypeABO(statusEnumOptions4); + + // 获取RH血型列表 + List statusEnumOptions5 = Stream.of(BloodTypeRH.values()) + .map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + initDto.setBloodTypeRH(statusEnumOptions5); + + // 获取家庭关系列表 + List statusEnumOptions6 = Stream.of(FamilyRelationshipType.values()) + .map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + initDto.setFamilyRelationshipType(statusEnumOptions6); + + return initDto; + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/OutpatientRecordController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/OutpatientRecordController.java index 3bbbe65b..e8930adc 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/OutpatientRecordController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/OutpatientRecordController.java @@ -1,22 +1,16 @@ package com.openhis.web.patientmanage.controller; -import java.util.List; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; -import com.openhis.common.enums.AdministrativeGender; -import com.openhis.common.enums.EncounterSubjectStatus; -import com.openhis.common.utils.EnumUtils; -import com.openhis.web.patientmanage.dto.OutpatientRecordDto; +import com.openhis.web.patientmanage.appservice.IOutpatientRecordService; import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam; -import com.openhis.web.patientmanage.mapper.PatientManageMapper; +import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; /** @@ -28,20 +22,21 @@ import lombok.extern.slf4j.Slf4j; @RestController @RequestMapping("/patientmanage/records") @Slf4j +@AllArgsConstructor public class OutpatientRecordController { - @Autowired(required = false) - PatientManageMapper patientManageMapper; + @Autowired + IOutpatientRecordService outpatientRecordService; /** - * 获取医生名字列表 + * 门诊输液记录初期数据 + * + * @return */ - @GetMapping("/list-doctornames") + @GetMapping("/init") public R getDoctorNames() { // 获取医生名字列表 - List listDoctorNames = patientManageMapper.getDoctorNames(); - - return R.ok(listDoctorNames); + return R.ok(outpatientRecordService.getOutpatientRecordInit()); } /** @@ -56,25 +51,7 @@ public class OutpatientRecordController { @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - // 跳过的记录数 - Integer offset = (pageNo - 1) * pageSize; - // 连表查询患者信息 - List listOutpatientRecords = - patientManageMapper.getOutpatientRecord(outpatientRecordSearchParam, pageSize, offset); - // 查询总记录数 - long total = patientManageMapper.countOutpatientRecords(outpatientRecordSearchParam); - // 创建Page对象并设置属性 - Page outpatientRecordPage = new Page<>(pageNo, pageSize, total); - outpatientRecordPage.setRecords(listOutpatientRecords); - outpatientRecordPage.getRecords().forEach(e -> { - // 性别枚举类回显赋值 - e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); - // 就诊对象状态枚举类回显赋值 - e.setSubjectStatusEnum_enumText( - EnumUtils.getInfoByValue(EncounterSubjectStatus.class, e.getSubjectStatusEnum())); - }); - - return R.ok(outpatientRecordPage); + return R.ok(outpatientRecordService.getPatient(outpatientRecordSearchParam, pageNo, pageSize)); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/PatientInformationController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/PatientInformationController.java index 64bb753b..52e02ced 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/PatientInformationController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/PatientInformationController.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.openhis.web.patientmanage.appservice.IPatientInformationService; +import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -19,7 +21,7 @@ import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.enums.*; import com.openhis.common.utils.EnumUtils; import com.openhis.web.patientmanage.dto.PatientInformationDto; -import com.openhis.web.patientmanage.dto.PatientListDto; +import com.openhis.web.patientmanage.dto.PatientInfoInitDto; import com.openhis.web.patientmanage.mapper.PatientManageMapper; import lombok.extern.slf4j.Slf4j; @@ -33,6 +35,7 @@ import lombok.extern.slf4j.Slf4j; @RestController @RequestMapping("/patientmanage/information") @Slf4j +@AllArgsConstructor public class PatientInformationController { @Autowired @@ -43,119 +46,25 @@ public class PatientInformationController { @Autowired(required = false) PatientManageMapper patientManageMapper; +// +// @Autowired(required = false) +// StringUtils stringUtils; - @Autowired(required = false) - StringUtils stringUtils; + @Autowired + IPatientInformationService patientInformationService; // todo 暂且机构ID写死,后续从登录里取得 private final Long organizationId = 91L; /** - * 获取婚姻状态列表 + * 病人信息记录初期数据列表 + * + * @return */ - @GetMapping("/list-maritalstatus") - public R getMaritalStatus() { - // 获取婚姻状态 - List statusList = Arrays.asList(MaritalStatus.values()); - List dtos = new ArrayList<>(); - // 取得更新值 - for (MaritalStatus status : statusList) { - PatientListDto dto = new PatientListDto(); - dto.setValue(status.getValue()); - dto.setInfo(status.getInfo()); - dtos.add(dto); - } - return R.ok(dtos); - } + @GetMapping("/init") + public R getPatientInfoInit() { - /** - * 获取职业编码列表 - */ - @GetMapping("/list-occupationtype") - public R getOccupationType() { - // 获取职业编码 - List statusList = Arrays.asList(OccupationType.values()); - List dtos = new ArrayList<>(); - // 取得更新值 - for (OccupationType status : statusList) { - PatientListDto dto = new PatientListDto(); - dto.setValue(status.getValue()); - dto.setInfo(status.getInfo()); - dtos.add(dto); - } - return R.ok(dtos); - } - - /** - * 获取性别列表 - */ - @GetMapping("/list-administrativegender") - public R getAdministrativeGender() { - // 获取性别 - List statusList = Arrays.asList(AdministrativeGender.values()); - List dtos = new ArrayList<>(); - // 取得更新值 - for (AdministrativeGender status : statusList) { - PatientListDto dto = new PatientListDto(); - dto.setValue(status.getValue()); - dto.setInfo(status.getInfo()); - dtos.add(dto); - } - return R.ok(dtos); - } - - /** - * 获取ABO血型列表 - */ - @GetMapping("/list-bloodtypeabo") - public R getBloodTypeABO() { - // 获取ABO血型 - List statusList = Arrays.asList(BloodTypeABO.values()); - List dtos = new ArrayList<>(); - // 取得更新值 - for (BloodTypeABO status : statusList) { - PatientListDto dto = new PatientListDto(); - dto.setValue(status.getValue()); - dto.setInfo(status.getInfo()); - dtos.add(dto); - } - return R.ok(dtos); - } - - /** - * 获取RH血型列表 - */ - @GetMapping("/list-bloodtypearh") - public R getBloodTypeRH() { - // 获取RH血型 - List statusList = Arrays.asList(BloodTypeRH.values()); - List dtos = new ArrayList<>(); - // 取得更新值 - for (BloodTypeRH status : statusList) { - PatientListDto dto = new PatientListDto(); - dto.setValue(status.getValue()); - dto.setInfo(status.getInfo()); - dtos.add(dto); - } - return R.ok(dtos); - } - - /** - * 获取家庭关系列表 - */ - @GetMapping("/list-familyrelationshiptype") - public R getFamilyRelationshipType() { - // 获取RH血型 - List statusList = Arrays.asList(FamilyRelationshipType.values()); - List dtos = new ArrayList<>(); - // 取得更新值 - for (FamilyRelationshipType status : statusList) { - PatientListDto dto = new PatientListDto(); - dto.setValue(status.getValue()); - dto.setInfo(status.getInfo()); - dtos.add(dto); - } - return R.ok(dtos); + return R.ok(patientInformationService.getPatientInfoInit()); } /** @@ -163,38 +72,38 @@ public class PatientInformationController { * * @param patientInformationDto 病人信息 */ - @PostMapping("/patient-information") - public R addPatient(@Validated @RequestBody PatientInformationDto patientInformationDto) { - - Patient patient = new Patient(); - BeanUtils.copyProperties(patientInformationDto, patient); - - // 使用基础采番,设置病人ID - String code = assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix()); - patient.setBusNo(code); - - // 设置机构ID - patient.setOrganizationId(organizationId); - // 设置生日 - patient.setBirthDate(patientService.extractBirthday(patient.getIdCard())); - // 设置拼音首拼 - patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName())); - // 设置五笔首拼 - patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName())); - // 设置死亡时间 - if (patientService.isFuture(patientInformationDto.getDeceasedDate())) { - return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"死亡时间未来时"})); - } - patient.setDeceasedDate(DateUtils.parseDate(patientInformationDto.getDeceasedDate())); - // 调用服务层保存病人信息 - boolean savePatientSuccess = patientService.save(patient); - - if (!savePatientSuccess) { - return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, null)); - } - - return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"病人信息"})); - } +// @PostMapping("/patient-information") +// public R addPatient(@Validated @RequestBody PatientInformationDto patientInformationDto) { +// +// Patient patient = new Patient(); +// BeanUtils.copyProperties(patientInformationDto, patient); +// +// // 使用基础采番,设置病人ID +// String code = assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix()); +// patient.setBusNo(code); +// +// // 设置机构ID +// patient.setOrganizationId(organizationId); +// // 设置生日 +// patient.setBirthDate(patientService.extractBirthday(patient.getIdCard())); +// // 设置拼音首拼 +// patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName())); +// // 设置五笔首拼 +// patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName())); +// // 设置死亡时间 +// if (patientService.isFuture(patientInformationDto.getDeceasedDate())) { +// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"死亡时间未来时"})); +// } +// patient.setDeceasedDate(DateUtils.parseDate(patientInformationDto.getDeceasedDate())); +// // 调用服务层保存病人信息 +// boolean savePatientSuccess = patientService.save(patient); +// +// if (!savePatientSuccess) { +// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, null)); +// } +// +// return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"病人信息"})); +// } /** * 修改病人信息 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInfoInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInfoInitDto.java new file mode 100644 index 00000000..cd65c7f1 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInfoInitDto.java @@ -0,0 +1,46 @@ +package com.openhis.web.patientmanage.dto; + +import com.openhis.web.outpatientmanage.dto.OutpatientInfusionInitDto; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 病人信息初期信息列表 + * + * @author liuhr + * @date 2025/2/25 + */ +@Data +@Accessors(chain = true) +public class PatientInfoInitDto { + + //获取婚姻状态列表 + private List maritalStatus; + //获取职业编码列表 + private List occupationType; + //获取性别列表 + private List administrativeGender; + //获取ABO血型列表 + private List bloodTypeABO; + //获取RH血型列表 + private List bloodTypeRH; + //获取家庭关系列表 + private List familyRelationshipType; + + /** + * 状态 + */ + @Data + public static class statusEnumOption { + private Integer value; + private String info; + + public statusEnumOption(Integer value, String info) { + this.value = value; + this.info = info; + } + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientListDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientListDto.java deleted file mode 100644 index 7f4f4116..00000000 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientListDto.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.openhis.web.patientmanage.dto; - -import lombok.Data; - -/** - * 状态列表 - * - * @author liuhr - * @date 2025/2/25 - */ -@Data -public class PatientListDto { - - private Integer value; - private String info; -} 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 e3e4a4ba..b13448f0 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 @@ -148,6 +148,7 @@ SELECT DISTINCT sr.id AS service_id, --服务申请管理ID sr.prescription_no, --处方号 + sr.tenant_id, e.bus_no as encounter_busNo, --就诊号 pt.birth_date , --病人生日 pt.bus_no AS patient_busNo, --病人ID(前台显示用) @@ -184,13 +185,14 @@ T1.activity_id, T1.prescription_no, T1.encounter_id, - T1.encounter_busNo, + T1.encounter_bus_No, T1.patient_name, - T1.patient_busNo, + T1.patient_bus_No, T1.patient_id, T1.medication_information, T1.medication_antity, - T1.medication_statusEnum, + T1.medication_status_Enum, + T1.group_id, T1.clinical_status_enum, T1.flag_text, T1.speed, @@ -207,18 +209,20 @@ SELECT sr.id AS service_id, --服务申请管理ID sr.bus_no, -- 服务请求编码 - (SELECT COUNT(*) FROM wor_service_request WHERE based_on_id = SPLIT_PART(sr.bus_no, '.', 1)) AS execution_count, -- 执行次数 - sr.based_on_id, --请求基于什么的ID + (SELECT COUNT(*) FROM wor_service_request wsr WHERE wsr.based_on_id = sr.based_on_id) AS execution_count, + sr.based_on_id, -- 请求基于什么的ID sr.activity_id,--请求code,输液 sr.prescription_no, --处方号 sr.encounter_id , --就诊ID + sr.tenant_id, e.bus_no AS encounter_busNo, --就诊ID(前台显示用) pt.name AS patient_name, --病人姓名 pt.bus_no AS patient_busNo, --病人ID(前台显示用) sr.patient_id, --病人ID ad.name AS medication_information, --药品信息 mr.antity AS medication_antity,--药品数量 - mr.status_enum AS medication_statusEnum, --药品状态 + mr.status_enum AS medication_status_Enum, --药品状态 + mr.group_id, --注射药品组号 ai.clinical_status_enum, --皮试检查结果 CASE mr.skin_test_flag--皮试标志 WHEN 1 THEN '是' @@ -249,7 +253,7 @@ ORDER BY - mr.create_time,e.bus_no,pt.bus_no + mr.create_time desc,e.bus_no,pt.bus_no ) AS T1 ${ew.customSqlSegment}