患者导入
This commit is contained in:
parent
0133f88bf2
commit
0c2a26627c
@ -145,7 +145,7 @@ public class PatientInfoController extends BaseController {
|
||||
}
|
||||
ExcelUtil<PatientInfoImport> util = new ExcelUtil<>(PatientInfoImport.class);
|
||||
List<PatientInfoImport> list = util.importExcel(file.getInputStream());
|
||||
return patientInfoService.patientUpload(list, records);
|
||||
return patientInfoService.patientUpload(list, records, orgName);
|
||||
}
|
||||
|
||||
@ApiOperation("未识别科室名称导入")
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package com.xinelu.manage.domain.patientinfoimportmain;
|
||||
|
||||
import com.xinelu.common.annotation.Excel;
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 patient_info_import_main
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "【请填写功能名称】对象", description = "patient_info_import_main")
|
||||
public class PatientInfoImportMain extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
@ApiModelProperty(value = "流水号")
|
||||
@Excel(name = "流水号")
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 导入人员所属机构ID
|
||||
*/
|
||||
@ApiModelProperty(value = "导入人员所属机构ID")
|
||||
@Excel(name = "导入人员所属机构ID")
|
||||
private Long hospitalAgencyId;
|
||||
|
||||
/**
|
||||
* 所属医院名称
|
||||
*/
|
||||
@ApiModelProperty(value = "所属医院名称")
|
||||
@Excel(name = "所属医院名称")
|
||||
private String hospitalAgencyName;
|
||||
|
||||
/**
|
||||
* 附件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "附件名称")
|
||||
@Excel(name = "附件名称")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 已随访:FOLLOWED;未随访:NOT_FOLLOWED;PARTIAL_FOLLOWED
|
||||
*/
|
||||
@ApiModelProperty(value = "已随访:FOLLOWED;未随访:NOT_FOLLOWED;PARTIAL_FOLLOWED")
|
||||
@Excel(name = "已随访:FOLLOWED;未随访:NOT_FOLLOWED;PARTIAL_FOLLOWED")
|
||||
private String followupStatus;
|
||||
|
||||
/**
|
||||
* 已随访人数
|
||||
*/
|
||||
@ApiModelProperty(value = "已随访人数")
|
||||
@Excel(name = "已随访人数")
|
||||
private Long followupCount;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("sn", getSn())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("hospitalAgencyId", getHospitalAgencyId())
|
||||
.append("hospitalAgencyName", getHospitalAgencyName())
|
||||
.append("fileName", getFileName())
|
||||
.append("followupStatus", getFollowupStatus())
|
||||
.append("followupCount", getFollowupCount())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.xinelu.manage.mapper.patientinfoimportmain;
|
||||
|
||||
import com.xinelu.manage.domain.patientinfoimportmain.PatientInfoImportMain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 患者导入记录Mapper接口
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface PatientInfoImportMainMapper {
|
||||
/**
|
||||
* 查询患者导入记录
|
||||
*
|
||||
* @param id 患者导入记录主键
|
||||
* @return 患者导入记录
|
||||
*/
|
||||
PatientInfoImportMain selectPatientInfoImportMainById(Long id);
|
||||
|
||||
/**
|
||||
* 查询患者导入记录列表
|
||||
*
|
||||
* @param patientInfoImportMain 患者导入记录
|
||||
* @return 患者导入记录集合
|
||||
*/
|
||||
List<PatientInfoImportMain> selectPatientInfoImportMainList(PatientInfoImportMain patientInfoImportMain);
|
||||
|
||||
/**
|
||||
* 新增患者导入记录
|
||||
*
|
||||
* @param patientInfoImportMain 患者导入记录
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPatientInfoImportMain(PatientInfoImportMain patientInfoImportMain);
|
||||
|
||||
/**
|
||||
* 修改患者导入记录
|
||||
*
|
||||
* @param patientInfoImportMain 患者导入记录
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePatientInfoImportMain(PatientInfoImportMain patientInfoImportMain);
|
||||
|
||||
/**
|
||||
* 删除患者导入记录
|
||||
*
|
||||
* @param id 患者导入记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePatientInfoImportMainById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除患者导入记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePatientInfoImportMainByIds(Long[] ids);
|
||||
}
|
||||
@ -96,7 +96,7 @@ public interface IPatientInfoService {
|
||||
* @param list 患者信息结合
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult patientUpload(List<PatientInfoImport> list,Integer records);
|
||||
AjaxResult patientUpload(List<PatientInfoImport> list,Integer records,String orgName);
|
||||
|
||||
/**
|
||||
* 未识别科室名称导入
|
||||
|
||||
@ -12,23 +12,29 @@ import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
import com.xinelu.common.utils.regex.RegexUtil;
|
||||
import com.xinelu.manage.domain.agency.Agency;
|
||||
import com.xinelu.manage.domain.department.Department;
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
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;
|
||||
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
||||
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
||||
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||
import com.xinelu.manage.mapper.patientinfoimport.PatientInfoImportMapper;
|
||||
import com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper;
|
||||
import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper;
|
||||
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;
|
||||
@ -75,6 +81,10 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
private PatientVisitRecordMapper patientVisitRecordMapper;
|
||||
@Resource
|
||||
private RegexUtil regexUtil;
|
||||
@Resource
|
||||
private PatientInfoImportMainMapper patientInfoImportMainMapper;
|
||||
@Resource
|
||||
private AgencyMapper agencyMapper;
|
||||
|
||||
/**
|
||||
* 查询患者信息
|
||||
@ -319,7 +329,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult patientUpload(List<PatientInfoImport> list, Integer records) {
|
||||
public AjaxResult patientUpload(List<PatientInfoImport> list, Integer records, String orgName) {
|
||||
if (CollectionUtils.isEmpty(list) || list.size() == 0) {
|
||||
return AjaxResult.error("导入用户数据不能为空!");
|
||||
}
|
||||
@ -343,6 +353,10 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
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())) {
|
||||
return AjaxResult.error("该账号无所属医院信息,请先添加该账号所属的医院信息!");
|
||||
@ -399,6 +413,17 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
if (insertCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
//导入记录表
|
||||
PatientInfoImportMain patientInfoImportMain = new PatientInfoImportMain();
|
||||
patientInfoImportMain.setCreateBy(SecurityUtils.getUsername());
|
||||
patientInfoImportMain.setCreateTime(LocalDateTime.now());
|
||||
patientInfoImportMain.setSn(sn);
|
||||
patientInfoImportMain.setHospitalAgencyId(department.getHospitalAgencyId());
|
||||
patientInfoImportMain.setFileName(orgName);
|
||||
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||
patientInfoImportMain.setHospitalAgencyName(departmentList.get(0).getHospitalAgencyName());
|
||||
}
|
||||
patientInfoImportMainMapper.insertPatientInfoImportMain(patientInfoImportMain);
|
||||
//科室名称全符合新增患者表,否则返回数据
|
||||
if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
|
||||
return AjaxResult.success("科室名称不存在", patientInfoImportVO);
|
||||
|
||||
@ -514,4 +514,15 @@
|
||||
</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>
|
||||
|
||||
@ -626,12 +626,13 @@
|
||||
</select>
|
||||
|
||||
<select id="selectDepartmentNameCount" resultType="com.xinelu.manage.domain.department.Department" resultMap="DepartmentResult">
|
||||
<include refid="selectDepartmentVo"/>
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null ">
|
||||
and hospital_agency_id =#{hospitalAgencyId}
|
||||
</if>
|
||||
</where>
|
||||
select a.agency_name as hospitalAgencyName,
|
||||
a.id as hospitalAgencyId,
|
||||
d.id,
|
||||
d.department_name
|
||||
FROM agency a
|
||||
LEFT JOIN department d ON a.id = d.hospital_agency_id
|
||||
where a.id = #{hospitalAgencyId}
|
||||
</select>
|
||||
|
||||
<update id="updateDepartmentListByIds">
|
||||
|
||||
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper">
|
||||
|
||||
<resultMap type="PatientInfoImportMain" id="PatientInfoImportMainResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sn" column="sn"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="hospitalAgencyId" column="hospital_agency_id"/>
|
||||
<result property="hospitalAgencyName" column="hospital_agency_name"/>
|
||||
<result property="fileName" column="file_name"/>
|
||||
<result property="followupStatus" column="followup_status"/>
|
||||
<result property="followupCount" column="followup_count"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPatientInfoImportMainVo">
|
||||
select id, sn, create_time, create_by, hospital_agency_id, hospital_agency_name, file_name, followup_status, followup_count from patient_info_import_main
|
||||
</sql>
|
||||
|
||||
<select id="selectPatientInfoImportMainList" parameterType="PatientInfoImportMain" resultMap="PatientInfoImportMainResult">
|
||||
<include refid="selectPatientInfoImportMainVo"/>
|
||||
<where>
|
||||
<if test="sn != null and sn != ''">
|
||||
and sn = #{sn}
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null ">
|
||||
and hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null and hospitalAgencyName != ''">
|
||||
and hospital_agency_name like concat('%', #{hospitalAgencyName}, '%')
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
and file_name like concat('%', #{fileName}, '%')
|
||||
</if>
|
||||
<if test="followupStatus != null and followupStatus != ''">
|
||||
and followup_status = #{followupStatus}
|
||||
</if>
|
||||
<if test="followupCount != null ">
|
||||
and followup_count = #{followupCount}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPatientInfoImportMainById" parameterType="Long"
|
||||
resultMap="PatientInfoImportMainResult">
|
||||
<include refid="selectPatientInfoImportMainVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPatientInfoImportMain" parameterType="PatientInfoImportMain" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into patient_info_import_main
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sn != null">sn,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">hospital_agency_id,
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null">hospital_agency_name,
|
||||
</if>
|
||||
<if test="fileName != null">file_name,
|
||||
</if>
|
||||
<if test="followupStatus != null">followup_status,
|
||||
</if>
|
||||
<if test="followupCount != null">followup_count,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sn != null">#{sn},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">#{hospitalAgencyId},
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null">#{hospitalAgencyName},
|
||||
</if>
|
||||
<if test="fileName != null">#{fileName},
|
||||
</if>
|
||||
<if test="followupStatus != null">#{followupStatus},
|
||||
</if>
|
||||
<if test="followupCount != null">#{followupCount},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePatientInfoImportMain" parameterType="PatientInfoImportMain">
|
||||
update patient_info_import_main
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sn != null">sn =
|
||||
#{sn},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">hospital_agency_id =
|
||||
#{hospitalAgencyId},
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null">hospital_agency_name =
|
||||
#{hospitalAgencyName},
|
||||
</if>
|
||||
<if test="fileName != null">file_name =
|
||||
#{fileName},
|
||||
</if>
|
||||
<if test="followupStatus != null">followup_status =
|
||||
#{followupStatus},
|
||||
</if>
|
||||
<if test="followupCount != null">followup_count =
|
||||
#{followupCount},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePatientInfoImportMainById" parameterType="Long">
|
||||
delete from patient_info_import_main where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePatientInfoImportMainByIds" parameterType="String">
|
||||
delete from patient_info_import_main where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user