From 02079ac874413b4ffe5ca96f669484408ba08b8c Mon Sep 17 00:00:00 2001 From: liquanyu Date: Thu, 20 Jun 2019 13:55:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=8D=E6=9C=BA=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lyms/hospitalapi/Cdfy/CdGwInterface.java | 186 +++++++++++++-------- 1 file changed, 115 insertions(+), 71 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java index 6cafa3a..c1423af 100644 --- a/platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java @@ -139,7 +139,7 @@ public class CdGwInterface { PreparedStatement ps = null; ResultSet rs = null; try { - String id= getPersonId( patient); + String id= getPersonId(patient); System.out.println("saveBaseInfo id = "+id); if (id != null) { @@ -194,7 +194,9 @@ public class CdGwInterface { String chXiang = CommonsHelper.getName1(patient.getStreetPostRestId(), basicConfigService); - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(patient.getTownOrgId()); + Organization organization = organizationService.getOrganization(Integer.parseInt(patient.getTownOrgId())); + + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()); //String hospitalName = basicConfig == null ? "" : basicConfig.getName(); String code = basicConfig.getCode();//getCodeByHospital(hospitalName); @@ -378,32 +380,34 @@ public class CdGwInterface { maternalInfo.setGeneticDiseaseHistoryCode("1"); - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(patient.getTownOrgId()); - - if (basicConfig != null) + if (StringUtils.isNotEmpty(patient.getTownOrgId()) && StringUtils.isNumeric(patient.getTownOrgId())) { + Organization organization = organizationService.getOrganization(Integer.parseInt(patient.getTownOrgId())); + - CdGwOrgRelationModel orgRelationModel = mongoTemplate.findOne(Query.query(Criteria.where("orgId").is(basicConfig.getId())), CdGwOrgRelationModel.class); - if (orgRelationModel != null) + if (organization != null && StringUtils.isNotEmpty(organization.getTownOrgId())) { + CdGwOrgRelationModel orgRelationModel = mongoTemplate.findOne(Query.query(Criteria.where("orgId").is(organization.getTownOrgId())), CdGwOrgRelationModel.class); + if (orgRelationModel != null) + { // maternalInfo.setCommittee("30832bbc-7231-442c-8a0a-a3662cee0c46");//TODO - maternalInfo.setCommittee(orgRelationModel.getCommunitId()); - } + maternalInfo.setCommittee(orgRelationModel.getCommunitId()); + } + maternalInfo.setCreateOrgId(organization.getTownOrgId()); + maternalInfo.setOrgName(organization.getName()); - } - String hospitalName = basicConfig == null ? "" : basicConfig.getName(); + Map gxMap = findGxHospitalById(organization.getTownOrgId()); + if(gxMap != null) { + String creator = gxMap.get("creator") == null ? "" : gxMap.get("creator"); + String creatorId = gxMap.get("creatorId") == null ? "" : gxMap.get("creatorId"); + maternalInfo.setCreatorId(creatorId); + maternalInfo.setCreator(creator); + } + } + } - maternalInfo.setCreateOrgId(basicConfig.getId()); - maternalInfo.setOrgName(hospitalName); - Map gxMap = findGxHospitalById(patient.getTownOrgId()); - if(gxMap != null) { - String creator = gxMap.get("creator") == null ? "" : gxMap.get("creator"); - String creatorId = gxMap.get("creatorId") == null ? "" : gxMap.get("creatorId"); - maternalInfo.setCreatorId(creatorId); - maternalInfo.setCreator(creator); - } //测试数据 //"createOrgId":"60f5462b-2b4f-4cad-9645-83e1be0af87f","orgName":"建设社区卫生服务中心", @@ -458,35 +462,35 @@ public class CdGwInterface { } - /** - * 通过卫生院机构名称获取code - * @param hospital - * @return - */ - private String getCodeByHospital(String hospital) - { - String code = ""; - Connection conn = null; - PreparedStatement ps = null; - ResultSet rs = null; - try { - conn = ConnTools.makeGwConnection(); - String hoSql = "select code from yljg where wname=\'"+hospital+"\'"; - ps = conn.prepareStatement(hoSql); - rs = ps.executeQuery(); - while(rs.next()){ - code = rs.getString("code"); - } - } - catch (Exception e) - { - ExceptionUtils.catchException(e,"getCodeByHospital error."); - } - finally { - close(conn,ps,rs); - } - return code; - } +// /** +// * 通过卫生院机构名称获取code +// * @param hospital +// * @return +// */ +// private String getCodeByHospital(String hospital) +// { +// String code = ""; +// Connection conn = null; +// PreparedStatement ps = null; +// ResultSet rs = null; +// try { +// conn = ConnTools.makeGwConnection(); +// String hoSql = "select code from yljg where wname=\'"+hospital+"\'"; +// ps = conn.prepareStatement(hoSql); +// rs = ps.executeQuery(); +// while(rs.next()){ +// code = rs.getString("code"); +// } +// } +// catch (Exception e) +// { +// ExceptionUtils.catchException(e,"getCodeByHospital error."); +// } +// finally { +// close(conn,ps,rs); +// } +// return code; +// } /** @@ -559,14 +563,21 @@ public class CdGwInterface { String liveAddress = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId())); + + + if (organization == null) + { + return null; + } //智业中间库的医疗机构编码 - BasicConfig basic = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()); + BasicConfig basic = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()); //String hospital =basic.getName(); String code = basic.getCode();//getCodeByHospital(hospital); - Map gxMap = findGxHospitalById(patients.getId()); + Map gxMap = findGxHospitalById(organization.getTownOrgId()); if(gxMap != null){ createOrgId = gxMap.get("createOrgId"); orgName = gxMap.get("orgName"); @@ -1182,9 +1193,16 @@ public class CdGwInterface { return null; } + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId())); + + if (organization == null) + { + return null; + } + //智业中间库的医疗机构编码 String code = ""; - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName(); + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName(); if(hospital != "" && hospital != null){ code = patients.getHospitalId(); @@ -1195,7 +1213,7 @@ public class CdGwInterface { code = rs.getString("code"); } - gxMap = findGxHospitalById(patients.getTownOrgId()); + gxMap = findGxHospitalById(organization.getTownOrgId()); if(gxMap != null){ createOrgId = gxMap.get("createOrgId"); orgName = gxMap.get("orgName"); @@ -1364,10 +1382,19 @@ public class CdGwInterface { return null; } + + + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId())); + + if (organization == null) + { + return null; + } + Map map = (Map)br.getData(); //智业中间库的医疗机构编码 String code = ""; - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName(); + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName(); if(hospital != "" && hospital != null){ code = patients.getHospitalId(); String hoSql = "select code from yljg where wname=\'"+hospital+"\'"; @@ -1386,7 +1413,7 @@ public class CdGwInterface { fmCode = rs.getString("code"); } - gxMap = findGxHospitalById(hospital); + gxMap = findGxHospitalById(organization.getTownOrgId()); if(gxMap != null){ createOrgId = gxMap.get("createOrgId"); orgName = gxMap.get("orgName"); @@ -2226,16 +2253,6 @@ public class CdGwInterface { ps = conn.prepareStatement(inSql); ps.setDate(1, new Date(babyModel.getModified().getTime())); if(org.apache.commons.lang.math.NumberUtils.isNumber(babyModel.getDeliverOrg())){ - /*int orgId = NumberUtils.toInt(babyModel.getDeliverOrg(), 0); - if(orgId>0){ - Organization org = organizationService.getOrganization(orgId); - if (org != null) - { - ps.setString(2,org.getName()); - }else{ - ps.setString(2,null); - } - }*/ ps.setString(2,code); }else{ ps.setString(2,null); @@ -2372,12 +2389,22 @@ public class CdGwInterface { try{ + + + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId())); + + if (organization == null) + { + return null; + } + + String delSql = "delete from WOMAN_POSTVISIT where POST_VISIT_FORM_NO=\'"+matdeliverFollowModel.getId()+"\'"; deleteData(delSql,conn,ps); //智业中间库的医疗机构编码 String code = ""; - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName(); + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName(); if(hospital != "" && hospital != null){ code = patients.getHospitalId(); String hoSql = "select code from yljg where wname=\'"+hospital+"\'"; @@ -2386,7 +2413,7 @@ public class CdGwInterface { while(rs.next()){ code = rs.getString("code"); } - gxMap = findGxHospitalById(patients.getTownOrgId()); + gxMap = findGxHospitalById(organization.getTownOrgId()); if(gxMap != null){ createOrgId = gxMap.get("createOrgId"); orgName = gxMap.get("orgName"); @@ -2813,13 +2840,23 @@ public class CdGwInterface { return null; } + + + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId())); + + if (organization == null) + { + return null; + } + + String delSql = "delete from CHILD_HOMEVISIT_MEMO where NEWBORN_VISIT_FORM_NO=\'"+newbornVisit.getId()+"\'"; deleteData(delSql,conn,ps); //智业中间库的医疗机构编码 String code = ""; - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName(); + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName(); if(hospital != "" && hospital != null){ code = patients.getHospitalId(); @@ -2830,7 +2867,7 @@ public class CdGwInterface { code = rs.getString("code"); } - gxMap = findGxHospitalById(patients.getTownOrgId()); + gxMap = findGxHospitalById(organization.getTownOrgId()); if(gxMap != null){ createOrgId = gxMap.get("createOrgId"); orgName = gxMap.get("orgName"); @@ -3165,6 +3202,13 @@ public class CdGwInterface { } + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getTownOrgId())); + + if (organization == null) + { + return null; + } + String delSql = "delete from CHILD_HEALTHEXAM where CHE_FORM_NO=\'"+babyCheckModel.getId()+"\'"; deleteData(delSql,conn,ps); @@ -3173,7 +3217,7 @@ public class CdGwInterface { //智业中间库的医疗机构编码 String code = ""; - String hospital = basicConfigService.getOneBasicConfigById(patients.getTownOrgId()).getName(); + String hospital = basicConfigService.getOneBasicConfigById(organization.getTownOrgId()).getName(); if(hospital != "" && hospital != null){ code = patients.getHospitalId(); @@ -3184,7 +3228,7 @@ public class CdGwInterface { code = rs.getString("code"); } - gxMap = findGxHospitalById(patients.getTownOrgId()); + gxMap = findGxHospitalById(organization.getTownOrgId()); if(gxMap != null){ createOrgId = gxMap.get("createOrgId"); orgName = gxMap.get("orgName"); -- 1.8.3.1