导入修改-新增科室
This commit is contained in:
parent
f5dad5d7aa
commit
58f2b05511
@ -199,6 +199,11 @@ public class Constants {
|
|||||||
*/
|
*/
|
||||||
public static final String AGENCY_CODE = "AYC";
|
public static final String AGENCY_CODE = "AYC";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室导入自动新增代码编码
|
||||||
|
*/
|
||||||
|
public static final String DEPARTMENT_IMPORT_CODE = "DIC";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 科室病种编码
|
* 科室病种编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -130,6 +130,14 @@ public interface DepartmentMapper {
|
|||||||
**/
|
**/
|
||||||
int insertDepartmentList(List<Department> departmentList);
|
int insertDepartmentList(List<Department> departmentList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室信息导入(部分)
|
||||||
|
*
|
||||||
|
* @param departmentList 机构信息
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
int insertPartDepartmentList(List<Department> departmentList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询科室信息列表及包含服务包数量
|
* 查询科室信息列表及包含服务包数量
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package com.xinelu.manage.service.patientinfo.impl;
|
package com.xinelu.manage.service.patientinfo.impl;
|
||||||
|
|
||||||
import com.xinelu.common.annotation.DataScope;
|
import com.xinelu.common.annotation.DataScope;
|
||||||
|
import com.xinelu.common.constant.Constants;
|
||||||
import com.xinelu.common.constant.SignRecordServiceStatusConstants;
|
import com.xinelu.common.constant.SignRecordServiceStatusConstants;
|
||||||
import com.xinelu.common.constant.VisitMethodConstants;
|
import com.xinelu.common.constant.VisitMethodConstants;
|
||||||
import com.xinelu.common.core.domain.AjaxResult;
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
import com.xinelu.common.core.domain.entity.SysUser;
|
import com.xinelu.common.core.domain.entity.SysUser;
|
||||||
import com.xinelu.common.enums.ImportStatusEnum;
|
import com.xinelu.common.enums.ImportStatusEnum;
|
||||||
|
import com.xinelu.common.enums.NodeTypeEnum;
|
||||||
import com.xinelu.common.enums.PatientSourceEnum;
|
import com.xinelu.common.enums.PatientSourceEnum;
|
||||||
import com.xinelu.common.enums.PatientTypeEnum;
|
import com.xinelu.common.enums.PatientTypeEnum;
|
||||||
import com.xinelu.common.exception.ServiceException;
|
import com.xinelu.common.exception.ServiceException;
|
||||||
@ -13,7 +15,7 @@ import com.xinelu.common.utils.BaseUtil;
|
|||||||
import com.xinelu.common.utils.SecurityUtils;
|
import com.xinelu.common.utils.SecurityUtils;
|
||||||
import com.xinelu.common.utils.StringUtils;
|
import com.xinelu.common.utils.StringUtils;
|
||||||
import com.xinelu.common.utils.bean.BeanUtils;
|
import com.xinelu.common.utils.bean.BeanUtils;
|
||||||
import com.xinelu.common.utils.regex.RegexUtil;
|
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
||||||
import com.xinelu.manage.domain.agency.Agency;
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
import com.xinelu.manage.domain.department.Department;
|
import com.xinelu.manage.domain.department.Department;
|
||||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||||
@ -87,6 +89,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
private AgencyMapper agencyMapper;
|
private AgencyMapper agencyMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ISysConfigService sysConfigService;
|
private ISysConfigService sysConfigService;
|
||||||
|
@Resource
|
||||||
|
private GenerateSystemCodeUtil generateSystemCodeUtil;
|
||||||
|
|
||||||
private static final String IMPORT_PERSON_TIME = "import_person_time";
|
private static final String IMPORT_PERSON_TIME = "import_person_time";
|
||||||
|
|
||||||
@ -374,9 +378,9 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
return AjaxResult.error("导入数据列表不能为空!");
|
return AjaxResult.error("导入数据列表不能为空!");
|
||||||
}
|
}
|
||||||
//如果存在 患者姓名或手机号或科室或就诊日期为空的情况,直接返回;(暂时去除时间判断)
|
//如果存在 患者姓名或手机号或科室或就诊日期为空的情况,直接返回;(暂时去除时间判断)
|
||||||
List<PatientInfoImport> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName())).collect(Collectors.toList());
|
List<PatientInfoImport> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName()) || StringUtils.isEmpty(item.getDepartmentName()) || StringUtils.isEmpty(item.getPatientPhone())).collect(Collectors.toList());
|
||||||
if (CollectionUtils.isNotEmpty(collect)) {
|
if (CollectionUtils.isNotEmpty(collect)) {
|
||||||
return AjaxResult.error("用户信息不完整,姓名均不允许为空,请完善后重试;");
|
return AjaxResult.error("用户信息不完整,姓名、联系电话、科室均不能为空,请完善后重试;");
|
||||||
}
|
}
|
||||||
//存在手机号格式不正确的情况,直接返回
|
//存在手机号格式不正确的情况,直接返回
|
||||||
// List<PatientInfoImport> regexPhoneList = list.stream().filter(item -> StringUtils.isNotBlank(item.getPatientPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getPatientPhone()))).collect(Collectors.toList());
|
// List<PatientInfoImport> regexPhoneList = list.stream().filter(item -> StringUtils.isNotBlank(item.getPatientPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getPatientPhone()))).collect(Collectors.toList());
|
||||||
@ -412,7 +416,8 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
Department department = new Department();
|
Department department = new Department();
|
||||||
department.setHospitalAgencyId(sysUser.getHospitalAgencyId());
|
department.setHospitalAgencyId(sysUser.getHospitalAgencyId());
|
||||||
List<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
List<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||||
|
//导入未识别科室
|
||||||
|
List<String> addDepartmentName = new ArrayList<>();
|
||||||
PatientInfoImportVO patientInfoImportVO = new PatientInfoImportVO();
|
PatientInfoImportVO patientInfoImportVO = new PatientInfoImportVO();
|
||||||
List<DeptAliasVO> deptAliasVOS = new ArrayList<>();
|
List<DeptAliasVO> deptAliasVOS = new ArrayList<>();
|
||||||
//组装数据
|
//组装数据
|
||||||
@ -480,9 +485,10 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
// patientInfoImportList为总数据,新增patient_info_import需要
|
// patientInfoImportList为总数据,新增patient_info_import需要
|
||||||
patientInfoImport.setDepartmentName(patientInfoImport.getDeptAlias());
|
patientInfoImport.setDepartmentName(patientInfoImport.getDeptAlias());
|
||||||
patientInfoImportList.add(patientInfoImport);
|
patientInfoImportList.add(patientInfoImport);
|
||||||
|
addDepartmentName.add(patientInfoImport.getDeptAlias());
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(patientInfoImportList)) {
|
if (CollectionUtils.isEmpty(patientInfoImportList)) {
|
||||||
return AjaxResult.success("附件中所有患者记录与今日已导入数据重复,不能重复导入");
|
return AjaxResult.success("附件中所有患者记录与今日已导入数据重复或达到本月个人拨打次数限制,不能重复导入");
|
||||||
}
|
}
|
||||||
//组装返回科室数据
|
//组装返回科室数据
|
||||||
patientInfoImportVO.setSn(sn);
|
patientInfoImportVO.setSn(sn);
|
||||||
@ -494,7 +500,32 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
deptAliasVOS = deptAliasVOS.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDeptAlias())).distinct().collect(Collectors.toList());
|
deptAliasVOS = deptAliasVOS.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDeptAlias())).distinct().collect(Collectors.toList());
|
||||||
patientInfoImportVO.setDeptAliasVOS(deptAliasVOS);
|
patientInfoImportVO.setDeptAliasVOS(deptAliasVOS);
|
||||||
}
|
}
|
||||||
|
//不存在科室信息中的数据(包括别名) - 新增
|
||||||
|
if (CollectionUtils.isNotEmpty(addDepartmentName)) {
|
||||||
|
List<Department> departments = new ArrayList<>();
|
||||||
|
List<String> addDepartmentNameList = addDepartmentName.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
|
for (String s : addDepartmentNameList) {
|
||||||
|
Department addDepartment = new Department();
|
||||||
|
addDepartment.setParentDepartmentId(0L);
|
||||||
|
addDepartment.setNodeType(NodeTypeEnum.DEPARTMENT.getInfo());
|
||||||
|
addDepartment.setDepartmentName(s);
|
||||||
|
addDepartment.setDepartmentCode(Constants.DEPARTMENT_IMPORT_CODE + generateSystemCodeUtil.generateSystemCode(Constants.DEPARTMENT_IMPORT_CODE));
|
||||||
|
addDepartment.setHospitalAgencyName(agency.getAgencyName());
|
||||||
|
addDepartment.setHospitalAgencyId(agency.getId());
|
||||||
|
addDepartment.setCreateTime(LocalDateTime.now());
|
||||||
|
addDepartment.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
departments.add(addDepartment);
|
||||||
|
}
|
||||||
|
departmentMapper.insertPartDepartmentList(departments);
|
||||||
|
departmentList.addAll(departments);
|
||||||
|
//未识别科室新增后补到导入数据里面
|
||||||
|
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
||||||
|
if (Objects.isNull(patientInfoImport.getDepartmentId()) && StringUtils.isNotBlank(patientInfoImport.getDepartmentName())) {
|
||||||
|
Department streamDepartment = departments.stream().filter(Objects::nonNull).filter(item -> item.getDepartmentName().equals(patientInfoImport.getDepartmentName())).findFirst().orElse(new Department());
|
||||||
|
patientInfoImport.setDepartmentId(streamDepartment.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//新增缓存表
|
//新增缓存表
|
||||||
int insertCount = patientInfoImportMapper.insertPatientInfoImportList(patientInfoImportList);
|
int insertCount = patientInfoImportMapper.insertPatientInfoImportList(patientInfoImportList);
|
||||||
if (insertCount <= 0) {
|
if (insertCount <= 0) {
|
||||||
|
|||||||
@ -492,6 +492,31 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertPartDepartmentList" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into department(
|
||||||
|
parent_department_id,
|
||||||
|
hospital_agency_id,
|
||||||
|
hospital_agency_name,
|
||||||
|
department_name,
|
||||||
|
department_code,
|
||||||
|
node_type,
|
||||||
|
create_by,
|
||||||
|
create_time
|
||||||
|
) values
|
||||||
|
<foreach item="Department" index="index" collection="list" separator=",">
|
||||||
|
(
|
||||||
|
#{Department.parentDepartmentId},
|
||||||
|
#{Department.hospitalAgencyId},
|
||||||
|
#{Department.hospitalAgencyName},
|
||||||
|
#{Department.departmentName},
|
||||||
|
#{Department.departmentCode},
|
||||||
|
#{Department.nodeType},
|
||||||
|
#{Department.createBy},
|
||||||
|
#{Department.createTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateDepartment" parameterType="com.xinelu.manage.domain.department.Department">
|
<update id="updateDepartment" parameterType="com.xinelu.manage.domain.department.Department">
|
||||||
update department
|
update department
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|||||||
@ -909,6 +909,7 @@
|
|||||||
<foreach item="list" index="index" collection="list" open="(" separator="," close=")">
|
<foreach item="list" index="index" collection="list" open="(" separator="," close=")">
|
||||||
#{list.patientPhone}
|
#{list.patientPhone}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
GROUP BY pi.department_id,pii.patient_phone
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertPatientInfoList" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertPatientInfoList" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user