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

View File

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