|
|
|
@ -112,7 +112,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
* @param startDate
|
|
|
|
|
* @param endDate
|
|
|
|
|
*/
|
|
|
|
|
/* private void collectByDates(String startDate, String endDate) {
|
|
|
|
|
private void collectByDates(String startDate, String endDate) {
|
|
|
|
|
//页码
|
|
|
|
|
int current;
|
|
|
|
|
//每页10条数据
|
|
|
|
@ -147,11 +147,21 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
if (null == maps || maps.size() <= 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
maps.stream().forEach(map -> {
|
|
|
|
|
maps:
|
|
|
|
|
for (Map map : maps) {
|
|
|
|
|
//获取过滤报告单
|
|
|
|
|
String[] filterReports = String.valueOf(FileUtils.getJsonByName("filterReport")).split(",");
|
|
|
|
|
if (filterReports.length > 0) {
|
|
|
|
|
for (String filterReport : filterReports) {
|
|
|
|
|
//需要过滤的报告单存在则不采集
|
|
|
|
|
if (String.valueOf(map.get(filetitle)).equals(filterReport)) {
|
|
|
|
|
continue maps;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ReportDownDto reportDownDto = new ReportDownDto();
|
|
|
|
|
reportDownDto.setCollectorid(collectorid);
|
|
|
|
|
reportDownDto.setAssortid(assortid);
|
|
|
|
|
|
|
|
|
|
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
|
|
|
|
|
reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
|
|
|
|
|
reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
@ -169,6 +179,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
try {
|
|
|
|
|
afCollectTaskService.insert(reportDownDto);
|
|
|
|
|
//String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
|
|
|
|
|
//调用下载接口
|
|
|
|
|
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
|
|
|
|
|
Map resMap = JSON.parseObject(post, Map.class);
|
|
|
|
|
logger.info(reportDownDto);
|
|
|
|
@ -184,98 +195,104 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
addMrReportErrorLog(reportDownDto);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据时间到采集任务 重症
|
|
|
|
|
*
|
|
|
|
|
* @param startDate
|
|
|
|
|
* @param endDate
|
|
|
|
|
*/
|
|
|
|
|
private void collectByDates(String startDate, String endDate) {
|
|
|
|
|
//页码
|
|
|
|
|
int current;
|
|
|
|
|
//每页10条数据
|
|
|
|
|
int size;
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
String assortid = String.valueOf(FileUtils.getJsonByName("assortid"));
|
|
|
|
|
int filesource = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource")));
|
|
|
|
|
int filestoragetype = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype")));
|
|
|
|
|
Map<String, Object> headMap = new HashMap<>();
|
|
|
|
|
headMap.put("Content-Type", "application/json");
|
|
|
|
|
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
|
|
|
|
|
String indexFlag = String.valueOf(FileUtils.getJsonByName("indexFlag"));
|
|
|
|
|
String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum"));
|
|
|
|
|
//String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle"));
|
|
|
|
|
String downurl = String.valueOf(FileUtils.getJsonByName("downurl"));
|
|
|
|
|
List<String> fieldArr=new ArrayList<>();
|
|
|
|
|
fieldArr.add(indexFlag);
|
|
|
|
|
fieldArr.add(serialnum);
|
|
|
|
|
// if(StringUtils.isNotBlank(filetitle)){
|
|
|
|
|
// fieldArr.add(filetitle);
|
|
|
|
|
// private void collectByDates(String startDate, String endDate) {
|
|
|
|
|
// //页码
|
|
|
|
|
// int current;
|
|
|
|
|
// //每页10条数据
|
|
|
|
|
// int size;
|
|
|
|
|
// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
// String assortid = String.valueOf(FileUtils.getJsonByName("assortid"));
|
|
|
|
|
// int filesource = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource")));
|
|
|
|
|
// int filestoragetype = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype")));
|
|
|
|
|
// Map<String, Object> headMap = new HashMap<>();
|
|
|
|
|
// headMap.put("Content-Type", "application/json");
|
|
|
|
|
// SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
|
|
|
|
|
// String indexFlag = String.valueOf(FileUtils.getJsonByName("indexFlag"));
|
|
|
|
|
// String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum"));
|
|
|
|
|
// //String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle"));
|
|
|
|
|
// String downurl = String.valueOf(FileUtils.getJsonByName("downurl"));
|
|
|
|
|
// List<String> fieldArr=new ArrayList<>();
|
|
|
|
|
// fieldArr.add(indexFlag);
|
|
|
|
|
// fieldArr.add(serialnum);
|
|
|
|
|
//// if(StringUtils.isNotBlank(filetitle)){
|
|
|
|
|
//// fieldArr.add(filetitle);
|
|
|
|
|
//// }
|
|
|
|
|
// fieldArr.add(downurl);
|
|
|
|
|
// String namespace = String.valueOf(FileUtils.getJsonByName("namespace"));
|
|
|
|
|
// String tableName = String.valueOf(FileUtils.getJsonByName("tableName"));
|
|
|
|
|
// String collectTimeName = String.valueOf(FileUtils.getJsonByName("collectTimeName"));
|
|
|
|
|
// List<Map> maps;
|
|
|
|
|
// //2.获取第一页10条数据开始采集
|
|
|
|
|
// logger.info("开始时间-----"+startDate+"结束时间-----"+"\n"+endDate);
|
|
|
|
|
// for (current = 1; ; current++) {
|
|
|
|
|
// size = 10 * current;
|
|
|
|
|
// maps = vDocumentPdfMapper.listCollectPage(size-10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
|
|
|
|
|
// logger.info("处理采集数据:"+maps);
|
|
|
|
|
// if (null == maps || maps.size() <= 0) {
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// maps.stream().forEach(map -> {
|
|
|
|
|
// ReportDownDto reportDownDto = new ReportDownDto();
|
|
|
|
|
// reportDownDto.setCollectorid(collectorid);
|
|
|
|
|
// reportDownDto.setAssortid(assortid);
|
|
|
|
|
//
|
|
|
|
|
// ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
|
|
|
|
|
// reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
|
|
|
|
|
// reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
|
//
|
|
|
|
|
// List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>();
|
|
|
|
|
// ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
|
|
|
|
|
// reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
|
|
|
|
|
// reportDownScanFileDto.setFilestoragetype(filestoragetype);
|
|
|
|
|
// reportDownScanFileDto.setFilesource(filesource);
|
|
|
|
|
// //reportDownScanFileDto.setFiletitle(map.get(filetitle)==null?"重症"+(System.currentTimeMillis()):String.valueOf(map.get(filetitle)));
|
|
|
|
|
// reportDownScanFileDto.setFiletitle(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
|
|
|
|
|
// reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
|
|
|
|
|
// reportDownScanFileDtos.add(reportDownScanFileDto);
|
|
|
|
|
// reportDownDto.setScanfiles(reportDownScanFileDtos);
|
|
|
|
|
// String post;
|
|
|
|
|
// try {
|
|
|
|
|
// afCollectTaskService.insert(reportDownDto);
|
|
|
|
|
// //String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
|
|
|
|
|
// post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
|
|
|
|
|
// Map resMap = JSON.parseObject(post, Map.class);
|
|
|
|
|
// logger.info(reportDownDto);
|
|
|
|
|
// if (String.valueOf(resMap.get("code")).equals("500")) {
|
|
|
|
|
// throw new RuntimeException(String.valueOf(resMap.get("msg")));
|
|
|
|
|
// }
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// //打印错误日志
|
|
|
|
|
// logger.info("采集出错:"+reportDownDto);
|
|
|
|
|
// logger.info(e);
|
|
|
|
|
// String stackTrace = ExceptionUtils.getStackTrace(e);
|
|
|
|
|
// logger.info("错误信息----------"+stackTrace);
|
|
|
|
|
// addMrReportErrorLog(reportDownDto);
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
fieldArr.add(downurl);
|
|
|
|
|
String namespace = String.valueOf(FileUtils.getJsonByName("namespace"));
|
|
|
|
|
String tableName = String.valueOf(FileUtils.getJsonByName("tableName"));
|
|
|
|
|
String collectTimeName = String.valueOf(FileUtils.getJsonByName("collectTimeName"));
|
|
|
|
|
List<Map> maps;
|
|
|
|
|
//2.获取第一页10条数据开始采集
|
|
|
|
|
logger.info("开始时间-----"+startDate+"结束时间-----"+"\n"+endDate);
|
|
|
|
|
for (current = 1; ; current++) {
|
|
|
|
|
size = 10 * current;
|
|
|
|
|
maps = vDocumentPdfMapper.listCollectPage(size-10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
|
|
|
|
|
logger.info("处理采集数据:"+maps);
|
|
|
|
|
if (null == maps || maps.size() <= 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
maps.stream().forEach(map -> {
|
|
|
|
|
ReportDownDto reportDownDto = new ReportDownDto();
|
|
|
|
|
reportDownDto.setCollectorid(collectorid);
|
|
|
|
|
reportDownDto.setAssortid(assortid);
|
|
|
|
|
|
|
|
|
|
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
|
|
|
|
|
reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
|
|
|
|
|
reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
|
|
|
|
|
|
List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>();
|
|
|
|
|
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
|
|
|
|
|
reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
|
|
|
|
|
reportDownScanFileDto.setFilestoragetype(filestoragetype);
|
|
|
|
|
reportDownScanFileDto.setFilesource(filesource);
|
|
|
|
|
//reportDownScanFileDto.setFiletitle(map.get(filetitle)==null?"重症"+(System.currentTimeMillis()):String.valueOf(map.get(filetitle)));
|
|
|
|
|
reportDownScanFileDto.setFiletitle(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
|
|
|
|
|
reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
|
|
|
|
|
reportDownScanFileDtos.add(reportDownScanFileDto);
|
|
|
|
|
reportDownDto.setScanfiles(reportDownScanFileDtos);
|
|
|
|
|
String post;
|
|
|
|
|
try {
|
|
|
|
|
afCollectTaskService.insert(reportDownDto);
|
|
|
|
|
//String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
|
|
|
|
|
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
|
|
|
|
|
Map resMap = JSON.parseObject(post, Map.class);
|
|
|
|
|
logger.info(reportDownDto);
|
|
|
|
|
if (String.valueOf(resMap.get("code")).equals("500")) {
|
|
|
|
|
throw new RuntimeException(String.valueOf(resMap.get("msg")));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
//打印错误日志
|
|
|
|
|
logger.info("采集出错:"+reportDownDto);
|
|
|
|
|
logger.info(e);
|
|
|
|
|
String stackTrace = ExceptionUtils.getStackTrace(e);
|
|
|
|
|
logger.info("错误信息----------"+stackTrace);
|
|
|
|
|
addMrReportErrorLog(reportDownDto);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void timerCollect() {
|
|
|
|
|
logger.info("------采集器开始采集---------");
|
|
|
|
|
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
|
|
|
|
|
//1.获取上次采集时间
|
|
|
|
|
Date time = afCollectAddMapper.getTimeByAdd();
|
|
|
|
|
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);
|
|
|
|
|
//当前日期
|
|
|
|
@ -440,6 +457,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据时间批量按需采集
|
|
|
|
|
*
|
|
|
|
|
* @param startDate 开始时间
|
|
|
|
|
* @param endDate 结束时间
|
|
|
|
|
* @param collectorId 采集器编号
|
|
|
|
@ -452,7 +470,7 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
//通过唯一报告单号查询patient_id
|
|
|
|
|
//List<String> patientIdByC1 = afCollectTaskService.getPatientIdByC1(c1s);
|
|
|
|
|
//通过patientId集合查询jzh
|
|
|
|
|
List<String> jzhs = afCollectTaskService.getJzhByPatientId(patientIds);
|
|
|
|
|
//List<String> jzhs = afCollectTaskService.getJzhByPatientId(patientIds);
|
|
|
|
|
//int i = -1;
|
|
|
|
|
//循环jzh与报告单号c1调用按需采集
|
|
|
|
|
// for (String c1 : c1s) {
|
|
|
|
@ -470,9 +488,18 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
try {
|
|
|
|
|
for (String jzh : jzhs) {
|
|
|
|
|
collect(jzh);
|
|
|
|
|
for (String patientId : patientIds) {
|
|
|
|
|
if (patientId!=null){
|
|
|
|
|
logger.info("按需采集------患者"+patientId);
|
|
|
|
|
collect(patientId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// for (String jzh : jzhs) {
|
|
|
|
|
// if (jzh!=null) {
|
|
|
|
|
// logger.info("按需采集------患者"+jzh);
|
|
|
|
|
// collect(jzh);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|