Commit ba1c849baecaeaa9c8275298e5a3cfb68a84d48d

Authored by dongqin

Merge remote-tracking branch 'origin/master'

Showing 1 changed file

platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java View file @ ba1c849
... ... @@ -139,7 +139,7 @@
139 139 PreparedStatement ps = null;
140 140 ResultSet rs = null;
141 141 try {
142   - String id= getPersonId( patient);
  142 + String id= getPersonId(patient);
143 143 System.out.println("saveBaseInfo id = "+id);
144 144 if (id != null)
145 145 {
... ... @@ -194,7 +194,9 @@
194 194 String chXiang = CommonsHelper.getName1(patient.getStreetPostRestId(), basicConfigService);
195 195  
196 196  
197   - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(patient.getTownOrgId());
  197 + Organization organization = organizationService.getOrganization(Integer.parseInt(patient.getTownOrgId()));
  198 +
  199 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getTownOrgId());
198 200 //String hospitalName = basicConfig == null ? "" : basicConfig.getName();
199 201  
200 202 String code = basicConfig.getCode();//getCodeByHospital(hospitalName);
201 203  
202 204  
203 205  
204 206  
205 207  
206 208  
207 209  
208 210  
... ... @@ -378,33 +380,35 @@
378 380 maternalInfo.setGeneticDiseaseHistoryCode("1");
379 381  
380 382  
381   - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(patient.getTownOrgId());
382   -
383   - if (basicConfig != null)
  383 + if (StringUtils.isNotEmpty(patient.getTownOrgId()) && StringUtils.isNumeric(patient.getTownOrgId()))
384 384 {
  385 + Organization organization = organizationService.getOrganization(Integer.parseInt(patient.getTownOrgId()));
385 386  
386   - CdGwOrgRelationModel orgRelationModel = mongoTemplate.findOne(Query.query(Criteria.where("orgId").is(basicConfig.getId())), CdGwOrgRelationModel.class);
387   - if (orgRelationModel != null)
  387 +
  388 + if (organization != null && StringUtils.isNotEmpty(organization.getTownOrgId()))
388 389 {
  390 + CdGwOrgRelationModel orgRelationModel = mongoTemplate.findOne(Query.query(Criteria.where("orgId").is(organization.getTownOrgId())), CdGwOrgRelationModel.class);
  391 + if (orgRelationModel != null)
  392 + {
389 393 // maternalInfo.setCommittee("30832bbc-7231-442c-8a0a-a3662cee0c46");//TODO
390   - maternalInfo.setCommittee(orgRelationModel.getCommunitId());
391   - }
  394 + maternalInfo.setCommittee(orgRelationModel.getCommunitId());
  395 + }
  396 + maternalInfo.setCreateOrgId(organization.getTownOrgId());
  397 + maternalInfo.setOrgName(organization.getName());
392 398  
  399 +
  400 + Map<String,String> gxMap = findGxHospitalById(organization.getTownOrgId());
  401 + if(gxMap != null) {
  402 + String creator = gxMap.get("creator") == null ? "" : gxMap.get("creator");
  403 + String creatorId = gxMap.get("creatorId") == null ? "" : gxMap.get("creatorId");
  404 + maternalInfo.setCreatorId(creatorId);
  405 + maternalInfo.setCreator(creator);
  406 + }
  407 + }
393 408 }
394 409  
395   - String hospitalName = basicConfig == null ? "" : basicConfig.getName();
396 410  
397   - maternalInfo.setCreateOrgId(basicConfig.getId());
398   - maternalInfo.setOrgName(hospitalName);
399 411  
400   - Map<String,String> gxMap = findGxHospitalById(patient.getTownOrgId());
401   - if(gxMap != null) {
402   - String creator = gxMap.get("creator") == null ? "" : gxMap.get("creator");
403   - String creatorId = gxMap.get("creatorId") == null ? "" : gxMap.get("creatorId");
404   - maternalInfo.setCreatorId(creatorId);
405   - maternalInfo.setCreator(creator);
406   - }
407   -
408 412 //测试数据
409 413 //"createOrgId":"60f5462b-2b4f-4cad-9645-83e1be0af87f","orgName":"建设社区卫生服务中心",
410 414 // "creatorId":"60f5462b-2b4f-4cad-9645-83e1be0af87f",
... ... @@ -458,35 +462,35 @@
458 462  
459 463 }
460 464  
461   - /**
462   - * 通过卫生院机构名称获取code
463   - * @param hospital
464   - * @return
465   - */
466   - private String getCodeByHospital(String hospital)
467   - {
468   - String code = "";
469   - Connection conn = null;
470   - PreparedStatement ps = null;
471   - ResultSet rs = null;
472   - try {
473   - conn = ConnTools.makeGwConnection();
474   - String hoSql = "select code from yljg where wname=\'"+hospital+"\'";
475   - ps = conn.prepareStatement(hoSql);
476   - rs = ps.executeQuery();
477   - while(rs.next()){
478   - code = rs.getString("code");
479   - }
480   - }
481   - catch (Exception e)
482   - {
483   - ExceptionUtils.catchException(e,"getCodeByHospital error.");
484   - }
485   - finally {
486   - close(conn,ps,rs);
487   - }
488   - return code;
489   - }
  465 +// /**
  466 +// * 通过卫生院机构名称获取code
  467 +// * @param hospital
  468 +// * @return
  469 +// */
  470 +// private String getCodeByHospital(String hospital)
  471 +// {
  472 +// String code = "";
  473 +// Connection conn = null;
  474 +// PreparedStatement ps = null;
  475 +// ResultSet rs = null;
  476 +// try {
  477 +// conn = ConnTools.makeGwConnection();
  478 +// String hoSql = "select code from yljg where wname=\'"+hospital+"\'";
  479 +// ps = conn.prepareStatement(hoSql);
  480 +// rs = ps.executeQuery();
  481 +// while(rs.next()){
  482 +// code = rs.getString("code");
  483 +// }
  484 +// }
  485 +// catch (Exception e)
  486 +// {
  487 +// ExceptionUtils.catchException(e,"getCodeByHospital error.");
  488 +// }
  489 +// finally {
  490 +// close(conn,ps,rs);
  491 +// }
  492 +// return code;
  493 +// }
490 494  
491 495  
492 496 /**
493 497  
494 498  
495 499  
... ... @@ -559,14 +563,21 @@
559 563 String liveAddress = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(),
560 564 patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService);
561 565  
  566 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId()));
562 567  
  568 +
  569 + if (organization == null)
  570 + {
  571 + return null;
  572 + }
  573 +
563 574 //智业中间库的医疗机构编码
564   - BasicConfig basic = basicConfigService.getOneBasicConfigById(patients.getTownOrgId());
  575 + BasicConfig basic = basicConfigService.getOneBasicConfigById(organization.getTownOrgId());
565 576 //String hospital =basic.getName();
566 577  
567 578 String code = basic.getCode();//getCodeByHospital(hospital);
568 579  
569   - Map<String,String> gxMap = findGxHospitalById(patients.getId());
  580 + Map<String,String> gxMap = findGxHospitalById(organization.getTownOrgId());
570 581 if(gxMap != null){
571 582 createOrgId = gxMap.get("createOrgId");
572 583 orgName = gxMap.get("orgName");
573 584  
... ... @@ -1182,9 +1193,16 @@
1182 1193 return null;
1183 1194 }
1184 1195  
  1196 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId()));
  1197 +
  1198 + if (organization == null)
  1199 + {
  1200 + return null;
  1201 + }
  1202 +
1185 1203 //智业中间库的医疗机构编码
1186 1204 String code = "";
1187   - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName();
  1205 + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName();
1188 1206  
1189 1207 if(hospital != "" && hospital != null){
1190 1208 code = patients.getHospitalId();
... ... @@ -1195,7 +1213,7 @@
1195 1213 code = rs.getString("code");
1196 1214 }
1197 1215  
1198   - gxMap = findGxHospitalById(patients.getTownOrgId());
  1216 + gxMap = findGxHospitalById(organization.getTownOrgId());
1199 1217 if(gxMap != null){
1200 1218 createOrgId = gxMap.get("createOrgId");
1201 1219 orgName = gxMap.get("orgName");
1202 1220  
... ... @@ -1364,10 +1382,19 @@
1364 1382 return null;
1365 1383 }
1366 1384  
  1385 +
  1386 +
  1387 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId()));
  1388 +
  1389 + if (organization == null)
  1390 + {
  1391 + return null;
  1392 + }
  1393 +
1367 1394 Map<String,Object> map = (Map)br.getData();
1368 1395 //智业中间库的医疗机构编码
1369 1396 String code = "";
1370   - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName();
  1397 + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName();
1371 1398 if(hospital != "" && hospital != null){
1372 1399 code = patients.getHospitalId();
1373 1400 String hoSql = "select code from yljg where wname=\'"+hospital+"\'";
... ... @@ -1386,7 +1413,7 @@
1386 1413 fmCode = rs.getString("code");
1387 1414 }
1388 1415  
1389   - gxMap = findGxHospitalById(hospital);
  1416 + gxMap = findGxHospitalById(organization.getTownOrgId());
1390 1417 if(gxMap != null){
1391 1418 createOrgId = gxMap.get("createOrgId");
1392 1419 orgName = gxMap.get("orgName");
... ... @@ -2226,16 +2253,6 @@
2226 2253 ps = conn.prepareStatement(inSql);
2227 2254 ps.setDate(1, new Date(babyModel.getModified().getTime()));
2228 2255 if(org.apache.commons.lang.math.NumberUtils.isNumber(babyModel.getDeliverOrg())){
2229   - /*int orgId = NumberUtils.toInt(babyModel.getDeliverOrg(), 0);
2230   - if(orgId>0){
2231   - Organization org = organizationService.getOrganization(orgId);
2232   - if (org != null)
2233   - {
2234   - ps.setString(2,org.getName());
2235   - }else{
2236   - ps.setString(2,null);
2237   - }
2238   - }*/
2239 2256 ps.setString(2,code);
2240 2257 }else{
2241 2258 ps.setString(2,null);
2242 2259  
... ... @@ -2372,12 +2389,22 @@
2372 2389  
2373 2390 try{
2374 2391  
  2392 +
  2393 +
  2394 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId()));
  2395 +
  2396 + if (organization == null)
  2397 + {
  2398 + return null;
  2399 + }
  2400 +
  2401 +
2375 2402 String delSql = "delete from WOMAN_POSTVISIT where POST_VISIT_FORM_NO=\'"+matdeliverFollowModel.getId()+"\'";
2376 2403 deleteData(delSql,conn,ps);
2377 2404  
2378 2405 //智业中间库的医疗机构编码
2379 2406 String code = "";
2380   - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName();
  2407 + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName();
2381 2408 if(hospital != "" && hospital != null){
2382 2409 code = patients.getHospitalId();
2383 2410 String hoSql = "select code from yljg where wname=\'"+hospital+"\'";
... ... @@ -2386,7 +2413,7 @@
2386 2413 while(rs.next()){
2387 2414 code = rs.getString("code");
2388 2415 }
2389   - gxMap = findGxHospitalById(patients.getTownOrgId());
  2416 + gxMap = findGxHospitalById(organization.getTownOrgId());
2390 2417 if(gxMap != null){
2391 2418 createOrgId = gxMap.get("createOrgId");
2392 2419 orgName = gxMap.get("orgName");
2393 2420  
... ... @@ -2813,13 +2840,23 @@
2813 2840 return null;
2814 2841 }
2815 2842  
  2843 +
  2844 +
  2845 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId()));
  2846 +
  2847 + if (organization == null)
  2848 + {
  2849 + return null;
  2850 + }
  2851 +
  2852 +
2816 2853 String delSql = "delete from CHILD_HOMEVISIT_MEMO where NEWBORN_VISIT_FORM_NO=\'"+newbornVisit.getId()+"\'";
2817 2854 deleteData(delSql,conn,ps);
2818 2855  
2819 2856  
2820 2857 //智业中间库的医疗机构编码
2821 2858 String code = "";
2822   - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName();
  2859 + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName();
2823 2860  
2824 2861 if(hospital != "" && hospital != null){
2825 2862 code = patients.getHospitalId();
... ... @@ -2830,7 +2867,7 @@
2830 2867 code = rs.getString("code");
2831 2868 }
2832 2869  
2833   - gxMap = findGxHospitalById(patients.getTownOrgId());
  2870 + gxMap = findGxHospitalById(organization.getTownOrgId());
2834 2871 if(gxMap != null){
2835 2872 createOrgId = gxMap.get("createOrgId");
2836 2873 orgName = gxMap.get("orgName");
... ... @@ -3165,6 +3202,13 @@
3165 3202 }
3166 3203  
3167 3204  
  3205 + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId()));
  3206 +
  3207 + if (organization == null)
  3208 + {
  3209 + return null;
  3210 + }
  3211 +
3168 3212 String delSql = "delete from CHILD_HEALTHEXAM where CHE_FORM_NO=\'"+babyCheckModel.getId()+"\'";
3169 3213  
3170 3214 deleteData(delSql,conn,ps);
... ... @@ -3173,7 +3217,7 @@
3173 3217  
3174 3218 //智业中间库的医疗机构编码
3175 3219 String code = "";
3176   - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName();
  3220 + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName();
3177 3221  
3178 3222 if(hospital != "" && hospital != null){
3179 3223 code = patients.getHospitalId();
... ... @@ -3184,7 +3228,7 @@
3184 3228 code = rs.getString("code");
3185 3229 }
3186 3230  
3187   - gxMap = findGxHospitalById(patients.getTownOrgId());
  3231 + gxMap = findGxHospitalById(organization.getTownOrgId());
3188 3232 if(gxMap != null){
3189 3233 createOrgId = gxMap.get("createOrgId");
3190 3234 orgName = gxMap.get("orgName");