Commit 95b71f0cc763b613217a9a334918d3fa61441721

Authored by liquanyu
1 parent 78cf6e3569

code update

Showing 2 changed files with 28 additions and 13 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java View file @ 95b71f0
... ... @@ -176,7 +176,7 @@
176 176 }
177 177  
178 178  
179   - public static void syncPatientData(String hospitalId)
  179 + public static void syncPatientData(String hospitalId,MongoTemplate mongoTemplate)
180 180 {
181 181  
182 182 int num = 1;
... ... @@ -186,7 +186,7 @@
186 186 "(select replace(mp.P_NO,'-','') as PID,mp.*,p_birthday,p_name,floor((trunc(sysdate) - trunc(mp.P_LASTMENSTRUALPERIOD)+1) /7) as weeks from MOMMY_PATIENT mp left join Plat_Patient pp" +
187 187 " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '" + hospitalId + "') A WHERE ROWNUM < "+(num+20)+" and weeks < 42) WHERE RN >= "+num+" ");
188 188 num=num+20;
189   - MongoTemplate mongoTemplate = getMongoTemplate();
  189 +// MongoTemplate mongoTemplate = getMongoTemplate();
190 190  
191 191 for (Map<String, Object> map : list) {
192 192 Patients patients = new Patients();
... ... @@ -896,7 +896,7 @@
896 896 return dat1a;
897 897 }
898 898  
899   - public static void syncBabyData(String hospitalId) {
  899 + public static void syncBabyData(String hospitalId,MongoTemplate mongoTemplate) {
900 900  
901 901 int num = 1;
902 902  
... ... @@ -910,7 +910,7 @@
910 910 " A WHERE ROWNUM < "+(num+20)+" ) WHERE RN >= "+num+" ");
911 911  
912 912 num = num+20;
913   - MongoTemplate mongoTemplate = getMongoTemplate();
  913 +// MongoTemplate mongoTemplate = getMongoTemplate();
914 914  
915 915 for (Map<String, Object> map : list) {
916 916  
917 917  
... ... @@ -1398,10 +1398,10 @@
1398 1398 }
1399 1399 }
1400 1400  
1401   - public static void syncData(String hid)
  1401 + public void syncData(String hid,MongoTemplate mongoTemplate)
1402 1402 {
1403   - syncBabyData(hid);
1404   - syncPatientData(hid);
  1403 + syncBabyData(hid,mongoTemplate);
  1404 + syncPatientData(hid,mongoTemplate);
1405 1405 }
1406 1406  
1407 1407 public static void main(String[] args)
... ... @@ -1415,8 +1415,8 @@
1415 1415 // System.out.print(list);
1416 1416 // DBCollection conn = template.getCollection("lyms_patient_test");
1417 1417 // conn.up
1418   - syncBabyData("62");
1419   - syncPatientData("62");
  1418 +// syncBabyData("62");
  1419 +// syncPatientData("62");
1420 1420 }
1421 1421 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 95b71f0
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3 import com.lyms.platform.operate.web.utils.JdbcUtil;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.data.mongodb.core.MongoTemplate;
4 6 import org.springframework.stereotype.Controller;
5 7 import org.springframework.web.bind.annotation.RequestMapping;
6 8 import org.springframework.web.bind.annotation.RequestMethod;
... ... @@ -19,6 +21,9 @@
19 21 @Controller
20 22 public class TestController {
21 23  
  24 +
  25 + @Autowired
  26 + private MongoTemplate mongoTemplate;
22 27 /**
23 28 * 获取科室
24 29 */
... ... @@ -91,10 +96,20 @@
91 96  
92 97  
93 98 @RequestMapping(value = "/syncData", method = RequestMethod.GET)
94   - public void syncData( @RequestParam(required = true) String hid) {
95   - System.out.print("同步开始>>>>>>>>>>>>>>>>>>>>>>>>>");
96   - com.lyms.platform.biz.JdbcUtil.syncData(hid);
97   - System.out.print("同步结束>>>>>>>>>>>>>>>>>>>>>>>>>");
  99 + public void syncData( @RequestParam(required = true) final String hid) {
  100 +
  101 + final MongoTemplate template = mongoTemplate;
  102 +
  103 + new Thread(new Runnable() {
  104 + @Override
  105 + public void run() {
  106 + System.out.print("同步开始>>>>>>>>>>>>>>>>>>>>>>>>>");
  107 + new com.lyms.platform.biz.JdbcUtil().syncData(hid, template);
  108 + System.out.print("同步结束>>>>>>>>>>>>>>>>>>>>>>>>>");
  109 + }
  110 + }).start();
  111 +
  112 +
98 113 }
99 114 }