导入修改
This commit is contained in:
parent
35bd64d5cd
commit
f88b28b243
@ -64,7 +64,9 @@ public class ImportDownloadController {
|
||||
file = ResourceUtils.getFile("classpath:template/门诊患者信息导入表.xlsx");
|
||||
break;
|
||||
case Constants.PATIENT_INFO_IMPORT: // 门诊患者
|
||||
//本地服务
|
||||
//file = ResourceUtils.getFile("classpath:template/OutpatientFollowUpRecords.xlsx");
|
||||
//线上服务
|
||||
Resource resource = new ClassPathResource("classpath:template/OutpatientFollowUpRecords.xlsx");
|
||||
String filePath= this.getClass().getClassLoader().getResource("classpath:template/OutpatientFollowUpRecords.xlsx").getFile();
|
||||
file= new File(filePath);
|
||||
|
||||
@ -597,12 +597,23 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
if (CollectionUtils.isEmpty(patientInfoImports)) {
|
||||
return AjaxResult.error("已完成数据导入!导入成功0条记录;失败" + patientInfoImportVO.getCount() + "条记录。");
|
||||
}
|
||||
List<PatientInfoImport> insertResidentInfo = new ArrayList<>();
|
||||
List<ResidentInfo> residentInfos = residentInfoMapper.selectResidentInfoByPhoneList(patientInfoImports);
|
||||
for (PatientInfoImport patientInfoImport : patientInfoImports) {
|
||||
if (StringUtils.isEmpty(patientInfoImport.getDepartmentName()) || Objects.isNull(patientInfoImport.getDepartmentId())) {
|
||||
DeptAliasVO deptAliasVO = patientInfoImportVO.getDeptAliasVOS().stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getDepartmentName()) && StringUtils.isNotEmpty(item.getDeptAlias()) && patientInfoImport.getDeptAlias().equals(item.getDeptAlias())).findFirst().orElse(new DeptAliasVO());
|
||||
Department equalsDepartment = departmentList.stream().filter(Objects::nonNull).filter(item -> item.getDepartmentName().equals(deptAliasVO.getDepartmentName())).findFirst().orElse(new Department());
|
||||
patientInfoImport.setDepartmentId(equalsDepartment.getId());
|
||||
patientInfoImport.setDepartmentName(equalsDepartment.getDepartmentName());
|
||||
//居民信息去重
|
||||
patientInfoImport.setPatientInfoImportId(patientInfoImport.getId());
|
||||
List<ResidentInfo> collect = residentInfos.stream().filter(residentInfo -> residentInfo.getPatientName().equals(patientInfoImport.getPatientName()) && residentInfo.getPatientPhone().equals(patientInfoImport.getPatientPhone())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(collect) || collect.size() == 0) {
|
||||
insertResidentInfo.add(patientInfoImport);
|
||||
} else { //如果已存在 设置居民ID
|
||||
patientInfoImport.setResidentId(residentInfos.stream().filter(residentInfo -> residentInfo.getPatientName().equals(patientInfoImport.getPatientName())
|
||||
&& residentInfo.getPatientPhone().equals(patientInfoImport.getPatientPhone())).findFirst().orElse(new ResidentInfo()).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
//科室组装别名
|
||||
@ -633,8 +644,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
}
|
||||
}
|
||||
//新增居民表
|
||||
patientInfoImports.forEach(item -> item.setPatientInfoImportId(item.getId()));
|
||||
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImports);
|
||||
int residentCount = residentInfoMapper.insertResidentInfoList(insertResidentInfo);
|
||||
if (residentCount <= 0) {
|
||||
return AjaxResult.error("已完成数据导入!导入成功0条记录;失败" + patientInfoImportVO.getCount() + "条记录。");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user