|
@@ -16,6 +16,7 @@ import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.SysUserUtils;
|
|
import com.diagbot.util.SysUserUtils;
|
|
import com.diagbot.vo.*;
|
|
import com.diagbot.vo.*;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -27,6 +28,7 @@ import java.util.stream.Collectors;
|
|
* @author songxl
|
|
* @author songxl
|
|
* @since 2021-05-11
|
|
* @since 2021-05-11
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
@Component
|
|
@Component
|
|
public class MedCheckWorkFacade {
|
|
public class MedCheckWorkFacade {
|
|
@Autowired
|
|
@Autowired
|
|
@@ -144,8 +146,7 @@ public class MedCheckWorkFacade {
|
|
recordContentVO.setIsPlacefile(1l);//获取已归档的患者
|
|
recordContentVO.setIsPlacefile(1l);//获取已归档的患者
|
|
recordContentVO.setStartTime(DateUtil.formatDateTime(DateUtil.addMinutes(DateUtil.now(), -30)));
|
|
recordContentVO.setStartTime(DateUtil.formatDateTime(DateUtil.addMinutes(DateUtil.now(), -30)));
|
|
recordContentVO.setEndTime(DateUtil.formatDateTime(DateUtil.now()));
|
|
recordContentVO.setEndTime(DateUtil.formatDateTime(DateUtil.now()));
|
|
- getPatientRecordType(medBehospitalTypeMap,
|
|
|
|
- medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
|
|
|
|
|
|
+ putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
|
|
} else {
|
|
} else {
|
|
//2.2添加今天之前所有患者的类型
|
|
//2.2添加今天之前所有患者的类型
|
|
//2.2.1获取所有数据数量
|
|
//2.2.1获取所有数据数量
|
|
@@ -154,16 +155,36 @@ public class MedCheckWorkFacade {
|
|
recordContentVO.setHospitalId(hospiatlId);
|
|
recordContentVO.setHospitalId(hospiatlId);
|
|
recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
|
|
recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
|
|
recordContentVO.setIsPlacefile(1l);//获取已归档的患者
|
|
recordContentVO.setIsPlacefile(1l);//获取已归档的患者
|
|
- int num = medicalRecordServiceImpl.getRecordCount(recordContentVO);
|
|
|
|
- if (num > 0) {
|
|
|
|
|
|
+ putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
|
|
|
|
+ }
|
|
|
|
+ //3.批量执行插入操作
|
|
|
|
+ try {
|
|
|
|
+ if (medBehospitalTypeMap!=null&&medBehospitalTypeMap.size() > 0) {
|
|
|
|
+ List<MedBehospitalType> medBehospitalTypeList = new ArrayList<>(medBehospitalTypeMap.values());
|
|
|
|
+ medBehospitalTypeServiceImpl.saveBatch(medBehospitalTypeList, batchSize);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch(Exception e)
|
|
|
|
+ {
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if (num < searchSize) {
|
|
|
|
- //执行一次
|
|
|
|
- recordContentVO.setStart(0L);
|
|
|
|
- recordContentVO.setEnd(num + 0L);
|
|
|
|
- getPatientRecordType(medBehospitalTypeMap,
|
|
|
|
- medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
|
|
|
|
- }
|
|
|
|
|
|
+ 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;
|
|
int i = num / searchSize + 1;
|
|
for (int j = 0; j < i; j++) {
|
|
for (int j = 0; j < i; j++) {
|
|
//5000个一次循环添加
|
|
//5000个一次循环添加
|
|
@@ -172,17 +193,8 @@ public class MedCheckWorkFacade {
|
|
getPatientRecordType(medBehospitalTypeMap,
|
|
getPatientRecordType(medBehospitalTypeMap,
|
|
medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
|
|
medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //3.批量执行插入操作
|
|
|
|
- if (medBehospitalTypeMap.size() > 0) {
|
|
|
|
- List<MedBehospitalType> medBehospitalTypeList = new ArrayList<>(medBehospitalTypeMap.values());
|
|
|
|
- medBehospitalTypeServiceImpl.saveBatch(medBehospitalTypeList, batchSize);
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|