|
|
|
@ -101,8 +101,6 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
collectExams(exams, empId, reportDownDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collectPacs(String empId, String admissDate, String disDate, String times) throws Exception {
|
|
|
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
@ -125,7 +123,6 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
collectExams(exams, empId, reportDownDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collectSealPacs(String sealId) throws Exception{
|
|
|
|
|
TSeal seal = getSealAndCheckBySealId(sealId);
|
|
|
|
@ -167,26 +164,6 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
downloadPlatformRpc.sealReport(reportDownDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据封存id获取封存病案信息并且校验
|
|
|
|
|
*
|
|
|
|
|
* @param sealId 封存id
|
|
|
|
|
* @return com.docus.bgts.entity.TSeal
|
|
|
|
|
* @date 2024/1/11 10:47
|
|
|
|
|
* @author YongBin Wen
|
|
|
|
|
*/
|
|
|
|
|
private TSeal getSealAndCheckBySealId(String sealId) {
|
|
|
|
|
TSeal condition = new TSeal();
|
|
|
|
|
condition.setSealId(sealId);
|
|
|
|
|
TSeal seal = afCollectTaskService.findSealByCondition(condition);
|
|
|
|
|
if (Objects.isNull(seal)) {
|
|
|
|
|
throw new RuntimeException("sealId:" + sealId + " 未找到封存病案信息!");
|
|
|
|
|
}
|
|
|
|
|
return seal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collectEcg(String empId, String admissDate, String disDate, String times) throws Exception {
|
|
|
|
|
Map<String, String> smCollectionTime = getSmCollectionTimeEcg(admissDate, disDate);
|
|
|
|
@ -239,6 +216,131 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
logger.info("--------------全量采集结束------------------");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collectPacss(){
|
|
|
|
|
logger.info("按需采集任务执行----");
|
|
|
|
|
// if (CollUtil.isEmpty(date)) {
|
|
|
|
|
// try {
|
|
|
|
|
// initDate();
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// logger.error(e.getMessage());
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (currentIndex >= date.size()) {
|
|
|
|
|
// currentIndex = 0;
|
|
|
|
|
// }
|
|
|
|
|
logger.info("index:{},Thread {}", currentIndex, Thread.currentThread().getName());
|
|
|
|
|
// String collectStartDate = date.get(currentIndex);
|
|
|
|
|
// String collectEndDate = collectStartDate + "\t23:59:59";
|
|
|
|
|
String collectStartDate = String.valueOf(FileUtils.getJsonByName("collectStartDate"))+"\t00:00:00";
|
|
|
|
|
String collectEndDate = String.valueOf(FileUtils.getJsonByName("collectEndDate"))+"\t23:59:59";
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
|
|
|
|
threadPoolExecutor.execute(() -> {
|
|
|
|
|
try {
|
|
|
|
|
collectByDate(collectStartDate, collectEndDate, collectorid);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.info("按需采集出错{}",e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
countDownLatch.countDown();
|
|
|
|
|
});
|
|
|
|
|
try {
|
|
|
|
|
countDownLatch.await();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("JUC countDownLatch error {}", e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
logger.info("{},采集结束----", collectStartDate);
|
|
|
|
|
// currentIndex++;
|
|
|
|
|
System.gc();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void timerCollect() {
|
|
|
|
|
logger.info("------采集器开始采集---------");
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
//1.获取上次采集时间
|
|
|
|
|
Date time;
|
|
|
|
|
if (collectorid.equals("5")) {
|
|
|
|
|
time = afCollectAddMapper.getTimeByAdd(5);
|
|
|
|
|
} else {
|
|
|
|
|
time = afCollectAddMapper.getTimeByAdd(15);
|
|
|
|
|
}
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
String startDate = simpleDateFormat.format(time);
|
|
|
|
|
//当前日期
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
String endDate = simpleDateFormat.format(date);
|
|
|
|
|
collectByDates(startDate, endDate);
|
|
|
|
|
//更新采集时间
|
|
|
|
|
addAfCollectAdd(date);
|
|
|
|
|
logger.info("--------采集器结束采集------");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collectByDate(String startDate, String endDate, String collectorId) {
|
|
|
|
|
logger.info("按需采集开始----------开始时间---" + startDate + "------结束时间---" + endDate);
|
|
|
|
|
//页码
|
|
|
|
|
int startrow;
|
|
|
|
|
//每页10条数据
|
|
|
|
|
int endrow = 10;
|
|
|
|
|
//2.获取第一页10条数据开始采集
|
|
|
|
|
try{
|
|
|
|
|
List<Map> patientIds;
|
|
|
|
|
for (startrow = 0; ; startrow += 10) {
|
|
|
|
|
patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow);
|
|
|
|
|
if (null == patientIds || patientIds.size() <= 0) {
|
|
|
|
|
logger.info("未查询到按需采集患者!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (Map patientId : patientIds) {
|
|
|
|
|
if (patientId != null) {
|
|
|
|
|
try {
|
|
|
|
|
logger.info("按需采集------患者" + patientId.get("inpatient_no"));
|
|
|
|
|
logger.info("处理按需采集第" + startrow + "条数据----");
|
|
|
|
|
if (collectorId.equals("3")) {
|
|
|
|
|
collectPacs(String.valueOf(patientId.get("inpatient_no")), String.valueOf(patientId.get("admiss_date"))
|
|
|
|
|
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
|
|
|
|
|
} else if (collectorId.equals("4") || collectorId.equals("23")) {
|
|
|
|
|
collectEcg(String.valueOf(patientId.get("jzh")), String.valueOf(patientId.get("admiss_date"))
|
|
|
|
|
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
|
|
|
|
|
} else {
|
|
|
|
|
collect(String.valueOf(patientId.get("jzh")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("按需采集-患者inpatient_no:{},collectPacs() Error:{}", patientId.get("inpatient_no"), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
patientIds.clear();
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}catch (Throwable t) {
|
|
|
|
|
t.printStackTrace();
|
|
|
|
|
logger.error("throwable,{}", t.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据封存id获取封存病案信息并且校验
|
|
|
|
|
*
|
|
|
|
|
* @param sealId 封存id
|
|
|
|
|
* @return com.docus.bgts.entity.TSeal
|
|
|
|
|
* @date 2024/1/11 10:47
|
|
|
|
|
* @author YongBin Wen
|
|
|
|
|
*/
|
|
|
|
|
private TSeal getSealAndCheckBySealId(String sealId) {
|
|
|
|
|
TSeal condition = new TSeal();
|
|
|
|
|
condition.setSealId(sealId);
|
|
|
|
|
TSeal seal = afCollectTaskService.findSealByCondition(condition);
|
|
|
|
|
if (Objects.isNull(seal)) {
|
|
|
|
|
throw new RuntimeException("sealId:" + sealId + " 未找到封存病案信息!");
|
|
|
|
|
}
|
|
|
|
|
return seal;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 根据时间到采集任务 手麻
|
|
|
|
|
*
|
|
|
|
@ -356,44 +458,6 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void collectPacss(){
|
|
|
|
|
logger.info("按需采集任务执行----");
|
|
|
|
|
// if (CollUtil.isEmpty(date)) {
|
|
|
|
|
// try {
|
|
|
|
|
// initDate();
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// logger.error(e.getMessage());
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (currentIndex >= date.size()) {
|
|
|
|
|
// currentIndex = 0;
|
|
|
|
|
// }
|
|
|
|
|
logger.info("index:{},Thread {}", currentIndex, Thread.currentThread().getName());
|
|
|
|
|
// String collectStartDate = date.get(currentIndex);
|
|
|
|
|
// String collectEndDate = collectStartDate + "\t23:59:59";
|
|
|
|
|
String collectStartDate = String.valueOf(FileUtils.getJsonByName("collectStartDate"))+"\t00:00:00";
|
|
|
|
|
String collectEndDate = String.valueOf(FileUtils.getJsonByName("collectEndDate"))+"\t23:59:59";
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
|
|
|
|
threadPoolExecutor.execute(() -> {
|
|
|
|
|
try {
|
|
|
|
|
collectByDate(collectStartDate, collectEndDate, collectorid);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.info("按需采集出错{}",e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
countDownLatch.countDown();
|
|
|
|
|
});
|
|
|
|
|
try {
|
|
|
|
|
countDownLatch.await();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("JUC countDownLatch error {}", e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
logger.info("{},采集结束----", collectStartDate);
|
|
|
|
|
// currentIndex++;
|
|
|
|
|
System.gc();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -500,27 +564,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void timerCollect() {
|
|
|
|
|
logger.info("------采集器开始采集---------");
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
//1.获取上次采集时间
|
|
|
|
|
Date time;
|
|
|
|
|
if (collectorid.equals("5")) {
|
|
|
|
|
time = afCollectAddMapper.getTimeByAdd(5);
|
|
|
|
|
} else {
|
|
|
|
|
time = afCollectAddMapper.getTimeByAdd(15);
|
|
|
|
|
}
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
String startDate = simpleDateFormat.format(time);
|
|
|
|
|
//当前日期
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
String endDate = simpleDateFormat.format(date);
|
|
|
|
|
collectByDates(startDate, endDate);
|
|
|
|
|
//更新采集时间
|
|
|
|
|
addAfCollectAdd(date);
|
|
|
|
|
logger.info("--------采集器结束采集------");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新采集时间
|
|
|
|
@ -952,57 +996,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据时间批量按需采集
|
|
|
|
|
*
|
|
|
|
|
* @param startDate 开始时间
|
|
|
|
|
* @param endDate 结束时间
|
|
|
|
|
* @param collectorId 采集器编号
|
|
|
|
|
*/
|
|
|
|
|
public void collectByDate(String startDate, String endDate, String collectorId) {
|
|
|
|
|
logger.info("按需采集开始----------开始时间---" + startDate + "------结束时间---" + endDate);
|
|
|
|
|
//页码
|
|
|
|
|
int startrow;
|
|
|
|
|
//每页10条数据
|
|
|
|
|
int endrow = 10;
|
|
|
|
|
//2.获取第一页10条数据开始采集
|
|
|
|
|
try{
|
|
|
|
|
List<Map> patientIds;
|
|
|
|
|
for (startrow = 0; ; startrow += 10) {
|
|
|
|
|
patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow);
|
|
|
|
|
if (null == patientIds || patientIds.size() <= 0) {
|
|
|
|
|
logger.info("未查询到按需采集患者!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
for (Map patientId : patientIds) {
|
|
|
|
|
if (patientId != null) {
|
|
|
|
|
try {
|
|
|
|
|
logger.info("按需采集------患者" + patientId.get("inpatient_no"));
|
|
|
|
|
logger.info("处理按需采集第" + startrow + "条数据----");
|
|
|
|
|
if (collectorId.equals("3")) {
|
|
|
|
|
collectPacs(String.valueOf(patientId.get("inpatient_no")), String.valueOf(patientId.get("admiss_date"))
|
|
|
|
|
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
|
|
|
|
|
} else if (collectorId.equals("4") || collectorId.equals("23")) {
|
|
|
|
|
collectEcg(String.valueOf(patientId.get("jzh")), String.valueOf(patientId.get("admiss_date"))
|
|
|
|
|
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
|
|
|
|
|
} else {
|
|
|
|
|
collect(String.valueOf(patientId.get("jzh")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("按需采集-患者inpatient_no:{},collectPacs() Error:{}", patientId.get("inpatient_no"), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
patientIds.clear();
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
logger.error(e.getMessage());
|
|
|
|
|
}catch (Throwable t) {
|
|
|
|
|
t.printStackTrace();
|
|
|
|
|
logger.error("throwable,{}", t.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static JaxWsDynamicClientFactory wsDynamicClientFactory = JaxWsDynamicClientFactory.newInstance();
|
|
|
|
|
private static volatile Client client = null;
|
|
|
|
|