|
|
|
@ -173,92 +173,96 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
* @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);
|
|
|
|
|
// }
|
|
|
|
|
// 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条数据开始采集
|
|
|
|
|
// 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:
|
|
|
|
|
// 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);
|
|
|
|
|
//
|
|
|
|
|
// 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.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();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
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条数据开始采集
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
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.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.getMessage());
|
|
|
|
|
addMrReportErrorLog(reportDownDto);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
logger.info(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 时间
|
|
|
|
|
private static List<String> date = new ArrayList<>();
|
|
|
|
|
// 上次任务执行时间
|
|
|
|
@ -327,102 +331,102 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
* @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"));
|
|
|
|
|
String inPatientNo = String.valueOf(FileUtils.getJsonByName("inPatientNo"));
|
|
|
|
|
String visitId = String.valueOf(FileUtils.getJsonByName("visitId"));
|
|
|
|
|
String inJzh = String.valueOf(FileUtils.getJsonByName("jzh"));
|
|
|
|
|
|
|
|
|
|
List<String> fieldArr = new ArrayList<>();
|
|
|
|
|
fieldArr.add(indexFlag);
|
|
|
|
|
fieldArr.add(serialnum);
|
|
|
|
|
fieldArr.add(inPatientNo);
|
|
|
|
|
fieldArr.add(visitId);
|
|
|
|
|
fieldArr.add(inJzh);
|
|
|
|
|
// 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"));
|
|
|
|
|
// String inPatientNo = String.valueOf(FileUtils.getJsonByName("inPatientNo"));
|
|
|
|
|
// String visitId = String.valueOf(FileUtils.getJsonByName("visitId"));
|
|
|
|
|
// String inJzh = String.valueOf(FileUtils.getJsonByName("jzh"));
|
|
|
|
|
//
|
|
|
|
|
// List<String> fieldArr = new ArrayList<>();
|
|
|
|
|
// fieldArr.add(indexFlag);
|
|
|
|
|
// fieldArr.add(serialnum);
|
|
|
|
|
// fieldArr.add(inPatientNo);
|
|
|
|
|
// fieldArr.add(visitId);
|
|
|
|
|
// fieldArr.add(inJzh);
|
|
|
|
|
//// 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();
|
|
|
|
|
// if (collectorid.equals("15")){
|
|
|
|
|
// reportDownPatientDto.setJzh(String.valueOf(map.get(inJzh)));
|
|
|
|
|
// }else {
|
|
|
|
|
// reportDownPatientDto.setInPatientNo(String.valueOf(map.get(inPatientNo)));
|
|
|
|
|
// reportDownPatientDto.setVisitId(String.valueOf(map.get(visitId)));
|
|
|
|
|
// }
|
|
|
|
|
// reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
|
// // reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
|
|
|
|
|
// 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.insertServer(reportDownDto);
|
|
|
|
|
// //String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
|
|
|
|
|
// String jzh = afCollectTaskService.getJzhByJzh(reportDownDto.getPatient().getJzh());
|
|
|
|
|
// if (null != jzh && !("").equals(jzh)) {
|
|
|
|
|
// reportDownPatientDto.setJzh(jzh);
|
|
|
|
|
// reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
|
// 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.getPatient().getJzh()+" 调用下载参数:--\n"+JSON.parseObject(JSON.toJSONString(reportDownDto)));
|
|
|
|
|
// if (String.valueOf(resMap.get("code")).equals("500")) {
|
|
|
|
|
// logger.info(reportDownDto.getPatient().getJzh()+" 下载失败!");
|
|
|
|
|
// throw new RuntimeException(String.valueOf(resMap.get("msg")));
|
|
|
|
|
// }else {
|
|
|
|
|
// logger.info(reportDownDto.getPatient().getJzh()+" 下载成功!");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// //打印错误日志
|
|
|
|
|
// logger.info(reportDownDto.getPatient().getJzh()+" 采集出错:" + reportDownDto +e.getMessage());
|
|
|
|
|
// // 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();
|
|
|
|
|
if (collectorid.equals("15")){
|
|
|
|
|
reportDownPatientDto.setJzh(String.valueOf(map.get(inJzh)));
|
|
|
|
|
}else {
|
|
|
|
|
reportDownPatientDto.setInPatientNo(String.valueOf(map.get(inPatientNo)));
|
|
|
|
|
reportDownPatientDto.setVisitId(String.valueOf(map.get(visitId)));
|
|
|
|
|
}
|
|
|
|
|
reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
|
// reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
|
|
|
|
|
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.insertServer(reportDownDto);
|
|
|
|
|
//String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
|
|
|
|
|
String jzh = afCollectTaskService.getJzhByJzh(reportDownDto.getPatient().getJzh());
|
|
|
|
|
if (null != jzh && !("").equals(jzh)) {
|
|
|
|
|
reportDownPatientDto.setJzh(jzh);
|
|
|
|
|
reportDownDto.setPatient(reportDownPatientDto);
|
|
|
|
|
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.getPatient().getJzh()+" 调用下载参数:--\n"+JSON.parseObject(JSON.toJSONString(reportDownDto)));
|
|
|
|
|
if (String.valueOf(resMap.get("code")).equals("500")) {
|
|
|
|
|
logger.info(reportDownDto.getPatient().getJzh()+" 下载失败!");
|
|
|
|
|
throw new RuntimeException(String.valueOf(resMap.get("msg")));
|
|
|
|
|
}else {
|
|
|
|
|
logger.info(reportDownDto.getPatient().getJzh()+" 下载成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
//打印错误日志
|
|
|
|
|
logger.info(reportDownDto.getPatient().getJzh()+" 采集出错:" + reportDownDto +e.getMessage());
|
|
|
|
|
// String stackTrace = ExceptionUtils.getStackTrace(e);
|
|
|
|
|
// logger.info("错误信息----------"+stackTrace);
|
|
|
|
|
addMrReportErrorLog(reportDownDto);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void timerCollect() {
|
|
|
|
@ -851,7 +855,6 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
List<Map> patientIds;
|
|
|
|
|
for (startrow = 0; ; startrow += 10) {
|
|
|
|
|
patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow);
|
|
|
|
|
|
|
|
|
|
if (null == patientIds || patientIds.size() <= 0) {
|
|
|
|
|
logger.info("未查询到按需采集患者!");
|
|
|
|
|
break;
|
|
|
|
|