患者导入
This commit is contained in:
parent
6dbd0185f7
commit
637dd44f09
Binary file not shown.
@ -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) {
|
||||
|
||||
@ -101,7 +101,7 @@ public interface IPatientInfoService {
|
||||
/**
|
||||
* 未识别科室名称导入
|
||||
*
|
||||
* @param patientInfoImportVO
|
||||
* @param patientInfoImportVO 未识别科室集合
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult secondaryUpload(PatientInfoImportVO patientInfoImportVO);
|
||||
|
||||
@ -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<PatientInfoImport> list, Integer records, String orgName) {
|
||||
@ -343,33 +347,30 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
}
|
||||
//导入重复过滤
|
||||
List<PatientInfoImport> distinctCollect = list.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
LocalDate nowDate = LocalDate.now();
|
||||
//与数据库重复
|
||||
List<PatientInfo> 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<AgencyVO> 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<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||
PatientInfoImportVO patientInfoImportVO = new PatientInfoImportVO();
|
||||
List<DeptAliasVO> deptAliasVOS = new ArrayList<>();
|
||||
//组装数据
|
||||
List<PatientInfoImport> patientInfoImportList = new ArrayList<>();
|
||||
//选择自动去除当日重复记录
|
||||
for (PatientInfoImport patientInfoImport : distinctCollect) {
|
||||
if (CollectionUtils.isNotEmpty(patientInfos)) {
|
||||
//选择自动去除当日重复记录
|
||||
if (CollectionUtils.isNotEmpty(patientInfos) && (Objects.isNull(records) || records == 1)) {
|
||||
List<PatientInfo> 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<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||
if (CollectionUtils.isEmpty(departmentList)) {
|
||||
return AjaxResult.error("该账号所属医院无下级科室,请先维护所属医院的下级科室信息!");
|
||||
}
|
||||
//根据sn查询数据
|
||||
List<PatientInfoImport> 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<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||
if (CollectionUtils.isEmpty(departmentList)) {
|
||||
return AjaxResult.error("该账号所属医院无下级科室,请先维护所属医院的下级科室信息!");
|
||||
}
|
||||
//科室组装别名
|
||||
List<Department> 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);
|
||||
|
||||
@ -514,15 +514,4 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAgencyHigherLevelList" resultType="com.xinelu.manage.domain.agency.Agency">
|
||||
select higher.id higherId,
|
||||
higher.agency_name higherAgencyName,
|
||||
this.id thisId,
|
||||
this.agency_name thisAgencyName
|
||||
from agency higher,
|
||||
agency this
|
||||
WHERE this.parent_id = higher.id
|
||||
AND this.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -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}
|
||||
)
|
||||
|
||||
@ -237,7 +237,9 @@
|
||||
department_name,
|
||||
sn,
|
||||
create_time,
|
||||
create_by
|
||||
create_by,
|
||||
hospital_agency_id,
|
||||
hospital_agency_name
|
||||
) values
|
||||
<foreach item="PatientInfoImport" index="index" collection="list" separator=",">
|
||||
(
|
||||
@ -254,7 +256,9 @@
|
||||
#{PatientInfoImport.departmentName},
|
||||
#{PatientInfoImport.sn},
|
||||
#{PatientInfoImport.createTime},
|
||||
#{PatientInfoImport.createBy}
|
||||
#{PatientInfoImport.createBy},
|
||||
#{PatientInfoImport.hospitalAgencyId},
|
||||
#{PatientInfoImport.hospitalAgencyName}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user