This commit is contained in:
zhuangyuanke 2024-12-31 17:10:08 +08:00
parent f88b28b243
commit b54fee7a77
2 changed files with 195 additions and 184 deletions

View File

@ -114,14 +114,15 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
}
/**
* @description 患者管理患者档案列表
* @param patientInfo 患者信息查询传输对象
* @return 患者信息集合
* @description 患者管理患者档案列表
* @Author haown
* @Date 2024-08-05 14:46
*/
@DataScope(agencyAlias = "p", userAlias = "p.attending_physician_id")
@Override public List<PatientInfoVo> getPatientList(PatientInfoDto patientInfo) {
@Override
public List<PatientInfoVo> getPatientList(PatientInfoDto patientInfo) {
List<PatientInfoVo> patientInfoVoList = patientInfoMapper.getPatientList(patientInfo);
return patientInfoVoList;
}
@ -155,7 +156,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
patientQuery.setHospitalAgencyId(patientInfo.getHospitalAgencyId());
List<PatientInfo> patientList = patientInfoMapper.selectPatientInfoList(patientQuery);
boolean exist = false;
if(CollectionUtils.isNotEmpty(patientList)) {
if (CollectionUtils.isNotEmpty(patientList)) {
PatientInfo patientOld = patientList.get(0);
patientInfo.setId(patientOld.getId());
exist = true;
@ -256,7 +257,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
return patientInfo;
}
@Override public PatientInfo updateBaseInfo(PatientBaseInfoDto patientInfo) {
@Override
public PatientInfo updateBaseInfo(PatientBaseInfoDto patientInfo) {
PatientInfo patientInfo1 = patientInfoMapper.selectPatientInfoById(patientInfo.getId());
BeanUtils.copyBeanProp(patientInfo1, patientInfo);
return updatePatientInfo(patientInfo1);
@ -304,9 +306,10 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
/**
* 设置患者就诊信息为空
*
* @param patientInfo 患者信息
*/
private void setVisitInfoNull(PatientInfo patientInfo){
private void setVisitInfoNull(PatientInfo patientInfo) {
patientInfo.setVisitDate(null);
patientInfo.setPatientType(null);
patientInfo.setPatientVisitRecordId(null);
@ -320,6 +323,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
patientInfo.setVisitSerialNumber(null);
patientInfo.setInHospitalNumber(null);
}
/**
* 删除患者信息
*
@ -350,7 +354,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
}
//如果要导入的数据列表为空直接返回
if (CollectionUtils.isEmpty(list) || list.size() == 0) {
return AjaxResult.error("导入数据列表不能为空!" );
return AjaxResult.error("导入数据列表不能为空!");
}
//如果存在 患者姓名或手机号或科室或就诊日期为空的情况直接返回
List<PatientInfoImport> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName()) || StringUtils.isEmpty(item.getPatientPhone()) || StringUtils.isEmpty(item.getDeptAlias()) || Objects.isNull(item.getVisitDate())).collect(Collectors.toList());
@ -485,9 +489,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
//设置导入记录ID
item.setPatientInfoImportId(item.getId());
//居民信息去重
if(residentInfos.stream().filter(residentInfo -> residentInfo.getPatientName().equals(item.getPatientName())
&& residentInfo.getPatientPhone().equals(item.getPatientPhone())).collect(Collectors.toSet()).size()==0)
{
if (residentInfos.stream().filter(residentInfo -> residentInfo.getPatientName().equals(item.getPatientName())
&& residentInfo.getPatientPhone().equals(item.getPatientPhone())).collect(Collectors.toSet()).size() == 0) {
patientInfoImportList_forResident.add(item);
}
//如果已存在
@ -498,21 +501,28 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
}
}
);
if(patientInfoImportList_forResident.size()>0) {
if (patientInfoImportList_forResident.size() > 0) {
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImportList_forResident);
if (residentCount <= 0) {
log.info("居民表新增失败!");
return AjaxResult.error("居民信息新增失败;");
}
//设置居民ID
patientInfoImportList.forEach(item -> item.setResidentId(item.getId()));
patientInfoImportList_forResident.forEach(item ->
{
patientInfoImportList.stream().filter(item2 -> item2.getPatientName().equals(item.getPatientName())
&& item2.getPatientPhone().equals(item.getPatientPhone())).findFirst().orElse(new PatientInfoImport())
.setResidentId(item.getId());
}
);
}
//endregion
//设置为门诊患者
patientInfoImportList.forEach(item ->
{item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);});
{
item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);
});
//新增患者表
int i = patientInfoMapper.insertPatientInfoList(patientInfoImportList);
if (i <= 0) {
@ -651,7 +661,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
patientInfoImports.forEach(item -> item.setResidentId(item.getId()));
//设置为门诊患者
patientInfoImports.forEach(item ->
{item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
{
item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);
});

View File

@ -906,7 +906,7 @@
) values
<foreach item="PatientInfoImport" index="index" collection="list" separator=",">
(
#{PatientInfoImport.id},
#{PatientInfoImport.residentId},
#{PatientInfoImport.patientInfoImportId},
#{PatientInfoImport.visitDate},
#{PatientInfoImport.inHospitalNumber},