diff --git a/postdischarge-admin/src/main/resources/template/门诊随访记录 - 未随访.xlsx b/postdischarge-admin/src/main/resources/template/门诊随访记录 - 未随访.xlsx index 13595b5d..2870fe1e 100644 Binary files a/postdischarge-admin/src/main/resources/template/门诊随访记录 - 未随访.xlsx and b/postdischarge-admin/src/main/resources/template/门诊随访记录 - 未随访.xlsx differ diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfoimport/PatientInfoImport.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfoimport/PatientInfoImport.java index cad48097..496eaba9 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfoimport/PatientInfoImport.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfoimport/PatientInfoImport.java @@ -117,6 +117,14 @@ public class PatientInfoImport extends BaseEntity { @Excel(name = "流水号") private String sn; + @ApiModelProperty(value = "导入人员所属机构ID") + @Excel(name = "导入人员所属机构ID") + private Long hospitalAgencyId; + + @ApiModelProperty(value = "所属医院名称") + @Excel(name = "所属医院名称") + private String hospitalAgencyName; + @Override public boolean equals(Object o) { if (this == o) { diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/IPatientInfoService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/IPatientInfoService.java index 74cec5e3..46b7777e 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/IPatientInfoService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/IPatientInfoService.java @@ -101,7 +101,7 @@ public interface IPatientInfoService { /** * 未识别科室名称导入 * - * @param patientInfoImportVO + * @param patientInfoImportVO 未识别科室集合 * @return AjaxResult */ AjaxResult secondaryUpload(PatientInfoImportVO patientInfoImportVO); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java index a861c887..34493fd8 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java @@ -20,7 +20,6 @@ import com.xinelu.manage.domain.patientinfoimportmain.PatientInfoImportMain; import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord; import com.xinelu.manage.domain.residentinfo.ResidentInfo; import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord; -import com.xinelu.manage.dto.agency.AgencyTreeDto; import com.xinelu.manage.dto.patientinfo.PatientBaseInfoDto; import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.dto.patientvisitrecord.PatientVisitRecordDto; @@ -34,7 +33,6 @@ import com.xinelu.manage.mapper.residentinfo.ResidentInfoMapper; import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper; import com.xinelu.manage.service.patientinfo.IPatientInfoService; import com.xinelu.manage.service.patientvisitrecord.IPatientVisitRecordService; -import com.xinelu.manage.vo.agency.AgencyVO; import com.xinelu.manage.vo.patientinfo.PatientInfoVo; import com.xinelu.manage.vo.patientinfoimport.DeptAliasVO; import com.xinelu.manage.vo.patientinfoimport.PatientInfoImportVO; @@ -327,6 +325,12 @@ public class PatientInfoServiceImpl implements IPatientInfoService { return patientInfoMapper.deletePatientInfoById(id); } + /** + * 患者导入 + * + * @param list 患者信息结合 + * @return AjaxResult + */ @Transactional(rollbackFor = Exception.class) @Override public AjaxResult patientUpload(List list, Integer records, String orgName) { @@ -343,33 +347,30 @@ public class PatientInfoServiceImpl implements IPatientInfoService { } //导入重复过滤 List distinctCollect = list.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList()); - LocalDate nowDate = LocalDate.now(); //与数据库重复 List patientInfos = new ArrayList<>(); if (Objects.isNull(records) || records == 1) { + LocalDate nowDate = LocalDate.now(); patientInfos = patientInfoMapper.selectPatientInfoByPatientName(list, nowDate); } //sn String sn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); //登录用户科室信息 SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); - AgencyTreeDto agencyTreeDto = new AgencyTreeDto(); - agencyTreeDto.setAgencyAndChild("1"); - agencyTreeDto.setId(sysUser.getHospitalAgencyId()); - List agencyVOS = agencyMapper.selectAgencyVOList(agencyTreeDto); - Department department = new Department(); - if (Objects.isNull(sysUser.getHospitalAgencyId())) { + Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); + if (Objects.isNull(agency) || StringUtils.isEmpty(agency.getNodeType())) { return AjaxResult.error("该账号无所属医院信息,请先添加该账号所属的医院信息!"); } + Department department = new Department(); department.setHospitalAgencyId(sysUser.getHospitalAgencyId()); List departmentList = departmentMapper.selectDepartmentNameCount(department); PatientInfoImportVO patientInfoImportVO = new PatientInfoImportVO(); List deptAliasVOS = new ArrayList<>(); //组装数据 List patientInfoImportList = new ArrayList<>(); - //选择自动去除当日重复记录 for (PatientInfoImport patientInfoImport : distinctCollect) { - if (CollectionUtils.isNotEmpty(patientInfos)) { + //选择自动去除当日重复记录 + if (CollectionUtils.isNotEmpty(patientInfos) && (Objects.isNull(records) || records == 1)) { List collect1 = patientInfos.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientName().equals(item.getPatientName()) && patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(collect1)) { continue; @@ -379,6 +380,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService { patientInfoImport.setSn(sn); patientInfoImport.setCreateBy(SecurityUtils.getUsername()); patientInfoImport.setCreateTime(LocalDateTime.now()); + patientInfoImport.setHospitalAgencyId(agency.getId()); + patientInfoImport.setHospitalAgencyName(agency.getAgencyName()); //医院有科室且名称一致塞值,不一致取数据返回,医院没科室科室数据返回 if (CollectionUtils.isNotEmpty(departmentList)) { Department equalsDepartment = departmentList.stream().filter(Objects::nonNull) @@ -418,11 +421,9 @@ public class PatientInfoServiceImpl implements IPatientInfoService { patientInfoImportMain.setCreateBy(SecurityUtils.getUsername()); patientInfoImportMain.setCreateTime(LocalDateTime.now()); patientInfoImportMain.setSn(sn); - patientInfoImportMain.setHospitalAgencyId(department.getHospitalAgencyId()); + patientInfoImportMain.setHospitalAgencyId(agency.getId()); patientInfoImportMain.setFileName(orgName); - if (CollectionUtils.isNotEmpty(departmentList)) { - patientInfoImportMain.setHospitalAgencyName(departmentList.get(0).getHospitalAgencyName()); - } + patientInfoImportMain.setHospitalAgencyName(agency.getAgencyName()); patientInfoImportMainMapper.insertPatientInfoImportMain(patientInfoImportMain); //科室名称全符合新增患者表,否则返回数据 if (CollectionUtils.isNotEmpty(deptAliasVOS)) { @@ -450,8 +451,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService { patientVisitRecord.setResidentId(residentId.getId()); BeanUtils.copyProperties(patientInfoImport, patientVisitRecord); patientVisitRecord.setDelFlag(0); - patientVisitRecord.setHospitalAgencyId(departmentList.get(0).getHospitalAgencyId()); - patientVisitRecord.setHospitalAgencyName(departmentList.get(0).getHospitalAgencyName()); + patientVisitRecord.setHospitalAgencyId(agency.getId()); + patientVisitRecord.setHospitalAgencyName(agency.getAgencyName()); patientVisitRecord.setCreateBy(SecurityUtils.getUsername()); patientVisitRecord.setCreateTime(LocalDateTime.now()); patientVisitRecords.add(patientVisitRecord); @@ -464,12 +465,30 @@ public class PatientInfoServiceImpl implements IPatientInfoService { return AjaxResult.success(); } + /** + * 未识别科室名称导入 + * + * @param patientInfoImportVO 未识别科室集合 + * @return AjaxResult + */ @Transactional(rollbackFor = Exception.class) @Override public AjaxResult secondaryUpload(PatientInfoImportVO patientInfoImportVO) { if (Objects.isNull(patientInfoImportVO) || CollectionUtils.isEmpty(patientInfoImportVO.getDeptAliasVOS()) || StringUtils.isEmpty(patientInfoImportVO.getSn())) { return AjaxResult.success(); } + //科室、医院 + SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); + Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); + if (Objects.isNull(agency)) { + return AjaxResult.error("该账号无所属医院信息,请先添加该账号所属的医院信息!"); + } + Department department = new Department(); + department.setHospitalAgencyId(sysUser.getHospitalAgencyId()); + List departmentList = departmentMapper.selectDepartmentNameCount(department); + if (CollectionUtils.isEmpty(departmentList)) { + return AjaxResult.error("该账号所属医院无下级科室,请先维护所属医院的下级科室信息!"); + } //根据sn查询数据 List patientInfoImports = patientInfoImportMapper.selectPatientInfoImportBySn(patientInfoImportVO.getSn()); for (PatientInfoImport patientInfoImport : patientInfoImports) { @@ -479,17 +498,6 @@ public class PatientInfoServiceImpl implements IPatientInfoService { patientInfoImport.setDepartmentName(deptAliasVO.getDepartmentName()); } } - //科室、医院 - SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); - Department department = new Department(); - if (Objects.isNull(sysUser.getHospitalAgencyId())) { - return AjaxResult.error("该账号无所属医院信息,请先添加该账号所属的医院信息!"); - } - department.setHospitalAgencyId(sysUser.getHospitalAgencyId()); - List departmentList = departmentMapper.selectDepartmentNameCount(department); - if (CollectionUtils.isEmpty(departmentList)) { - return AjaxResult.error("该账号所属医院无下级科室,请先维护所属医院的下级科室信息!"); - } //科室组装别名 List departments = new ArrayList<>(); for (Department department1 : departmentList) { @@ -537,8 +545,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService { patientVisitRecord.setResidentId(residentId.getId()); BeanUtils.copyProperties(patientInfoImport, patientVisitRecord); patientVisitRecord.setDelFlag(0); - patientVisitRecord.setHospitalAgencyId(department.getHospitalAgencyId()); - patientVisitRecord.setHospitalAgencyName(department.getHospitalAgencyName()); + patientVisitRecord.setHospitalAgencyId(agency.getId()); + patientVisitRecord.setHospitalAgencyName(agency.getAgencyName()); patientVisitRecord.setCreateBy(SecurityUtils.getUsername()); patientVisitRecord.setCreateTime(LocalDateTime.now()); patientVisitRecords.add(patientVisitRecord); diff --git a/postdischarge-manage/src/main/resources/mapper/manage/agency/AgencyMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/agency/AgencyMapper.xml index b9aac349..4174d79d 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/agency/AgencyMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/agency/AgencyMapper.xml @@ -514,15 +514,4 @@ - - diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml index cfb1def7..02014757 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml @@ -887,6 +887,8 @@ department_name, sn, del_flag, + hospital_agency_id, + hospital_agency_name, create_time, create_by ) values @@ -904,6 +906,8 @@ #{PatientInfoImport.departmentName}, #{PatientInfoImport.sn}, 0, + #{PatientInfoImport.hospitalAgencyId}, + #{PatientInfoImport.hospitalAgencyName}, #{PatientInfoImport.createTime}, #{PatientInfoImport.createBy} ) diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfoimport/PatientInfoImportMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfoimport/PatientInfoImportMapper.xml index 983ecf45..4f991c3d 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfoimport/PatientInfoImportMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfoimport/PatientInfoImportMapper.xml @@ -237,7 +237,9 @@ department_name, sn, create_time, - create_by + create_by, + hospital_agency_id, + hospital_agency_name ) values ( @@ -254,7 +256,9 @@ #{PatientInfoImport.departmentName}, #{PatientInfoImport.sn}, #{PatientInfoImport.createTime}, - #{PatientInfoImport.createBy} + #{PatientInfoImport.createBy}, + #{PatientInfoImport.hospitalAgencyId}, + #{PatientInfoImport.hospitalAgencyName} )