Commit a1b373421e0ec0aad49f0e0dc3ca093dfab5c8fd
1 parent
d0b9005ff5
Exists in
master
and in
6 other branches
诸城初诊接口
Showing 4 changed files with 304 additions and 16 deletions
- platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/ConnTools.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ConnTools.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ZcPrenatalService.java
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java
View file @
a1b3734
1 | 1 | package com.lyms.hospitalapi.Cdfy; |
2 | 2 | |
3 | 3 | import com.lyms.hospitalapi.pojo.HealthRecord; |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
5 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
6 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
7 | +import com.lyms.platform.common.utils.PropertiesUtil; | |
8 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
4 | 9 | import com.lyms.platform.pojo.Patients; |
10 | +import org.apache.commons.dbutils.DbUtils; | |
11 | +import org.apache.commons.dbutils.QueryRunner; | |
12 | +import org.springframework.beans.factory.annotation.Autowired; | |
5 | 13 | import org.springframework.stereotype.Service; |
6 | 14 | |
15 | +import java.sql.Connection; | |
16 | + | |
7 | 17 | /** |
8 | - * Created by Administrator on 2018/4/18. | |
18 | + * Created by Administrator on 2018/5/21. | |
9 | 19 | * 承德公共卫生系统接口(gxk) |
20 | + * 保存个人基本信息,保存地址信息 | |
10 | 21 | */ |
11 | 22 | @Service("cdGwInterface") |
12 | 23 | public class CdGwInterface { |
13 | 24 | |
14 | - //保存孕妇建档(更新健康档案暂时不支持) | |
15 | - private static String jdUrl = "http://gxgg.greatsoft.net:8083/maternal/personInfo/savePersonInfo"; | |
25 | + @Autowired | |
26 | + private BasicConfigService basicConfigService; | |
16 | 27 | |
28 | + public BaseObjectResponse saveBaseInfo(Patients patient,String hosipitalId){ | |
17 | 29 | |
18 | - public String saveRecord(Patients patient,String hosipitalId){ | |
30 | + //户籍地址 | |
31 | + String hjSheng = CommonsHelper.getName1(patient.getProvinceId(),basicConfigService); | |
32 | + String hjShi = CommonsHelper.getName1(patient.getCityId(),basicConfigService); | |
33 | + String hjXian = CommonsHelper.getName1(patient.getAreaId(), basicConfigService); | |
34 | + String hjXiang = CommonsHelper.getName1(patient.getStreetId(),basicConfigService); | |
19 | 35 | |
36 | + //居住地址 | |
37 | + String jzSheng = CommonsHelper.getName1(patient.getProvinceRegisterId(),basicConfigService); | |
38 | + String jzShi = CommonsHelper.getName1(patient.getCityRegisterId(),basicConfigService); | |
39 | + String jzXian = CommonsHelper.getName1(patient.getAreaRegisterId(),basicConfigService); | |
40 | + String jzXiang = CommonsHelper.getName1(patient.getStreetRegisterId(),basicConfigService); | |
20 | 41 | |
42 | + //产后居住地 | |
43 | + String chSheng = CommonsHelper.getName1(patient.getProvincePostRestId(),basicConfigService); | |
44 | + String chShi = CommonsHelper.getName1(patient.getCityPostRestId(),basicConfigService); | |
45 | + String chXian = CommonsHelper.getName1(patient.getAreaPostRestId(),basicConfigService); | |
46 | + String chXiang = CommonsHelper.getName1(patient.getStreetPostRestId(),basicConfigService); | |
21 | 47 | |
22 | - HealthRecord HealthRecord = new HealthRecord(); | |
23 | - HealthRecord.setPersonInfoId(""); | |
24 | - HealthRecord.setName(patient.getUsername()); | |
25 | - HealthRecord.setPinYinStr("无"); | |
26 | - HealthRecord.setIdNo(patient.getCardNo()); | |
27 | - HealthRecord.setTelNo(patient.getPhone()); | |
28 | - HealthRecord.setBirthday(patient.getBirth()); | |
29 | - HealthRecord.setAddress(""); | |
48 | + BaseObjectResponse br = new BaseObjectResponse(); | |
49 | + Connection conn = ConnTools.makeGwConnection(); | |
50 | + QueryRunner queryRunner = new QueryRunner(); | |
51 | + //个人基本信息语句 | |
52 | + String inBaseInfoSql = "insert into baseinfo(ORG_CODE,PATIENT_ID,CARD_NO,CARD_TYPE_CODE,NAME,\n" + | |
53 | + "SEX_CODE,BIRTH_DATE,ID_TYPE_CODE,ID_NO,EMPLOYER_NAME,TEL_NO,\n" + | |
54 | + "CONTACT_NAME,CONTACT_TEL_NO,NATIONALITY_CODE,ABO_CODE,RH_CODE,\n" + | |
55 | + "EDUCATION_CODE,OCCUPATION_CODE,MARRIAGE_CODE,DRUG_ALLERGY_MARK,OP_HISTORY_MARK,TRAUMA_HISTORY_MARK,\n" + | |
56 | + "BLOOD_TRANSF_MARK,GENETIC_DISEASE_HISTORY,OPERATION_HISTORY,Sec_Type_Code,Employer_Tel_No,DELETE_MARK)\n" + | |
57 | + "vakues("+patient.getHospitalId()+","+patient.getId()+","+patient.getVcCardNo()+",'03',"+patient.getUsername()+",\n" + | |
58 | + "'2',"+patient.getBirth()+",'01',"+patient.getCardNo()+","+patient.getPworkUnit()+","+patient.getPhone()+",\n" + | |
59 | + ""+patient.getHusbandName()+","+patient.getHusbandPhone()+","+patient.getPnationId()+",'5','4',\n" + | |
60 | + "'',"+patient.getPprofessionTypeId()+",'20','0','0','0',\n" + | |
61 | + "'9','无','无','01','无','0')"; | |
30 | 62 | |
63 | + //地址信息语句,01:户籍地址 | |
64 | + String inAddressSql01 = "insert into baseinfo_address(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" + | |
65 | + "Addr_County,Addr_Town,Addr_Village,Addr_House_No,Postal_Code,DELETE_MARK) \n" + | |
66 | + "values("+patient.getHospitalId()+","+patient.getId()+",'01',"+hjSheng+","+hjShi+",\n" + | |
67 | + ""+hjXian+","+hjXiang+","+patient.getAddress()+","+patient.getAddress()+",'','0')"; | |
31 | 68 | |
32 | - HealthRecord.setIsAppCreate("9"); | |
33 | - HealthRecord.setRemarks("无"); | |
34 | - HealthRecord.setModifier(""); | |
35 | - HealthRecord.setModifierId(""); | |
69 | + //地址信息语句,03:居住地址 | |
70 | + String inAddressSql03 = "insert into baseinfo_address(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" + | |
71 | + "Addr_County,Addr_Town,Addr_Village,Addr_House_No,Postal_Code,DELETE_MARK) \n" + | |
72 | + "values("+patient.getHospitalId()+","+patient.getId()+",'03',"+jzSheng+","+jzShi+",\n" + | |
73 | + ""+jzXian+","+jzXiang+","+patient.getAddressRegister()+","+patient.getAddressRegister()+",'','0')"; | |
74 | + | |
75 | + //地址信息语句,07:产后居住地 | |
76 | + String inAddressSql07 = "insert into baseinfo_address(ORG_CODE,PATIENT_ID,Address_Type_Code,Addr_Province,Addr_City,\n" + | |
77 | + "Addr_County,Addr_Town,Addr_Village,Addr_House_No,Postal_Code,DELETE_MARK) \n" + | |
78 | + "values("+patient.getHospitalId()+","+patient.getId()+",'07',"+chSheng+","+chShi+",\n" + | |
79 | + ""+chXian+","+chXiang+","+patient.getAddressPostRest()+","+patient.getAddressPostRest()+",'','0')"; | |
80 | + | |
81 | + try{ | |
82 | + //执行插入个人基本信息表(BASEINFO) | |
83 | + int result = queryRunner.update(conn,inBaseInfoSql); | |
84 | + if(result > 0){ | |
85 | + int adress01 = queryRunner.update(conn,inAddressSql01); | |
86 | + if(adress01 > 0){ | |
87 | + int adress03 = queryRunner.update(conn,inAddressSql03); | |
88 | + if(adress03 > 0){ | |
89 | + int adress07 = queryRunner.update(conn,inAddressSql07); | |
90 | + if(adress07 > 0){ | |
91 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
92 | + br.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
93 | + return br; | |
94 | + }else{ | |
95 | + br.setErrorcode(-1); | |
96 | + br.setErrormsg("产后居住地址信息保存有误!"); | |
97 | + return br; | |
98 | + } | |
99 | + }else{ | |
100 | + br.setErrorcode(-1); | |
101 | + br.setErrormsg("居住地址信息保存有误!"); | |
102 | + return br; | |
103 | + } | |
104 | + }else { | |
105 | + br.setErrorcode(-1); | |
106 | + br.setErrormsg("户籍地址信息保存有误!"); | |
107 | + return br; | |
108 | + } | |
109 | + | |
110 | + } | |
111 | + }catch (Exception e){ | |
112 | + e.printStackTrace(); | |
113 | + }finally { | |
114 | + DbUtils.closeQuietly(conn); | |
115 | + } | |
116 | + | |
117 | + | |
36 | 118 | |
37 | 119 | |
38 | 120 | return null; |
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/ConnTools.java
View file @
a1b3734
... | ... | @@ -15,6 +15,14 @@ |
15 | 15 | private static String hisPassword = "his"; |
16 | 16 | |
17 | 17 | |
18 | + private static String gwDirverClassName = "oracle.jdbc.driver.OracleDriver"; | |
19 | + private static String gwUrl = "jdbc:oracle:thin:@10.0.255.18:1521:fycehr"; | |
20 | + private static String gwUser = "FYCEHR"; | |
21 | + private static String gwPassword = "fycehr"; | |
22 | + | |
23 | + | |
24 | + | |
25 | + | |
18 | 26 | public static Connection makeHisConnection() { |
19 | 27 | Connection conn = null; |
20 | 28 | try { |
... | ... | @@ -29,6 +37,25 @@ |
29 | 37 | } |
30 | 38 | return conn; |
31 | 39 | } |
40 | + | |
41 | + | |
42 | + public static Connection makeGwConnection() { | |
43 | + Connection conn = null; | |
44 | + try { | |
45 | + Class.forName(gwDirverClassName); | |
46 | + } catch (ClassNotFoundException e) { | |
47 | + e.printStackTrace(); | |
48 | + } | |
49 | + try { | |
50 | + conn = DriverManager.getConnection(gwUrl, gwUser, gwPassword); | |
51 | + } catch (SQLException e) { | |
52 | + e.printStackTrace(); | |
53 | + } | |
54 | + return conn; | |
55 | + } | |
56 | + | |
57 | + | |
58 | + | |
32 | 59 | |
33 | 60 | } |
platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ConnTools.java
View file @
a1b3734
... | ... | @@ -19,7 +19,13 @@ |
19 | 19 | private static String fmUser = "lymsfm"; |
20 | 20 | private static String fmPassword = "lyms123"; |
21 | 21 | |
22 | + private static String czDirverClassName = "com.mysql.jdbc.Driver"; | |
23 | + private static String czUrl = "jdbc:mysql://:119.90.57.26:3306/platform"; | |
24 | + private static String czUser = "platform"; | |
25 | + private static String czPassword = "platform123"; | |
22 | 26 | |
27 | + | |
28 | + | |
23 | 29 | public static Connection makeHisConnection() { |
24 | 30 | Connection conn = null; |
25 | 31 | try { |
... | ... | @@ -48,6 +54,26 @@ |
48 | 54 | } |
49 | 55 | try { |
50 | 56 | conn = DriverManager.getConnection(fmUrl, fmUser, fmPassword); |
57 | + } catch (SQLException e) { | |
58 | + e.printStackTrace(); | |
59 | + } | |
60 | + return conn; | |
61 | + } | |
62 | + | |
63 | + | |
64 | + /** | |
65 | + * 诸城初诊,复诊连接源 | |
66 | + * @return | |
67 | + */ | |
68 | + public static Connection makeCzConnection() { | |
69 | + Connection conn = null; | |
70 | + try { | |
71 | + Class.forName(czDirverClassName); | |
72 | + } catch (ClassNotFoundException e) { | |
73 | + e.printStackTrace(); | |
74 | + } | |
75 | + try { | |
76 | + conn = DriverManager.getConnection(czUrl, czUser, czPassword); | |
51 | 77 | } catch (SQLException e) { |
52 | 78 | e.printStackTrace(); |
53 | 79 | } |
platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ZcPrenatalService.java
View file @
a1b3734
1 | +package com.lyms.hospitalapi.zcfy; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.PatientsService; | |
4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
5 | +import com.lyms.platform.common.result.BaseListResponse; | |
6 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
7 | +import com.lyms.platform.operate.web.facade.ViewFacade; | |
8 | +import com.lyms.platform.pojo.AntExChuModel; | |
9 | +import com.lyms.platform.pojo.Patients; | |
10 | +import org.apache.commons.lang.StringUtils; | |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
12 | +import org.springframework.stereotype.Service; | |
13 | + | |
14 | +import java.sql.Connection; | |
15 | +import java.sql.PreparedStatement; | |
16 | +import java.sql.ResultSet; | |
17 | +import java.util.List; | |
18 | +import java.util.Map; | |
19 | + | |
20 | +/** | |
21 | + * 诸城初诊复诊接口(GXK) | |
22 | + * Created by Administrator on 2018/6/17. | |
23 | + */ | |
24 | +@Service("zcPrenatalService") | |
25 | +public class ZcPrenatalService { | |
26 | + | |
27 | + @Autowired | |
28 | + private PatientsService patientsService; | |
29 | + @Autowired | |
30 | + private ViewFacade viewFacade; | |
31 | + | |
32 | + //初诊 | |
33 | + public BaseObjectResponse saveAntexChu(AntExChuModel antExChuModel) { | |
34 | + | |
35 | + PreparedStatement ps = null; | |
36 | + ResultSet rs = null; | |
37 | + Connection conn = ConnTools.makeCzConnection(); | |
38 | + int count = 0; | |
39 | + | |
40 | + try { | |
41 | + //首先查询孕妇的基本信息(就诊卡号,身份证,电话号码),以便于对方查询数据 | |
42 | + Patients patients = patientsService.findOnePatientById(antExChuModel.getParentId()); | |
43 | + | |
44 | + BaseObjectResponse br = viewFacade.findAntExChu(antExChuModel.getId()); | |
45 | + | |
46 | + if (br.getData() != null && patients != null) { | |
47 | + | |
48 | + if (StringUtils.isNotEmpty(antExChuModel.getId())) { | |
49 | + | |
50 | + String slSql = "select count(*) from lyms_zccz where id = " + antExChuModel.getId() + ""; | |
51 | + ps=conn.prepareStatement(slSql); | |
52 | + rs=ps.executeQuery(); | |
53 | + if(rs.next()){ | |
54 | + count=rs.getInt(1); | |
55 | + } | |
56 | + if(count > 0){//更新数据 | |
57 | + | |
58 | + String upSql = "delete from lyms_zccz where id ="+antExChuModel.getId()+""; | |
59 | + ps = conn.prepareStatement(upSql); | |
60 | + int delCount = ps.executeUpdate(); | |
61 | + if(delCount == 1){ | |
62 | + System.out.print("旧数据删除成功!"); | |
63 | + } | |
64 | + | |
65 | + } | |
66 | + | |
67 | + //新增数据 | |
68 | + Map<String,Object> map = (Map)br.getData(); | |
69 | + List<Map<String,Object>> list = (List)map.get("placentas"); | |
70 | + String fetalPosition = null; | |
71 | + String heartRate = null; | |
72 | + String fetalPresentation = null; | |
73 | + String join1 = null; | |
74 | + | |
75 | + if(list != null && list.size()>0){ | |
76 | + fetalPosition = list.get(0).get("fetalPosition").toString();//胎方位 | |
77 | + heartRate = list.get(0).get("heartRate").toString();//心率 | |
78 | + fetalPresentation = list.get(0).get("fetalPresentation").toString();//胎先露 | |
79 | + join1 = list.get(0).get("join").toString();//衔接 | |
80 | + | |
81 | + } | |
82 | + String inSql = "insert into lyms_zccz(id,name,idcard,vccardno,\n" + | |
83 | + "phone,genRemark,gynRemark,treatmentOpinion3,\n" + | |
84 | + "quicken,quickenRemark,resultSupple,syjgSelect,\n" + | |
85 | + "hivktSelect,neoDeathTodo,birthDefectTodo,neoDeath,\n" + | |
86 | + "birthDefect,dueDate,lastMenses,bg,pastHistory,\n" + | |
87 | + "familyHistory,personalHistory,ymjzHistory,ywgmHistory,\n" + | |
88 | + "fksxHistory,ysfyHistory,cestationInfo,hHealthInfo,\n" + | |
89 | + "pregnancyTimes,prodTime,delivery,planedProd,\n" + | |
90 | + "abortion,stillbirth,stillChan,height,weight,\n" + | |
91 | + "yqWeight,baricIndex,bp,heart,lungs,\n" + | |
92 | + "vulva,vagina,cervical,uterus,fujian,\n" + | |
93 | + "gonggao,fuwei,edema,tireNumber,xhdb,\n" + | |
94 | + "bxbjs,platelet,chgOther,ndb,nt,\n" + | |
95 | + "urineKetone,bld,ncgOther,abo,rh,\n" + | |
96 | + "bloodSugar,xqgbzam,xqgczam,albumin,totalBilirubin,\n" + | |
97 | + "jhBilirubin,ygbmky,ygbmkt,ygeky,ygekt,\n" + | |
98 | + "yghxkt,xqjq,xnsd,hivkt,ydfmw,ydqjd,\n" + | |
99 | + "bChao,heartRate,fetalPosition,fetalPresentation,join1) " + | |
100 | + "values("+antExChuModel.getId()+","+patients.getUsername()+","+patients.getCardNo()+","+patients.getVcCardNo()+",\n" + | |
101 | + ""+patients.getPhone()+","+map.get("genRemark")+","+map.get("gynRemark")+","+map.get("treatmentOpinion3")+",\n" + | |
102 | + ""+map.get("quicken")+","+map.get("quickenRemark")+","+map.get("resultSupple")+","+map.get("syjgSelect")+",\n" + | |
103 | + ""+map.get("hivktSelect")+","+map.get("neoDeathTodo")+","+map.get("birthDefectTodo")+","+map.get("neoDeath")+",\n" + | |
104 | + ""+map.get("birthDefect")+","+map.get("dueDate")+","+map.get("lastMenses")+","+map.get("bg")+","+map.get("pastHistory")+",\n" + | |
105 | + ""+map.get("familyHistory")+","+map.get("personalHistory")+","+map.get("ymjzHistory")+","+map.get("ywgmHistory")+",\n" + | |
106 | + ""+map.get("fksxHistory")+","+map.get("ysfyHistory")+","+map.get("cestationInfo")+","+map.get("hHealthInfo")+",\n" + | |
107 | + ""+map.get("pregnancyTimes")+","+map.get("prodTime")+","+map.get("delivery")+","+map.get("planedProd")+",\n" + | |
108 | + ""+map.get("abortion")+","+map.get("stillbirth")+","+map.get("stillChan")+","+map.get("height")+","+map.get("weight")+",\n" + | |
109 | + ""+map.get("yqWeight")+","+map.get("baricIndex")+","+map.get("bp")+","+map.get("heart")+","+map.get("lungs")+",\n" + | |
110 | + ""+map.get("vulva")+","+map.get("vagina")+","+map.get("cervical")+","+map.get("uterus")+","+map.get("fujian")+",\n" + | |
111 | + ""+map.get("gonggao")+","+map.get("fuwei")+","+map.get("edema")+","+map.get("tireNumber")+","+map.get("xhdb")+",\n" + | |
112 | + ""+map.get("bxbjs")+","+map.get("platelet")+","+map.get("chgOther")+","+map.get("ndb")+","+map.get("nt")+",\n" + | |
113 | + ""+map.get("urineKetone")+","+map.get("bld")+","+map.get("ncgOther")+","+map.get("abo")+","+map.get("rh")+",\n" + | |
114 | + ""+map.get("bloodSugar")+","+map.get("xqgbzam")+","+map.get("xqgczam")+","+map.get("albumin")+","+map.get("totalBilirubin")+",\n" + | |
115 | + ""+map.get("jhBilirubin")+","+map.get("ygbmky")+","+map.get("ygbmkt")+","+map.get("ygeky")+","+map.get("ygekt")+",\n" + | |
116 | + ""+map.get("yghxkt")+","+map.get("xqjq")+","+map.get("xnsd")+","+map.get("hivkt")+","+map.get("ydfmw")+","+map.get("ydqjd")+",\n" + | |
117 | + ""+map.get("bChao")+","+heartRate+","+fetalPosition+","+fetalPresentation+","+join1+")"; | |
118 | + | |
119 | + ps=conn.prepareStatement(inSql); | |
120 | + int result = ps.executeUpdate(); | |
121 | + if(result > 0){ | |
122 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
123 | + br.setErrormsg("成功"); | |
124 | + return br; | |
125 | + } | |
126 | + | |
127 | + | |
128 | + | |
129 | + | |
130 | + | |
131 | + } | |
132 | + | |
133 | + } | |
134 | + | |
135 | + return null; | |
136 | + } catch (Exception e) { | |
137 | + e.printStackTrace(); | |
138 | + }finally { | |
139 | + try{ | |
140 | + ps.close(); | |
141 | + rs.close(); | |
142 | + conn.close(); | |
143 | + }catch (Exception e){ | |
144 | + e.printStackTrace(); | |
145 | + } | |
146 | + | |
147 | + } | |
148 | + return null; | |
149 | + } | |
150 | + | |
151 | + | |
152 | + | |
153 | +} |