患者导入限制修改
This commit is contained in:
parent
0901b6411a
commit
e79509d9f4
@ -346,8 +346,12 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult patientUpload(List<PatientInfoImport> list, Integer isDistinct, String fileName, String importName) {
|
public AjaxResult patientUpload(List<PatientInfoImport> list, Integer isDistinct, String fileName, String importName) {
|
||||||
|
int number;
|
||||||
String importPersonTime = sysConfigService.selectConfigByKey("import_person_time");
|
String importPersonTime = sysConfigService.selectConfigByKey("import_person_time");
|
||||||
int number = Integer.parseInt(importPersonTime);
|
if (org.apache.commons.lang3.StringUtils.isBlank(importPersonTime)) {
|
||||||
|
number = 1000;
|
||||||
|
}
|
||||||
|
number = Integer.parseInt(importPersonTime);
|
||||||
if (CollectionUtils.isNotEmpty(list) && list.size() > number) {
|
if (CollectionUtils.isNotEmpty(list) && list.size() > number) {
|
||||||
return AjaxResult.error("本次导入表数据超过" + number + "人次上限!");
|
return AjaxResult.error("本次导入表数据超过" + number + "人次上限!");
|
||||||
}
|
}
|
||||||
@ -507,13 +511,13 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
patientInfoImportMain.setFileName(fileName);
|
patientInfoImportMain.setFileName(fileName);
|
||||||
patientInfoImportMain.setHospitalAgencyName(agency.getAgencyName());
|
patientInfoImportMain.setHospitalAgencyName(agency.getAgencyName());
|
||||||
patientInfoImportMain.setImportStatus(ImportStatusEnum.UNFINISHED.getInfo());
|
patientInfoImportMain.setImportStatus(ImportStatusEnum.UNFINISHED.getInfo());
|
||||||
patientInfoImportMain.setImportName(org.apache.commons.lang3.StringUtils.isNotBlank(importName)?importName : sn);
|
patientInfoImportMain.setImportName(org.apache.commons.lang3.StringUtils.isNotBlank(importName) ? importName : sn);
|
||||||
patientInfoImportMainMapper.insertPatientInfoImportMain(patientInfoImportMain);
|
patientInfoImportMainMapper.insertPatientInfoImportMain(patientInfoImportMain);
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//科室名称全符合新增患者表,否则返回数据 (简化导入修改)
|
//科室名称全符合新增患者表,否则返回数据 (简化导入修改)
|
||||||
//if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
|
//if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
|
||||||
//return AjaxResult.error("科室名称不存在", patientInfoImportVO);
|
//return AjaxResult.error("科室名称不存在", patientInfoImportVO);
|
||||||
//}
|
//}
|
||||||
//region 新增居民表
|
//region 新增居民表
|
||||||
patientInfoImportList.forEach(item ->
|
patientInfoImportList.forEach(item ->
|
||||||
@ -553,53 +557,53 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
|||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//设置为门诊患者
|
//设置为门诊患者
|
||||||
patientInfoImportList.forEach(item ->
|
patientInfoImportList.forEach(item ->
|
||||||
{
|
{
|
||||||
item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
|
item.setPatientType(PatientTypeEnum.OUTPATIENT.getInfo());
|
||||||
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);
|
item.setVisitMethod(VisitMethodConstants.OUTPATIENT_SERVICE);
|
||||||
});
|
});
|
||||||
//新增患者表
|
//新增患者表
|
||||||
int insertPatientInfo = patientInfoMapper.insertPatientInfoList(patientInfoImportList);
|
int insertPatientInfo = patientInfoMapper.insertPatientInfoList(patientInfoImportList);
|
||||||
if (insertPatientInfo <= 0) {
|
if (insertPatientInfo <= 0) {
|
||||||
log.info("患者表新增失败!");
|
log.info("患者表新增失败!");
|
||||||
return AjaxResult.error("患者信息新增失败;");
|
return AjaxResult.error("患者信息新增失败;");
|
||||||
}
|
}
|
||||||
patientInfoImportList.forEach(item -> item.setPatientInfoId(item.getId()));
|
patientInfoImportList.forEach(item -> item.setPatientInfoId(item.getId()));
|
||||||
//新增就诊记录表
|
//新增就诊记录表
|
||||||
//region 新增就诊记录表
|
//region 新增就诊记录表
|
||||||
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
||||||
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
||||||
PatientVisitRecord patientVisitRecord = new PatientVisitRecord();
|
PatientVisitRecord patientVisitRecord = new PatientVisitRecord();
|
||||||
patientVisitRecord.setPatientId(patientInfoImport.getPatientInfoId());
|
patientVisitRecord.setPatientId(patientInfoImport.getPatientInfoId());
|
||||||
patientVisitRecord.setResidentId(patientInfoImport.getResidentId());
|
patientVisitRecord.setResidentId(patientInfoImport.getResidentId());
|
||||||
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
||||||
patientVisitRecord.setDelFlag(0);
|
patientVisitRecord.setDelFlag(0);
|
||||||
patientVisitRecord.setHospitalAgencyId(agency.getId());
|
patientVisitRecord.setHospitalAgencyId(agency.getId());
|
||||||
patientVisitRecord.setHospitalAgencyName(agency.getAgencyName());
|
patientVisitRecord.setHospitalAgencyName(agency.getAgencyName());
|
||||||
patientVisitRecord.setCreateBy(SecurityUtils.getUsername());
|
patientVisitRecord.setCreateBy(SecurityUtils.getUsername());
|
||||||
patientVisitRecord.setCreateTime(LocalDateTime.now());
|
patientVisitRecord.setCreateTime(LocalDateTime.now());
|
||||||
patientVisitRecord.setVisitDate(patientInfoImport.getVisitDate().atTime(0, 0, 0));
|
patientVisitRecord.setVisitDate(patientInfoImport.getVisitDate().atTime(0, 0, 0));
|
||||||
patientVisitRecords.add(patientVisitRecord);
|
patientVisitRecords.add(patientVisitRecord);
|
||||||
}
|
}
|
||||||
int patientVisitRecordCount = patientVisitRecordMapper.insertPatientVisitRecordList(patientVisitRecords);
|
int patientVisitRecordCount = patientVisitRecordMapper.insertPatientVisitRecordList(patientVisitRecords);
|
||||||
if (patientVisitRecordCount <= 0) {
|
if (patientVisitRecordCount <= 0) {
|
||||||
log.info("就诊记录表新增失败!");
|
log.info("就诊记录表新增失败!");
|
||||||
return AjaxResult.error("就诊记录新增失败");
|
return AjaxResult.error("就诊记录新增失败");
|
||||||
}
|
}
|
||||||
// 更新 患者信息表中 的 最近一次问诊记录id
|
// 更新 患者信息表中 的 最近一次问诊记录id
|
||||||
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
||||||
//获取患者的最近一次就诊ID
|
//获取患者的最近一次就诊ID
|
||||||
PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto();
|
PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto();
|
||||||
patientVisitRecordDto.setPatientId(patientInfoImport.getPatientInfoId());
|
patientVisitRecordDto.setPatientId(patientInfoImport.getPatientInfoId());
|
||||||
PatientVisitRecord patientVisitRecord = patientVisitRecordMapper.getLastRecord(patientVisitRecordDto);
|
PatientVisitRecord patientVisitRecord = patientVisitRecordMapper.getLastRecord(patientVisitRecordDto);
|
||||||
PatientInfo patientInfo = new PatientInfo();
|
PatientInfo patientInfo = new PatientInfo();
|
||||||
patientInfo.setId(patientInfoImport.getPatientInfoId());
|
patientInfo.setId(patientInfoImport.getPatientInfoId());
|
||||||
// 修改患者最近一次就诊记录id
|
// 修改患者最近一次就诊记录id
|
||||||
patientInfo.setPatientVisitRecordId(patientVisitRecord.getId());
|
patientInfo.setPatientVisitRecordId(patientVisitRecord.getId());
|
||||||
patientInfoMapper.updatePatientInfoSelective(patientInfo);
|
patientInfoMapper.updatePatientInfoSelective(patientInfo);
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
PatientInfoImportMain patientInfoImportMainSn = new PatientInfoImportMain();
|
PatientInfoImportMain patientInfoImportMainSn = new PatientInfoImportMain();
|
||||||
patientInfoImportMainSn.setSn(sn);
|
patientInfoImportMainSn.setSn(sn);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user