refactor(core): 优化DelFlag枚举值比较逻辑

- 修改DelFlag.getValue()调用为直接访问value字段
- 提升代码性能和可读性
```
This commit is contained in:
2025-12-27 22:45:20 +08:00
parent 79ea4ed4f7
commit 5f600209b8
35 changed files with 516 additions and 244 deletions

View File

@@ -0,0 +1,36 @@
package com.openhis.web.patientmanage.appservice;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam;
/**
* 门诊记录查询 service
*
* @author liuhr
* @date 2025/3/15
*/
public interface IOutpatientRecordService {
/**
* 分页查询门诊记录
*
* @param outpatientRecordSearchParam 门诊录查询参数
* @param searchKey 模糊查询关键字
* @param pageNo 页码默认为1
* @param pageSize 每页大小默认为10
* @param request 请求
* @return 分页查询
*/
IPage<OutpatientRecordDto> getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
/**
* 获取医生名字列表
*
* @return 医生名字列表
*/
R<?> getDoctorNames();
}

View File

@@ -55,4 +55,13 @@ public interface IPatientInformationService {
* @param patientBaseInfoDto 患者信息
*/
R<?> updatePatientPhone(PatientBaseInfoDto patientBaseInfoDto);
/**
* 检查患者是否存在
*
* @param name 患者姓名
* @param idCardNo 身份证号
* @return 是否存在
*/
boolean checkPatientExists(String name, String idCardNo);
}

View File

@@ -21,6 +21,7 @@ import com.openhis.common.utils.HisQueryUtils;
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;
/**
@@ -45,24 +46,24 @@ public class OutpatientRecordServiceImpl implements IOutpatientRecordService {
*/
@Override
public IPage<OutpatientRecordDto> getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam,
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<OutpatientRecordDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(outpatientRecordSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.IdCard, CommonConstants.FieldName.Name,
CommonConstants.FieldName.PatientBusNo, CommonConstants.FieldName.EncounterBusNo)),
request);
QueryWrapper<OutpatientRecordDto> queryWrapper
= HisQueryUtils.buildQueryWrapper(outpatientRecordSearchParam, searchKey,
new HashSet<>(Arrays.asList(CommonConstants.FieldName.IdCard, CommonConstants.FieldName.Name,
CommonConstants.FieldName.PatientBusNo, CommonConstants.FieldName.EncounterBusNo)),
request);
IPage<OutpatientRecordDto> outpatientRecordPage = patientManageMapper
.getOutpatientRecord(ParticipantType.ADMITTER.getCode(), new Page<>(pageNo, pageSize), queryWrapper);
.getOutpatientRecord(ParticipantType.ADMITTER.getCode(), new Page<>(pageNo, pageSize), queryWrapper);
outpatientRecordPage.getRecords().forEach(e -> {
// 性别枚举类回显赋值
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 就诊对象状态枚举类回显赋值
e.setSubjectStatusEnum_enumText(
EnumUtils.getInfoByValue(EncounterSubjectStatus.class, e.getSubjectStatusEnum()));
EnumUtils.getInfoByValue(EncounterSubjectStatus.class, e.getSubjectStatusEnum()));
});
return outpatientRecordPage;

View File

@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.core.common.core.domain.model.LoginUser;
import com.core.common.enums.DelFlag;
import com.core.common.exception.ServiceException;
import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.ChineseConvertUtils;
@@ -324,4 +325,20 @@ public class PatientInformationServiceImpl implements IPatientInformationService
}
return R.fail("更新患者手机号失败");
}
/**
* 检查患者是否存在
*
* @param name 患者姓名
* @param idCardNo 身份证号
* @return 是否存在
*/
@Override
public boolean checkPatientExists(String name, String idCardNo) {
LambdaQueryWrapper<Patient> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Patient::getName, name)
.eq(Patient::getIdCard, idCardNo)
.eq(Patient::getDeleteFlag, DelFlag.NO.getCode());
return patientService.count(queryWrapper) > 0;
}
}

View File

@@ -0,0 +1,67 @@
package com.openhis.web.patientmanage.dto;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 门诊记录 Dto
*
* @author liuhr
* @date 2025/3/15
*/
@Data
@Accessors(chain = true)
public class OutpatientRecordDto {
/**
* ID
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 患者姓名
*/
private String name;
/**
* 身份证号码
*/
private String idCard;
/**
* 患者院内编码
*/
private String patientBusNo;
/**
* 就诊流水号
*/
private String encounterBusNo;
/**
* 性别编码
*/
private Integer genderEnum;
private String genderEnum_enumText;
/**
* 就诊对象状态
*/
private Integer subjectStatusEnum;
private String subjectStatusEnum_enumText;
/**
* 登记时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
// 其他可能需要的字段
}

View File

@@ -0,0 +1,47 @@
package com.openhis.web.patientmanage.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 门诊记录查询参数
*
* @author liuhr
* @date 2025/3/15
*/
@Data
@Accessors(chain = true)
public class OutpatientRecordSearchParam {
/**
* 患者姓名
*/
private String name;
/**
* 身份证号码
*/
private String idCard;
/**
* 患者院内编码
*/
private String patientBusNo;
/**
* 就诊流水号
*/
private String encounterBusNo;
/**
* 性别编码
*/
private Integer genderEnum;
/**
* 就诊对象状态
*/
private Integer subjectStatusEnum;
// 其他可能需要的查询参数
}

View File

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.administration.domain.Patient;
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
import com.openhis.web.patientmanage.dto.PatientBaseInfoDto;
import com.openhis.web.patientmanage.dto.PatientIdInfoDto;
@@ -31,14 +32,31 @@ public interface PatientManageMapper extends BaseMapper<Patient> {
* @return 病人信息列表
*/
IPage<PatientBaseInfoDto> getPatientPage(@Param("page") Page<PatientBaseInfoDto> page,
@Param(Constants.WRAPPER) QueryWrapper<PatientBaseInfoDto> queryWrapper);
@Param(Constants.WRAPPER) QueryWrapper<PatientBaseInfoDto> queryWrapper);
/**
* 查询患者身份信息
*
*
* @param patientIdList 患者id集合
* @return 患者身份信息
*/
List<PatientIdInfoDto> getPatientIdInfo(@Param("patientIdList") List<Long> patientIdList);
/**
* 查询门诊记录
*
* @param participantType 参与者类型
* @param page 分页参数
* @param queryWrapper 查询条件
* @return 门诊记录列表
*/
IPage<OutpatientRecordDto> getOutpatientRecord(@Param("participantType") String participantType,
@Param("page") Page<OutpatientRecordDto> page, @Param(Constants.WRAPPER) QueryWrapper<OutpatientRecordDto> queryWrapper);
/**
* 获取医生名字列表
*
* @return 医生名字列表
*/
List<String> getDoctorNames();
}