|
@@ -22,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -137,34 +136,21 @@ public class MedCheckWorkFacade {
|
|
|
|
|
|
|
|
|
//定义批量插入的集合
|
|
|
- HashMap<String, MedBehospitalType> medBehospitalTypeMap = null;
|
|
|
- //1.判断患者类型表是否有记录
|
|
|
- int count = medBehospitalTypeServiceImpl.count();
|
|
|
- if (count > 0) {
|
|
|
- medBehospitalTypeMap = new HashMap<>();
|
|
|
- //2.1获取最近指定归档时间间隔的患者
|
|
|
- RecordTypeVO recordContentVO = new RecordTypeVO();
|
|
|
- recordContentVO.setHospitalId(hospiatlId);
|
|
|
- recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
|
|
|
- recordContentVO.setIsPlacefile(1l);//获取已归档的患者
|
|
|
- recordContentVO.setStartTime(DateUtil.formatDateTime(DateUtil.addMinutes(DateUtil.now(), -30)));
|
|
|
- recordContentVO.setEndTime(DateUtil.formatDateTime(DateUtil.now()));
|
|
|
- putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
|
|
|
- } else {
|
|
|
- //2.2添加今天之前所有患者的类型
|
|
|
- //2.2.1获取所有数据数量
|
|
|
- medBehospitalTypeMap = new HashMap<>();
|
|
|
- RecordTypeVO recordContentVO = new RecordTypeVO();
|
|
|
- recordContentVO.setHospitalId(hospiatlId);
|
|
|
- recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
|
|
|
- recordContentVO.setIsPlacefile(1l);//获取已归档的患者
|
|
|
- putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
|
|
|
+ HashMap<String, MedBehospitalType> medBehospitalTypeMap = new HashMap<>();
|
|
|
+ //1.获取有指定文书、没有患者类型的患者数据
|
|
|
+ RecordTypeVO recordContentVO = new RecordTypeVO();
|
|
|
+ recordContentVO.setHospitalId(hospiatlId);
|
|
|
+ recordContentVO.setModeList(new ArrayList<>(typeValue.keySet()));
|
|
|
+ List<MedicalRecordDTO> medicalRecordList = medicalRecordServiceImpl.getMedicalRecord(recordContentVO);
|
|
|
+ if(medicalRecordList!=null&&!medicalRecordList.isEmpty())
|
|
|
+ {
|
|
|
+ getPatientRecordType(medBehospitalTypeMap,medicalRecordList, typeValue, typeName, hospiatlId);
|
|
|
}
|
|
|
- //3.批量执行插入操作
|
|
|
+ //2.批量执行插入操作
|
|
|
try {
|
|
|
if (medBehospitalTypeMap!=null&&medBehospitalTypeMap.size() > 0) {
|
|
|
List<MedBehospitalType> medBehospitalTypeList = new ArrayList<>(medBehospitalTypeMap.values());
|
|
|
- medBehospitalTypeServiceImpl.saveBatch(medBehospitalTypeList, batchSize);
|
|
|
+ medBehospitalTypeServiceImpl.saveOrUpdateBatch(medBehospitalTypeList, batchSize);
|
|
|
}
|
|
|
}
|
|
|
catch(Exception e)
|
|
@@ -173,33 +159,6 @@ public class MedCheckWorkFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void putBehospitalTypeMap(HashMap<String, MedBehospitalType> medBehospitalTypeMap,
|
|
|
- RecordTypeVO recordContentVO, JSONObject typeValue,
|
|
|
- JSONObject typeName, Long hospiatlId,int searchSize) {
|
|
|
- int num = medicalRecordServiceImpl.getRecordCount(recordContentVO);
|
|
|
- if (num > 0) {
|
|
|
-
|
|
|
- if (num < searchSize) {
|
|
|
- //执行一次
|
|
|
- recordContentVO.setStart(0L);
|
|
|
- recordContentVO.setEnd(num + 0L);
|
|
|
- getPatientRecordType(medBehospitalTypeMap,
|
|
|
- medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int i = num / searchSize + 1;
|
|
|
- for (int j = 0; j < i; j++) {
|
|
|
- //5000个一次循环添加
|
|
|
- recordContentVO.setStart(j * searchSize * 1L);
|
|
|
- recordContentVO.setEnd(searchSize * 1L);
|
|
|
- getPatientRecordType(medBehospitalTypeMap,
|
|
|
- medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @Author songxl
|
|
|
* @Description 获取患者类型存入批量插入map
|