Commit c0a8f76403bdd6d66f2c2071e58759e14a7b54f8
1 parent
f8985f7816
Exists in
master
and in
6 other branches
数据同步
Showing 3 changed files with 29 additions and 11 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
c0a8f76
... | ... | @@ -2929,7 +2929,7 @@ |
2929 | 2929 | Connection connection = BookbuildingFacade.getConnection(); |
2930 | 2930 | String sql = "select * " + |
2931 | 2931 | "from V_SYNC_TO_V3_PDR pdr " + |
2932 | - "where pdr.PDR_CHILDBIRTHDAY > sysdate - 290 " + | |
2932 | + "where pdr.PDR_CHILDBIRTHDAY > sysdate - 29 " + | |
2933 | 2933 | "and to_char(pdr.PDR_CHILDBIRTHDAY,'YYYY-MM') BETWEEN '"+param.getStartTime()+ "' and '"+ param.getEndTime() +"'"; |
2934 | 2934 | List<MatDeliverAddRequest> list = new ArrayList<MatDeliverAddRequest>(1024); |
2935 | 2935 | try { |
... | ... | @@ -2971,7 +2971,7 @@ |
2971 | 2971 | String nbChildsex = resultSet.getString("NB_CHILDSEX"); |
2972 | 2972 | double nbChildweight = resultSet.getDouble("NB_CHILDWEIGHT"); |
2973 | 2973 | String nbLength = resultSet.getString("NB_LENGTH"); |
2974 | - baby.setDueTime(DateUtil.getymdhm(nbChildbirthday)); | |
2974 | + baby.setDueTime(DateUtil.getyyyy_MM_dd(nbChildbirthday)); | |
2975 | 2975 | |
2976 | 2976 | baby.setPregnancyOut(getPregnancyOutByV2(nbChantype)); |
2977 | 2977 | baby.setBabyGender(nbChildsex); |
... | ... | @@ -2990,7 +2990,7 @@ |
2990 | 2990 | // TODO 2019/6/9 14:54 dongqing 分娩医院 |
2991 | 2991 | matDeliverAddRequest.setFmHospital("216"); |
2992 | 2992 | // TODO 2019/6/9 14:55 dongqing 接生者 |
2993 | - matDeliverAddRequest.setDeliverDoctor(""); | |
2993 | + matDeliverAddRequest.setDeliverDoctor("1000000185"); | |
2994 | 2994 | matDeliverAddRequest.setDeliveryMode(new HashedMap()); |
2995 | 2995 | list.add(matDeliverAddRequest); |
2996 | 2996 | } |
... | ... | @@ -3022,7 +3022,10 @@ |
3022 | 3022 | }); |
3023 | 3023 | } |
3024 | 3024 | service.shutdown(); |
3025 | - return null; | |
3025 | + BaseResponse baseResponse = new BaseResponse(); | |
3026 | + baseResponse.setObject("当前同步数:" + list.size()); | |
3027 | + | |
3028 | + return baseResponse; | |
3026 | 3029 | } |
3027 | 3030 | |
3028 | 3031 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SaveByV2ThreadPoolFacade.java
View file @
c0a8f76
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | import org.slf4j.LoggerFactory; |
13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
14 | 14 | import org.springframework.beans.factory.annotation.Qualifier; |
15 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
15 | 16 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
16 | 17 | import org.springframework.stereotype.Component; |
17 | 18 | |
... | ... | @@ -34,6 +35,9 @@ |
34 | 35 | |
35 | 36 | @Autowired |
36 | 37 | BookbuildingFacade bookbuildingFacade; |
38 | + | |
39 | + @Autowired | |
40 | + private MongoTemplate mongoTemplate; | |
37 | 41 | /** |
38 | 42 | * 保存历史数据,根据时间和医院id |
39 | 43 | * |
... | ... | @@ -59,7 +63,7 @@ |
59 | 63 | if (end > lists.size()) { |
60 | 64 | end = lists.size(); |
61 | 65 | } |
62 | - Future f = commonThreadPool.submit(new SyncV2HistoryWorkerx(bookbuildingFacade, lists.subList(i, end))); | |
66 | + Future f = commonThreadPool.submit(new SyncV2HistoryWorkerx(bookbuildingFacade, lists.subList(i, end), mongoTemplate)); | |
63 | 67 | } |
64 | 68 | } |
65 | 69 | |
66 | 70 | |
... | ... | @@ -119,12 +123,12 @@ |
119 | 123 | String sql = "select " + str + " from " + |
120 | 124 | " (select p.* from V_SYNC_TO_V3_PATIENT p " + |
121 | 125 | " left join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + |
122 | - " where pdr.p_no is null and to_char(p.P_FILINGTIME,'YYY-MM') BETWEEN '" + startTime + "' and '" + endTime + "' and ( p.P_ADDRESSCOUNTY='160' OR p.P_POSTPARTUMCOUNTY='160' OR p.P_RRCOUNTY ='160')" + | |
123 | - " and p.P_LASTMENSTRUALPERIOD > sysdate - 294" + | |
126 | + " where pdr.p_no is null and to_char(p.P_FILINGTIME,'YYYY-MM') BETWEEN '" + startTime + "' and '" + endTime + "' and ( p.P_ADDRESSCOUNTY='160' OR p.P_POSTPARTUMCOUNTY='160' OR p.P_RRCOUNTY ='160')" + | |
127 | + " and p.P_LASTMENSTRUALPERIOD > sysdate - 2940" + | |
124 | 128 | " union " + |
125 | 129 | " select p.* from V_SYNC_TO_V3_PATIENT p " + |
126 | 130 | " right join V_SYNC_TO_V3_PDR pdr on pdr.p_no = p.p_no " + |
127 | - " where pdr.PDR_CHILDBIRTHDAY > sysdate - 290 and pdr.p_no is not null and to_char(pdr.PDR_CHILDBIRTHDAY,'YYYY-MM') BETWEEN '" + startTime + "' AND '" + endTime + "'" + | |
131 | + " where pdr.PDR_CHILDBIRTHDAY > sysdate - 29 and pdr.p_no is not null and to_char(pdr.PDR_CHILDBIRTHDAY,'YYYY-MM') BETWEEN '" + startTime + "' AND '" + endTime + "'" + | |
128 | 132 | ") t"; |
129 | 133 | return sql; |
130 | 134 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/SyncV2HistoryWorkerx.java
View file @
c0a8f76
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | import com.lyms.platform.biz.service.PostReviewService; |
6 | 6 | import com.lyms.platform.common.enums.YnEnums; |
7 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
8 | +import com.lyms.platform.common.utils.DateUtil; | |
8 | 9 | import com.lyms.platform.common.utils.ExceptionUtils; |
9 | 10 | import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; |
10 | 11 | import com.lyms.platform.operate.web.facade.BookbuildingFacade; |
... | ... | @@ -18,6 +19,9 @@ |
18 | 19 | import com.lyms.platform.query.PostReviewQuery; |
19 | 20 | import org.apache.commons.collections.CollectionUtils; |
20 | 21 | import org.springframework.data.domain.Sort; |
22 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
23 | +import org.springframework.data.mongodb.core.query.Criteria; | |
24 | +import org.springframework.data.mongodb.core.query.Query; | |
21 | 25 | |
22 | 26 | import java.util.Date; |
23 | 27 | import java.util.List; |
24 | 28 | |
25 | 29 | |
26 | 30 | |
... | ... | @@ -35,20 +39,27 @@ |
35 | 39 | |
36 | 40 | private List<SyncV2HistoryRequest> lists; |
37 | 41 | |
38 | - public SyncV2HistoryWorkerx(BookbuildingFacade bookbuildingFacade, List<SyncV2HistoryRequest> lists) { | |
42 | + private MongoTemplate mongoTemplate; | |
43 | + | |
44 | + public SyncV2HistoryWorkerx(BookbuildingFacade bookbuildingFacade, List<SyncV2HistoryRequest> lists, MongoTemplate mongoTemplate) { | |
39 | 45 | this.bookbuildingFacade = bookbuildingFacade; |
40 | 46 | this.lists = lists; |
47 | + this.mongoTemplate = mongoTemplate; | |
41 | 48 | } |
42 | 49 | |
43 | 50 | @Override |
44 | 51 | public BaseObjectResponse call() throws Exception { |
45 | 52 | BaseObjectResponse p=null; |
46 | 53 | for (YunBookbuildingAddRequest list : lists) { |
54 | + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("cardNo").is(list.getPregnantCertificateNum())), Patients.class); | |
55 | + if (patients != null) { | |
56 | + continue; | |
57 | + } | |
47 | 58 | //董勤让写死的 |
48 | 59 | list.setHospitalId("216");//todo |
49 | 60 | list.setBookbuildingDoctor("1000000185");//todo |
50 | - | |
51 | - p = bookbuildingFacade.addPregnantBookbuilding(list, null, false); | |
61 | + list.setBookbuildingDate(DateUtil.getyyyy_MM_dd(new Date())); | |
62 | + p = bookbuildingFacade.addPregnantBookbuilding(list, null, false); | |
52 | 63 | System.out.println("当前线程名称:"+Thread.currentThread().getName()+"===保存好建档_id:"+p.getData()); |
53 | 64 | } |
54 | 65 | return p; |