Commit 47abd1a5dfa045079e973dcfa7820ef3f93425d9
1 parent
30e345ff6d
Exists in
master
and in
6 other branches
建档历史数据初始化2.0到3.0线程池方式
Showing 4 changed files with 116 additions and 206 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SaveByV2ThreadPoolFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
View file @
47abd1a
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | import com.lyms.platform.common.utils.StringUtils; |
| 13 | 13 | import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; |
| 14 | 14 | import com.lyms.platform.operate.web.facade.BookbuildingFacade; |
| 15 | +import com.lyms.platform.operate.web.facade.SaveByV2ThreadPoolFacade; | |
| 15 | 16 | import com.lyms.platform.operate.web.request.*; |
| 16 | 17 | import net.sf.json.JSONObject; |
| 17 | 18 | import org.apache.commons.httpclient.HttpClient; |
| ... | ... | @@ -42,6 +43,8 @@ |
| 42 | 43 | @Autowired |
| 43 | 44 | private AntenatalExaminationFacade antenatalExaminationFacade; |
| 44 | 45 | |
| 46 | + @Autowired | |
| 47 | + private SaveByV2ThreadPoolFacade saveByV2ThreadPoolFacade; | |
| 45 | 48 | |
| 46 | 49 | /** |
| 47 | 50 | * 查询孕妇是否有建档记录 有就返回patientid |
| ... | ... | @@ -146,7 +149,7 @@ |
| 146 | 149 | @RequestMapping(method = RequestMethod.POST, value = "/v2/history/batchSave") |
| 147 | 150 | @ResponseBody |
| 148 | 151 | public BaseResponse saveByV2(@RequestBody SyncV2HistoryRequest param) { |
| 149 | - return bookbuildingFacade.saveByV2(param); | |
| 152 | + return saveByV2ThreadPoolFacade.saveByV2(param); | |
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
47abd1a
| ... | ... | @@ -2368,108 +2368,6 @@ |
| 2368 | 2368 | return param; |
| 2369 | 2369 | } |
| 2370 | 2370 | |
| 2371 | - /** | |
| 2372 | - * 保存历史数据,根据时间和医院id | |
| 2373 | - * | |
| 2374 | - * @param param 请求参数 | |
| 2375 | - * @return BaseResponse | |
| 2376 | - */ | |
| 2377 | - public BaseResponse saveByV2(SyncV2HistoryRequest param) { | |
| 2378 | - //获取2.0历史建档数据 | |
| 2379 | - String startTime = param.getStartTime(); | |
| 2380 | - String endTime = param.getEndTime(); | |
| 2381 | - Connection connection = null; | |
| 2382 | - try { | |
| 2383 | - connection = getConnection(); | |
| 2384 | - String sql = getSqlString(startTime, endTime); | |
| 2385 | - QueryRunner queryRunner = new QueryRunner(true); | |
| 2386 | - List<SyncV2HistoryRequest> lists = queryRunner.query(connection, sql, new BeanListHandler<SyncV2HistoryRequest>(SyncV2HistoryRequest.class)); | |
| 2387 | - // TODO 2019/6/5 15:39 dongqing 分批次请求保存 | |
| 2388 | - | |
| 2389 | - for (YunBookbuildingAddRequest list : lists) { | |
| 2390 | - list.setHospitalId("216216"); | |
| 2391 | - list.setBookbuildingDoctor("1000000185"); | |
| 2392 | - System.out.println("建档孕妇身份证号cardNo=="+list.getPregnantCertificateNum()); | |
| 2393 | - addPregnantBookbuilding(list, null, false);//Integer.parseInt(list.getBookbuildingDoctor() | |
| 2394 | - } | |
| 2395 | - | |
| 2396 | -// if (CollectionUtils.isNotEmpty(lists)) { | |
| 2397 | -// int batchSize = 2; | |
| 2398 | -// int end = 0; | |
| 2399 | -// for (int i = 0; i < lists.size(); i += batchSize) { | |
| 2400 | -// end = (end + batchSize); | |
| 2401 | -// if (end > lists.size()) { | |
| 2402 | -// end = lists.size(); | |
| 2403 | -// } | |
| 2404 | -// Future f = commonThreadPool.submit(new SyncV2HistoryWorkerx(new BookbuildingFacade(), lists.subList(i, end))); | |
| 2405 | -// } | |
| 2406 | -// } | |
| 2407 | - | |
| 2408 | - } catch (Exception e) { | |
| 2409 | - logger.info(e.getMessage()); | |
| 2410 | - return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg("系统异常"); | |
| 2411 | - } finally { | |
| 2412 | - if (connection != null) { | |
| 2413 | - try { | |
| 2414 | - connection.close(); | |
| 2415 | - } catch (SQLException e) { | |
| 2416 | - e.printStackTrace(); | |
| 2417 | - } | |
| 2418 | - } | |
| 2419 | - } | |
| 2420 | - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 2421 | - | |
| 2422 | - } | |
| 2423 | - | |
| 2424 | - private String getSqlString(String startTime, String endTime) { | |
| 2425 | - String str = "t.P_CARDTYPE as pregnantCertificateTypeId," +//证件类型 | |
| 2426 | - "t.P_ADDRESSPROVINCE as pregnantCensusProvinceId," +//居住地-省 | |
| 2427 | - "t.P_ADDRESSCITY as pregnantCensusCityId," +//居住地 -城市 | |
| 2428 | - "t.P_ADDRESSCOUNTY as pregnantCensusAreaId," +//居住地区 | |
| 2429 | - "t.P_ADDRESSSTREET as pregnantCensusStreetId," +//居住地 -街道 | |
| 2430 | - "t.P_COUNTRY as pregnantCountryId," +//国籍 | |
| 2431 | - "t.P_HUSBANDCOUNTRY as husbandCountryId," +//丈夫国籍 | |
| 2432 | - "t.P_HUSBANDCARDTYPE as husbandCertificateTypeId," +//丈夫证件类型 | |
| 2433 | - "t.P_NATION as pregnantNationId," +//民族 | |
| 2434 | - "t.P_HUSBANDNATION as husbandNationId," +//丈夫民族 | |
| 2435 | - "t.P_DOCID as bookbuildingDoctor," +//建档医生 | |
| 2436 | - "t.P_CARDNO as pregnantCertificateNum," +//证件号 | |
| 2437 | - "t.P_CARDNO as pregnantNationId," +// 孕妇民族 | |
| 2438 | - "t.P_CARDNO as pregnantPhone," +// 孕妇手机号 | |
| 2439 | - "t.P_RRPROVINCE as pregnantLiveProvinceId," +//户口——省 | |
| 2440 | - "t.P_RRCITY as pregnantLiveCityId," +//户口——市 | |
| 2441 | - "t.P_RRCOUNTY as pregnantLiveAreaId," +//户口——区县 | |
| 2442 | - "t.P_RRSTREET as pregnantLiveStreetId," +//户口——街道 | |
| 2443 | - "t.P_POSTPARTUMPROVINCE as childbirthProvinceId," +//产后——省 | |
| 2444 | - "t.P_POSTPARTUMCITY as childbirthCityId," +//产后——市 | |
| 2445 | - "t.P_POSTPARTUMCOUNTY as childbirthAreaId," +//产后——区县 | |
| 2446 | - "t.P_POSTPARTUMSTREET as childbirthStreetId," +//产后——街道 | |
| 2447 | - "t.P_HUSBANDNAME as husbandName," +//丈夫姓名 | |
| 2448 | - "t.P_HUSBANDCARDNO as husbandCertificateNum," +//丈夫证件号码 | |
| 2449 | - "t.P_HUSBANDBIRTHDAY as husbandBirth," +//丈夫出生日期 | |
| 2450 | - "t.P_HUSBANDRRPROVINCE as husbandProvinceRegisterId," +//丈夫户口所在地 省 | |
| 2451 | - "t.P_HUSBANDRRCITY as husbandCityRegisterId," +//丈夫户口所在地 市 | |
| 2452 | - "t.P_HUSBANDRRCOUNTY as husbandAreaRegisterId," +//丈夫户口所在地 县 | |
| 2453 | - "t.P_HUSBANDRRSTREET as husbandStreetRegisterId," +//丈夫户口所在地 街道 | |
| 2454 | - "t.VC_CARDNO as vcCardNo, " +//就诊卡号 条码号 | |
| 2455 | - "t.P_BIRTHDAY as birthday, " +//孕妇生日 | |
| 2456 | - "t.P_LASTMENSTRUALPERIOD as lastMenstrualPeriod," +//末次月经 | |
| 2457 | - "t.YCQ as dueDate," +//预产期 | |
| 2458 | - "t.P_FILINGTIME as bookbuildingDate," +//建档日期 | |
| 2459 | - "t.P_HOSPITALID as hospitalId ";//医院Id | |
| 2460 | - | |
| 2461 | - String sql = "select " + str + " from " + | |
| 2462 | - " (select p.* from V_SYNC_TO_V3_PATIENT p " + | |
| 2463 | - " left join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + | |
| 2464 | - " where pdr.p_no is null and (TRUNC(p.P_FILINGTIME) BETWEEN TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD')) and ( p.P_ADDRESSCOUNTY='160' OR p.P_POSTPARTUMCOUNTY='160' OR p.P_RRCOUNTY ='160')" + | |
| 2465 | - " union " + | |
| 2466 | - " select p.* from V_SYNC_TO_V3_PATIENT p " + | |
| 2467 | - " right join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + | |
| 2468 | - " where pdr.PDR_CHILDBIRTHDAY > sysdate - 29 and pdr.p_no is not null and to_char(pdr.PDR_CHILDBIRTHDAY,'YYYY-MM-DD') BETWEEN TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD')" + | |
| 2469 | - ") t"; | |
| 2470 | - return sql; | |
| 2471 | - } | |
| 2472 | - | |
| 2473 | 2371 | /* |
| 2474 | 2372 | WHERE TRUNC(T.P_FILINGTIME) between TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD') " + |
| 2475 | 2373 | "and pdr.p_no is null " + |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SaveByV2ThreadPoolFacade.java
View file @
47abd1a
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 3 | 4 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 5 | +import com.lyms.platform.common.result.BaseResponse; | |
| 4 | 6 | import com.lyms.platform.operate.web.request.SyncV2HistoryRequest; |
| 7 | +import com.lyms.platform.operate.web.worker.SyncV2HistoryWorkerx; | |
| 8 | +import org.apache.commons.collections.CollectionUtils; | |
| 9 | +import org.apache.commons.dbutils.QueryRunner; | |
| 10 | +import org.apache.commons.dbutils.handlers.BeanListHandler; | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 5 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 15 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 6 | 16 | import org.springframework.stereotype.Component; |
| 7 | 17 | |
| 18 | +import java.sql.Connection; | |
| 19 | +import java.sql.SQLException; | |
| 8 | 20 | import java.util.List; |
| 9 | 21 | import java.util.concurrent.CountDownLatch; |
| 10 | 22 | import java.util.concurrent.ExecutorService; |
| 11 | 23 | import java.util.concurrent.Executors; |
| 24 | +import java.util.concurrent.Future; | |
| 12 | 25 | |
| 13 | 26 | @Component |
| 14 | 27 | public class SaveByV2ThreadPoolFacade { |
| 15 | 28 | |
| 29 | + private Logger logger = LoggerFactory.getLogger(BookbuildingFacade.class); | |
| 30 | + | |
| 16 | 31 | @Autowired |
| 17 | - private BookbuildingFacade bookbuildingFacade; | |
| 32 | + @Qualifier("commonThreadPool") | |
| 33 | + private ThreadPoolTaskExecutor commonThreadPool; | |
| 18 | 34 | |
| 19 | - public void exec(List<SyncV2HistoryRequest> list) throws InterruptedException { | |
| 20 | - //初始化线程处理500条数据 | |
| 21 | - int count = 500; | |
| 22 | - int listSize = list.size(); | |
| 23 | - int runSize = (listSize / count) + 1; | |
| 24 | - //线程数最大设置10个 | |
| 25 | - if (runSize>10){ | |
| 26 | - runSize=10; | |
| 27 | - count= listSize/runSize; | |
| 28 | - } | |
| 29 | - List<SyncV2HistoryRequest> newlist = null; | |
| 30 | - //创建一个线程池,数量和开启线程的数量一样 | |
| 31 | - ExecutorService executor = Executors.newFixedThreadPool(runSize); | |
| 32 | - CountDownLatch begin = new CountDownLatch(1); | |
| 33 | - CountDownLatch end = new CountDownLatch(runSize); | |
| 34 | - for (int i = 0; i < runSize; i++) { | |
| 35 | - //计算每个线程执行的数据 | |
| 36 | - if ((i + 1) == runSize) { | |
| 37 | - int startIndex = (i * count); | |
| 38 | - int endIndex = list.size(); | |
| 39 | - newlist = list.subList(startIndex, endIndex); | |
| 40 | - } else { | |
| 41 | - int startIndex = (i * count); | |
| 42 | - int endIndex = (i + 1) * count; | |
| 43 | - newlist = list.subList(startIndex, endIndex); | |
| 44 | - } | |
| 45 | - MyThread mythead = new MyThread(newlist, begin, end,bookbuildingFacade); | |
| 46 | - MyThread2 mythead2 = new MyThread2(bookbuildingFacade, newlist, begin, end); | |
| 47 | - executor.execute(mythead2); | |
| 48 | -// executor.execute(mythead); | |
| 49 | - } | |
| 35 | + @Autowired | |
| 36 | + BookbuildingFacade bookbuildingFacade; | |
| 37 | + /** | |
| 38 | + * 保存历史数据,根据时间和医院id | |
| 39 | + * | |
| 40 | + * @param param 请求参数 | |
| 41 | + * @return BaseResponse | |
| 42 | + */ | |
| 43 | + public BaseResponse saveByV2(SyncV2HistoryRequest param) { | |
| 44 | + //获取2.0历史建档数据 | |
| 45 | + String startTime = param.getStartTime(); | |
| 46 | + String endTime = param.getEndTime(); | |
| 47 | + Connection connection = null; | |
| 48 | + try { | |
| 49 | + connection = bookbuildingFacade.getConnection(); | |
| 50 | + String sql = getSqlString(startTime, endTime); | |
| 51 | + QueryRunner queryRunner = new QueryRunner(true); | |
| 52 | + List<SyncV2HistoryRequest> lists = queryRunner.query(connection, sql, new BeanListHandler<SyncV2HistoryRequest>(SyncV2HistoryRequest.class)); | |
| 53 | + // TODO 2019/6/5 15:39 dongqing 分批次请求保存 | |
| 50 | 54 | |
| 51 | - begin.countDown(); | |
| 52 | - end.await(); | |
| 53 | - executor.shutdown(); | |
| 54 | - } | |
| 55 | +// for (YunBookbuildingAddRequest list : lists) { | |
| 56 | +// list.setHospitalId("216216"); | |
| 57 | +// list.setBookbuildingDoctor("1000000185"); | |
| 58 | +// System.out.println("建档孕妇身份证号cardNo=="+list.getPregnantCertificateNum()); | |
| 59 | +// addPregnantBookbuilding(list, null, false);//Integer.parseInt(list.getBookbuildingDoctor() | |
| 60 | +// } | |
| 55 | 61 | |
| 56 | -} | |
| 57 | - | |
| 58 | -class MyThread implements Runnable { | |
| 59 | - private BookbuildingFacade bookbuildingFacade; | |
| 60 | - private List<SyncV2HistoryRequest> list; | |
| 61 | - private CountDownLatch begin; | |
| 62 | - private CountDownLatch end; | |
| 63 | - | |
| 64 | - public MyThread(List<SyncV2HistoryRequest> list, CountDownLatch begin, CountDownLatch end,BookbuildingFacade bookbuildingFacade) { | |
| 65 | - this.list = list; | |
| 66 | - this.begin = begin; | |
| 67 | - this.end = end; | |
| 68 | - this.bookbuildingFacade = bookbuildingFacade; | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Override | |
| 72 | - public void run() { | |
| 73 | - try { | |
| 74 | - for (int i = 0; i < list.size(); i++) { | |
| 75 | - /* | |
| 76 | - 2: 具体插入实现在这里写 | |
| 77 | - */ | |
| 78 | - BaseObjectResponse p = bookbuildingFacade.addPregnantBookbuilding(list.get(i), null, false);//Integer.parseInt(list.getBookbuildingDoctor() | |
| 79 | - System.out.println(p.getData()); | |
| 80 | - System.out.println("当前线程名称:"+Thread.currentThread().getName()+"======存储的数据内容:"+p.getData() | |
| 81 | - ); | |
| 62 | + if (CollectionUtils.isNotEmpty(lists)) { | |
| 63 | + int batchSize = 2; | |
| 64 | + int end = 0; | |
| 65 | + for (int i = 0; i < lists.size(); i += batchSize) { | |
| 66 | + end = (end + batchSize); | |
| 67 | + if (end > lists.size()) { | |
| 68 | + end = lists.size(); | |
| 69 | + } | |
| 70 | + Future f = commonThreadPool.submit(new SyncV2HistoryWorkerx(bookbuildingFacade, lists.subList(i, end))); | |
| 71 | + } | |
| 82 | 72 | } |
| 83 | - //执行完让线程直接进入等待 | |
| 84 | - begin.await(); | |
| 85 | - } catch (InterruptedException e) { | |
| 86 | - e.printStackTrace(); | |
| 73 | + | |
| 74 | + } catch (Exception e) { | |
| 75 | + logger.info(e.getMessage()); | |
| 76 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg("系统异常"); | |
| 87 | 77 | } finally { |
| 88 | - end.countDown(); | |
| 78 | + if (connection != null) { | |
| 79 | + try { | |
| 80 | + connection.close(); | |
| 81 | + } catch (SQLException e) { | |
| 82 | + e.printStackTrace(); | |
| 83 | + } | |
| 84 | + } | |
| 89 | 85 | } |
| 90 | - } | |
| 86 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 91 | 87 | |
| 92 | - | |
| 93 | -} | |
| 94 | -class MyThread2 implements Runnable { | |
| 95 | - private BookbuildingFacade bookbuildingFacade; | |
| 96 | - private List<SyncV2HistoryRequest> list; | |
| 97 | - private CountDownLatch begin; | |
| 98 | - private CountDownLatch end; | |
| 99 | - | |
| 100 | - public MyThread2(BookbuildingFacade bookbuildingFacade, List<SyncV2HistoryRequest> list, CountDownLatch begin, CountDownLatch end) { | |
| 101 | - this.bookbuildingFacade = bookbuildingFacade; | |
| 102 | - this.list = list; | |
| 103 | - this.begin = begin; | |
| 104 | - this.end = end; | |
| 105 | 88 | } |
| 106 | 89 | |
| 107 | - @Override | |
| 108 | - public void run() { | |
| 109 | - System.out.println("123456"); | |
| 90 | + private String getSqlString(String startTime, String endTime) { | |
| 91 | + String str = "t.P_CARDTYPE as pregnantCertificateTypeId," +//证件类型 | |
| 92 | + "t.P_ADDRESSPROVINCE as pregnantCensusProvinceId," +//居住地-省 | |
| 93 | + "t.P_ADDRESSCITY as pregnantCensusCityId," +//居住地 -城市 | |
| 94 | + "t.P_ADDRESSCOUNTY as pregnantCensusAreaId," +//居住地区 | |
| 95 | + "t.P_ADDRESSSTREET as pregnantCensusStreetId," +//居住地 -街道 | |
| 96 | + "t.P_COUNTRY as pregnantCountryId," +//国籍 | |
| 97 | + "t.P_HUSBANDCOUNTRY as husbandCountryId," +//丈夫国籍 | |
| 98 | + "t.P_HUSBANDCARDTYPE as husbandCertificateTypeId," +//丈夫证件类型 | |
| 99 | + "t.P_NATION as pregnantNationId," +//民族 | |
| 100 | + "t.P_HUSBANDNATION as husbandNationId," +//丈夫民族 | |
| 101 | + "t.P_DOCID as bookbuildingDoctor," +//建档医生 | |
| 102 | + "t.P_CARDNO as pregnantCertificateNum," +//证件号 | |
| 103 | + "t.P_CARDNO as pregnantNationId," +// 孕妇民族 | |
| 104 | + "t.P_CARDNO as pregnantPhone," +// 孕妇手机号 | |
| 105 | + "t.P_RRPROVINCE as pregnantLiveProvinceId," +//户口——省 | |
| 106 | + "t.P_RRCITY as pregnantLiveCityId," +//户口——市 | |
| 107 | + "t.P_RRCOUNTY as pregnantLiveAreaId," +//户口——区县 | |
| 108 | + "t.P_RRSTREET as pregnantLiveStreetId," +//户口——街道 | |
| 109 | + "t.P_POSTPARTUMPROVINCE as childbirthProvinceId," +//产后——省 | |
| 110 | + "t.P_POSTPARTUMCITY as childbirthCityId," +//产后——市 | |
| 111 | + "t.P_POSTPARTUMCOUNTY as childbirthAreaId," +//产后——区县 | |
| 112 | + "t.P_POSTPARTUMSTREET as childbirthStreetId," +//产后——街道 | |
| 113 | + "t.P_HUSBANDNAME as husbandName," +//丈夫姓名 | |
| 114 | + "t.P_HUSBANDCARDNO as husbandCertificateNum," +//丈夫证件号码 | |
| 115 | + "t.P_HUSBANDBIRTHDAY as husbandBirth," +//丈夫出生日期 | |
| 116 | + "t.P_HUSBANDRRPROVINCE as husbandProvinceRegisterId," +//丈夫户口所在地 省 | |
| 117 | + "t.P_HUSBANDRRCITY as husbandCityRegisterId," +//丈夫户口所在地 市 | |
| 118 | + "t.P_HUSBANDRRCOUNTY as husbandAreaRegisterId," +//丈夫户口所在地 县 | |
| 119 | + "t.P_HUSBANDRRSTREET as husbandStreetRegisterId," +//丈夫户口所在地 街道 | |
| 120 | + "t.VC_CARDNO as vcCardNo, " +//就诊卡号 条码号 | |
| 121 | + "t.P_BIRTHDAY as birthday, " +//孕妇生日 | |
| 122 | + "t.P_LASTMENSTRUALPERIOD as lastMenstrualPeriod," +//末次月经 | |
| 123 | + "t.YCQ as dueDate," +//预产期 | |
| 124 | + "t.P_FILINGTIME as bookbuildingDate," +//建档日期 | |
| 125 | + "t.P_HOSPITALID as hospitalId ";//医院Id | |
| 110 | 126 | |
| 111 | - try { | |
| 112 | - for (int i = 0; i < list.size(); i++) { | |
| 113 | - /* | |
| 114 | - 2: 具体插入实现在这里写 | |
| 115 | - */ | |
| 116 | - BaseObjectResponse p = bookbuildingFacade.addPregnantBookbuilding(list.get(i), null, false);//Integer.parseInt(list.getBookbuildingDoctor() | |
| 117 | - System.out.println(p.getData()); | |
| 118 | - System.out.println("当前线程名称:"+Thread.currentThread().getName()+"======存储的数据内容:"+p.getData() | |
| 119 | - ); | |
| 120 | - } | |
| 121 | - //执行完让线程直接进入等待 | |
| 122 | - begin.await(); | |
| 123 | - } catch (InterruptedException e) { | |
| 124 | - e.printStackTrace(); | |
| 125 | - } finally { | |
| 126 | - end.countDown(); | |
| 127 | - } | |
| 127 | + String sql = "select " + str + " from " + | |
| 128 | + " (select p.* from V_SYNC_TO_V3_PATIENT p " + | |
| 129 | + " left join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + | |
| 130 | + " where pdr.p_no is null and (TRUNC(p.P_FILINGTIME) BETWEEN TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD')) and ( p.P_ADDRESSCOUNTY='160' OR p.P_POSTPARTUMCOUNTY='160' OR p.P_RRCOUNTY ='160')" + | |
| 131 | + " union " + | |
| 132 | + " select p.* from V_SYNC_TO_V3_PATIENT p " + | |
| 133 | + " right join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + | |
| 134 | + " where pdr.PDR_CHILDBIRTHDAY > sysdate - 29 and pdr.p_no is not null and to_char(pdr.PDR_CHILDBIRTHDAY,'YYYY-MM-DD') BETWEEN TO_DATE('" + startTime + "','YYYY-MM-DD') AND TO_DATE('" + endTime + "','YYYY-MM-DD')" + | |
| 135 | + ") t"; | |
| 136 | + return sql; | |
| 128 | 137 | } |
| 129 | 138 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java
View file @
47abd1a
| ... | ... | @@ -47,8 +47,8 @@ |
| 47 | 47 | //董勤让写死的 |
| 48 | 48 | list.setHospitalId("216216"); |
| 49 | 49 | list.setBookbuildingDoctor("1000000185"); |
| 50 | - System.out.println("建档孕妇身份证号=="+list.getPregnantCertificateNum()); | |
| 51 | - p = bookbuildingFacade.addPregnantBookbuilding(list, null, false);//Integer.parseInt(list.getBookbuildingDoctor() | |
| 50 | + p = bookbuildingFacade.addPregnantBookbuilding(list, null, false); | |
| 51 | + System.out.println("当前线程名称:"+Thread.currentThread().getName()+"===保存好建档_id:"+p.getData()); | |
| 52 | 52 | } |
| 53 | 53 | return p; |
| 54 | 54 | } |