患者导入
This commit is contained in:
parent
2a1f1bd871
commit
f9d2a978bf
BIN
postdischarge-admin/src/main/resources/template/满意度调查系统资料.xlsx
Normal file
BIN
postdischarge-admin/src/main/resources/template/满意度调查系统资料.xlsx
Normal file
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
package com.xinelu.manage.controller.patientinfo;
|
||||
|
||||
import com.xinelu.common.annotation.Log;
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
@ -8,24 +9,23 @@ import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientBaseInfoDto;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
|
||||
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimport.PatientInfoImportVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 患者信息Controller
|
||||
@ -131,4 +131,26 @@ public class PatientInfoController extends BaseController {
|
||||
return toAjax(patientInfoService.deletePatientInfoByIds(ids));
|
||||
}
|
||||
|
||||
@ApiOperation("患者信息导入")
|
||||
@PostMapping("/patientUpload")
|
||||
public AjaxResult patientUpload(MultipartFile file) throws Exception {
|
||||
//判断excel里面是否有数据/文件格式
|
||||
if (Objects.isNull(file) || StringUtils.isBlank(file.getOriginalFilename())) {
|
||||
return AjaxResult.error("请选择需要导入的文件!");
|
||||
}
|
||||
// 获取文件名
|
||||
String orgName = file.getOriginalFilename();
|
||||
if (!orgName.endsWith(Constants.XLSX) && !orgName.endsWith(Constants.XLS)) {
|
||||
return AjaxResult.error("导入文件格式不正确,请导入xlsx或xls格式的文件!");
|
||||
}
|
||||
ExcelUtil<PatientInfoImport> util = new ExcelUtil<>(PatientInfoImport.class);
|
||||
List<PatientInfoImport> list = util.importExcel(file.getInputStream());
|
||||
return patientInfoService.patientUpload(list);
|
||||
}
|
||||
|
||||
@ApiOperation("未识别科室名称导入")
|
||||
@PostMapping("/secondaryUpload")
|
||||
public AjaxResult secondaryUpload(PatientInfoImportVO patientInfoImportVO) {
|
||||
return patientInfoService.secondaryUpload(patientInfoImportVO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,4 +344,12 @@ public class PatientInfo extends BaseEntity {
|
||||
/** 删除标识,0:未删除,1:已删除 */
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty(value = "导入流水号")
|
||||
private String sn;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
|
||||
@ApiModelProperty(value = "导入患者表id")
|
||||
private Integer patientInfoImportId;
|
||||
}
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
package com.xinelu.manage.domain.patientinfoimport;
|
||||
|
||||
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.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 患者导入表对象 patient_info_import
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel(value = "患者导入表对象", description = "patient_info_import")
|
||||
public class PatientInfoImport extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号")
|
||||
private Long orderNum;
|
||||
|
||||
/**
|
||||
* 科室名称(别名)
|
||||
*/
|
||||
@ApiModelProperty(value = "科室名称")
|
||||
@Excel(name = "科室名称")
|
||||
private String deptAlias;
|
||||
|
||||
/**
|
||||
* 就诊时间(门诊患者),时间格式:yyyy-MM-dd
|
||||
*/
|
||||
@ApiModelProperty(value = "就诊时间")
|
||||
@Excel(name = "就诊时间")
|
||||
private LocalDateTime visitDate;
|
||||
|
||||
/**
|
||||
* 门诊/住院号
|
||||
*/
|
||||
@ApiModelProperty(value = "门诊/住院号")
|
||||
@Excel(name = "就诊号")
|
||||
private String inHospitalNumber;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "患者姓名")
|
||||
@Excel(name = "患者姓名")
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
@Excel(name = "身份证号")
|
||||
private String cardNo;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
@ApiModelProperty(value = "年龄")
|
||||
@Excel(name = "年龄")
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 主要诊断
|
||||
*/
|
||||
@ApiModelProperty(value = "主要诊断")
|
||||
@Excel(name = "诊断名称")
|
||||
private String mainDiagnosis;
|
||||
|
||||
/**
|
||||
* 患者电话
|
||||
*/
|
||||
@ApiModelProperty(value = "患者电话")
|
||||
@Excel(name = "手机号号码")
|
||||
private String patientPhone;
|
||||
|
||||
/**
|
||||
* 匹配的科室ID
|
||||
*/
|
||||
@ApiModelProperty(value = "匹配的科室ID")
|
||||
@Excel(name = "匹配的科室ID")
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 匹配的科室名称
|
||||
*/
|
||||
@ApiModelProperty(value = "匹配的科室名称")
|
||||
@Excel(name = "科室名称")
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
@ApiModelProperty(value = "流水号")
|
||||
@Excel(name = "流水号")
|
||||
private String sn;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
PatientInfoImport that = (PatientInfoImport) o;
|
||||
return Objects.equals(patientName, that.patientName) && Objects.equals(patientPhone, that.patientPhone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(patientName, patientPhone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("deptAlias", getDeptAlias())
|
||||
.append("visitDate", getVisitDate())
|
||||
.append("inHospitalNumber", getInHospitalNumber())
|
||||
.append("patientName", getPatientName())
|
||||
.append("cardNo", getCardNo())
|
||||
.append("age", getAge())
|
||||
.append("mainDiagnosis", getMainDiagnosis())
|
||||
.append("patientPhone", getPatientPhone())
|
||||
.append("departmentId", getDepartmentId())
|
||||
.append("departmentName", getDepartmentName())
|
||||
.append("sn", getSn())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -153,4 +153,12 @@ public interface DepartmentMapper {
|
||||
* @return int
|
||||
*/
|
||||
List<Department> selectDepartmentNameCount(Department department);
|
||||
|
||||
/**
|
||||
* 批量修改科室别名
|
||||
*
|
||||
* @param departmentList
|
||||
* @return int
|
||||
*/
|
||||
int updateDepartmentListByIds(List<Department> departmentList);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xinelu.manage.mapper.patientinfo;
|
||||
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
import com.xinelu.manage.domain.residentinfo.ResidentInfo;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientBaseInfoVo;
|
||||
@ -139,4 +140,20 @@ public interface PatientInfoMapper {
|
||||
* @return int
|
||||
*/
|
||||
int selectPatientSignServiceCount();
|
||||
|
||||
/**
|
||||
* 批量查询患者信息
|
||||
*
|
||||
* @param list 集合
|
||||
* @return PatientInfo
|
||||
*/
|
||||
List<PatientInfo> selectPatientInfoByPatientName(@Param("list") List<PatientInfoImport> list);
|
||||
|
||||
/**
|
||||
* 新增患者信息
|
||||
*
|
||||
* @param patientInfo 患者信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPatientInfoList(List<PatientInfoImport> patientInfo);
|
||||
}
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
package com.xinelu.manage.mapper.patientinfoimport;
|
||||
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导入患者暂存表Mapper接口
|
||||
*
|
||||
* @author xinelu
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
public interface PatientInfoImportMapper {
|
||||
/**
|
||||
* 查询导入患者暂存表
|
||||
*
|
||||
* @param id 导入患者暂存表主键
|
||||
* @return 导入患者暂存表
|
||||
*/
|
||||
PatientInfoImport selectPatientInfoImportById(Long id);
|
||||
|
||||
/**
|
||||
* 查询导入患者暂存表列表
|
||||
*
|
||||
* @param patientInfoImport 导入患者暂存表
|
||||
* @return 导入患者暂存表集合
|
||||
*/
|
||||
List<PatientInfoImport> selectPatientInfoImportList(PatientInfoImport patientInfoImport);
|
||||
|
||||
/**
|
||||
* 新增导入患者暂存表
|
||||
*
|
||||
* @param patientInfoImport 导入患者暂存表
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPatientInfoImport(PatientInfoImport patientInfoImport);
|
||||
|
||||
/**
|
||||
* 修改导入患者暂存表
|
||||
*
|
||||
* @param patientInfoImport 导入患者暂存表
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePatientInfoImport(PatientInfoImport patientInfoImport);
|
||||
|
||||
/**
|
||||
* 删除导入患者暂存表
|
||||
*
|
||||
* @param id 导入患者暂存表主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePatientInfoImportById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除导入患者暂存表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePatientInfoImportByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 新增导入患者暂存表
|
||||
*
|
||||
* @param patientInfoImport 导入患者暂存表
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPatientInfoImportList(List<PatientInfoImport> patientInfoImport);
|
||||
|
||||
/**
|
||||
* 根据序列号查询数据
|
||||
*
|
||||
* @param sn 序列号
|
||||
* @return PatientInfoImport
|
||||
*/
|
||||
List<PatientInfoImport> selectPatientInfoImportBySn(String sn);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xinelu.manage.mapper.residentinfo;
|
||||
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
import com.xinelu.manage.domain.residentinfo.ResidentInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -85,4 +86,12 @@ public interface ResidentInfoMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
int updateResidentInfoOpenid(ResidentInfo residentInfo);
|
||||
|
||||
/**
|
||||
* 批量新增居民信息
|
||||
*
|
||||
* @param patientInfoImports 居民信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertResidentInfoList(List<PatientInfoImport> patientInfoImports);
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
package com.xinelu.manage.service.patientinfo;
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientBaseInfoDto;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimport.PatientInfoImportVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -85,4 +89,20 @@ public interface IPatientInfoService {
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePatientInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 患者导入
|
||||
*
|
||||
* @param list 患者信息结合
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult patientUpload(List<PatientInfoImport> list);
|
||||
|
||||
/**
|
||||
* 未识别科室名称导入
|
||||
*
|
||||
* @param patientInfoImportVO
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult secondaryUpload(PatientInfoImportVO patientInfoImportVO);
|
||||
}
|
||||
|
||||
@ -2,34 +2,50 @@ package com.xinelu.manage.service.patientinfo.impl;
|
||||
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.constant.SignRecordServiceStatusConstants;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.domain.entity.SysUser;
|
||||
import com.xinelu.common.enums.PatientSourceEnum;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.BaseUtil;
|
||||
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.department.Department;
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
import com.xinelu.manage.domain.patientinfoimport.PatientInfoImport;
|
||||
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.patientinfo.PatientBaseInfoDto;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
|
||||
import com.xinelu.manage.dto.patientvisitrecord.PatientVisitRecordDto;
|
||||
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.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.patientinfo.PatientInfoVo;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Resource;
|
||||
import com.xinelu.manage.vo.patientinfoimport.DeptAliasVO;
|
||||
import com.xinelu.manage.vo.patientinfoimport.PatientInfoImportVO;
|
||||
import com.xinelu.system.mapper.SysUserMapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 患者信息Service业务层处理
|
||||
*
|
||||
@ -41,12 +57,22 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
|
||||
@Resource
|
||||
private PatientInfoMapper patientInfoMapper;
|
||||
@Resource
|
||||
private ResidentInfoMapper residentInfoMapper;
|
||||
@Resource
|
||||
private IPatientVisitRecordService patientVisitRecordService;
|
||||
@Resource
|
||||
private SignPatientRecordMapper signPatientRecordMapper;
|
||||
@Resource
|
||||
private ResidentInfoMapper residentInfoMapper;
|
||||
@Resource
|
||||
private IPatientVisitRecordService patientVisitRecordService;
|
||||
@Resource
|
||||
private SignPatientRecordMapper signPatientRecordMapper;
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Resource
|
||||
private DepartmentMapper departmentMapper;
|
||||
@Resource
|
||||
private PatientInfoImportMapper patientInfoImportMapper;
|
||||
@Resource
|
||||
private PatientVisitRecordMapper patientVisitRecordMapper;
|
||||
@Resource
|
||||
private RegexUtil regexUtil;
|
||||
|
||||
/**
|
||||
* 查询患者信息
|
||||
@ -288,4 +314,209 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
public int deletePatientInfoById(Long id) {
|
||||
return patientInfoMapper.deletePatientInfoById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult patientUpload(List<PatientInfoImport> list) {
|
||||
if (CollectionUtils.isEmpty(list) || list.size() == 0) {
|
||||
return AjaxResult.error("导入用户数据不能为空!");
|
||||
}
|
||||
PatientInfoImport regexPhone = list.stream().filter(item -> StringUtils.isNotBlank(item.getPatientPhone())).filter(item -> BooleanUtils.isFalse(regexUtil.regexPhone(item.getPatientPhone()))).findFirst().orElse(new PatientInfoImport());
|
||||
if (StringUtils.isNotBlank(regexPhone.getPatientPhone())) {
|
||||
return AjaxResult.error("手机号号码:" + regexPhone.getPatientPhone() + " 格式不正确,请重新录入!");
|
||||
}
|
||||
PatientInfoImport regexCardNo = list.stream().filter(item -> StringUtils.isNotBlank(item.getCardNo())).filter(item -> BooleanUtils.isFalse(regexUtil.regexCardNo(item.getCardNo()))).findFirst().orElse(new PatientInfoImport());
|
||||
if (StringUtils.isNotBlank(regexCardNo.getCardNo())) {
|
||||
return AjaxResult.error("身份证号:" + regexCardNo.getCardNo() + " 格式不正确,请重新录入!");
|
||||
}
|
||||
//导入重复
|
||||
List<PatientInfoImport> distinctCollect = list.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (list.size() != distinctCollect.size()) {
|
||||
List<PatientInfoImport> contains = list.stream().filter(item -> !distinctCollect.contains(item)).collect(Collectors.toList());
|
||||
return AjaxResult.error("导入数据重复", contains);
|
||||
}
|
||||
//与数据库重复
|
||||
List<PatientInfo> patientInfos = patientInfoMapper.selectPatientInfoByPatientName(list);
|
||||
if (CollectionUtils.isEmpty(patientInfos)) {
|
||||
return AjaxResult.error("有" + patientInfos.size() + "条记录当天已导入,是否继续导入");
|
||||
}
|
||||
//sn
|
||||
String sn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
//登录用户科室信息
|
||||
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("该账号所属医院无下级科室,请先维护所属医院的下级科室信息!");
|
||||
}
|
||||
PatientInfoImportVO patientInfoImportVO = new PatientInfoImportVO();
|
||||
List<DeptAliasVO> deptAliasVOS = new ArrayList<>();
|
||||
//组装数据
|
||||
for (PatientInfoImport patientInfoImport : list) {
|
||||
//判断是否有科室名称或别名一致
|
||||
Department equalsDepartment = departmentList.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getDeptAlias().equals(item.getDepartmentName()) || item.getDepartmentAbbreviation().contains(patientInfoImport.getDeptAlias())).findFirst().orElse(new Department());
|
||||
patientInfoImport.setSn(sn);
|
||||
patientInfoImport.setCreateBy(SecurityUtils.getUsername());
|
||||
patientInfoImport.setCreateTime(LocalDateTime.now());
|
||||
//一致塞值,不一致取数据返回
|
||||
if (Objects.nonNull(equalsDepartment.getId())) {
|
||||
patientInfoImport.setDepartmentId(equalsDepartment.getId());
|
||||
patientInfoImport.setDepartmentName(patientInfoImport.getDepartmentName());
|
||||
} else {
|
||||
DeptAliasVO deptAliasVO = new DeptAliasVO();
|
||||
deptAliasVO.setSn(sn);
|
||||
deptAliasVO.setDeptAlias(patientInfoImport.getDeptAlias());
|
||||
deptAliasVOS.add(deptAliasVO);
|
||||
}
|
||||
}
|
||||
List<PatientInfoImport> patientInfoImports = new ArrayList<>(list);
|
||||
patientInfoImportVO.setSn(sn);
|
||||
patientInfoImportVO.setDepartments(departmentList);
|
||||
if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
|
||||
deptAliasVOS = deptAliasVOS.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getDepartmentId())).distinct().collect(Collectors.toList());
|
||||
patientInfoImportVO.setDeptAliasVOS(deptAliasVOS);
|
||||
}
|
||||
//新增缓存表
|
||||
int insertCount = patientInfoImportMapper.insertPatientInfoImportList(list);
|
||||
if (insertCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
//科室名称全符合新增患者表,否则返回数据
|
||||
if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
|
||||
return AjaxResult.success("科室名称不存在", patientInfoImportVO);
|
||||
} else {
|
||||
int i = patientInfoMapper.insertPatientInfoList(list);
|
||||
if (i <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
List<PatientInfoImport> patientInfoIds = new ArrayList<>(list);
|
||||
int residentCount = residentInfoMapper.insertResidentInfoList(list);
|
||||
if (residentCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
List<PatientInfoImport> residentIds = new ArrayList<>(list);
|
||||
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
||||
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.setPatientId(patientInfoId.getId());
|
||||
patientVisitRecord.setResidentId(residentId.getId());
|
||||
// patientVisitRecord.setVisitDate(patientInfoImport.getVisitDate());
|
||||
// patientVisitRecord.setCardNo(patientInfoImport.getCardNo());
|
||||
// patientVisitRecord.setAge(patientInfoImport.getAge());
|
||||
// patientVisitRecord.setMainDiagnosis(patientInfoImport.getMainDiagnosis());
|
||||
// patientVisitRecord.setPatientPhone(patientInfoImport.getPatientPhone());
|
||||
// patientVisitRecord.setPatientName(patientInfoImport.getPatientName());
|
||||
// patientVisitRecord.setDepartmentId(patientInfoImport.getDepartmentId());
|
||||
// patientVisitRecord.setDepartmentName(patientInfoImport.getDepartmentName());
|
||||
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
||||
patientVisitRecord.setDelFlag(0);
|
||||
patientVisitRecord.setHospitalAgencyId(departmentList.get(0).getHospitalAgencyId());
|
||||
patientVisitRecord.setHospitalAgencyName(departmentList.get(0).getHospitalAgencyName());
|
||||
patientVisitRecord.setCreateBy(SecurityUtils.getUsername());
|
||||
patientVisitRecord.setCreateTime(LocalDateTime.now());
|
||||
patientVisitRecords.add(patientVisitRecord);
|
||||
}
|
||||
int patientVisitRecordCount = patientVisitRecordMapper.insertBatch(patientVisitRecords);
|
||||
if (patientVisitRecordCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
//根据sn查询数据
|
||||
List<PatientInfoImport> patientInfoImports = patientInfoImportMapper.selectPatientInfoImportBySn(patientInfoImportVO.getSn());
|
||||
for (PatientInfoImport patientInfoImport : patientInfoImports) {
|
||||
if (StringUtils.isEmpty(patientInfoImport.getDepartmentName()) || Objects.isNull(patientInfoImport.getDepartmentId())) {
|
||||
DeptAliasVO deptAliasVO = patientInfoImportVO.getDeptAliasVOS().stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getDepartmentName()) && StringUtils.isNotEmpty(item.getDeptAlias()) && patientInfoImport.getDeptAlias().equals(item.getDeptAlias())).findFirst().orElse(new DeptAliasVO());
|
||||
patientInfoImport.setDepartmentId(deptAliasVO.getDepartmentId());
|
||||
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) {
|
||||
Department deptAliasdepartment = new Department();
|
||||
DeptAliasVO deptAliasVO = patientInfoImportVO.getDeptAliasVOS().stream().filter(Objects::nonNull).filter(item -> department1.getDepartmentName().equals(item.getDepartmentName())).findFirst().orElse(new DeptAliasVO());
|
||||
if (Objects.nonNull(deptAliasVO.getDeptAlias()) && StringUtils.isNotEmpty(department1.getDepartmentAbbreviation())) {
|
||||
deptAliasdepartment.setDepartmentAbbreviation(department1.getDepartmentAbbreviation() + "|" + deptAliasVO.getDeptAlias());
|
||||
deptAliasdepartment.setId(department1.getId());
|
||||
deptAliasdepartment.setUpdateBy(SecurityUtils.getUsername());
|
||||
deptAliasdepartment.setUpdateTime(LocalDateTime.now());
|
||||
departments.add(deptAliasdepartment);
|
||||
} else if (Objects.nonNull(deptAliasVO.getDeptAlias()) && StringUtils.isEmpty(department1.getDepartmentAbbreviation())) {
|
||||
department1.setDepartmentAbbreviation(deptAliasVO.getDeptAlias());
|
||||
deptAliasdepartment.setId(department1.getId());
|
||||
deptAliasdepartment.setUpdateBy(SecurityUtils.getUsername());
|
||||
deptAliasdepartment.setUpdateTime(LocalDateTime.now());
|
||||
departments.add(deptAliasdepartment);
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(departments)) {
|
||||
int i = departmentMapper.updateDepartmentListByIds(departments);
|
||||
if (i <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
}
|
||||
int i = patientInfoMapper.insertPatientInfoList(patientInfoImports);
|
||||
if (i <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
List<PatientInfoImport> patientInfoIds = new ArrayList<>(patientInfoImports);
|
||||
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImports);
|
||||
if (residentCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
List<PatientInfoImport> residentIds = new ArrayList<>(patientInfoImports);
|
||||
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
||||
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.setPatientId(patientInfoId.getId());
|
||||
patientVisitRecord.setResidentId(residentId.getId());
|
||||
// patientVisitRecord.setVisitDate(patientInfoImport.getVisitDate());
|
||||
// patientVisitRecord.setCardNo(patientInfoImport.getCardNo());
|
||||
// patientVisitRecord.setAge(patientInfoImport.getAge());
|
||||
// patientVisitRecord.setMainDiagnosis(patientInfoImport.getMainDiagnosis());
|
||||
// patientVisitRecord.setPatientPhone(patientInfoImport.getPatientPhone());
|
||||
// patientVisitRecord.setPatientName(patientInfoImport.getPatientName());
|
||||
// patientVisitRecord.setDepartmentId(patientInfoImport.getDepartmentId());
|
||||
// patientVisitRecord.setDepartmentName(patientInfoImport.getDepartmentName());
|
||||
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
||||
patientVisitRecord.setDelFlag(0);
|
||||
patientVisitRecord.setHospitalAgencyId(department.getHospitalAgencyId());
|
||||
patientVisitRecord.setHospitalAgencyName(department.getHospitalAgencyName());
|
||||
patientVisitRecord.setCreateBy(SecurityUtils.getUsername());
|
||||
patientVisitRecord.setCreateTime(LocalDateTime.now());
|
||||
patientVisitRecords.add(patientVisitRecord);
|
||||
}
|
||||
int patientVisitRecordCount = patientVisitRecordMapper.insertBatch(patientVisitRecords);
|
||||
if (patientVisitRecordCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,4 +52,7 @@ public class PatientBaseInfoVo {
|
||||
@ApiModelProperty(value = "住址")
|
||||
@Excel(name = "住址")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
}
|
||||
|
||||
@ -244,4 +244,7 @@ public class PatientInfoVo {
|
||||
@ApiModelProperty(value = "下次任务执行时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime nextTaskTime;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
private Integer age;
|
||||
}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.xinelu.manage.vo.patientinfoimport;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 科室别名集合
|
||||
*
|
||||
* @author zh
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@Data
|
||||
public class DeptAliasVO {
|
||||
|
||||
/**
|
||||
* 科室名称(别名)
|
||||
*/
|
||||
@ApiModelProperty(value = "科室名称")
|
||||
private String deptAlias;
|
||||
|
||||
/**
|
||||
* 匹配的科室ID
|
||||
*/
|
||||
@ApiModelProperty(value = "匹配的科室ID")
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 匹配的科室名称
|
||||
*/
|
||||
@ApiModelProperty(value = "匹配的科室名称")
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
@ApiModelProperty(value = "流水号")
|
||||
private String sn;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DeptAliasVO that = (DeptAliasVO) o;
|
||||
return Objects.equals(deptAlias, that.deptAlias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(deptAlias);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.xinelu.manage.vo.patientinfoimport;
|
||||
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import com.xinelu.manage.domain.department.Department;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 科室对象
|
||||
*
|
||||
* @author zh
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PatientInfoImportVO extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 科室别名集合
|
||||
*/
|
||||
private List<DeptAliasVO> deptAliasVOS;
|
||||
|
||||
/**
|
||||
* 科室集合
|
||||
*/
|
||||
private List<Department> departments;
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xinelu.manage.mapper.department.DepartmentMapper">
|
||||
|
||||
<resultMap type="Department" id="DepartmentResult">
|
||||
<resultMap type="com.xinelu.manage.domain.department.Department" id="DepartmentResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="parentDepartmentId" column="parent_department_id"/>
|
||||
<result property="hospitalAgencyId" column="hospital_agency_id"/>
|
||||
@ -61,7 +61,7 @@
|
||||
from department
|
||||
</sql>
|
||||
|
||||
<select id="selectDepartmentList" parameterType="Department" resultMap="DepartmentResult">
|
||||
<select id="selectDepartmentList" parameterType="com.xinelu.manage.domain.department.Department" resultMap="DepartmentResult">
|
||||
<include refid="selectDepartmentVo"/>
|
||||
<where>
|
||||
<if test="parentDepartmentId != null ">
|
||||
@ -334,7 +334,7 @@
|
||||
d.department_code
|
||||
</select>
|
||||
|
||||
<insert id="insertDepartment" parameterType="Department" useGeneratedKeys="true"
|
||||
<insert id="insertDepartment" parameterType="com.xinelu.manage.domain.department.Department" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into department
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -492,7 +492,7 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDepartment" parameterType="Department">
|
||||
<update id="updateDepartment" parameterType="com.xinelu.manage.domain.department.Department">
|
||||
update department
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentDepartmentId != null">parent_department_id =
|
||||
@ -571,7 +571,7 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateDepartmentById" parameterType="Department">
|
||||
<update id="updateDepartmentById" parameterType="com.xinelu.manage.domain.department.Department">
|
||||
update department
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
parent_department_id = #{parentDepartmentId},
|
||||
@ -633,4 +633,14 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateDepartmentListByIds">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
update department
|
||||
<set>
|
||||
department_abbreviation =#{item.departmentAbbreviation},
|
||||
</set>
|
||||
where id = #{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@ -46,6 +46,9 @@
|
||||
<result property="patientSource" column="patient_source"/>
|
||||
<result property="surgicalName" column="surgical_name"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="sn" column="sn"/>
|
||||
<result property="patientInfoImportId" column="patient_info_import_id"/>
|
||||
<result property="age" column="age"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -96,6 +99,9 @@
|
||||
p.patient_source,
|
||||
p.surgical_name,
|
||||
p.del_flag,
|
||||
p.sn,
|
||||
p.patient_info_import_id,
|
||||
p.age,
|
||||
p.create_by,
|
||||
p.create_time,
|
||||
p.update_by,
|
||||
@ -228,6 +234,7 @@
|
||||
p.sign_patient_record_id,
|
||||
p.visit_date AS visit_date,
|
||||
p.patient_source AS patient_source,
|
||||
p.age AS age,
|
||||
CASE
|
||||
WHEN isnull( p.sign_patient_record_id) THEN '新建'
|
||||
WHEN sign.service_status = 'INTENTIONAL_SIGNING' THEN '意向签约'
|
||||
@ -379,7 +386,8 @@
|
||||
birth_date,
|
||||
card_no,
|
||||
sex,
|
||||
address
|
||||
address,
|
||||
age
|
||||
from patient_info
|
||||
where id = #{id}
|
||||
</select>
|
||||
@ -784,7 +792,7 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getPatientInfoByOpenId" parameterType="string" resultType="ResidentInfo">
|
||||
<select id="getPatientInfoByOpenId" parameterType="string" resultType="com.xinelu.manage.domain.residentinfo.ResidentInfo">
|
||||
SELECT
|
||||
id,
|
||||
patient_name,
|
||||
@ -849,4 +857,54 @@
|
||||
where del_flag = 0
|
||||
and service_status = 'SERVICE_CENTER'
|
||||
</select>
|
||||
|
||||
<select id="selectPatientInfoByPatientName" resultType="com.xinelu.manage.domain.patientinfo.PatientInfo">
|
||||
select
|
||||
patient_name,
|
||||
patient_phone
|
||||
from patient_info
|
||||
<where>
|
||||
(patient_name, patient_phone) IN
|
||||
<foreach item="list" index="index" collection="item" open="(" separator="," close=")">
|
||||
(#{list.patientName}, #{list.patientPhone})
|
||||
</foreach>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertPatientInfoList" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into patient_info(
|
||||
patient_info_import_id,
|
||||
visit_date,
|
||||
in_hospital_number,
|
||||
patient_name,
|
||||
card_no,
|
||||
age,
|
||||
main_diagnosis,
|
||||
patient_phone,
|
||||
department_id,
|
||||
department_name,
|
||||
sn,
|
||||
del_flag,
|
||||
create_time,
|
||||
create_by
|
||||
) values
|
||||
<foreach item="PatientInfoImport" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{PatientInfoImport.id},
|
||||
#{PatientInfoImport.visitDate},
|
||||
#{PatientInfoImport.inHospitalNumber},
|
||||
#{PatientInfoImport.patientName},
|
||||
#{PatientInfoImport.cardNo},
|
||||
#{PatientInfoImport.age},
|
||||
#{PatientInfoImport.mainDiagnosis},
|
||||
#{PatientInfoImport.patientPhone},
|
||||
#{PatientInfoImport.departmentId},
|
||||
#{PatientInfoImport.departmentName},
|
||||
#{PatientInfoImport.sn},
|
||||
0,
|
||||
#{PatientInfoImport.createTime},
|
||||
#{PatientInfoImport.createBy}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,267 @@
|
||||
<?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.patientinfoimport.PatientInfoImportMapper">
|
||||
|
||||
<resultMap type="com.xinelu.manage.domain.patientinfoimport.PatientInfoImport" id="PatientInfoImportResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="deptAlias" column="dept_alias"/>
|
||||
<result property="visitDate" column="visit_date"/>
|
||||
<result property="inHospitalNumber" column="in_hospital_number"/>
|
||||
<result property="patientName" column="patient_name"/>
|
||||
<result property="cardNo" column="card_no"/>
|
||||
<result property="age" column="age"/>
|
||||
<result property="mainDiagnosis" column="main_diagnosis"/>
|
||||
<result property="patientPhone" column="patient_phone"/>
|
||||
<result property="departmentId" column="department_id"/>
|
||||
<result property="departmentName" column="department_name"/>
|
||||
<result property="sn" column="sn"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPatientInfoImportVo">
|
||||
select id,
|
||||
order_num,
|
||||
dept_alias,
|
||||
visit_date,
|
||||
in_hospital_number,
|
||||
patient_name,
|
||||
card_no,
|
||||
age,
|
||||
main_diagnosis,
|
||||
patient_phone,
|
||||
department_id,
|
||||
department_name,
|
||||
sn,
|
||||
create_time,
|
||||
create_by
|
||||
from patient_info_import
|
||||
</sql>
|
||||
|
||||
<select id="selectPatientInfoImportList"
|
||||
parameterType="com.xinelu.manage.domain.patientinfoimport.PatientInfoImport"
|
||||
resultMap="PatientInfoImportResult">
|
||||
<include refid="selectPatientInfoImportVo"/>
|
||||
<where>
|
||||
<if test="orderNum != null ">
|
||||
and order_num = #{orderNum}
|
||||
</if>
|
||||
<if test="deptAlias != null and deptAlias != ''">
|
||||
and dept_alias = #{deptAlias}
|
||||
</if>
|
||||
<if test="visitDate != null ">
|
||||
and visit_date = #{visitDate}
|
||||
</if>
|
||||
<if test="inHospitalNumber != null and inHospitalNumber != ''">
|
||||
and in_hospital_number = #{inHospitalNumber}
|
||||
</if>
|
||||
<if test="patientName != null and patientName != ''">
|
||||
and patient_name like concat('%', #{patientName}, '%')
|
||||
</if>
|
||||
<if test="cardNo != null and cardNo != ''">
|
||||
and card_no = #{cardNo}
|
||||
</if>
|
||||
<if test="age != null and age != ''">
|
||||
and age = #{age}
|
||||
</if>
|
||||
<if test="mainDiagnosis != null and mainDiagnosis != ''">
|
||||
and main_diagnosis = #{mainDiagnosis}
|
||||
</if>
|
||||
<if test="patientPhone != null and patientPhone != ''">
|
||||
and patient_phone = #{patientPhone}
|
||||
</if>
|
||||
<if test="departmentId != null ">
|
||||
and department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
and department_name like concat('%', #{departmentName}, '%')
|
||||
</if>
|
||||
<if test="sn != null and sn != ''">
|
||||
and sn = #{sn}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPatientInfoImportById" parameterType="Long"
|
||||
resultMap="PatientInfoImportResult">
|
||||
<include refid="selectPatientInfoImportVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPatientInfoImport" parameterType="com.xinelu.manage.domain.patientinfoimport.PatientInfoImport">
|
||||
insert into patient_info_import
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,
|
||||
</if>
|
||||
<if test="orderNum != null">order_num,
|
||||
</if>
|
||||
<if test="deptAlias != null">dept_alias,
|
||||
</if>
|
||||
<if test="visitDate != null">visit_date,
|
||||
</if>
|
||||
<if test="inHospitalNumber != null">in_hospital_number,
|
||||
</if>
|
||||
<if test="patientName != null">patient_name,
|
||||
</if>
|
||||
<if test="cardNo != null">card_no,
|
||||
</if>
|
||||
<if test="age != null">age,
|
||||
</if>
|
||||
<if test="mainDiagnosis != null">main_diagnosis,
|
||||
</if>
|
||||
<if test="patientPhone != null">patient_phone,
|
||||
</if>
|
||||
<if test="departmentId != null">department_id,
|
||||
</if>
|
||||
<if test="departmentName != null">department_name,
|
||||
</if>
|
||||
<if test="sn != null">sn,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},
|
||||
</if>
|
||||
<if test="orderNum != null">#{orderNum},
|
||||
</if>
|
||||
<if test="deptAlias != null">#{deptAlias},
|
||||
</if>
|
||||
<if test="visitDate != null">#{visitDate},
|
||||
</if>
|
||||
<if test="inHospitalNumber != null">#{inHospitalNumber},
|
||||
</if>
|
||||
<if test="patientName != null">#{patientName},
|
||||
</if>
|
||||
<if test="cardNo != null">#{cardNo},
|
||||
</if>
|
||||
<if test="age != null">#{age},
|
||||
</if>
|
||||
<if test="mainDiagnosis != null">#{mainDiagnosis},
|
||||
</if>
|
||||
<if test="patientPhone != null">#{patientPhone},
|
||||
</if>
|
||||
<if test="departmentId != null">#{departmentId},
|
||||
</if>
|
||||
<if test="departmentName != null">#{departmentName},
|
||||
</if>
|
||||
<if test="sn != null">#{sn},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePatientInfoImport" parameterType="com.xinelu.manage.domain.patientinfoimport.PatientInfoImport">
|
||||
update patient_info_import
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="orderNum != null">order_num =
|
||||
#{orderNum},
|
||||
</if>
|
||||
<if test="deptAlias != null">dept_alias =
|
||||
#{deptAlias},
|
||||
</if>
|
||||
<if test="visitDate != null">visit_date =
|
||||
#{visitDate},
|
||||
</if>
|
||||
<if test="inHospitalNumber != null">in_hospital_number =
|
||||
#{inHospitalNumber},
|
||||
</if>
|
||||
<if test="patientName != null">patient_name =
|
||||
#{patientName},
|
||||
</if>
|
||||
<if test="cardNo != null">card_no =
|
||||
#{cardNo},
|
||||
</if>
|
||||
<if test="age != null">age =
|
||||
#{age},
|
||||
</if>
|
||||
<if test="mainDiagnosis != null">main_diagnosis =
|
||||
#{mainDiagnosis},
|
||||
</if>
|
||||
<if test="patientPhone != null">patient_phone =
|
||||
#{patientPhone},
|
||||
</if>
|
||||
<if test="departmentId != null">department_id =
|
||||
#{departmentId},
|
||||
</if>
|
||||
<if test="departmentName != null">department_name =
|
||||
#{departmentName},
|
||||
</if>
|
||||
<if test="sn != null">sn =
|
||||
#{sn},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePatientInfoImportById" parameterType="Long">
|
||||
delete
|
||||
from patient_info_import
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePatientInfoImportByIds" parameterType="String">
|
||||
delete from patient_info_import where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="insertPatientInfoImportList" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into patient_info_import(
|
||||
order_num,
|
||||
dept_alias,
|
||||
visit_date,
|
||||
in_hospital_number,
|
||||
patient_name,
|
||||
card_no,
|
||||
age,
|
||||
main_diagnosis,
|
||||
patient_phone,
|
||||
department_id,
|
||||
department_name,
|
||||
sn,
|
||||
create_time,
|
||||
create_by
|
||||
) values
|
||||
<foreach item="PatientInfoImport" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{PatientInfoImport.orderNum},
|
||||
#{PatientInfoImport.deptAlias},
|
||||
#{PatientInfoImport.visitDate},
|
||||
#{PatientInfoImport.inHospitalNumber},
|
||||
#{PatientInfoImport.patientName},
|
||||
#{PatientInfoImport.cardNo},
|
||||
#{PatientInfoImport.age},
|
||||
#{PatientInfoImport.mainDiagnosis},
|
||||
#{PatientInfoImport.patientPhone},
|
||||
#{PatientInfoImport.departmentId},
|
||||
#{PatientInfoImport.departmentName},
|
||||
#{PatientInfoImport.sn},
|
||||
#{PatientInfoImport.createTime},
|
||||
#{PatientInfoImport.createBy}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectPatientInfoImportBySn"
|
||||
resultType="com.xinelu.manage.domain.patientinfoimport.PatientInfoImport">
|
||||
<include refid="selectPatientInfoImportVo"/>
|
||||
where sn = #{sn}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -124,7 +124,7 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateResidentInfo" parameterType="com.xinelu.manage.domain.residentinfo.ResidentInfo">
|
||||
<update id="updateResidentInfo" parameterType="com.xinelu.manage.domain.residentinfo.ResidentInfo">
|
||||
update resident_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="patientName != null">patient_name =
|
||||
@ -214,4 +214,25 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertResidentInfoList" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into resident_info(
|
||||
patient_name,
|
||||
patient_phone,
|
||||
card_no,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time
|
||||
) values
|
||||
<foreach item="PatientInfoImport" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{PatientInfoImport.patientName},
|
||||
#{PatientInfoImport.patientPhone},
|
||||
#{PatientInfoImport.cardNo},
|
||||
0,
|
||||
#{PatientInfoImport.createBy},
|
||||
#{PatientInfoImport.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user