Commit de6fb0f3e0a92e7fe96a127d6d7f886f3d0ce948

Authored by liquanyu
1 parent 14981a1b59

code update

Showing 2 changed files with 348 additions and 403 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/JdbcUtil.java View file @ de6fb0f
1 1 package com.lyms.platform.biz;
2 2  
  3 +import com.google.common.io.LittleEndianDataInputStream;
3 4 import com.lyms.platform.common.dao.operator.MongoCondition;
4 5 import com.lyms.platform.common.dao.operator.MongoOper;
5 6 import com.lyms.platform.common.dao.operator.MongoQuery;
6 7  
... ... @@ -30,12 +31,12 @@
30 31 */
31 32 public class JdbcUtil {
32 33  
33   - private static List<Map<String,String>> employees = new ArrayList<>();
34   - private static List<Map<String,String>> oracleHosps = new ArrayList<>();
  34 + private static Map<String,String> employees = new HashMap<>();
  35 + private static Map<String,String> oracleHosps = new HashMap<>();
35 36 private static List<Map<String,String>> users = new ArrayList<>();
36 37 private static List<Map<String,String>> mysqlHosps = new ArrayList<>();
37   - private static List<Map<String,String>> datacontents = new ArrayList<>();
38   - private static List<Map<String,String>> basicConfigs = new ArrayList<>();
  38 + private static Map<String,String> datacontents = new HashMap<>();
  39 + private static Map<String,String> basicConfigs = new HashMap<>();
39 40  
40 41  
41 42  
... ... @@ -44,10 +45,7 @@
44 45 List<Map<String,Object>> listEmp = getListDataBySql("select e.e_name,e.e_id from mommy_employee e");
45 46 for(Map<String,Object> map : listEmp)
46 47 {
47   - Map<String,String> emap = new HashMap<>();
48   - emap.put("id",getString(map.get("E_ID")));
49   - emap.put("name",getString(map.get("E_NAME")));
50   - employees.add(emap);
  48 + employees.put(getString(map.get("E_ID")), getString(map.get("E_NAME")));
51 49 }
52 50  
53 51 System.out.println("employees------"+employees.size());
54 52  
55 53  
56 54  
... ... @@ -56,25 +54,20 @@
56 54 List<Map<String,Object>> datacontentsList = getListDataBySql("select dc_name,dc_id from plat_datacontent ");
57 55 for(Map<String,Object> map : datacontentsList)
58 56 {
59   - Map<String,String> data = new HashMap<>();
60   - data.put("id",getString(map.get("DC_ID")));
61   - data.put("name",getString(map.get("DC_NAME")));
62   - datacontents.add(data);
  57 + datacontents.put(getString(map.get("DC_ID")), getString(map.get("DC_NAME")));
63 58 }
64 59  
65 60 System.out.println("datacontents------"+datacontents.size());
  61 +
66 62 List<Map<String,Object>> orcleHospsList = getListDataBySql("select h_name,h_id from plat_hospital h");
67 63 for(Map<String,Object> map : orcleHospsList)
68 64 {
69   - Map<String,String> data = new HashMap<>();
70   - data.put("id",getString(map.get("H_ID")));
71   - data.put("name",getString(map.get("H_NAME")));
72   - oracleHosps.add(data);
  65 + oracleHosps.put(getString(map.get("H_ID")), getString(map.get("H_NAME")));
73 66 }
74 67  
75 68 System.out.println("oracleHosps------"+oracleHosps.size());
76 69  
77   - List<Map<String,Object>> usersList = getMysqlListDataBySql("select id,name from users");
  70 + List<Map<String,Object>> usersList = getMysqlListDataBySql("select id,name from users where org_id = 216 ");
78 71 for(Map<String,Object> map : usersList)
79 72 {
80 73 Map<String,String> data = new HashMap<>();
... ... @@ -84,7 +77,7 @@
84 77 }
85 78 System.out.println("users------"+users.size());
86 79  
87   - List<Map<String,Object>> mysqlHospsList = getMysqlListDataBySql("select id,name from organization");
  80 + List<Map<String,Object>> mysqlHospsList = getMysqlListDataBySql("select id,name from organization ");
88 81 for(Map<String,Object> map : mysqlHospsList)
89 82 {
90 83 Map<String,String> data = new HashMap<>();
... ... @@ -97,11 +90,7 @@
97 90 List<Map<String,Object>> oracleBasicList = getListDataBySql("select id,name,parentId from lyms_basicconfig ");
98 91 for(Map<String,Object> map : oracleBasicList)
99 92 {
100   - Map<String,String> data = new HashMap<>();
101   - data.put("id",getString(map.get("ID")));
102   - data.put("name",getString(map.get("NAME")));
103   - data.put("parentId",getString(map.get("PARENTID")));
104   - basicConfigs.add(data);
  93 + basicConfigs.put(getString(map.get("NAME"))+getString(map.get("PARENTID")),getString(map.get("ID")));
105 94 }
106 95  
107 96 System.out.println("basicConfigs------"+basicConfigs.size());
108 97  
109 98  
... ... @@ -111,33 +100,21 @@
111 100  
112 101 public static String getDataContentByById(String id)
113 102 {
114   - for (Map<String,String> map : datacontents)
115   - {
116   - if (StringUtils.isNotEmpty(map.get("id")) && map.get("id").equals(map.get(id)))
117   - {
118   - return map.get("name");
119   - }
120   - }
121   - return null;
  103 + return datacontents.get(id);
  104 +
122 105 }
123 106  
124 107  
125 108 public static String getPatHosptalById(String id)
126 109 {
127   - for (Map<String,String> map : oracleHosps)
128   - {
129   - if (StringUtils.isNotEmpty(map.get("id")) && map.get("id").equals(map.get(id)))
130   - {
131   - return map.get("name");
132   - }
133   - }
134   - return null;
  110 + return oracleHosps.get(id);
  111 +
135 112 }
136 113  
137 114  
138 115 public static String getOrgIdByName(String name)
139 116 {
140   - for (Map<String,String> map : oracleHosps)
  117 + for (Map<String,String> map : mysqlHosps)
141 118 {
142 119 if (StringUtils.isNotEmpty(map.get("name")) && map.get("name").equals(map.get(name)))
143 120 {
144 121  
... ... @@ -148,20 +125,13 @@
148 125 }
149 126 public static String getEmpNameById(String id)
150 127 {
151   - for (Map<String,String> map : oracleHosps)
152   - {
153   - if (StringUtils.isNotEmpty(map.get("id")) && map.get("id").equals(map.get(id)))
154   - {
155   - return map.get("name");
156   - }
157   - }
158   - return null;
  128 + return employees.get(id);
159 129 }
160 130  
161 131  
162 132 public static String getUserIdByName(String name)
163 133 {
164   - for (Map<String,String> map : oracleHosps)
  134 + for (Map<String,String> map : users)
165 135 {
166 136 if (StringUtils.isNotEmpty(map.get("name")) && map.get("name").equals(map.get(name)))
167 137 {
168 138  
... ... @@ -169,16 +139,11 @@
169 139 }
170 140 }
171 141 return null;
172   - } public static String getBasicConfigByNameAndParentId(String name,String parentId)
  142 + }
  143 + public static String getBasicConfigByNameAndParentId(String name,String parentId)
173 144 {
174   - for (Map<String,String> map : basicConfigs)
175   - {
176   - if (StringUtils.isNotEmpty(map.get("parentId")) && StringUtils.isNotEmpty(map.get("name")) && map.get("name").equals(map.get(name)) && map.get("parentId").equals(parentId))
177   - {
178   - return map.get("id");
179   - }
180   - }
181   - return null;
  145 + return basicConfigs.get(name+parentId);
  146 +
182 147 }
183 148  
184 149 public static Connection getOracleConnection() {
185 150  
186 151  
187 152  
188 153  
189 154  
190 155  
191 156  
192 157  
193 158  
194 159  
195 160  
196 161  
197 162  
198 163  
199 164  
200 165  
201 166  
202 167  
203 168  
204 169  
205 170  
206 171  
207 172  
208 173  
209 174  
210 175  
211 176  
212 177  
213 178  
214 179  
215 180  
216 181  
217 182  
218 183  
219 184  
220 185  
221 186  
222 187  
223 188  
224 189  
225 190  
226 191  
227 192  
228 193  
229 194  
230 195  
231 196  
232 197  
233 198  
234 199  
235 200  
236 201  
237 202  
238 203  
239 204  
240 205  
241 206  
242 207  
243 208  
244 209  
245 210  
246 211  
247 212  
... ... @@ -363,364 +328,384 @@
363 328 }
364 329  
365 330  
366   - public static void syncPatientData(String hospitalId,MongoTemplate mongoTemplate,int start,int end)
367   - {
  331 + private static class Worker extends Thread{
368 332  
369   -// String sql = " SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " +
370   -// "(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" +
371   -// " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '" + hospitalId + "' order by mp.p_lastmenstrualperiod desc ) A WHERE ROWNUM <= "+end+" ) WHERE RN >= "+start;
372 333  
373   - String sql = "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" +
374   - " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '" + hospitalId + "' order by mp.p_lastmenstrualperiod desc " ;
375   - List<Map<String, Object>> list = getListDataBySql(sql);
376   - System.out.println(list.size()+"---------------------------------");
377   - System.out.println(sql);
  334 + private List<Map<String, Object>> list;
  335 + MongoTemplate mongoTemplate;
  336 + public Worker(List<Map<String, Object>> list,MongoTemplate mongoTemplate){
  337 + this.list = list;
  338 + this.mongoTemplate = mongoTemplate;
  339 + }
  340 + @Override
  341 + public void run() {
378 342 for (Map<String, Object> map : list) {
379 343 try {
380 344  
381   - Patients patients = new Patients();
382   - PersonModel person = new PersonModel();
383   - int type = 1;
384   - Integer weeks = getInteger(map.get("WEEKS"));
385   - List<Map<String, Object>> chanList = null;
386   - if (StringUtils.isNotEmpty(getString(map.get("P_ID")))) {
387   - chanList = getListDataBySql("select * from MOMMY_PREGDELIVERYRECORD p where p.pdr_patientid = '" + getString(map.get("p_id")) + "' order by p.PDR_CHILDBIRTHDAY desc ");
388   - }
389   - if (weeks != null && weeks >= 42 || CollectionUtils.isNotEmpty(chanList)) {
390   - Date fmDate = null;
391   - if (CollectionUtils.isNotEmpty(chanList)) {
392   - fmDate = getDate(chanList.get(0).get("PDR_CHILDBIRTHDAY"));
393   - } else {
394   - fmDate = DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7);
  345 + Patients patients = new Patients();
  346 + PersonModel person = new PersonModel();
  347 + int type = 1;
  348 + Integer weeks = getInteger(map.get("WEEKS"));
  349 + List<Map<String, Object>> chanList = null;
  350 + if (StringUtils.isNotEmpty(getString(map.get("P_ID")))) {
  351 + chanList = getListDataBySql("select * from MOMMY_PREGDELIVERYRECORD p where p.pdr_patientid = '" + getString(map.get("p_id")) + "' order by p.PDR_CHILDBIRTHDAY desc ");
395 352 }
396   - patients.setFmDate(fmDate);
  353 + if (weeks != null && weeks >= 42 || CollectionUtils.isNotEmpty(chanList)) {
  354 + Date fmDate = null;
  355 + if (CollectionUtils.isNotEmpty(chanList)) {
  356 + fmDate = getDate(chanList.get(0).get("PDR_CHILDBIRTHDAY"));
  357 + } else {
  358 + fmDate = DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7);
  359 + }
  360 + patients.setFmDate(fmDate);
397 361  
398   - type = 3;
399   - }
400   - if (map.get("P_LASTMENSTRUALPERIOD")== null || "".equals(map.get("P_LASTMENSTRUALPERIOD")))
401   - {
402   - continue;
403   - }
  362 + type = 3;
  363 + }
  364 + if (map.get("P_LASTMENSTRUALPERIOD") == null || "".equals(map.get("P_LASTMENSTRUALPERIOD"))) {
  365 + continue;
  366 + }
404 367  
405   - patients.setDueDate(DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7));
406   - person.setCreated(new Date());
  368 + patients.setDueDate(DateUtil.addDay(getDate(map.get("P_LASTMENSTRUALPERIOD")), 42 * 7));
  369 + person.setCreated(new Date());
407 370  
408 371  
409   - person.setType(type);
410   - person.setYn(YnEnums.YES.getId());
411   - person.setBirth(getDate(map.get("P_BIRTHDAY")));
412   - person.setCardNo(getString(map.get("P_CARDNO")));
413   - person.setName(getString(map.get("P_NAME")));
414   - person.setPhone(getString(map.get("P_MOBILEPHONE")));
415   - person.setCreated(getDate(map.get("P_FILINGTIME")));
416   - person.setModified(getDate(map.get("P_OPERTIME")));
417   - mongoTemplate.save(person);
  372 + person.setType(type);
  373 + person.setYn(YnEnums.YES.getId());
  374 + person.setBirth(getDate(map.get("P_BIRTHDAY")));
  375 + person.setCardNo(getString(map.get("P_CARDNO")));
  376 + person.setName(getString(map.get("P_NAME")));
  377 + person.setPhone(getString(map.get("P_MOBILEPHONE")));
  378 + person.setCreated(getDate(map.get("P_FILINGTIME")));
  379 + person.setModified(getDate(map.get("P_OPERTIME")));
  380 + mongoTemplate.save(person);
418 381  
419 382  
420   - patients.setPid(person.getId());
421   - patients.setId(String.valueOf(map.get("PID")));
422   - patients.setYn(getInteger(map.get("P_ISVALID"))); //是否有效
423   - patients.setBuildType(0);
424   - patients.setBirth(getDate(map.get("P_BIRTHDAY")));
425   - patients.setCreated(getDate(map.get("P_FILINGTIME")));
426   - patients.setModified(getDate(map.get("P_OPERTIME")));
427   - patients.setDueStatus(0);
  383 + patients.setPid(person.getId());
  384 + patients.setId(String.valueOf(map.get("PID")));
  385 + patients.setYn(getInteger(map.get("P_ISVALID"))); //是否有效
  386 + patients.setBuildType(0);
  387 + patients.setBirth(getDate(map.get("P_BIRTHDAY")));
  388 + patients.setCreated(getDate(map.get("P_FILINGTIME")));
  389 + patients.setModified(getDate(map.get("P_OPERTIME")));
  390 + patients.setDueStatus(0);
428 391  
429   - if (StringUtils.isNotEmpty(getString(map.get("P_CARDNO")))) {
430   - String cardType = getString(map.get("P_CARDTYPE")); //证件类型
431   - String cardTypeName = getDataContentByById(cardType);
432   - //String cardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + cardType + "'"));
433   - if (cardTypeName != null && !"".equals(cardTypeName)) {
434   - String id = getMongoBasicConfig(cardTypeName, SystemConfig.CERTE_TYPE_ID);
435   - patients.setPcerteTypeId(id);
  392 + if (StringUtils.isNotEmpty(getString(map.get("P_CARDNO")))) {
  393 + String cardType = getString(map.get("P_CARDTYPE")); //证件类型
  394 + String cardTypeName = getDataContentByById(cardType);
  395 + //String cardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + cardType + "'"));
  396 + if (cardTypeName != null && !"".equals(cardTypeName)) {
  397 + String id = getMongoBasicConfig(cardTypeName, SystemConfig.CERTE_TYPE_ID);
  398 + patients.setPcerteTypeId(id);
  399 + }
  400 +
  401 + patients.setCardNo(getString(map.get("P_CARDNO"))); //证件号码
  402 + } else {
  403 + patients.setCardNo(getString(map.get("P_MOBILEPHONE"))); //证件号码
  404 + patients.setPcerteTypeId("57e0a21c0cf209b410a82cda");
436 405 }
437 406  
438   - patients.setCardNo(getString(map.get("P_CARDNO"))); //证件号码
439   - } else {
440   - patients.setCardNo(getString(map.get("P_MOBILEPHONE"))); //证件号码
441   - patients.setPcerteTypeId("57e0a21c0cf209b410a82cda");
442   - }
  407 + //---------------------居住地址
  408 + String proviceId = getString(map.get("P_ADDRESSPROVINCE"));
  409 + if (proviceId != null && !"".equals(proviceId)) {
  410 + String juzhudiProviceName = getOracleBasicConfig(proviceId);
  411 + String id1 = getMongoBasicConfig(juzhudiProviceName, SystemConfig.CHINA_BASIC_ID);
  412 + patients.setProvinceId(id1); //居住地省
443 413  
444   - //---------------------居住地址
445   - String proviceId = getString(map.get("P_ADDRESSPROVINCE"));
446   - if (proviceId != null && !"".equals(proviceId)) {
447   - String juzhudiProviceName = getOracleBasicConfig(proviceId);
448   - String id1 = getMongoBasicConfig(juzhudiProviceName, SystemConfig.CHINA_BASIC_ID);
449   - patients.setProvinceId(id1); //居住地省
  414 + String cityId = getString(map.get("P_ADDRESSCITY"));
  415 + if (cityId != null && !"".equals(cityId)) {
  416 + String juzhudiCityName = getOracleBasicConfig(cityId);
  417 + String id2 = getMongoBasicConfig(juzhudiCityName, id1);
  418 + patients.setCityId(id2); //居住地市
  419 + String areaId = getString(getString(map.get("P_ADDRESSCOUNTY")));
  420 + if (areaId != null && !"".equals(areaId)) {
  421 + String juzhudiAreaName = getOracleBasicConfig(areaId);
  422 + String id3 = getMongoBasicConfig(juzhudiAreaName, id2);
  423 + patients.setAreaId(id3); //居住区
450 424  
451   - String cityId = getString(map.get("P_ADDRESSCITY"));
452   - if (cityId != null && !"".equals(cityId)) {
453   - String juzhudiCityName = getOracleBasicConfig(cityId);
454   - String id2 = getMongoBasicConfig(juzhudiCityName, id1);
455   - patients.setCityId(id2); //居住地市
456   - String areaId = getString(getString(map.get("P_ADDRESSCOUNTY")));
457   - if (areaId != null && !"".equals(areaId)) {
458   - String juzhudiAreaName = getOracleBasicConfig(areaId);
459   - String id3 = getMongoBasicConfig(juzhudiAreaName, id2);
460   - patients.setAreaId(id3); //居住区
461   -
462   - String streetId = getString(map.get("P_TOWNSHIP"));
463   - if (streetId != null && !"".equals(streetId)) {
464   - String juzhudiStreetName = getOracleBasicConfig(streetId);
465   - String id4 = getMongoBasicConfig(juzhudiStreetName, id3);
466   - patients.setStreetId(id4); //街道 镇
  425 + String streetId = getString(map.get("P_TOWNSHIP"));
  426 + if (streetId != null && !"".equals(streetId)) {
  427 + String juzhudiStreetName = getOracleBasicConfig(streetId);
  428 + String id4 = getMongoBasicConfig(juzhudiStreetName, id3);
  429 + patients.setStreetId(id4); //街道 镇
  430 + }
467 431 }
468 432 }
469 433 }
470   - }
471 434  
472   - patients.setAddress(getString(map.get("P_ADDRESSSTREET"))); // 详细地址
  435 + patients.setAddress(getString(map.get("P_ADDRESSSTREET"))); // 详细地址
473 436  
474   - //---------------------居住地址
  437 + //---------------------居住地址
475 438  
476   - String pprofessionTypeId = getString(map.get("P_OCCUPATIONID"));
477   - if (pprofessionTypeId != null && !"".equals(pprofessionTypeId)) {
478   - String pprofessionTypeName = getOracleBasicConfig(pprofessionTypeId);
479   - String id = getMongoBasicConfig(pprofessionTypeName, SystemConfig.PROFESSION_TYPE_ID);
480   - patients.setPprofessionTypeId(id); // 职业
481   - }
  439 + String pprofessionTypeId = getString(map.get("P_OCCUPATIONID"));
  440 + if (pprofessionTypeId != null && !"".equals(pprofessionTypeId)) {
  441 + String pprofessionTypeName = getOracleBasicConfig(pprofessionTypeId);
  442 + String id = getMongoBasicConfig(pprofessionTypeName, SystemConfig.PROFESSION_TYPE_ID);
  443 + patients.setPprofessionTypeId(id); // 职业
  444 + }
482 445  
483   - patients.setPhone(getString(map.get("P_MOBILEPHONE"))); //孕妇手机号码
484   - patients.setUsername(getString(map.get("P_NAME"))); //孕妇姓名
485   - patients.setBookbuildingDate(getDate(map.get("P_FILINGTIME"))); //建档日期
486   - patients.setLastMenses(getDate(map.get("P_LASTMENSTRUALPERIOD"))); //末次月经
  446 + patients.setPhone(getString(map.get("P_MOBILEPHONE"))); //孕妇手机号码
  447 + patients.setUsername(getString(map.get("P_NAME"))); //孕妇姓名
  448 + patients.setBookbuildingDate(getDate(map.get("P_FILINGTIME"))); //建档日期
  449 + patients.setLastMenses(getDate(map.get("P_LASTMENSTRUALPERIOD"))); //末次月经
487 450  
488   - String buildHospitalId = getString(map.get("P_HOSPITALID")); //医院ID
  451 + String buildHospitalId = getString(map.get("P_HOSPITALID")); //医院ID
489 452  
490 453  
491   - Integer P_RESIDETYPE = getInteger(map.get("P_RESIDETYPE")); //居住类别
492   - if (P_RESIDETYPE != null && P_RESIDETYPE == 0) {
493   - patients.setPliveTypeId("57624bf90cf23d4631523e9e");
494   - } else if (P_RESIDETYPE != null && (P_RESIDETYPE == 1 || P_RESIDETYPE == 2)) {
495   - patients.setPliveTypeId("57624c090cf23d4631523e9f");
496   - }
  454 + Integer P_RESIDETYPE = getInteger(map.get("P_RESIDETYPE")); //居住类别
  455 + if (P_RESIDETYPE != null && P_RESIDETYPE == 0) {
  456 + patients.setPliveTypeId("57624bf90cf23d4631523e9e");
  457 + } else if (P_RESIDETYPE != null && (P_RESIDETYPE == 1 || P_RESIDETYPE == 2)) {
  458 + patients.setPliveTypeId("57624c090cf23d4631523e9f");
  459 + }
497 460  
498 461  
499   - Integer P_ACCOUNTTYPE = getInteger(map.get("P_ACCOUNTTYPE")); //户口类别
500   - if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 0) {
501   - patients.setPliveTypeId("57624c440cf23d4631523ea1");
502   - } else if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 1) {
503   - patients.setPliveTypeId("57624c5e0cf23d4631523ea2");
504   - }
  462 + Integer P_ACCOUNTTYPE = getInteger(map.get("P_ACCOUNTTYPE")); //户口类别
  463 + if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 0) {
  464 + patients.setPliveTypeId("57624c440cf23d4631523ea1");
  465 + } else if (P_ACCOUNTTYPE != null && P_ACCOUNTTYPE == 1) {
  466 + patients.setPliveTypeId("57624c5e0cf23d4631523ea2");
  467 + }
505 468  
506   - if (buildHospitalId != null && !"".equals(buildHospitalId)) {
507   - //String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + buildHospitalId + "'"));
508   - String hname = getPatHosptalById(buildHospitalId);
509   - // String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
510   - String id = getOrgIdByName(hname);
511   - patients.setHospitalId(id);
512   - }
  469 + if (buildHospitalId != null && !"".equals(buildHospitalId)) {
  470 + //String hname = getString(getOralceSingleObjBySql("select h_name from plat_hospital h where h.h_isvalid=1 and h_id = '" + buildHospitalId + "'"));
  471 + String hname = getPatHosptalById(buildHospitalId);
  472 + // String id = getString(getMysqlSingleObjBySql("select id from organization where name = '" + hname + "'"));
  473 + String id = getOrgIdByName(hname);
  474 + patients.setHospitalId(id);
  475 + }
513 476  
514   - patients.setType(type); //患者类型
  477 + patients.setType(type); //患者类型
515 478  
516   - String doctorId = getString(map.get("P_FILINGOPER"));
517   - if (doctorId != null && !"".equals(doctorId)) {
518   - //String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'"));
519   - String userName = getEmpNameById(doctorId);
520   - //String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'"));
521   - String id = getUserIdByName(userName);
522   - patients.setBookbuildingDoctor(id); //建档医生(创建者)
523   - }
  479 + String doctorId = getString(map.get("P_FILINGOPER"));
  480 + if (doctorId != null && !"".equals(doctorId)) {
  481 + //String hname = getString(getOralceSingleObjBySql("select e.e_name from mommy_employee e where e.e_id = '" + doctorId + "'"));
  482 + String userName = getEmpNameById(doctorId);
  483 + //String id = getString(getMysqlSingleObjBySql("select id from users where name = '" + hname + "'"));
  484 + String id = getUserIdByName(userName);
  485 + patients.setBookbuildingDoctor(id); //建档医生(创建者)
  486 + }
524 487  
525   - Integer isvip = getInteger(map.get("P_ISVIP")); //vip
526   - if (isvip != null) {
527   - //会员状态 0不是会员 1 是
528   - if (0 == isvip) {
529   - patients.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId());
530   - patients.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId());
531   - } else if (1 == isvip) {
532   - patients.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId());
533   - patients.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId());
  488 + Integer isvip = getInteger(map.get("P_ISVIP")); //vip
  489 + if (isvip != null) {
  490 + //会员状态 0不是会员 1 是
  491 + if (0 == isvip) {
  492 + patients.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId());
  493 + patients.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId());
  494 + } else if (1 == isvip) {
  495 + patients.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId());
  496 + patients.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId());
  497 + }
534 498 }
535   - }
536 499  
537 500  
538   - String plevel = getString(map.get("P_EDUCATIONLEVEL"));//孕妇文化程度
539   - if (plevel != null && !"".equals(plevel)) {
540   - String plevelName = getOracleBasicConfig(plevel);
541   - String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID);
542   - patients.setPlevelTypeId(id);
543   - }
  501 + String plevel = getString(map.get("P_EDUCATIONLEVEL"));//孕妇文化程度
  502 + if (plevel != null && !"".equals(plevel)) {
  503 + String plevelName = getOracleBasicConfig(plevel);
  504 + String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID);
  505 + patients.setPlevelTypeId(id);
  506 + }
544 507  
545 508  
546   - String guoJi = getString(map.get("P_COUNTRY"));//孕妇国籍
547   - if (guoJi != null && !"".equals(guoJi)) {
548   - String guoJiName = getOracleBasicConfig(guoJi);
549   - String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID);
550   - patients.setPcountryId(id);
551   - }
  509 + String guoJi = getString(map.get("P_COUNTRY"));//孕妇国籍
  510 + if (guoJi != null && !"".equals(guoJi)) {
  511 + String guoJiName = getOracleBasicConfig(guoJi);
  512 + String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID);
  513 + patients.setPcountryId(id);
  514 + }
552 515  
553   - patients.setPworkUnit(getString(map.get("P_UNITWORK")));//孕妇工作单位
  516 + patients.setPworkUnit(getString(map.get("P_UNITWORK")));//孕妇工作单位
554 517  
555   - String pnation = getString(map.get("P_NATION"));
556   - if (pnation != null && !"".equals(pnation)) {
557   - String pnationName = getOracleBasicConfig(pnation);
558   - String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID);
559   - patients.setPnationId(id);
560   - }
  518 + String pnation = getString(map.get("P_NATION"));
  519 + if (pnation != null && !"".equals(pnation)) {
  520 + String pnationName = getOracleBasicConfig(pnation);
  521 + String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID);
  522 + patients.setPnationId(id);
  523 + }
561 524  
562   - //---------------------户口地址
563   - String huKouproviceId = getString(map.get("P_RRPROVINCE"));
564   - if (huKouproviceId != null && !"".equals(huKouproviceId)) {
565   - String proviceName = getOracleBasicConfig(huKouproviceId);
566   - String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID);
567   - patients.setProvinceRegisterId(id1); //户口地省
  525 + //---------------------户口地址
  526 + String huKouproviceId = getString(map.get("P_RRPROVINCE"));
  527 + if (huKouproviceId != null && !"".equals(huKouproviceId)) {
  528 + String proviceName = getOracleBasicConfig(huKouproviceId);
  529 + String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID);
  530 + patients.setProvinceRegisterId(id1); //户口地省
568 531  
569   - String huKoucityId = getString(map.get("P_RRCITY"));
570   - if (huKoucityId != null && !"".equals(huKoucityId)) {
571   - String cityName = getOracleBasicConfig(huKoucityId);
572   - String id2 = getMongoBasicConfig(cityName, id1);
573   - patients.setCityRegisterId(id2); //户口地市
  532 + String huKoucityId = getString(map.get("P_RRCITY"));
  533 + if (huKoucityId != null && !"".equals(huKoucityId)) {
  534 + String cityName = getOracleBasicConfig(huKoucityId);
  535 + String id2 = getMongoBasicConfig(cityName, id1);
  536 + patients.setCityRegisterId(id2); //户口地市
574 537  
575   - String huKouareaId = getString(getString(map.get("P_RRCOUNTY")));
576   - if (huKouareaId != null && !"".equals(huKouareaId)) {
577   - String areaName = getOracleBasicConfig(huKouareaId);
578   - String id3 = getMongoBasicConfig(areaName, id2);
579   - patients.setAreaRegisterId(id3); //户口居住区
  538 + String huKouareaId = getString(getString(map.get("P_RRCOUNTY")));
  539 + if (huKouareaId != null && !"".equals(huKouareaId)) {
  540 + String areaName = getOracleBasicConfig(huKouareaId);
  541 + String id3 = getMongoBasicConfig(areaName, id2);
  542 + patients.setAreaRegisterId(id3); //户口居住区
580 543  
581   - String huKoustreetId = getString(map.get("P_RRTOWNSHIP"));
582   - if (huKoustreetId != null && !"".equals(huKoustreetId)) {
583   - String streetName = getOracleBasicConfig(huKoustreetId);
584   - String id4 = getMongoBasicConfig(streetName, id3);
585   - patients.setStreetRegisterId(id4); //户口街道 镇
  544 + String huKoustreetId = getString(map.get("P_RRTOWNSHIP"));
  545 + if (huKoustreetId != null && !"".equals(huKoustreetId)) {
  546 + String streetName = getOracleBasicConfig(huKoustreetId);
  547 + String id4 = getMongoBasicConfig(streetName, id3);
  548 + patients.setStreetRegisterId(id4); //户口街道 镇
586 549  
  550 + }
587 551 }
588   - }
589 552  
  553 + }
590 554 }
591   - }
592   - patients.setAddressRegister(getString(map.get("P_RRSTREET"))); // 详细地址
  555 + patients.setAddressRegister(getString(map.get("P_RRSTREET"))); // 详细地址
593 556  
594   - //---------------------户口地址
  557 + //---------------------户口地址
595 558  
596   - //----------------------产后修养地
  559 + //----------------------产后修养地
597 560  
598   - String chanHouproviceId = getString(map.get("P_POSTPARTUMPROVINCE"));
599   - if (chanHouproviceId != null && !"".equals(chanHouproviceId)) {
600   - String proviceName = getOracleBasicConfig(chanHouproviceId);
601   - String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID);
602   - patients.setProvincePostRestId(id1);
  561 + String chanHouproviceId = getString(map.get("P_POSTPARTUMPROVINCE"));
  562 + if (chanHouproviceId != null && !"".equals(chanHouproviceId)) {
  563 + String proviceName = getOracleBasicConfig(chanHouproviceId);
  564 + String id1 = getMongoBasicConfig(proviceName, SystemConfig.LIVE_TYPE_ID);
  565 + patients.setProvincePostRestId(id1);
603 566  
604   - String chanhoucityId = getString(map.get("P_POSTPARTUMCITY"));
605   - if (chanhoucityId != null && !"".equals(chanhoucityId)) {
606   - String cityName = getOracleBasicConfig(chanhoucityId);
607   - String id2 = getMongoBasicConfig(cityName, id1);
608   - patients.setCityPostRestId(id2);
  567 + String chanhoucityId = getString(map.get("P_POSTPARTUMCITY"));
  568 + if (chanhoucityId != null && !"".equals(chanhoucityId)) {
  569 + String cityName = getOracleBasicConfig(chanhoucityId);
  570 + String id2 = getMongoBasicConfig(cityName, id1);
  571 + patients.setCityPostRestId(id2);
609 572  
610   - String chanhouareaId = getString(getString(map.get("P_POSTPARTUMCOUNTY")));
611   - if (chanhouareaId != null && !"".equals(chanhouareaId)) {
612   - String areaName = getOracleBasicConfig(chanhouareaId);
613   - String id3 = getMongoBasicConfig(areaName, id2);
614   - patients.setAreaPostRestId(id3);
  573 + String chanhouareaId = getString(getString(map.get("P_POSTPARTUMCOUNTY")));
  574 + if (chanhouareaId != null && !"".equals(chanhouareaId)) {
  575 + String areaName = getOracleBasicConfig(chanhouareaId);
  576 + String id3 = getMongoBasicConfig(areaName, id2);
  577 + patients.setAreaPostRestId(id3);
615 578  
616   - String chanhoustreetId = getString(map.get("P_POSTPARTUMTOWNSHIP"));
617   - if (chanhoustreetId != null && !"".equals(chanhoustreetId)) {
618   - String streetName = getOracleBasicConfig(chanhoustreetId);
619   - String id4 = getMongoBasicConfig(streetName, id3);
620   - patients.setStreetPostRestId(id4);
  579 + String chanhoustreetId = getString(map.get("P_POSTPARTUMTOWNSHIP"));
  580 + if (chanhoustreetId != null && !"".equals(chanhoustreetId)) {
  581 + String streetName = getOracleBasicConfig(chanhoustreetId);
  582 + String id4 = getMongoBasicConfig(streetName, id3);
  583 + patients.setStreetPostRestId(id4);
  584 + }
621 585 }
622 586 }
623 587 }
624   - }
625 588  
626   - patients.setAddressPostRest(getString(map.get("P_POSTPARTUMSTREET"))); // 详细地址
  589 + patients.setAddressPostRest(getString(map.get("P_POSTPARTUMSTREET"))); // 详细地址
627 590  
628   - //----------------------产后修养地
  591 + //----------------------产后修养地
629 592  
630   - patients.setHusbandName(getString(map.get("P_HUSBANDNAME"))); //丈夫名称
631   - patients.setHusbandBirth(getDate(map.get("P_HUSBANDBIRTHDAY"))); //丈夫生日
632   - patients.setHusbandPhone(getString(map.get("P_HUSBANDMOBILEPHONE"))); //丈夫电话
633   - patients.setHworkUnit(getString(map.get("P_HUSBANDUNITWORK"))); //丈夫工作单位
  593 + patients.setHusbandName(getString(map.get("P_HUSBANDNAME"))); //丈夫名称
  594 + patients.setHusbandBirth(getDate(map.get("P_HUSBANDBIRTHDAY"))); //丈夫生日
  595 + patients.setHusbandPhone(getString(map.get("P_HUSBANDMOBILEPHONE"))); //丈夫电话
  596 + patients.setHworkUnit(getString(map.get("P_HUSBANDUNITWORK"))); //丈夫工作单位
634 597  
635   - String hprofessionTypeId = getString(map.get("P_HUSBANDOCCUPATIONID"));// 职业
636   - if (hprofessionTypeId != null && !"".equals(hprofessionTypeId)) {
637   - String professionTypeName = getOracleBasicConfig(hprofessionTypeId);
638   - String id = getMongoBasicConfig(professionTypeName, SystemConfig.PROFESSION_TYPE_ID);
639   - patients.setHprofessionTypeId(id);
640   - }
  598 + String hprofessionTypeId = getString(map.get("P_HUSBANDOCCUPATIONID"));// 职业
  599 + if (hprofessionTypeId != null && !"".equals(hprofessionTypeId)) {
  600 + String professionTypeName = getOracleBasicConfig(hprofessionTypeId);
  601 + String id = getMongoBasicConfig(professionTypeName, SystemConfig.PROFESSION_TYPE_ID);
  602 + patients.setHprofessionTypeId(id);
  603 + }
641 604  
642   - String P_HUSBANDCARDTYPE = getString(map.get("P_HUSBANDCARDTYPE")); //丈夫证件类
643   - if (StringUtils.isNotEmpty(P_HUSBANDCARDTYPE))
644   - {
645   - String hcardTypeName = getDataContentByById(P_HUSBANDCARDTYPE);
646   - if (hcardTypeName != null && !"".equals(hcardTypeName)) {
647   - String id = getMongoBasicConfig(hcardTypeName, SystemConfig.CERTE_TYPE_ID);
648   - patients.setHcertificateTypeId(id);
649   - }
650   - }
651   - //String hcardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + P_HUSBANDCARDTYPE + "'"));
  605 + String P_HUSBANDCARDTYPE = getString(map.get("P_HUSBANDCARDTYPE")); //丈夫证件类
  606 + if (StringUtils.isNotEmpty(P_HUSBANDCARDTYPE)) {
  607 + String hcardTypeName = getDataContentByById(P_HUSBANDCARDTYPE);
  608 + if (hcardTypeName != null && !"".equals(hcardTypeName)) {
  609 + String id = getMongoBasicConfig(hcardTypeName, SystemConfig.CERTE_TYPE_ID);
  610 + patients.setHcertificateTypeId(id);
  611 + }
  612 + }
  613 + //String hcardTypeName = getString(getOralceSingleObjBySql("select dc_name from plat_datacontent where dc_id='" + P_HUSBANDCARDTYPE + "'"));
652 614  
653   - patients.setHcertificateNum(getString(map.get("P_HUSBANDCARDNO"))); //证件号码
  615 + patients.setHcertificateNum(getString(map.get("P_HUSBANDCARDNO"))); //证件号码
654 616  
655 617  
656   - String hlevel = getString(map.get("P_HUSBANDEDUCATIONLEVEL"));//丈夫文化程度
657   - if (hlevel != null && !"".equals(hlevel)) {
658   - String plevelName = getOracleBasicConfig(hlevel);
659   - String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID);
660   - patients.setHlevelTypeId(id);
661   - }
  618 + String hlevel = getString(map.get("P_HUSBANDEDUCATIONLEVEL"));//丈夫文化程度
  619 + if (hlevel != null && !"".equals(hlevel)) {
  620 + String plevelName = getOracleBasicConfig(hlevel);
  621 + String id = getMongoBasicConfig(plevelName, SystemConfig.LEVEL_TYPE_ID);
  622 + patients.setHlevelTypeId(id);
  623 + }
662 624  
663 625  
664   - String hguoji = getString(map.get("P_HUSBANDCOUNTRY"));//丈夫国籍
665   - if (hguoji != null && !"".equals(hguoji)) {
666   - String guoJiName = getOracleBasicConfig(hguoji);
667   - String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID);
668   - patients.setHcountryId(id);
669   - }
  626 + String hguoji = getString(map.get("P_HUSBANDCOUNTRY"));//丈夫国籍
  627 + if (hguoji != null && !"".equals(hguoji)) {
  628 + String guoJiName = getOracleBasicConfig(hguoji);
  629 + String id = getMongoBasicConfig(guoJiName, SystemConfig.COUNTRY_TYPE_ID);
  630 + patients.setHcountryId(id);
  631 + }
670 632  
671   - String P_HUSBANDNATION = getString(map.get("P_HUSBANDNATION")); //丈夫民族
672   - if (P_HUSBANDNATION != null && !"".equals(P_HUSBANDNATION)) {
673   - String pnationName = getOracleBasicConfig(P_HUSBANDNATION);
674   - String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID);
675   - patients.setHnationId(id);
676   - }
  633 + String P_HUSBANDNATION = getString(map.get("P_HUSBANDNATION")); //丈夫民族
  634 + if (P_HUSBANDNATION != null && !"".equals(P_HUSBANDNATION)) {
  635 + String pnationName = getOracleBasicConfig(P_HUSBANDNATION);
  636 + String id = getMongoBasicConfig(pnationName, SystemConfig.NATION_TYPE_ID);
  637 + patients.setHnationId(id);
  638 + }
677 639  
678   - //------丈夫户口所在地
  640 + //------丈夫户口所在地
679 641  
680   - String hproviceId = getString(map.get("P_HUSBANDRRPROVINCE"));
681   - if (hproviceId != null && !"".equals(hproviceId)) {
682   - String name = getOracleBasicConfig(hproviceId);
683   - String id1 = getMongoBasicConfig(name, SystemConfig.LIVE_TYPE_ID);
684   - patients.setProvincePostRestId(id1);
  642 + String hproviceId = getString(map.get("P_HUSBANDRRPROVINCE"));
  643 + if (hproviceId != null && !"".equals(hproviceId)) {
  644 + String name = getOracleBasicConfig(hproviceId);
  645 + String id1 = getMongoBasicConfig(name, SystemConfig.LIVE_TYPE_ID);
  646 + patients.setProvincePostRestId(id1);
685 647  
686   - String hcityId = getString(map.get("P_HUSBANDRRCITY"));
687   - if (hcityId != null && !"".equals(hcityId)) {
688   - String nameCity = getOracleBasicConfig(hcityId);
689   - String id2 = getMongoBasicConfig(nameCity, id1);
690   - patients.setCityPostRestId(id2);
  648 + String hcityId = getString(map.get("P_HUSBANDRRCITY"));
  649 + if (hcityId != null && !"".equals(hcityId)) {
  650 + String nameCity = getOracleBasicConfig(hcityId);
  651 + String id2 = getMongoBasicConfig(nameCity, id1);
  652 + patients.setCityPostRestId(id2);
691 653  
692   - String hareId = getString(getString(map.get("P_HUSBANDRRCOUNTY")));
693   - if (hareId != null && !"".equals(hareId)) {
694   - String nameArea = getOracleBasicConfig(hareId);
695   - String id3 = getMongoBasicConfig(nameArea, id2);
696   - patients.setAreaPostRestId(id3);
  654 + String hareId = getString(getString(map.get("P_HUSBANDRRCOUNTY")));
  655 + if (hareId != null && !"".equals(hareId)) {
  656 + String nameArea = getOracleBasicConfig(hareId);
  657 + String id3 = getMongoBasicConfig(nameArea, id2);
  658 + patients.setAreaPostRestId(id3);
697 659  
698   - String hstreetId = getString(map.get("P_HUSBANDRRTOWNSHIP"));
699   - if (hstreetId != null && !"".equals(hstreetId)) {
700   - String nameStreet = getOracleBasicConfig(hstreetId);
701   - String id4 = getMongoBasicConfig(nameStreet, id3);
702   - patients.setStreetPostRestId(id4);
  660 + String hstreetId = getString(map.get("P_HUSBANDRRTOWNSHIP"));
  661 + if (hstreetId != null && !"".equals(hstreetId)) {
  662 + String nameStreet = getOracleBasicConfig(hstreetId);
  663 + String id4 = getMongoBasicConfig(nameStreet, id3);
  664 + patients.setStreetPostRestId(id4);
  665 + }
703 666 }
704 667 }
705 668 }
706   - }
707 669  
708   - patients.setAddressPostRest(getString(map.get("P_HUSBANDRRSTREET"))); // 详细地址
709   - patients.setHworkUnit(getString(map.get("P_FILENUMBER"))); //建档编号
710   - patients.setFileCode(getString(map.get("P_CLINICNO"))); //就诊卡号
  670 + patients.setAddressPostRest(getString(map.get("P_HUSBANDRRSTREET"))); // 详细地址
  671 + patients.setHworkUnit(getString(map.get("P_FILENUMBER"))); //建档编号
  672 + patients.setFileCode(getString(map.get("P_CLINICNO"))); //就诊卡号
711 673  
712   - mongoTemplate.save(patients);
713   - System.out.println(patients.getId()+"============");
714   - syncChuZhen(person.getId(), patients.getId(), mongoTemplate);
715   - syncFuzhen(person.getId(), patients.getId(), mongoTemplate);
716   - } catch (Exception e)
717   - {
718   - ExceptionUtils.catchException(e,map+"孕妇异常");
  674 + mongoTemplate.save(patients);
  675 + System.out.println(patients.getId() + "============");
  676 + syncChuZhen(person.getId(), patients.getId(), mongoTemplate);
  677 + syncFuzhen(person.getId(), patients.getId(), mongoTemplate);
  678 + } catch (Exception e) {
  679 + ExceptionUtils.catchException(e, map + "孕妇异常");
719 680 continue;
720 681 }
721 682 }
  683 + }
722 684 }
723 685  
  686 + public static void syncPatientData(String hospitalId,MongoTemplate mongoTemplate)
  687 + {
  688 +
  689 +// String sql = " SELECT * FROM ( SELECT A.*, ROWNUM RN FROM " +
  690 +// "(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" +
  691 +// " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '" + hospitalId + "' order by mp.p_lastmenstrualperiod desc ) A WHERE ROWNUM <= "+end+" ) WHERE RN >= "+start;
  692 +
  693 + String sql = "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" +
  694 + " on mp.p_platpatientid=pp.p_id where mp.p_hospitalid = '" + hospitalId + "' order by mp.p_lastmenstrualperiod desc " ;
  695 + List<Map<String, Object>> list = getListDataBySql(sql);
  696 + int batchSize = 1000;
  697 + int end = 0;
  698 + for (int i = 0; i < list.size();i+=batchSize) {
  699 + end=(end + batchSize);
  700 + if(end>list.size()){
  701 + end=list.size();
  702 + }
  703 + System.out.println("start:" + i + ",end:" + end);
  704 + List<Map<String, Object>> tempList = list.subList(i, end);
  705 + new Worker(tempList,mongoTemplate).start();
  706 + }
  707 + }
  708 +
724 709 private static void syncChuZhen(String pid,String parentId, MongoTemplate mongoTemplate)
725 710 {
726 711 // List<Map<String,Object>> list = getListDataBySql(" SELECT * FROM MOMMY_FIRSTEXAMINE f where replace(f.FE_TRIAGEORDERNO,'-','') = '" + parentId + "'");
727 712  
... ... @@ -1639,10 +1624,10 @@
1639 1624  
1640 1625 }
1641 1626  
1642   - public static void syncDataPat1(String hid,MongoTemplate mongoTemplate)
  1627 + public static void syncDataPat(String hid,MongoTemplate mongoTemplate)
1643 1628 {
1644 1629 try {
1645   - syncPatientData(hid, mongoTemplate, 1, 30000);
  1630 + syncPatientData(hid, mongoTemplate);
1646 1631 }
1647 1632 catch (Exception e)
1648 1633 {
1649 1634  
... ... @@ -1650,28 +1635,7 @@
1650 1635 }
1651 1636  
1652 1637 }
1653   - public static void syncDataPat2(String hid,MongoTemplate mongoTemplate)
1654   - {
1655   - try {
1656   - syncPatientData(hid,mongoTemplate,30001,8000);
1657   - }
1658   - catch (Exception e)
1659   - {
1660   - ExceptionUtils.catchException(e,"孕妇同步出错2。。。。。。。。。。。。。。");
1661   - }
1662 1638  
1663   - }
1664   - public static void syncDataPat3(String hid,MongoTemplate mongoTemplate)
1665   - {
1666   - try {
1667   - syncPatientData(hid,mongoTemplate,8001,100000);
1668   - }
1669   - catch (Exception e)
1670   - {
1671   - ExceptionUtils.catchException(e,"孕妇同步出错3。。。。。。。。。。。。。。");
1672   - }
1673   -
1674   - }
1675 1639  
1676 1640 public static void main(String[] args)
1677 1641 {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ de6fb0f
... ... @@ -110,30 +110,11 @@
110 110 JdbcUtil.initData();
111 111 System.out.println("initData------");
112 112  
113   - new Thread(new Runnable() {
114   - @Override
115   - public void run() {
116   - System.out.println("同步开始孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
117   - JdbcUtil.syncDataPat1(hid, template);
118   - System.out.println("同步结束孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
119   - }
120   - }).start();
121   -// new Thread(new Runnable() {
122   -// @Override
123   -// public void run() {
124   -// System.out.println("同步开始孕妇2>>>>>>>>>>>>>>>>>>>>>>>>>");
125   -// JdbcUtil.syncDataPat2(hid, template);
126   -// System.out.println("同步结束孕妇2>>>>>>>>>>>>>>>>>>>>>>>>>");
127   -// }
128   -// }).start();
129   -// new Thread(new Runnable() {
130   -// @Override
131   -// public void run() {
132   -// System.out.println("同步开始孕妇3>>>>>>>>>>>>>>>>>>>>>>>>>");
133   -// JdbcUtil.syncDataPat3(hid, template);
134   -// System.out.println("同步结束孕妇3>>>>>>>>>>>>>>>>>>>>>>>>>");
135   -// }
136   -// }).start();
  113 + System.out.println("同步开始孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
  114 + JdbcUtil.syncDataPat(hid, template);
  115 + System.out.println("同步结束孕妇1>>>>>>>>>>>>>>>>>>>>>>>>>");
  116 +
  117 +
137 118 return "starting...........";
138 119 }
139 120 }