导入修改

This commit is contained in:
zhangheng 2024-12-31 17:55:35 +08:00
parent 4c137c636e
commit f1174757a6

View File

@ -478,7 +478,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
//科室名称全符合新增患者表否则返回数据
if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
return AjaxResult.error("科室名称不存在", patientInfoImportVO);
} else {
}
//region 新增居民表
patientInfoImportList.forEach(item ->
{
@ -520,8 +520,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);
});
//新增患者表
int i = patientInfoMapper.insertPatientInfoList(patientInfoImportList);
if (i <= 0) {
int insertPatientInfo = patientInfoMapper.insertPatientInfoList(patientInfoImportList);
if (insertPatientInfo <= 0) {
log.info("患者表新增失败!");
return AjaxResult.error("患者信息新增失败;");
}
@ -560,7 +560,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
patientInfoMapper.updatePatientInfoSelective(patientInfo);
}
//endregion
}
PatientInfoImportMain patientInfoImportMainSn = new PatientInfoImportMain();
patientInfoImportMainSn.setSn(sn);
patientInfoImportMainSn.setImportStatus(ImportStatusEnum.FINISHED.getInfo());
@ -649,14 +649,18 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
}
}
//新增居民表
int residentCount = residentInfoMapper.insertResidentInfoList(insertResidentInfo);
if (residentCount <= 0) {
return AjaxResult.error("已完成数据导入导入成功0条记录失败" + patientInfoImportVO.getCount() + "条记录。");
if (CollectionUtils.isNotEmpty(insertResidentInfo) || insertResidentInfo.size() != 0){
int residentCount = residentInfoMapper.insertResidentInfoList(insertResidentInfo);
if (residentCount <= 0) {
return AjaxResult.error("已完成数据导入导入成功0条记录失败" + patientInfoImportVO.getCount() + "条记录。");
}
insertResidentInfo.forEach(item -> { patientInfoImports.stream().filter(patientInfoImport -> patientInfoImport.getPatientName().equals(item.getPatientName())
&& patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).findFirst().orElse(new PatientInfoImport()).setResidentId(item.getId());
}
);
}
patientInfoImports.forEach(item -> item.setResidentId(item.getId()));
//设置为门诊患者
patientInfoImports.forEach(item ->
{
patientInfoImports.forEach(item -> {
item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);
});
@ -684,6 +688,19 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
if (patientVisitRecordCount <= 0) {
return AjaxResult.error("已完成数据导入导入成功0条记录失败" + patientInfoImportVO.getCount() + "条记录。");
}
// 更新 患者信息表中 最近一次问诊记录id
for (PatientInfoImport patientInfoImport : patientInfoImports) {
//获取患者的最近一次就诊ID
PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto();
patientVisitRecordDto.setPatientId(patientInfoImport.getPatientInfoId());
PatientVisitRecord patientVisitRecord = patientVisitRecordMapper.getLastRecord(patientVisitRecordDto);
PatientInfo patientInfo = new PatientInfo();
patientInfo.setId(patientInfoImport.getPatientInfoId());
// 修改患者最近一次就诊记录id
patientInfo.setPatientVisitRecordId(patientVisitRecord.getId());
patientInfoMapper.updatePatientInfoSelective(patientInfo);
}
//endregion
PatientInfoImportMain patientInfoImportMainSn = new PatientInfoImportMain();
patientInfoImportMainSn.setSn(patientInfoImportVO.getSn());
patientInfoImportMainSn.setImportStatus(ImportStatusEnum.FINISHED.getInfo());