From 747ce90a2fc87d28848cb8b261aa11d0141af0ea Mon Sep 17 00:00:00 2001 From: liuhongrui Date: Tue, 4 Mar 2025 16:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E8=AF=8A=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OutpatientRecordController.java | 92 ++++++++++++++ .../PatientInformationController.java | 15 +-- .../dto/OutpatientRecordDto.java | 49 ++++++++ .../dto/OutpatientRecordSearchParam.java | 33 +++++ .../dto/PatientInformationDto.java | 2 +- .../mapper/PatientManageMapper.java | 34 +++++- .../patientmanage/PatientManageMapper.xml | 114 +++++++++++++++++- 7 files changed, 326 insertions(+), 13 deletions(-) create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/OutpatientRecordController.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordDto.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordSearchParam.java 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 new file mode 100644 index 00000000..31f9b88a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/controller/OutpatientRecordController.java @@ -0,0 +1,92 @@ +package com.openhis.web.patientmanage.controller; + +import java.util.ArrayList; +import java.util.Arrays; +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.web.patientmanage.dto.OutpatientRecordDto; +import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam; +import com.openhis.web.patientmanage.dto.PatientListDto; +import com.openhis.web.patientmanage.mapper.PatientManageMapper; + +import lombok.extern.slf4j.Slf4j; + +/** + * 门诊记录 + * + * @author liuhr + * @date 2025/2/28 + */ +@RestController +@RequestMapping("/patientmanage/records") +@Slf4j +public class OutpatientRecordController { + + @Autowired(required = false) + PatientManageMapper patientManageMapper; + + /** + * 获取医生名字列表 + */ + @GetMapping("/list-doctornames") + public R getDoctorNames() { + // 获取医生名字列表 + List listDoctorNames = patientManageMapper.getDoctorNames(); + + return R.ok(listDoctorNames); + } + + /** + * 获取性别列表 + */ + @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); + } + + /** + * 分页查询门诊记录,可选条件 + * + * @param outpatientRecordSearchParam 查询条件 + * @param pageNo 页码(默认为1) + * @param pageSize 每页大小(默认为10) + */ + @GetMapping("/outpatient-record-page") + public R getPatient(@RequestParam(required = false) OutpatientRecordSearchParam outpatientRecordSearchParam, + @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); + + return R.ok(OutpatientRecordPage); + } + +} 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 443d6c75..64bb753b 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,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import com.core.common.utils.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -12,6 +11,7 @@ import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; import com.core.common.enums.AssignSeqEnum; +import com.core.common.utils.*; import com.core.common.utils.bean.BeanUtils; import com.openhis.administration.domain.Patient; import com.openhis.administration.service.IPatientService; @@ -181,8 +181,8 @@ public class PatientInformationController { patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName())); // 设置五笔首拼 patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName())); - //设置死亡时间 - if(patientService.isFuture(patientInformationDto.getDeceasedDate())){ + // 设置死亡时间 + if (patientService.isFuture(patientInformationDto.getDeceasedDate())) { return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"死亡时间未来时"})); } patient.setDeceasedDate(DateUtils.parseDate(patientInformationDto.getDeceasedDate())); @@ -213,8 +213,8 @@ public class PatientInformationController { patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patient.getName())); // 设置五笔首拼 patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patient.getName())); - //设置死亡时间 - if(patientService.isFuture(patientInformationDto.getDeceasedDate())){ + // 设置死亡时间 + if (patientService.isFuture(patientInformationDto.getDeceasedDate())) { return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"死亡时间未来时"})); } patient.setDeceasedDate(DateUtils.parseDate(patientInformationDto.getDeceasedDate())); @@ -256,11 +256,12 @@ public class PatientInformationController { // 职业编码枚举类回显赋值 e.setPrfsEnum_enumText(EnumUtils.getInfoByValue(OccupationType.class, e.getPrfsEnum())); // 血型ABO枚举类回显赋值 - e.setBloodAbo_text(EnumUtils.getInfoByValue(BloodTypeABO.class, e.getBloodAbo())); + e.setBloodAbo_enumText(EnumUtils.getInfoByValue(BloodTypeABO.class, e.getBloodAbo())); // 血型RH枚举类回显赋值 e.setBloodRh_enumText(EnumUtils.getInfoByValue(BloodTypeRH.class, e.getBloodRh())); // 家庭关系枚举类回显赋值 - e.setLinkRelationCode_enumText(EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode())); + e.setLinkRelationCode_enumText( + EnumUtils.getInfoByValue(FamilyRelationshipType.class, e.getLinkRelationCode())); }); return R.ok(patientInformationPage); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordDto.java new file mode 100644 index 00000000..4873ce60 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordDto.java @@ -0,0 +1,49 @@ +package com.openhis.web.patientmanage.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * 门诊记录Dto + * + * @author liuhr + * @date 2025/2/28 + */ +@Data +public class OutpatientRecordDto { + + /** 患者姓名 */ + private String name; + + /** 身份证号 */ + private String idCard; + + /** 疾病与诊断描述 */ + private String description; + + /** 患者院内编码/病历号 */ + private String patientBusNo; + + /** 就诊号 */ + private String encounterBusNo; + + /** 性别编码 */ + private Integer genderEnum; + + /** 就诊时间 */ + private Date encounterTime; + + /** 就诊对象状态 */ + private Integer subjectStatusEnum; + + /** 机构名称/接诊医院 */ + private String organizationName; + + /** 接诊医生姓名 */ + private String doctorName; + + /** 手机号码 */ + private String phone; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordSearchParam.java new file mode 100644 index 00000000..4dda4a1e --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/OutpatientRecordSearchParam.java @@ -0,0 +1,33 @@ +package com.openhis.web.patientmanage.dto; + +import java.util.Date; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 门诊记录查询参数 + * + * @author liuhr + * @date 2025/2/28 + */ +@Data +@Accessors(chain = true) +public class OutpatientRecordSearchParam { + + /** 身份证号/病人ID/门诊号/病人姓名 */ + private String searchKey; + + /** 手机号码 */ + private String phone; + + /** 医生姓名 */ + private String doctorName; + + /** 筛选开始时间 */ + private Date startTime; + + /** 筛选结束时间 */ + private Date endTime; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInformationDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInformationDto.java index 1b3a5c36..b354ed94 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInformationDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/dto/PatientInformationDto.java @@ -101,7 +101,7 @@ public class PatientInformationDto { /** 血型ABO */ private Integer bloodAbo; - private String bloodAbo_text; + private String bloodAbo_enumText; /** 血型RH */ private Integer bloodRh; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java index 72eca389..6a046b7d 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/patientmanage/mapper/PatientManageMapper.java @@ -7,12 +7,14 @@ import org.springframework.stereotype.Repository; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.openhis.administration.domain.Patient; +import com.openhis.web.patientmanage.dto.OutpatientRecordDto; +import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam; import com.openhis.web.patientmanage.dto.PatientInformationDto; /** * 病人信息管理 * - * @author Wuser + * @author liuhr * @date 2025/2/25 */ @Repository @@ -31,7 +33,7 @@ public interface PatientManageMapper extends BaseMapper { @Param("pageSize") Integer pageSize, @Param("offset") Integer offset); /** - * 统计总记录数的方法 + * 统计病人信息总记录数的方法 * * @param busNo 病人ID * @param name 病人姓名 @@ -39,4 +41,32 @@ public interface PatientManageMapper extends BaseMapper { */ long countPatients(@Param("busNo") String busNo, @Param("name") String name); + /** + * 门诊信息分页查询 + * + * @param outpatientRecordSearchParam 门诊查询参数 + * @param pageSize 页面大小 + * @param offset 跳过条数 + * @return 分页查询 + */ + List getOutpatientRecord( + @Param("OutpatientRecordSearchParam") OutpatientRecordSearchParam outpatientRecordSearchParam, + @Param("pageSize") Integer pageSize, @Param("offset") Integer offset); + + /** + * 统计门诊总记录数的方法 + * + * @param outpatientRecordSearchParam 门诊查询参数 + * @return 分页查询 + */ + long countOutpatientRecords( + @Param("OutpatientRecordSearchParam") OutpatientRecordSearchParam outpatientRecordSearchParam); + + /** + * 获取医生名字列表 + * + * @return 医生名字列表 + */ + List getDoctorNames(); + } diff --git a/openhis-server/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml index 8c1afd73..4e4d7089 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/patientmanage/PatientManageMapper.xml @@ -38,8 +38,7 @@ pt.organization_id, pt.create_time FROM adm_patient pt - - LEFT JOIN adm_organization ogt ON CAST(pt.organization_id AS VARCHAR) = ogt.bus_no + LEFT JOIN adm_organization ogt ON pt.organization_id = ogt.id @@ -72,7 +71,7 @@ SELECT COUNT(*) FROM adm_patient pt - LEFT JOIN adm_organization ogt ON CAST(pt.organization_id AS VARCHAR) = ogt.bus_no + LEFT JOIN adm_organization ogt ON pt.organization_id = ogt.id @@ -99,6 +98,115 @@ + + + + + + + \ No newline at end of file