导入修改
This commit is contained in:
parent
00296cc20c
commit
893b341775
@ -48,6 +48,7 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -384,23 +385,33 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
patientInfoImport.setHospitalAgencyName(agency.getAgencyName());
|
patientInfoImport.setHospitalAgencyName(agency.getAgencyName());
|
||||||
//医院有科室且名称一致塞值,不一致取数据返回,医院没科室科室数据返回
|
//医院有科室且名称一致塞值,不一致取数据返回,医院没科室科室数据返回
|
||||||
if (CollectionUtils.isNotEmpty(departmentList)) {
|
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||||
Department equalsDepartment = departmentList.stream().filter(Objects::nonNull)
|
Department equalsDepartment = departmentList.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getDeptAlias().equals(item.getDepartmentName())).findFirst().orElse(new Department());
|
||||||
.filter(item -> patientInfoImport.getDeptAlias().equals(item.getDepartmentName()) || (StringUtils.isNotEmpty(item.getDepartmentAbbreviation()) && item.getDepartmentAbbreviation().contains(patientInfoImport.getDeptAlias()))).findFirst().orElse(new Department());
|
//科室名称一致塞值
|
||||||
if (Objects.nonNull(equalsDepartment.getId())) {
|
if (Objects.nonNull(equalsDepartment.getId())) {
|
||||||
patientInfoImport.setDepartmentId(equalsDepartment.getId());
|
patientInfoImport.setDepartmentId(equalsDepartment.getId());
|
||||||
patientInfoImport.setDepartmentName(patientInfoImport.getDepartmentName());
|
patientInfoImport.setDepartmentName(patientInfoImport.getDepartmentName());
|
||||||
|
patientInfoImportList.add(patientInfoImport);
|
||||||
|
continue;
|
||||||
|
//科室别名一致塞值
|
||||||
} else {
|
} else {
|
||||||
|
Department containsDepartment = departmentList.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotEmpty(item.getDepartmentAbbreviation()) && item.getDepartmentAbbreviation().contains(patientInfoImport.getDeptAlias())).findFirst().orElse(new Department());
|
||||||
|
if (Objects.nonNull(containsDepartment.getId())) {
|
||||||
|
List<String> departmentAbbreviation = Arrays.asList(containsDepartment.getDepartmentAbbreviation().split("\\|"));
|
||||||
|
String s = departmentAbbreviation.stream().filter(Objects::nonNull).filter(item -> (patientInfoImport.getDeptAlias().equals(item))).findFirst().orElse(null);
|
||||||
|
if (StringUtils.isNotBlank(s)) {
|
||||||
|
patientInfoImport.setDepartmentId(containsDepartment.getId());
|
||||||
|
patientInfoImport.setDepartmentName(patientInfoImport.getDepartmentName());
|
||||||
|
patientInfoImportList.add(patientInfoImport);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//无科室名返回数据
|
||||||
DeptAliasVO deptAliasVO = new DeptAliasVO();
|
DeptAliasVO deptAliasVO = new DeptAliasVO();
|
||||||
deptAliasVO.setSn(sn);
|
deptAliasVO.setSn(sn);
|
||||||
deptAliasVO.setDeptAlias(patientInfoImport.getDeptAlias());
|
deptAliasVO.setDeptAlias(patientInfoImport.getDeptAlias());
|
||||||
deptAliasVOS.add(deptAliasVO);
|
deptAliasVOS.add(deptAliasVO);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DeptAliasVO deptAliasVO = new DeptAliasVO();
|
|
||||||
deptAliasVO.setSn(sn);
|
|
||||||
deptAliasVO.setDeptAlias(patientInfoImport.getDeptAlias());
|
|
||||||
deptAliasVOS.add(deptAliasVO);
|
|
||||||
}
|
|
||||||
patientInfoImportList.add(patientInfoImport);
|
patientInfoImportList.add(patientInfoImport);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(patientInfoImportList)) {
|
if (CollectionUtils.isEmpty(patientInfoImportList)) {
|
||||||
@ -515,7 +526,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
deptAliasdepartment.setUpdateTime(LocalDateTime.now());
|
deptAliasdepartment.setUpdateTime(LocalDateTime.now());
|
||||||
departments.add(deptAliasdepartment);
|
departments.add(deptAliasdepartment);
|
||||||
} else if (Objects.nonNull(deptAliasVO.getDeptAlias()) && StringUtils.isEmpty(department1.getDepartmentAbbreviation())) {
|
} else if (Objects.nonNull(deptAliasVO.getDeptAlias()) && StringUtils.isEmpty(department1.getDepartmentAbbreviation())) {
|
||||||
department1.setDepartmentAbbreviation(deptAliasVO.getDeptAlias());
|
deptAliasdepartment.setDepartmentAbbreviation(deptAliasVO.getDeptAlias());
|
||||||
deptAliasdepartment.setId(department1.getId());
|
deptAliasdepartment.setId(department1.getId());
|
||||||
deptAliasdepartment.setUpdateBy(SecurityUtils.getUsername());
|
deptAliasdepartment.setUpdateBy(SecurityUtils.getUsername());
|
||||||
deptAliasdepartment.setUpdateTime(LocalDateTime.now());
|
deptAliasdepartment.setUpdateTime(LocalDateTime.now());
|
||||||
@ -529,25 +540,24 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
return AjaxResult.error("导入失败,请联系管理员!");
|
return AjaxResult.error("导入失败,请联系管理员!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//新增患者表信息
|
//新增居民表
|
||||||
int i = patientInfoMapper.insertPatientInfoList(patientInfoImports);
|
patientInfoImports.forEach(item -> item.setPatientInfoImportId(item.getId()));
|
||||||
if (i <= 0) {
|
|
||||||
return AjaxResult.error("导入失败,请联系管理员!");
|
|
||||||
}
|
|
||||||
//新增居民表信息
|
|
||||||
List<PatientInfoImport> patientInfoIds = new ArrayList<>(patientInfoImports);
|
|
||||||
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImports);
|
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImports);
|
||||||
if (residentCount <= 0) {
|
if (residentCount <= 0) {
|
||||||
return AjaxResult.error("导入失败,请联系管理员!");
|
return AjaxResult.error("导入失败,请联系管理员!");
|
||||||
}
|
}
|
||||||
List<PatientInfoImport> residentIds = new ArrayList<>(patientInfoImports);
|
patientInfoImports.forEach(item -> item.setResidentId(item.getId()));
|
||||||
|
//新增患者表
|
||||||
|
int i = patientInfoMapper.insertPatientInfoList(patientInfoImports);
|
||||||
|
if (i <= 0) {
|
||||||
|
return AjaxResult.error("导入失败,请联系管理员!");
|
||||||
|
}
|
||||||
|
patientInfoImports.forEach(item -> item.setPatientInfoId(item.getId()));
|
||||||
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
||||||
for (PatientInfoImport patientInfoImport : patientInfoImports) {
|
for (PatientInfoImport patientInfoImport : patientInfoImports) {
|
||||||
PatientInfoImport patientInfoId = patientInfoIds.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientName().equals(item.getPatientName()) && patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).findFirst().orElse(new PatientInfoImport());
|
|
||||||
PatientInfoImport residentId = residentIds.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientName().equals(item.getPatientName()) && patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).findFirst().orElse(new PatientInfoImport());
|
|
||||||
PatientVisitRecord patientVisitRecord = new PatientVisitRecord();
|
PatientVisitRecord patientVisitRecord = new PatientVisitRecord();
|
||||||
patientVisitRecord.setPatientId(patientInfoId.getId());
|
patientVisitRecord.setPatientId(patientInfoImport.getPatientInfoId());
|
||||||
patientVisitRecord.setResidentId(residentId.getId());
|
patientVisitRecord.setResidentId(patientInfoImport.getResidentId());
|
||||||
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
||||||
patientVisitRecord.setDelFlag(0);
|
patientVisitRecord.setDelFlag(0);
|
||||||
patientVisitRecord.setHospitalAgencyId(agency.getId());
|
patientVisitRecord.setHospitalAgencyId(agency.getId());
|
||||||
|
|||||||
@ -629,7 +629,8 @@
|
|||||||
select a.agency_name as hospitalAgencyName,
|
select a.agency_name as hospitalAgencyName,
|
||||||
a.id as hospitalAgencyId,
|
a.id as hospitalAgencyId,
|
||||||
d.id,
|
d.id,
|
||||||
d.department_name
|
d.department_name,
|
||||||
|
d.department_abbreviation
|
||||||
FROM agency a
|
FROM agency a
|
||||||
LEFT JOIN department d ON a.id = d.hospital_agency_id
|
LEFT JOIN department d ON a.id = d.hospital_agency_id
|
||||||
where a.id = #{hospitalAgencyId}
|
where a.id = #{hospitalAgencyId}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user