From e3bcc934d4b390d21f3deffefdf158fab37c0889 Mon Sep 17 00:00:00 2001 From: tan <11033394+tanzr@user.noreply.gitee.com> Date: Thu, 30 Jun 2022 16:24:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E9=9C=80=E9=87=87=E9=9B=86=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dataConfig/homeQualitySet.json | 2 + .../com/docus/bgts/config/MyConstruct.java | 20 +- .../com/docus/bgts/config/MyScheduling.java | 80 +++--- .../mapper/dbmysql/AfCollectAddMapper.java | 2 +- .../docus/bgts/service/BgtsServiceImpl.java | 249 ++++++++++-------- src/main/resources/logback-spring.xml | 4 +- .../mapper/dbmysql/AfCollectAddMapper.xml | 2 +- .../mapper/dbmysql/AfCollectTaskMapper.xml | 2 +- 8 files changed, 195 insertions(+), 166 deletions(-) diff --git a/dataConfig/homeQualitySet.json b/dataConfig/homeQualitySet.json index 16785f9..abb59b1 100644 --- a/dataConfig/homeQualitySet.json +++ b/dataConfig/homeQualitySet.json @@ -11,6 +11,8 @@ "downurl":"WEB_ADDRESS", //分类id "assortid":"15E7FE7803F545CB81390BC88E725240", + //过滤报告单,多个用逗号隔开 + "filterReport":"病理送检标签,处方笺,麻醉处方精二-1,麻醉处方精二-2,术后镇痛", //系统id "collectorid":"14", //采集类型(文件来源 1:采集器;2:扫描生产软件) diff --git a/src/main/java/com/docus/bgts/config/MyConstruct.java b/src/main/java/com/docus/bgts/config/MyConstruct.java index 12ee26d..fa0b11f 100644 --- a/src/main/java/com/docus/bgts/config/MyConstruct.java +++ b/src/main/java/com/docus/bgts/config/MyConstruct.java @@ -17,6 +17,7 @@ public class MyConstruct { @Autowired IBgtsService bgtsService; + private Logger logger = LogManager.getLogger(MyConstruct.class); /** * 开启手麻全量采集 @@ -35,15 +36,16 @@ public class MyConstruct { /** * 开启重症全量采集 */ - @PostConstruct - public void startCollectAll(){ - String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); - String startCollectTime = String.valueOf(FileUtils.getJsonByName("startCollectTime")); - String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect")); - if(collectorid.equals(Codes.ZZCODE.getCode())&& StringUtils.isNotBlank(startCollectTime)&&isStartCollect!=null&&isStartCollect.equals("1")){ - bgtsService.collectAll(); - } - } +// @PostConstruct +// public void startCollectAll(){ +// logger.info("全量采集开始------"); +// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); +// String startCollectTime = String.valueOf(FileUtils.getJsonByName("startCollectTime")); +// String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect")); +// if(collectorid.equals(Codes.ZZCODE.getCode())&& StringUtils.isNotBlank(startCollectTime)&&isStartCollect!=null&&isStartCollect.equals("1")){ +// bgtsService.collectAll(); +// } +// } diff --git a/src/main/java/com/docus/bgts/config/MyScheduling.java b/src/main/java/com/docus/bgts/config/MyScheduling.java index bed86c5..ffd383b 100644 --- a/src/main/java/com/docus/bgts/config/MyScheduling.java +++ b/src/main/java/com/docus/bgts/config/MyScheduling.java @@ -3,6 +3,7 @@ package com.docus.bgts.config; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSON; import com.docus.bgts.entity.TableJsonRead; +import com.docus.bgts.enums.Codes; import com.docus.bgts.facade.IBgtsService; import com.docus.bgts.service.CheckIntegrityService; import com.docus.bgts.utils.FileUtils; @@ -29,9 +30,9 @@ public class MyScheduling { private final String tempDataFileName="collectTimeTemp"; private final String lastTimeStr="lastTime"; - static { - syncFlag=FileUtils.getJsonByName("syncFlag").toString(); - } +// static { +// syncFlag=FileUtils.getJsonByName("syncFlag").toString(); +// } @Autowired IBgtsService bgtsService; @@ -42,7 +43,7 @@ public class MyScheduling { private Logger logger = LogManager.getLogger(MyScheduling.class); //5分钟执行一次心跳 - /*@Scheduled(fixedRate = 1000 * 60 * 5) + @Scheduled(fixedRate = 1000 * 60 * 5) public void beat() { Map params = new HashMap<>(); params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid"))); @@ -52,7 +53,8 @@ public class MyScheduling { e.printStackTrace(); logger.info("心跳推送出错,可能是住院服务没有开启"); } - }*/ + } + /** @@ -62,10 +64,6 @@ public class MyScheduling { // @Scheduled(fixedRate = 1000 * 60 * 10) // public void collect() { // String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); -// String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect")); -// if (isStartCollect.equals("0")) { -// return; -// } // if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) { // return; // } @@ -74,9 +72,9 @@ public class MyScheduling { /** * 批量按需采集 - * 5分钟执行一次 + * 10分钟执行一次 */ - @Scheduled(fixedRate = 1000 * 5 ) + @Scheduled(fixedRate = 1000 * 60 *10 ) public void collectByExamNo(){ String collectOpen = String.valueOf(FileUtils.getJsonByName("collectOpen")); if (collectOpen.equals("1")){ @@ -91,42 +89,42 @@ public class MyScheduling { /** * 完整性校验 */ - @Scheduled(fixedRate = 1000 * 5 * 60) - public void syncIntegrality() { - if (null == syncFlag || "0".equals(syncFlag)) { - - } else { - //获取最后时间 - String lastDate = getLastDate(); - if(StringUtils.isNotBlank(lastDate)) { - Date date = new Date(); - boolean flag = checkIntegrityService.addSyncIntegrality(lastDate, null); - if(flag) { - refreshLastDate(date); - } - }else{ - logger.info("采集时间为空"); - } - } - } +// @Scheduled(fixedRate = 1000 * 5 * 60) +// public void syncIntegrality() { +// if (null == syncFlag || "0".equals(syncFlag)) { +// +// } else { +// //获取最后时间 +// String lastDate = getLastDate(); +// if(StringUtils.isNotBlank(lastDate)) { +// Date date = new Date(); +// boolean flag = checkIntegrityService.addSyncIntegrality(lastDate, null); +// if(flag) { +// refreshLastDate(date); +// } +// }else{ +// logger.info("采集时间为空"); +// } +// } +// } /** * 上次采集时间 * @return */ - private String getLastDate(){ - TableJsonRead tableJsonRead = new TableJsonRead(); - Map map = tableJsonRead.Read(tempfilePrefix, tempDataFileName,Map.class); - return map.get(lastTimeStr); - } +// private String getLastDate(){ +// TableJsonRead tableJsonRead = new TableJsonRead(); +// Map map = tableJsonRead.Read(tempfilePrefix, tempDataFileName,Map.class); +// return map.get(lastTimeStr); +// } /** * 刷新上次采集时间 */ - private void refreshLastDate(Date lastDate){ - String lastTime = DateUtil.format(lastDate, "yyyy-MM-dd HH:mm:ss"); - TableJsonRead tableJsonRead = new TableJsonRead(); - Map map = new HashMap<>(); - map.put(lastTimeStr, lastTime); - tableJsonRead.Save(tempfilePrefix, tempDataFileName, JSON.toJSONString(map)); - } +// private void refreshLastDate(Date lastDate){ +// String lastTime = DateUtil.format(lastDate, "yyyy-MM-dd HH:mm:ss"); +// TableJsonRead tableJsonRead = new TableJsonRead(); +// Map map = new HashMap<>(); +// map.put(lastTimeStr, lastTime); +// tableJsonRead.Save(tempfilePrefix, tempDataFileName, JSON.toJSONString(map)); +// } } diff --git a/src/main/java/com/docus/bgts/mapper/dbmysql/AfCollectAddMapper.java b/src/main/java/com/docus/bgts/mapper/dbmysql/AfCollectAddMapper.java index b744784..b65cc76 100644 --- a/src/main/java/com/docus/bgts/mapper/dbmysql/AfCollectAddMapper.java +++ b/src/main/java/com/docus/bgts/mapper/dbmysql/AfCollectAddMapper.java @@ -14,7 +14,7 @@ public interface AfCollectAddMapper extends BaseMapper { /** * 获取最新的采集时间 */ - Date getTimeByAdd(); + Date getTimeByAdd(Integer classIfy); /** * 获取jzh集合 diff --git a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java index b290cf6..d6e1053 100644 --- a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java +++ b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java @@ -70,7 +70,7 @@ public class BgtsServiceImpl implements IBgtsService { //插入文件af_collect_task表数据 afCollectTaskService.insert(reportDownDto); //通过报告单号集合采集 - collectExams(exams, empId,reportDownDto); + collectExams(exams, empId, reportDownDto); } @Override @@ -85,7 +85,7 @@ public class BgtsServiceImpl implements IBgtsService { exams.add(strings); //获取插入表数据 ReportDownDto reportDownDto = getUrlCreateReportDto(exams, empId); - collectExams(exams, empId,reportDownDto); + collectExams(exams, empId, reportDownDto); } @Override @@ -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条数据 @@ -128,10 +128,10 @@ public class BgtsServiceImpl implements IBgtsService { String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum")); String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle")); String downurl = String.valueOf(FileUtils.getJsonByName("downurl")); - List fieldArr=new ArrayList<>(); + List fieldArr = new ArrayList<>(); fieldArr.add(indexFlag); fieldArr.add(serialnum); - if(StringUtils.isNotBlank(filetitle)){ + if (StringUtils.isNotBlank(filetitle)) { fieldArr.add(filetitle); } fieldArr.add(downurl); @@ -142,16 +142,26 @@ public class BgtsServiceImpl implements IBgtsService { //2.获取第一页10条数据开始采集 for (current = 1; ; current++) { size = 10 * current; - maps = vDocumentPdfMapper.listCollectPage(size-10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName); - logger.info("处理采集数据:"+maps); + 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 -> { + 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); @@ -161,14 +171,15 @@ public class BgtsServiceImpl implements IBgtsService { 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())); + 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); @@ -177,105 +188,111 @@ public class BgtsServiceImpl implements IBgtsService { } } catch (Exception e) { //打印错误日志 - logger.info("采集出错:"+reportDownDto); + logger.info("采集出错:" + reportDownDto); logger.info(e); String stackTrace = ExceptionUtils.getStackTrace(e); - logger.info("错误信息----------"+stackTrace); + logger.info("错误信息----------" + stackTrace); 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 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 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 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 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 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 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 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 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); //当前日期 @@ -294,7 +311,7 @@ public class BgtsServiceImpl implements IBgtsService { String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); AfCollectAdd afCollectAdd = new AfCollectAdd(); afCollectAdd.setBeginStageDate(date); - afCollectAddMapper.update(afCollectAdd,new QueryWrapper().eq("classify",collectorid)); + afCollectAddMapper.update(afCollectAdd, new QueryWrapper().eq("classify", collectorid)); } /** @@ -317,7 +334,7 @@ public class BgtsServiceImpl implements IBgtsService { * @param exams * @param empId */ - private void collectExams(List exams, String empId,ReportDownDto reportDownDto) throws Exception { + private void collectExams(List exams, String empId, ReportDownDto reportDownDto) throws Exception { //调用上传接口 Map headMap = new HashMap<>(); headMap.put("Content-Type", "application/json"); @@ -369,16 +386,16 @@ public class BgtsServiceImpl implements IBgtsService { ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); reportDownScanFileDto.setSerialnum(exam[0]); reportDownScanFileDto.setFiletitle(exam[1]); - XmlUtils reqXmlUtils=new XmlUtils(FileUtils.getXmlDetailsPath()); + XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlDetailsPath()); Element esbEntry = reqXmlUtils.getMsgElement(); esbEntry.element("EXAM_NO").setText(exam[0]); String resXml = invokeWs(reqXmlUtils.getDocument().asXML()); - logger.info("明细入参------------"+reqXmlUtils.getDocument().asXML()); + logger.info("明细入参------------" + reqXmlUtils.getDocument().asXML()); //解析XML XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8"))); String success = xmlUtils.isSuccess(); - if(!success.equals("ok")){ - logger.info("发送错误:"+success); + if (!success.equals("ok")) { + logger.info("发送错误:" + success); throw new RuntimeException(success); } List dis = (List) FileUtils.getJsonByName("bgtsDetailRespon"); @@ -397,7 +414,7 @@ public class BgtsServiceImpl implements IBgtsService { private List getExamNo(String empId) throws Exception { List exams = new ArrayList<>(); - XmlUtils reqXmlUtils=new XmlUtils(FileUtils.getXmlPath()); + XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlPath()); Element reqElement = reqXmlUtils.getMsgElement(); reqElement.element("INHOSP_NO").setText(empId); logger.info("-------根据患者主索引号查询多个报告单号,地址:" + wsUrl + ",方法:" + wsLocalMethod + "---------"); @@ -412,8 +429,8 @@ public class BgtsServiceImpl implements IBgtsService { //解析XML XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8"))); String success = xmlUtils.isSuccess(); - if(!success.equals("ok")){ - logger.info("发送错误:"+success); + if (!success.equals("ok")) { + logger.info("发送错误:" + success); throw new RuntimeException(success); } List dis = (List) FileUtils.getJsonByName("bgtsRespon"); @@ -440,19 +457,20 @@ public class BgtsServiceImpl implements IBgtsService { /** * 根据时间批量按需采集 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param collectorId 采集器编号 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param collectorId 采集器编号 */ - public void collectByDate(String startDate,String endDate,String collectorId){ + public void collectByDate(String startDate, String endDate, String collectorId) { //通过日期查询patientId集合 - List patientIds = afCollectTaskService.getjzhByDate(startDate,endDate); + List patientIds = afCollectTaskService.getjzhByDate(startDate, endDate); //通过patientId集合与采集器编号查询报告单号 //List c1s = afCollectTaskService.getC1ByPatientId(patientIds, collectorId); //通过唯一报告单号查询patient_id //List patientIdByC1 = afCollectTaskService.getPatientIdByC1(c1s); //通过patientId集合查询jzh - List jzhs = afCollectTaskService.getJzhByPatientId(patientIds); + //List jzhs = afCollectTaskService.getJzhByPatientId(patientIds); //int i = -1; //循环jzh与报告单号c1调用按需采集 // for (String c1 : c1s) { @@ -470,10 +488,19 @@ public class BgtsServiceImpl implements IBgtsService { // } // } try { - for (String jzh : jzhs) { - collect(jzh); + for (String patientId : patientIds) { + if (patientId!=null){ + logger.info("按需采集------患者"+patientId); + collect(patientId); + } } - }catch (Exception e){ +// for (String jzh : jzhs) { +// if (jzh!=null) { +// logger.info("按需采集------患者"+jzh); +// collect(jzh); +// } +// } + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 1dd7dee..8d89969 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -44,7 +44,7 @@ - + \ No newline at end of file diff --git a/src/main/resources/mapper/dbmysql/AfCollectAddMapper.xml b/src/main/resources/mapper/dbmysql/AfCollectAddMapper.xml index 3ec60c5..ad1f222 100644 --- a/src/main/resources/mapper/dbmysql/AfCollectAddMapper.xml +++ b/src/main/resources/mapper/dbmysql/AfCollectAddMapper.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">