From 78140b91365f46e198a53ada75a815208d7a1286 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Thu, 11 Jan 2024 11:24:45 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E9=87=8D=E5=86=99=E6=96=B9=E6=B3=95=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E6=B7=BB=E5=8A=A0=E5=92=8C=E9=87=8D=E5=86=99=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/docus/bgts/facade/IBgtsService.java | 6 +- .../docus/bgts/service/BgtsServiceImpl.java | 258 +++++++++--------- 2 files changed, 130 insertions(+), 134 deletions(-) diff --git a/src/main/java/com/docus/bgts/facade/IBgtsService.java b/src/main/java/com/docus/bgts/facade/IBgtsService.java index cac83c0..b5a17e6 100644 --- a/src/main/java/com/docus/bgts/facade/IBgtsService.java +++ b/src/main/java/com/docus/bgts/facade/IBgtsService.java @@ -29,8 +29,10 @@ public interface IBgtsService { /** * 根据时间批量按需采集 - * @param startDate - * @param endDate + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param collectorId 采集器编号 */ void collectByDate(String startDate,String endDate,String collectorId); diff --git a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java index 88f27d9..5d2befd 100644 --- a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java +++ b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java @@ -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 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 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 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;