@@ -0,0 +1,36 @@
|
||||
package com.openhis.web.patientmanage.appservice;
|
||||
|
||||
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;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 门诊记录查询 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();
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.openhis.web.patientmanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.patientmanage.dto.PatientBaseInfoDto;
|
||||
import com.openhis.web.patientmanage.dto.PatientInfoInitDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 病人管理——病人信息
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/15
|
||||
*/
|
||||
public interface IPatientInformationService {
|
||||
|
||||
/**
|
||||
* 获取病人信息记录初期数据列表
|
||||
*
|
||||
* @return 病人信息记录初期数据列表
|
||||
*/
|
||||
PatientInfoInitDto getPatientInfoInit();
|
||||
|
||||
/**
|
||||
* 分页查询门诊记录
|
||||
*
|
||||
* @param patientBaseInfoDto 病人查询参数
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
* @return 分页查询
|
||||
*/
|
||||
IPage<PatientBaseInfoDto> getPatientInfo(PatientBaseInfoDto patientBaseInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 修改病人信息
|
||||
*
|
||||
* @param patientInfoDto 病人信息
|
||||
* @return 更新结果
|
||||
*/
|
||||
R<?> editPatient(PatientBaseInfoDto patientInfoDto);
|
||||
|
||||
/**
|
||||
* 添加病人信息
|
||||
*
|
||||
* @param patientBaseInfoDto 病人信息
|
||||
*/
|
||||
R<?> addPatient(PatientBaseInfoDto patientBaseInfoDto);
|
||||
|
||||
/**
|
||||
* 更新患者手机号
|
||||
*
|
||||
* @param patientBaseInfoDto 患者信息
|
||||
*/
|
||||
R<?> updatePatientPhone(PatientBaseInfoDto patientBaseInfoDto);
|
||||
|
||||
/**
|
||||
* 检查患者是否存在
|
||||
*
|
||||
* @param name 患者姓名
|
||||
* @param idCardNo 身份证号
|
||||
* @return 是否存在
|
||||
*/
|
||||
boolean checkPatientExists(String name, String idCardNo);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.openhis.web.patientmanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.EncounterSubjectStatus;
|
||||
import com.openhis.common.enums.ParticipantType;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* 门诊记录查询 应用实现
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/15
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OutpatientRecordServiceImpl implements IOutpatientRecordService {
|
||||
|
||||
@Resource
|
||||
private PatientManageMapper patientManageMapper;
|
||||
|
||||
/**
|
||||
* 分页查询门诊记录
|
||||
*
|
||||
* @param outpatientRecordSearchParam 门诊录查询参数
|
||||
* @param searchKey 搜索关键词(支持身份证号/病人ID/门诊号/姓名)
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
* @param request HTTP请求
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<OutpatientRecordDto> getPatient(OutpatientRecordSearchParam outpatientRecordSearchParam,
|
||||
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
log.info("进入门诊记录查询服务,searchKey: {}", searchKey);
|
||||
if (outpatientRecordSearchParam != null) {
|
||||
log.info("查询参数:searchKey={}, 性别={}, 状态={}, 电话={}, 医生={}, 开始时间={}, 结束时间={}",
|
||||
searchKey,
|
||||
outpatientRecordSearchParam.getGenderEnum(),
|
||||
outpatientRecordSearchParam.getSubjectStatusEnum(),
|
||||
outpatientRecordSearchParam.getPhone(),
|
||||
outpatientRecordSearchParam.getDoctorName(),
|
||||
outpatientRecordSearchParam.getStartTimeSTime(),
|
||||
outpatientRecordSearchParam.getStartTimeETime());
|
||||
}
|
||||
|
||||
// 构建查询条件(不自动添加tenant_id,手动指定表别名)
|
||||
QueryWrapper<OutpatientRecordDto> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
// 手动添加带表别名的tenant_id条件
|
||||
queryWrapper.eq("enc.tenant_id", com.core.common.utils.SecurityUtils.getLoginUser().getTenantId());
|
||||
|
||||
// 处理模糊查询关键字(searchKey)- 用于姓名/身份证号/病人ID/门诊号的模糊搜索
|
||||
if (searchKey != null && !searchKey.isEmpty()) {
|
||||
queryWrapper.and(wrapper -> {
|
||||
wrapper.like("pt.name", searchKey)
|
||||
.or().like("pt.id_card", searchKey)
|
||||
.or().like("pt.bus_no", searchKey)
|
||||
.or().like("enc.bus_no", searchKey);
|
||||
});
|
||||
}
|
||||
|
||||
// 处理其他筛选条件(这些条件可以与模糊查询或精确查询组合使用)
|
||||
if (outpatientRecordSearchParam != null) {
|
||||
// 处理性别筛选
|
||||
if (outpatientRecordSearchParam.getGenderEnum() != null) {
|
||||
queryWrapper.eq("pt.gender_enum", outpatientRecordSearchParam.getGenderEnum());
|
||||
}
|
||||
|
||||
// 处理就诊对象状态筛选
|
||||
if (outpatientRecordSearchParam.getSubjectStatusEnum() != null) {
|
||||
queryWrapper.eq("enc.status_enum", outpatientRecordSearchParam.getSubjectStatusEnum());
|
||||
}
|
||||
|
||||
// 处理医生姓名查询(支持模糊查询)
|
||||
if (outpatientRecordSearchParam.getDoctorName() != null && !outpatientRecordSearchParam.getDoctorName().isEmpty()) {
|
||||
queryWrapper.like("prac.name", outpatientRecordSearchParam.getDoctorName());
|
||||
}
|
||||
|
||||
// 处理电话号码查询(支持模糊查询)
|
||||
if (outpatientRecordSearchParam.getPhone() != null && !outpatientRecordSearchParam.getPhone().isEmpty()) {
|
||||
queryWrapper.like("pt.phone", outpatientRecordSearchParam.getPhone());
|
||||
}
|
||||
|
||||
// 处理时间范围查询
|
||||
if (outpatientRecordSearchParam.getStartTimeSTime() != null && !outpatientRecordSearchParam.getStartTimeSTime().isEmpty()
|
||||
&& outpatientRecordSearchParam.getStartTimeETime() != null && !outpatientRecordSearchParam.getStartTimeETime().isEmpty()) {
|
||||
queryWrapper.between("enc.create_time", outpatientRecordSearchParam.getStartTimeSTime(), outpatientRecordSearchParam.getStartTimeETime());
|
||||
}
|
||||
}
|
||||
|
||||
// 使用接诊医生(ADMITTER,code="1")作为参与者类型
|
||||
IPage<OutpatientRecordDto> outpatientRecordPage = patientManageMapper
|
||||
.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()));
|
||||
});
|
||||
|
||||
return outpatientRecordPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生名字列表
|
||||
*
|
||||
* @return 医生名字列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDoctorNames() {
|
||||
return R.ok(patientManageMapper.getDoctorNames());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
package com.openhis.web.patientmanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.domain.PatientIdentifier;
|
||||
import com.openhis.administration.service.IPatientIdentifierService;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.common.utils.IdCardUtil;
|
||||
import com.openhis.web.patientmanage.appservice.IPatientInformationService;
|
||||
import com.openhis.web.patientmanage.dto.PatientBaseInfoDto;
|
||||
import com.openhis.web.patientmanage.dto.PatientIdInfoDto;
|
||||
import com.openhis.web.patientmanage.dto.PatientInfoInitDto;
|
||||
import com.openhis.web.patientmanage.mapper.PatientManageMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 门诊患者
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/15
|
||||
*/
|
||||
@Service
|
||||
public class PatientInformationServiceImpl implements IPatientInformationService {
|
||||
|
||||
@Autowired
|
||||
PatientManageMapper patientManageMapper;
|
||||
|
||||
@Autowired
|
||||
private IPatientService patientService;
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
@Autowired
|
||||
private IPatientIdentifierService patientIdentifierService;
|
||||
|
||||
@Autowired
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
/**
|
||||
* 获取病人信息记录初期数据列表
|
||||
*
|
||||
* @return 病人信息记录初期数据列表
|
||||
*/
|
||||
@Override
|
||||
public PatientInfoInitDto getPatientInfoInit() {
|
||||
PatientInfoInitDto initDto = new PatientInfoInitDto();
|
||||
// 获取婚姻状态列表
|
||||
List<PatientInfoInitDto.statusEnumOption> maritalStatusOptions = Stream.of(MaritalStatus.values())
|
||||
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setMaritalStatus(maritalStatusOptions);
|
||||
|
||||
// 获取职业编码列表
|
||||
List<PatientInfoInitDto.statusEnumOption> occupationTypeOptions = Stream.of(OccupationType.values())
|
||||
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setOccupationType(occupationTypeOptions);
|
||||
|
||||
// 获取性别列表
|
||||
List<PatientInfoInitDto.statusEnumOption> sexOptions = new ArrayList<>();
|
||||
sexOptions.add(new PatientInfoInitDto.statusEnumOption(AdministrativeGender.MALE.getValue(),
|
||||
AdministrativeGender.MALE.getInfo()));
|
||||
sexOptions.add(new PatientInfoInitDto.statusEnumOption(AdministrativeGender.FEMALE.getValue(),
|
||||
AdministrativeGender.FEMALE.getInfo()));
|
||||
initDto.setSex(sexOptions);
|
||||
|
||||
// 获取ABO血型列表
|
||||
List<PatientInfoInitDto.statusEnumOption> bloodTypeABOOptions = Stream.of(BloodTypeABO.values())
|
||||
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setBloodTypeABO(bloodTypeABOOptions);
|
||||
|
||||
// 获取RH血型列表
|
||||
List<PatientInfoInitDto.statusEnumOption> bloodTypeRHOptions = Stream.of(BloodTypeRH.values())
|
||||
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setBloodTypeRH(bloodTypeRHOptions);
|
||||
|
||||
// 获取家庭关系列表
|
||||
List<PatientInfoInitDto.statusEnumOption> familyRelationshipType = Stream.of(FamilyRelationshipType.values())
|
||||
.map(status -> new PatientInfoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setFamilyRelationshipType(familyRelationshipType);
|
||||
|
||||
// 获取是/否状态
|
||||
List<PatientInfoInitDto.statusEnumOption> whetherOptions = new ArrayList<>();
|
||||
whetherOptions.add(new PatientInfoInitDto.statusEnumOption(PublicationStatus.ACTIVE.getValue(),
|
||||
PublicationStatus.ACTIVE.getInfo()));
|
||||
whetherOptions.add(new PatientInfoInitDto.statusEnumOption(PublicationStatus.RETIRED.getValue(),
|
||||
PublicationStatus.RETIRED.getInfo()));
|
||||
initDto.setWhetherStatus(whetherOptions);
|
||||
|
||||
return initDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门诊记录
|
||||
*
|
||||
* @param patientBaseInfoDto 病人查询参数
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
* @return 分页查询
|
||||
*/
|
||||
@Override
|
||||
public IPage<PatientBaseInfoDto> getPatientInfo(PatientBaseInfoDto patientBaseInfoDto, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建基础查询条件
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
QueryWrapper<PatientBaseInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
patientBaseInfoDto, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
|
||||
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
|
||||
request);
|
||||
|
||||
|
||||
IPage<PatientBaseInfoDto> patientInformationPage
|
||||
= patientManageMapper.getPatientPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
// 患者id集合
|
||||
List<Long> patientIdList
|
||||
= patientInformationPage.getRecords().stream().map(PatientBaseInfoDto::getId).collect(Collectors.toList());
|
||||
// 患者身份信息
|
||||
List<PatientIdInfoDto> patientIdInfo = patientManageMapper.getPatientIdInfo(patientIdList);
|
||||
|
||||
patientInformationPage.getRecords().forEach(e -> {
|
||||
// 性别枚举类回显赋值
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 婚姻状态枚举类回显赋值
|
||||
e.setMaritalStatusEnum_enumText(EnumUtils.getInfoByValue(MaritalStatus.class, e.getMaritalStatusEnum()));
|
||||
// 职业编码枚举类回显赋值
|
||||
e.setPrfsEnum_enumText(EnumUtils.getInfoByValue(OccupationType.class, e.getPrfsEnum()));
|
||||
// 血型ABO枚举类回显赋值
|
||||
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()));
|
||||
// 患者身份子表信息
|
||||
List<PatientIdInfoDto> idInfo = patientIdInfo.stream()
|
||||
.filter(idInfoDto -> idInfoDto.getPatientId().equals(e.getId())).collect(Collectors.toList());
|
||||
e.setPatientIdInfoList(idInfo);
|
||||
// 登记医院
|
||||
e.setOrganizationId(loginUser.getOrgId());
|
||||
});
|
||||
return patientInformationPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改病人信息
|
||||
*
|
||||
* @param patientInfoDto 病人信息
|
||||
* @return 更新结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> editPatient(PatientBaseInfoDto patientInfoDto) {
|
||||
// 如果患者没有输入身份证号则根据年龄自动生成
|
||||
String idCard = patientInfoDto.getIdCard();
|
||||
if (idCard == null || CommonConstants.Common.AREA_CODE.equals(idCard.substring(0, 6))) {
|
||||
if (patientInfoDto.getAge() != null) {
|
||||
idCard = IdCardUtil.generateIdByAge(patientInfoDto.getAge());
|
||||
patientInfoDto.setIdCard(idCard);
|
||||
}
|
||||
}
|
||||
// 身份证号是否存在
|
||||
List<Patient> idCardList
|
||||
= patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientInfoDto.getIdCard())
|
||||
.ne(patientInfoDto.getId() != null, Patient::getId, patientInfoDto.getId()));
|
||||
if (!idCardList.isEmpty()) {
|
||||
Patient patient = idCardList.get(0);
|
||||
if (patientInfoDto.getIdCard().equals(patient.getIdCard())
|
||||
&& !patientInfoDto.getId().equals(patientInfoDto.getId())) {
|
||||
throw new ServiceException("身份证号:" + patientInfoDto.getIdCard() + "已经存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 处理患者信息
|
||||
Patient patient = this.handlePatientInfo(patientInfoDto);
|
||||
// 患者身份子表信息,先删除再新增
|
||||
patientIdentifierService
|
||||
.remove(new LambdaQueryWrapper<PatientIdentifier>().eq(PatientIdentifier::getPatientId, patient.getId()));
|
||||
if (patientInfoDto.getPatientIdInfoList() != null) {
|
||||
// 新增患者身份子表信息
|
||||
List<PatientIdInfoDto> patientIdInfoList = patientInfoDto.getPatientIdInfoList();
|
||||
PatientIdentifier patientIdentifier;
|
||||
for (PatientIdInfoDto patientIdInfoDto : patientIdInfoList) {
|
||||
patientIdentifier = new PatientIdentifier();
|
||||
patientIdentifier.setPatientId(patient.getId());// 患者ID
|
||||
patientIdentifier.setTypeCode(patientIdInfoDto.getTypeCode()); // 标识类型编码
|
||||
patientIdentifier.setIdentifierNo(patientIdInfoDto.getIdentifierNo()); // 标识号
|
||||
patientIdentifier.setStartTime(patientIdInfoDto.getStartTime()); // 有效时间Start
|
||||
patientIdentifier.setEndTime(patientIdInfoDto.getEndTime()); // 有效时间end
|
||||
|
||||
patientIdentifierService.save(patientIdentifier);
|
||||
}
|
||||
}
|
||||
return R.ok(patient.getIdCard(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"病人信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加病人信息
|
||||
*
|
||||
* @param patientBaseInfoDto 病人信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> addPatient(PatientBaseInfoDto patientBaseInfoDto) {
|
||||
// log.debug("添加病人信息,patientInfoDto:{}", patientBaseInfoDto);
|
||||
// 如果患者没有输入身份证号则根据年龄自动生成
|
||||
String idCard = patientBaseInfoDto.getIdCard();
|
||||
if (idCard == null || idCard.length() < 6 || CommonConstants.Common.AREA_CODE.equals(idCard.substring(0, 6))) {
|
||||
if (patientBaseInfoDto.getAge() != null) {
|
||||
idCard = IdCardUtil.generateIdByAge(patientBaseInfoDto.getAge());
|
||||
patientBaseInfoDto.setIdCard(idCard);
|
||||
}
|
||||
}
|
||||
// 身份证号是否存在
|
||||
List<Patient> idCardList
|
||||
= patientService.list(new LambdaQueryWrapper<Patient>().eq(Patient::getIdCard, patientBaseInfoDto.getIdCard()));
|
||||
if (!idCardList.isEmpty()) {
|
||||
throw new ServiceException("身份证号:" + patientBaseInfoDto.getIdCard() + "已经存在");
|
||||
}
|
||||
|
||||
// 处理患者信息
|
||||
Patient patient = this.handlePatientInfo(patientBaseInfoDto);
|
||||
|
||||
// 新增患者身份子表信息
|
||||
if (patientBaseInfoDto.getPatientIdInfoList() != null) {
|
||||
List<PatientIdInfoDto> patientIdInfoList = patientBaseInfoDto.getPatientIdInfoList();
|
||||
PatientIdentifier patientIdentifier;
|
||||
for (PatientIdInfoDto patientIdInfoDto : patientIdInfoList) {
|
||||
patientIdentifier = new PatientIdentifier();
|
||||
patientIdentifier.setPatientId(patient.getId());// 患者ID
|
||||
patientIdentifier.setTypeCode(patientIdInfoDto.getTypeCode()); // 标识类型编码
|
||||
patientIdentifier.setIdentifierNo(patientIdInfoDto.getIdentifierNo()); // 标识号
|
||||
patientIdentifier.setStartTime(patientIdInfoDto.getStartTime()); // 有效时间Start
|
||||
patientIdentifier.setEndTime(patientIdInfoDto.getEndTime()); // 有效时间end
|
||||
patientIdentifierService.save(patientIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(patient, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[]{"患者信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理患者信息
|
||||
*
|
||||
* @param patientInfoDto 患者信息dto
|
||||
* @return 患者信息
|
||||
*/
|
||||
private Patient handlePatientInfo(PatientBaseInfoDto patientInfoDto) {
|
||||
Patient patient;
|
||||
if (patientInfoDto.getId() != null) {
|
||||
// 更新现有患者信息
|
||||
patient = patientService.getById(patientInfoDto.getId());
|
||||
if (patient == null) {
|
||||
throw new ServiceException("患者信息不存在,无法更新");
|
||||
}
|
||||
} else {
|
||||
// 新增患者信息
|
||||
patient = new Patient();
|
||||
patient.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.PATIENT_NUM.getPrefix(), 10));
|
||||
patient.setActiveFlag(PublicationStatus.ACTIVE.getValue()); // 默认启用
|
||||
}
|
||||
|
||||
patient.setName(patientInfoDto.getName()); // 患者姓名
|
||||
patient.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(patientInfoDto.getName())); // 拼音首拼
|
||||
patient.setWbStr(ChineseConvertUtils.toWBFirstLetter(patientInfoDto.getName())); // 五笔首拼
|
||||
patient.setIdCard(patientInfoDto.getIdCard()); // 身份证号
|
||||
patient.setBirthDate(IdCardUtil.extractBirthdayFromIdCard(patientInfoDto.getIdCard())); // 生日
|
||||
patient.setGenderEnum(patientInfoDto.getGenderEnum()); // 性别
|
||||
patient.setPhone(patientInfoDto.getPhone()); // 联系方式
|
||||
patient.setPrfsEnum(patientInfoDto.getPrfsEnum()); // 职业
|
||||
patient.setWorkCompany(patientInfoDto.getWorkCompany()); // 工作单位
|
||||
patient.setLinkName(patientInfoDto.getLinkName()); // 联系人
|
||||
patient.setLinkRelationCode(patientInfoDto.getLinkRelationCode()); // 联系人关系
|
||||
patient.setLinkTelcom(patientInfoDto.getLinkTelcom()); // 联系人电话
|
||||
patient.setAddress(patientInfoDto.getAddress()); // 地址
|
||||
patient.setAddressProvince(patientInfoDto.getAddressProvince()); // 地址省
|
||||
patient.setAddressCity(patientInfoDto.getAddressCity()); // 地址市
|
||||
patient.setAddressDistrict(patientInfoDto.getAddressDistrict()); // 地址区
|
||||
patient.setAddressStreet(patientInfoDto.getAddressStreet()); // 地址街道
|
||||
patient.setBloodAbo(patientInfoDto.getBloodAbo()); // 血型ABO
|
||||
patient.setBloodRh(patientInfoDto.getBloodRh()); // 血型RH
|
||||
patient.setMaritalStatusEnum(patientInfoDto.getMaritalStatusEnum()); // 婚姻状态
|
||||
patient.setDeceasedDate(patientInfoDto.getDeceasedDate()); // 死亡时间
|
||||
patient.setNationalityCode(patientInfoDto.getNationalityCode());// 民族
|
||||
patient.setActiveFlag(patientInfoDto.getActiveFlag());// 活动标识
|
||||
|
||||
if (patientInfoDto.getId() != null) {
|
||||
// 更新操作
|
||||
patientService.updateById(patient);
|
||||
} else {
|
||||
// 新增操作
|
||||
patientService.save(patient);
|
||||
}
|
||||
|
||||
return patient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新患者手机号
|
||||
*
|
||||
* @param patientBaseInfoDto 患者信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> updatePatientPhone(PatientBaseInfoDto patientBaseInfoDto) {
|
||||
if (patientBaseInfoDto != null) {
|
||||
if (patientBaseInfoDto.getId() != null && patientBaseInfoDto.getPhone() != null) {
|
||||
LambdaUpdateWrapper<Patient> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(Patient::getPhone, patientBaseInfoDto.getPhone());
|
||||
updateWrapper.eq(Patient::getId, patientBaseInfoDto.getId());
|
||||
// 手机号码不相等时更新号码
|
||||
updateWrapper.ne(Patient::getPhone, patientBaseInfoDto.getPhone()).or().isNull(Patient::getPhone);
|
||||
patientService.update(updateWrapper);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.openhis.web.patientmanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.annotation.Anonymous;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.patientmanage.appservice.IOutpatientRecordService;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordDto;
|
||||
import com.openhis.web.patientmanage.dto.OutpatientRecordSearchParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 门诊记录查询控制器
|
||||
*
|
||||
* @author system
|
||||
* @date 2025/12/31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/patient-manage/records")
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Anonymous
|
||||
public class OutpatientRecordController {
|
||||
|
||||
private final IOutpatientRecordService outpatientRecordService;
|
||||
|
||||
/**
|
||||
* 测试接口 - 验证Controller是否被加载
|
||||
*
|
||||
* @return 测试消息
|
||||
*/
|
||||
@GetMapping("/test")
|
||||
public R<?> test() {
|
||||
log.info("OutpatientRecordController.test() 被调用");
|
||||
return R.ok("OutpatientRecordController 工作正常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门诊记录初期数据
|
||||
*
|
||||
* @return 初期数据
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> getInitData() {
|
||||
return outpatientRecordService.getDoctorNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询门诊记录
|
||||
*
|
||||
* @param outpatientRecordSearchParam 门诊记录查询参数
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
* @param request 请求对象
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@GetMapping("/outpatient-record-page")
|
||||
public R<IPage<OutpatientRecordDto>> getOutpatientRecordPage(
|
||||
OutpatientRecordSearchParam outpatientRecordSearchParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
log.info("查询门诊记录,pageNo: {}, pageSize: {}", pageNo, pageSize);
|
||||
log.info("searchKey: {}", searchKey);
|
||||
log.info("outpatientRecordSearchParam: {}", outpatientRecordSearchParam);
|
||||
if (outpatientRecordSearchParam != null) {
|
||||
log.info("姓名参数: {}, 身份证参数: {}, 病人ID: {}, 门诊号: {}, 性别: {}, 状态: {}, 电话: {}, 医生: {}, 开始时间: {}, 结束时间: {}",
|
||||
outpatientRecordSearchParam.getName(),
|
||||
outpatientRecordSearchParam.getIdCard(),
|
||||
outpatientRecordSearchParam.getPatientBusNo(),
|
||||
outpatientRecordSearchParam.getEncounterBusNo(),
|
||||
outpatientRecordSearchParam.getGenderEnum(),
|
||||
outpatientRecordSearchParam.getSubjectStatusEnum(),
|
||||
outpatientRecordSearchParam.getPhone(),
|
||||
outpatientRecordSearchParam.getDoctorName(),
|
||||
outpatientRecordSearchParam.getStartTimeSTime(),
|
||||
outpatientRecordSearchParam.getStartTimeETime());
|
||||
}
|
||||
return R.ok(outpatientRecordService.getPatient(outpatientRecordSearchParam, searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生名字列表
|
||||
*
|
||||
* @return 医生名字列表
|
||||
*/
|
||||
@GetMapping("/doctor-names")
|
||||
public R<?> getDoctorNames() {
|
||||
return outpatientRecordService.getDoctorNames();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.openhis.web.patientmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.patientmanage.appservice.IPatientInformationService;
|
||||
import com.openhis.web.patientmanage.dto.PatientBaseInfoDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 病人管理——病人信息
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/patient-manage/information")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PatientInformationController {
|
||||
|
||||
@Autowired
|
||||
IPatientInformationService patientInformationService;
|
||||
|
||||
/**
|
||||
* 病人信息记录初期数据列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> getPatientInfoInit() {
|
||||
return R.ok(patientInformationService.getPatientInfoInit());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加病人信息
|
||||
*
|
||||
* @param patientBaseInfoDto 病人信息
|
||||
*/
|
||||
@PostMapping("/patient-information")
|
||||
public R<?> addPatient(@RequestBody PatientBaseInfoDto patientBaseInfoDto) {
|
||||
// log.debug("添加病人信息,patientInfoDto:{}", patientBaseInfoDto);
|
||||
return patientInformationService.addPatient(patientBaseInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改病人信息
|
||||
*
|
||||
* @param patientInfoDto 病人信息
|
||||
*/
|
||||
@PutMapping("/patient-information")
|
||||
public R<?> editPatient(@RequestBody PatientBaseInfoDto patientInfoDto) {
|
||||
return patientInformationService.editPatient(patientInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询病人信息,可选条件
|
||||
*
|
||||
* @param patientBaseInfoDto 患者查询参数
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 页码(默认为1)
|
||||
* @param pageSize 每页大小(默认为10)
|
||||
*/
|
||||
@GetMapping("/patient-information-page")
|
||||
public R<?> getPatient(PatientBaseInfoDto patientBaseInfoDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(patientInformationService.getPatientInfo(patientBaseInfoDto, searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新患者手机号
|
||||
*
|
||||
* @param patientBaseInfoDto 患者信息
|
||||
*/
|
||||
@PostMapping("/update-patient-phone")
|
||||
public R<?> updatePatientPhone(@RequestBody PatientBaseInfoDto patientBaseInfoDto) {
|
||||
return patientInformationService.updatePatientPhone(patientBaseInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查患者是否存在
|
||||
*
|
||||
* @param name 患者姓名
|
||||
* @param idCardNo 身份证号
|
||||
* @return 是否存在
|
||||
*/
|
||||
@GetMapping("/check-exists")
|
||||
public R<?> checkPatientExists(@RequestParam String name, @RequestParam String idCardNo) {
|
||||
return R.ok(patientInformationService.checkPatientExists(name, idCardNo));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.openhis.web.patientmanage.dto;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 门诊记录 Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/3/15
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OutpatientRecordDto {
|
||||
|
||||
/**
|
||||
* 就诊记录ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 患者院内编码
|
||||
*/
|
||||
private String patientBusNo;
|
||||
|
||||
/**
|
||||
* 就诊流水号
|
||||
*/
|
||||
private String encounterBusNo;
|
||||
|
||||
/**
|
||||
* 性别编码
|
||||
*/
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 就诊时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date encounterTime;
|
||||
|
||||
/**
|
||||
* 就诊对象状态
|
||||
*/
|
||||
private Integer subjectStatusEnum;
|
||||
private String subjectStatusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 医疗机构名称
|
||||
*/
|
||||
private String organizationName;
|
||||
|
||||
/**
|
||||
* 接诊医生姓名
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 登记时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 医生姓名
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 患者电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 搜索关键词(支持身份证号/病人ID/门诊号/姓名)
|
||||
*/
|
||||
private String searchKey;
|
||||
|
||||
/**
|
||||
* 开始时间(起始)
|
||||
*/
|
||||
private String startTimeSTime;
|
||||
|
||||
/**
|
||||
* 开始时间(结束)
|
||||
*/
|
||||
private String startTimeETime;
|
||||
|
||||
// 其他可能需要的查询参数
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.openhis.web.patientmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 病人信息 Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PatientBaseInfoDto {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 民族编码
|
||||
*/
|
||||
@Dict(dictCode = "nationality_code")
|
||||
private String nationalityCode;
|
||||
private String nationalityCode_dictText;
|
||||
|
||||
/**
|
||||
* 性别编码
|
||||
*/
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/**
|
||||
* 活动标记
|
||||
*/
|
||||
private Integer activeFlag;
|
||||
private Integer activeFlag_enumText;
|
||||
|
||||
/**
|
||||
* 身份证号码
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
|
||||
private Date birthDate;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 职业编码
|
||||
*/
|
||||
private Integer prfsEnum;
|
||||
private String prfsEnum_enumText;
|
||||
|
||||
/**
|
||||
* 工作单位
|
||||
*/
|
||||
private String workCompany;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 联系人关系
|
||||
*/
|
||||
private Integer linkRelationCode;
|
||||
private String linkRelationCode_enumText;
|
||||
|
||||
/**
|
||||
* 联系人电话
|
||||
*/
|
||||
private String linkTelcom;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 地址省
|
||||
*/
|
||||
private String addressProvince;
|
||||
|
||||
/**
|
||||
* 地址市
|
||||
*/
|
||||
private String addressCity;
|
||||
|
||||
/**
|
||||
* 地址区
|
||||
*/
|
||||
private String addressDistrict;
|
||||
|
||||
/**
|
||||
* 地址街道
|
||||
*/
|
||||
private String addressStreet;
|
||||
|
||||
/**
|
||||
* 血型ABO
|
||||
*/
|
||||
private Integer bloodAbo;
|
||||
private String bloodAbo_enumText;
|
||||
|
||||
/**
|
||||
* 血型RH
|
||||
*/
|
||||
private Integer bloodRh;
|
||||
private String bloodRh_enumText;
|
||||
|
||||
/**
|
||||
* 婚姻状态
|
||||
*/
|
||||
private Integer maritalStatusEnum;
|
||||
private String maritalStatusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 死亡时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deceasedDate;
|
||||
|
||||
/**
|
||||
* 病人证件信息集合
|
||||
*/
|
||||
private List<PatientIdInfoDto> patientIdInfoList;
|
||||
|
||||
/**
|
||||
* 患者院内编码/病历号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 登记医院ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 登记时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.openhis.web.patientmanage.dto;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 病人证件信息 Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PatientIdInfoDto {
|
||||
|
||||
/**
|
||||
* 患者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 标识类型编码 */
|
||||
private String typeCode;
|
||||
|
||||
/** 标识号 */
|
||||
private String identifierNo;
|
||||
|
||||
/** 有效时间Start */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/** 有效时间end */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.openhis.web.patientmanage.dto;
|
||||
|
||||
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> sex;
|
||||
//获取ABO血型列表
|
||||
private List<PatientInfoInitDto.statusEnumOption> bloodTypeABO;
|
||||
//获取RH血型列表
|
||||
private List<PatientInfoInitDto.statusEnumOption> bloodTypeRH;
|
||||
//获取家庭关系列表
|
||||
private List<PatientInfoInitDto.statusEnumOption> familyRelationshipType;
|
||||
//身份证件类型
|
||||
private List<PatientInfoInitDto.statusEnumOption> identityDocumentType;
|
||||
//是/否 状态
|
||||
private List<PatientInfoInitDto.statusEnumOption> whetherStatus;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Data
|
||||
public static class statusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public statusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.openhis.web.patientmanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
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;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 病人信息管理
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/2/25
|
||||
*/
|
||||
@Repository
|
||||
public interface PatientManageMapper extends BaseMapper<Patient> {
|
||||
|
||||
/**
|
||||
* 病人信息分页查询
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 病人信息列表
|
||||
*/
|
||||
IPage<PatientBaseInfoDto> getPatientPage(@Param("page") Page<PatientBaseInfoDto> page,
|
||||
@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();
|
||||
|
||||
/**
|
||||
* 根据医生ID和参与者类型获取相关的患者ID列表
|
||||
*
|
||||
* @param practitionerId 医生ID
|
||||
* @param typeCodes 参与者类型代码列表
|
||||
* @param tenantId 租户ID
|
||||
* @return 患者ID列表
|
||||
*/
|
||||
List<Long> getPatientIdsByPractitionerId(@Param("practitionerId") Long practitionerId,
|
||||
@Param("typeCodes") List<String> typeCodes,
|
||||
@Param("tenantId") Integer tenantId);
|
||||
}
|
||||
Reference in New Issue
Block a user