门诊和皮试和病人信息的格式修改

This commit is contained in:
liuhongrui
2025-03-15 16:06:22 +08:00
parent 48dfed2808
commit cd04bca322
17 changed files with 376 additions and 266 deletions

View File

@@ -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<String> getOutpatientRecordInit();
/**
* 分页查询门诊记录
*
* @param outpatientRecordSearchParam 门诊录查询参数
* @param pageNo 页码默认为1
* @param pageSize 每页大小默认为10
* @return 分页查询
*/
Page<OutpatientRecordDto> getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam, Integer pageNo,
Integer pageSize);
}

View File

@@ -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();
}

View File

@@ -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<String> getOutpatientRecordInit() {
// 获取医生名字列表
List<String> listDoctorNames = patientManageMapper.getDoctorNames();
return listDoctorNames;
}
/**
* 分页查询门诊记录
*
* @param outpatientRecordSearchParam 门诊录查询参数
* @param pageNo 页码默认为1
* @param pageSize 每页大小默认为10
* @return 分页查询
*/
public Page<OutpatientRecordDto> getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam, Integer pageNo,
Integer pageSize) {
// 跳过的记录数
Integer offset = (pageNo - 1) * pageSize;
// 连表查询患者信息
List<OutpatientRecordDto> listOutpatientRecords =
patientManageMapper.getOutpatientRecord(outpatientRecordSearchParam, pageSize, offset);
// 查询总记录数
long total = patientManageMapper.countOutpatientRecords(outpatientRecordSearchParam);
// 创建Page对象并设置属性
Page<OutpatientRecordDto> 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;
}
}

View File

@@ -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<PatientInfoInitDto.statusEnumOption> statusEnumOptions1 = Stream.of(MaritalStatus.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setMaritalStatus(statusEnumOptions1);
// 获取职业编码列表
List<PatientInfoInitDto.statusEnumOption> statusEnumOptions2 = Stream.of(OccupationType.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setOccupationType(statusEnumOptions2);
// 获取性别列表
List<PatientInfoInitDto.statusEnumOption> statusEnumOptions3 = Stream.of(AdministrativeGender.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setAdministrativeGender(statusEnumOptions3);
// 获取ABO血型列表
List<PatientInfoInitDto.statusEnumOption> statusEnumOptions4 = Stream.of(BloodTypeABO.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setBloodTypeABO(statusEnumOptions4);
// 获取RH血型列表
List<PatientInfoInitDto.statusEnumOption> statusEnumOptions5 = Stream.of(BloodTypeRH.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setBloodTypeRH(statusEnumOptions5);
// 获取家庭关系列表
List<PatientInfoInitDto.statusEnumOption> statusEnumOptions6 = Stream.of(FamilyRelationshipType.values())
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
initDto.setFamilyRelationshipType(statusEnumOptions6);
return initDto;
}
}

View File

@@ -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<String> 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<OutpatientRecordDto> listOutpatientRecords =
patientManageMapper.getOutpatientRecord(outpatientRecordSearchParam, pageSize, offset);
// 查询总记录数
long total = patientManageMapper.countOutpatientRecords(outpatientRecordSearchParam);
// 创建Page对象并设置属性
Page<OutpatientRecordDto> 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));
}
}

View File

@@ -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<MaritalStatus> statusList = Arrays.asList(MaritalStatus.values());
List<PatientListDto> 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<OccupationType> statusList = Arrays.asList(OccupationType.values());
List<PatientListDto> 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<AdministrativeGender> statusList = Arrays.asList(AdministrativeGender.values());
List<PatientListDto> 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<BloodTypeABO> statusList = Arrays.asList(BloodTypeABO.values());
List<PatientListDto> 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<BloodTypeRH> statusList = Arrays.asList(BloodTypeRH.values());
List<PatientListDto> 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<FamilyRelationshipType> statusList = Arrays.asList(FamilyRelationshipType.values());
List<PatientListDto> 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[] {"病人信息"}));
// }
/**
* 修改病人信息

View File

@@ -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<PatientInfoInitDto.statusEnumOption> maritalStatus;
//获取职业编码列表
private List<PatientInfoInitDto.statusEnumOption> occupationType;
//获取性别列表
private List<PatientInfoInitDto.statusEnumOption> administrativeGender;
//获取ABO血型列表
private List<PatientInfoInitDto.statusEnumOption> bloodTypeABO;
//获取RH血型列表
private List<PatientInfoInitDto.statusEnumOption> bloodTypeRH;
//获取家庭关系列表
private List<PatientInfoInitDto.statusEnumOption> familyRelationshipType;
/**
* 状态
*/
@Data
public static class statusEnumOption {
private Integer value;
private String info;
public statusEnumOption(Integer value, String info) {
this.value = value;
this.info = info;
}
}
}

View File

@@ -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;
}