Commit 0a3781b6b0390a5c8c85069e7dceaa9c3215c14b
1 parent
f631b82e02
Exists in
master
and in
6 other branches
秦皇岛天英接口修改
Showing 1 changed file with 308 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdTyInterface.java
View file @
0a3781b
1 | 1 | package com.lyms.hospitalapi.qhdfy; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
4 | +import com.lyms.platform.biz.service.PatientsService; | |
4 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
6 | +import com.lyms.platform.common.enums.YnEnums; | |
5 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
8 | +import com.lyms.platform.common.utils.JsonUtil; | |
6 | 9 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
10 | +import com.lyms.platform.operate.web.utils.ResolveUtils; | |
11 | +import com.lyms.platform.permission.model.Organization; | |
12 | +import com.lyms.platform.permission.model.Users; | |
13 | +import com.lyms.platform.permission.service.OrganizationService; | |
14 | +import com.lyms.platform.permission.service.UsersService; | |
15 | +import com.lyms.platform.pojo.AntExChuModel; | |
7 | 16 | import com.lyms.platform.pojo.Patients; |
17 | +import org.apache.commons.collections.MapUtils; | |
18 | +import org.apache.commons.lang.StringUtils; | |
8 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 20 | import org.springframework.stereotype.Service; |
10 | 21 | |
11 | 22 | import java.sql.*; |
23 | +import java.util.Map; | |
12 | 24 | |
13 | 25 | /** |
14 | 26 | * Created by Administrator on 2018/8/27. |
15 | 27 | |
... | ... | @@ -18,7 +30,14 @@ |
18 | 30 | |
19 | 31 | @Autowired |
20 | 32 | private BasicConfigService basicConfigService; |
33 | + @Autowired | |
34 | + private PatientsService patientsService; | |
35 | + @Autowired | |
36 | + private UsersService usersService; | |
37 | + @Autowired | |
38 | + private OrganizationService organizationService; | |
21 | 39 | |
40 | + | |
22 | 41 | /** |
23 | 42 | * 基本信息 |
24 | 43 | * @param patient |
25 | 44 | |
... | ... | @@ -30,8 +49,8 @@ |
30 | 49 | PreparedStatement ps = null; |
31 | 50 | ResultSet rs = null; |
32 | 51 | int result = 0; |
33 | - if(patient != null){ | |
34 | 52 | try{ |
53 | + if(patient != null){ | |
35 | 54 | String selSql = "select count(*) from PERSONS where PK='"+patient.getId()+"'"; |
36 | 55 | ps = conn.prepareStatement(selSql); |
37 | 56 | rs = ps.executeQuery(); |
... | ... | @@ -86,7 +105,8 @@ |
86 | 105 | br.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); |
87 | 106 | return br; |
88 | 107 | } |
89 | - }catch (Exception e){ | |
108 | + } | |
109 | + }catch (Exception e){ | |
90 | 110 | e.printStackTrace(); |
91 | 111 | }finally { |
92 | 112 | try{ |
93 | 113 | |
... | ... | @@ -103,12 +123,297 @@ |
103 | 123 | e.printStackTrace(); |
104 | 124 | } |
105 | 125 | } |
126 | + return null; | |
127 | + } | |
128 | + | |
129 | + | |
130 | + //初诊 | |
131 | + public BaseObjectResponse saveCHUZHENJIANCHA(AntExChuModel antExChuModel){ | |
132 | + BaseObjectResponse br = new BaseObjectResponse(); | |
133 | + Connection conn = ConnTools.makeQhdTyConnection(); | |
134 | + PreparedStatement ps = null; | |
135 | + ResultSet rs = null; | |
136 | + int result = 0; | |
137 | + try{ | |
138 | + if(antExChuModel != null){ | |
139 | + String selSql = "select count(*) from CHUZHENJIANCHA where ID='"+antExChuModel.getId()+"'"; | |
140 | + ps =conn.prepareStatement(selSql); | |
141 | + rs = ps.executeQuery(); | |
142 | + while(rs.next()){ | |
143 | + result = rs.getInt(1); | |
144 | + } | |
145 | + if(result > 0){ | |
146 | + String delSql = "delete from CHUZHENJIANCHA where ID='"+antExChuModel.getId()+"'"; | |
147 | + ps = conn.prepareStatement(delSql); | |
148 | + int delCount = ps.executeUpdate(); | |
149 | + if(delCount > 0){ | |
150 | + System.out.print("初诊数据删除完毕,请重新插入数据!"); | |
151 | + } | |
152 | + } | |
153 | + | |
154 | + Patients patients = patientsService.findOnePatientById(antExChuModel.getParentId()); | |
155 | + if(patients != null){ | |
156 | + //插入数据 | |
157 | + String inSql = "insert into CHUZHENJIANCHA(ID,DOCID,IDCARD,JCRQ,YZZS,YZTS,MCYJ,YCQ,JWSWU,JWSXZB,JWSSZJB,JWSGZJB,\n" + | |
158 | + "JWSGXY,JWSPX,JWSTNB,JWSQT,JWSQTNR,JZSWU,JZSYCXBS,JZSJSJB,JZSQT,JZSQTNR,GRSWU,GRSXY,GRSHJ,GRSFYYW,GRSJCYDYHWZ,\n" + | |
159 | + "GRSJCFSX,GRSQT,GRSQTNR,YMJZSWU,YMJZSFZYM,YMJZSYGYM,YMJZSMZYM,YMJZSPSFDS,YMJZSQT,YMJZSQTNR,YSFYWU,YSFYYOU,\n" + | |
160 | + "YSFYYQ1GY,YSFYYQ2GY,YSFYYQ3GY,YSFYYZQ1GY,YSFYYZQ2GY,YSFYYZQ3GY,BCRSYCQKWU,BCRSYCQKEX,BCRSYCQKOT,BCRSYCQKTT,\n" + | |
161 | + "BCRSYCQKYH,BCRSYCQKXM,BCRSYCQKFZ,BCRSYCQKYDCX,BCRSYCQKFT,BCRSYCQKGNYST,BCRSYCQKQT,BCRSYCQKQTNR,YWGMS,\n" + | |
162 | + "YWGMSBZ,FKSSS,YUNCI,CHANCI,YDFM,PGCCS,LIUCHAN,SITAI,SICHAN,XSESW,CSQX,SHENGAO,TIZHONG,BMI,XUEYADY,XUEYAGY,\n" + | |
163 | + "TZXZYCQK,TZFBYCQK,FKJCWYYCQK,FKJCYDYCQK,FKJCGJYCQK,FKJCZGYCQK,FKJCFJ,GDGD,FW,TAIXINLV,TAIFANGWEI,TAIXIANLU,\n" + | |
164 | + "XHDBZ,BXBJSZ,XXBJSZ,NDB,NT,NTT,NQX,NCGQT,XXABO,XXRH,XUETANG,BCHAO,XQGBZAM,XQGCZAM,BDB,ZDHS,JHDHS,YGBMKY,\n" + | |
165 | + "YGBMKT,YGEKY,YGEKT,YGHXKT,XQJG,XNSD,MDXQXSY,HIVKTJC,YDFMWWJYC,YDFMWDC,YDFMWJSJMJ,YDFMWQT,YDFMWQTNR,YDQJD,\n" + | |
166 | + "GWPF,GWYS,ZTPG,BJZDWU,JKZDGRWS,JKZDXL,JKZDYY,JKZDBLYX,JKZDXCGZ,JKZDQT,JKZDQTNR,ZHENDUAN,CHULIYIJIAN,ZZYUANYIN,\n" + | |
167 | + "ZZJGJKS,YSQM,YYJCRQ,JCJGMC) " + | |
168 | + "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,\n" + | |
169 | + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,\n" + | |
170 | + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
171 | + String cDueWeek = ResolveUtils.getPregnancyWeek(patients.getLastMenses(), antExChuModel.getCheckTime()); | |
172 | + int week = Integer.parseInt(cDueWeek.substring(1, cDueWeek.indexOf("周"))); | |
173 | + int day = Integer.parseInt(cDueWeek.substring(cDueWeek.indexOf("+")+1, cDueWeek.indexOf("天"))); | |
174 | + ps.setString(1,antExChuModel.getId()); | |
175 | + ps.setString(2,patients.getId()); | |
176 | + ps.setString(3, patients.getCardNo()); | |
177 | + ps.setDate(4, new Date(antExChuModel.getCheckTime().getTime())); | |
178 | + ps.setInt(5, week); | |
179 | + ps.setInt(6, day); | |
180 | + ps.setDate(7, new Date(patients.getLastMenses().getTime())); | |
181 | + ps.setDate(8, new Date(patients.getDueDate().getTime())); | |
182 | + ps.setString(9, null); | |
183 | + ps.setString(10, null); | |
184 | + ps.setString(11, null); | |
185 | + ps.setString(12, null); | |
186 | + ps.setString(13, null); | |
187 | + ps.setString(14, null); | |
188 | + ps.setString(15, null); | |
189 | + ps.setString(16, null); | |
190 | + ps.setString(17, null); | |
191 | + ps.setString(18, null); | |
192 | + ps.setString(19, null); | |
193 | + ps.setString(20, null); | |
194 | + ps.setString(21, null); | |
195 | + ps.setString(22, null); | |
196 | + ps.setString(23, null); | |
197 | + ps.setString(24, null); | |
198 | + ps.setString(25, null); | |
199 | + ps.setString(26, null); | |
200 | + ps.setString(27, null); | |
201 | + ps.setString(28, null); | |
202 | + ps.setString(29, null); | |
203 | + ps.setString(30, null); | |
204 | + ps.setString(31, null); | |
205 | + ps.setString(32, null); | |
206 | + ps.setString(33, null); | |
207 | + ps.setString(34, null); | |
208 | + ps.setString(35, null); | |
209 | + ps.setString(36, null); | |
210 | + ps.setString(37, null); | |
211 | + ps.setString(38, null); | |
212 | + ps.setString(39, null); | |
213 | + ps.setString(40, null); | |
214 | + ps.setString(41, null); | |
215 | + ps.setString(42, null); | |
216 | + ps.setString(43, null); | |
217 | + ps.setString(44, null); | |
218 | + ps.setString(45, null); | |
219 | + ps.setString(46, null); | |
220 | + ps.setString(47, null); | |
221 | + ps.setString(48, null); | |
222 | + ps.setString(49, null); | |
223 | + ps.setString(50, null); | |
224 | + ps.setString(51, null); | |
225 | + ps.setString(52, null); | |
226 | + ps.setString(53, null); | |
227 | + ps.setString(54, null); | |
228 | + ps.setString(55, null); | |
229 | + ps.setString(56, null); | |
230 | + ps.setString(57, null); | |
231 | + ps.setString(58, null); | |
232 | + ps.setString(59, null); | |
233 | + ps.setString(60,null); | |
234 | + if(antExChuModel.getPregnancyTimes() != null){ | |
235 | + ps.setString(61,String.valueOf(antExChuModel.getPregnancyTimes())); | |
236 | + }else{ | |
237 | + ps.setString(61,null); | |
238 | + } | |
239 | + if(antExChuModel.getProdTime() != null){ | |
240 | + ps.setString(62,String.valueOf(antExChuModel.getProdTime())); | |
241 | + }else{ | |
242 | + ps.setString(62,null); | |
243 | + } | |
244 | + if(antExChuModel.getDelivery() != null){ | |
245 | + ps.setString(63,String.valueOf(antExChuModel.getDelivery())); | |
246 | + }else{ | |
247 | + ps.setString(63,null); | |
248 | + } | |
249 | + if(antExChuModel.getPlanedProd() != null){ | |
250 | + ps.setString(64,String.valueOf(antExChuModel.getPlanedProd())); | |
251 | + }else{ | |
252 | + ps.setString(64,null); | |
253 | + } | |
254 | + if(antExChuModel.getAbortion() != null){ | |
255 | + ps.setString(65,String.valueOf(antExChuModel.getAbortion())); | |
256 | + }else{ | |
257 | + ps.setString(65,null); | |
258 | + } | |
259 | + if(antExChuModel.getStillbirth() != null){ | |
260 | + ps.setString(66,String.valueOf(antExChuModel.getStillbirth())); | |
261 | + }else{ | |
262 | + ps.setString(66,null); | |
263 | + } | |
264 | + if(antExChuModel.getStillChan() != null){ | |
265 | + ps.setString(67,String.valueOf(antExChuModel.getStillChan())); | |
266 | + }else{ | |
267 | + ps.setString(67,null); | |
268 | + } | |
269 | + if(antExChuModel.getNeoDeath() != null){ | |
270 | + ps.setString(68,String.valueOf(antExChuModel.getNeoDeath())); | |
271 | + }else{ | |
272 | + ps.setString(68,null); | |
273 | + } | |
274 | + if(antExChuModel.getBirthDefect() != null){ | |
275 | + ps.setString(69,String.valueOf(antExChuModel.getBirthDefect())); | |
276 | + }else{ | |
277 | + ps.setString(69,null); | |
278 | + } | |
279 | + if(antExChuModel.getHeight() != null){ | |
280 | + ps.setString(70,String.valueOf(antExChuModel.getHeight())); | |
281 | + }else{ | |
282 | + ps.setString(70,null); | |
283 | + } | |
284 | + if(antExChuModel.getWeight() != null){ | |
285 | + ps.setString(71,String.valueOf(antExChuModel.getWeight())); | |
286 | + }else{ | |
287 | + ps.setString(71,null); | |
288 | + } | |
289 | + if(antExChuModel.getHeight() != null && antExChuModel.getWeight() != null){ | |
290 | + Double wh = Double.parseDouble(antExChuModel.getHeight()) / 100; | |
291 | + Double shen = wh * wh; | |
292 | + Double bmi = Double.parseDouble(antExChuModel.getWeight()) / shen; | |
293 | + ps.setString(72,String.valueOf(bmi)); | |
294 | + }else{ | |
295 | + ps.setString(72,null); | |
296 | + } | |
297 | + String ssy = null; | |
298 | + String szy = null; | |
299 | + if(antExChuModel.getBp() != null){ | |
300 | + Map<String, String> chBpMap = JsonUtil.getMap(antExChuModel.getBp()); | |
301 | + if (MapUtils.isNotEmpty(chBpMap)) { | |
302 | + ssy = chBpMap.get("ssy"); | |
303 | + szy = chBpMap.get("szy"); | |
304 | + } | |
305 | + ps.setString(73,ssy); | |
306 | + ps.setString(74,szy); | |
307 | + }else{ | |
308 | + ps.setString(73,ssy); | |
309 | + ps.setString(74,szy); | |
310 | + } | |
311 | + ps.setString(75,antExChuModel.getHeart()); | |
312 | + ps.setString(76,antExChuModel.getLungs()); | |
313 | + ps.setString(77,antExChuModel.getVulva()); | |
314 | + ps.setString(78,antExChuModel.getVagina()); | |
315 | + ps.setString(79,antExChuModel.getCervical()); | |
316 | + ps.setString(80,antExChuModel.getUterus()); | |
317 | + ps.setString(81,antExChuModel.getFujian()); | |
318 | + ps.setString(82,antExChuModel.getGonggao()); | |
319 | + ps.setString(83,antExChuModel.getFuwei()); | |
320 | + ps.setString(84,null); | |
321 | + ps.setString(85,null); | |
322 | + ps.setString(86,null); | |
323 | + ps.setString(87,antExChuModel.getXhdb()); | |
324 | + ps.setString(88,antExChuModel.getBxbjs()); | |
325 | + ps.setString(89,antExChuModel.getPlatelet()); | |
326 | + ps.setString(90,antExChuModel.getNdb()); | |
327 | + ps.setString(91,antExChuModel.getNt()); | |
328 | + ps.setString(92,antExChuModel.getUrineKetone()); | |
329 | + ps.setString(93,antExChuModel.getBld()); | |
330 | + ps.setString(94,antExChuModel.getNcgOther()); | |
331 | + ps.setString(95,antExChuModel.getAbo()); | |
332 | + ps.setString(96,antExChuModel.getRh()); | |
333 | + ps.setString(97,antExChuModel.getBloodSugar()); | |
334 | + ps.setString(98,antExChuModel.getbChao()); | |
335 | + ps.setString(99,antExChuModel.getXqgbzam()); | |
336 | + ps.setString(100,antExChuModel.getXqgczam()); | |
337 | + ps.setString(101,antExChuModel.getAlbumin()); | |
338 | + ps.setString(102,antExChuModel.getTotalBilirubin()); | |
339 | + ps.setString(103,antExChuModel.getJhBilirubin()); | |
340 | + ps.setString(104,antExChuModel.getYgbmky()); | |
341 | + ps.setString(105,antExChuModel.getYgbmkt()); | |
342 | + ps.setString(106,antExChuModel.getYgeky()); | |
343 | + ps.setString(107,antExChuModel.getYgekt()); | |
344 | + ps.setString(108,antExChuModel.getYghxkt()); | |
345 | + ps.setString(109,antExChuModel.getXqjq()); | |
346 | + ps.setString(110,antExChuModel.getXnsd()); | |
347 | + ps.setString(111,antExChuModel.getSyjg()); | |
348 | + ps.setString(112,antExChuModel.getHivkt()); | |
349 | + String ydfmw = ""; | |
350 | + String ydqjd = ""; | |
351 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(antExChuModel.getYdfmw())) | |
352 | + | |
353 | + { | |
354 | + Map ydfmwMap = JsonUtil.str2Obj(antExChuModel.getYdfmw(), Map.class); | |
355 | + ydfmw = ResolveUtils.replaceYDFMW(ydfmwMap, 1); | |
356 | + ydqjd = ResolveUtils.replaceYDFMW(ydfmwMap, 2); | |
357 | + } | |
358 | + | |
359 | + ps.setString(113,null); | |
360 | + ps.setString(114,null); | |
361 | + ps.setString(115,null); | |
362 | + ps.setString(116,null); | |
363 | + ps.setString(117,null); | |
364 | + ps.setString(118,ydqjd); | |
365 | + ps.setNull(119, Types.INTEGER); | |
366 | + ps.setString(120, null); | |
367 | + ps.setString(121, null); | |
368 | + ps.setString(122, null); | |
369 | + ps.setString(123, null); | |
370 | + ps.setString(124, null); | |
371 | + ps.setString(125, null); | |
372 | + ps.setString(126, null); | |
373 | + ps.setString(127, null); | |
374 | + ps.setString(128, null); | |
375 | + ps.setString(129, null); | |
376 | + ps.setString(130,antExChuModel.getDiagnosis()); | |
377 | + ps.setString(131,antExChuModel.getTreatOpinion()); | |
378 | + ps.setString(132,null); | |
379 | + ps.setString(133,null); | |
380 | + String checkDoctor = ""; | |
381 | + | |
382 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(antExChuModel.getProdDoctor())) { | |
383 | + Users users = usersService.getUsers(Integer.parseInt(antExChuModel.getProdDoctor())); | |
384 | + if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
385 | + checkDoctor = users.getName(); | |
386 | + } | |
387 | + } | |
388 | + ps.setString(134, checkDoctor); | |
389 | + if(antExChuModel.getNextCheckTime() != null){ | |
390 | + ps.setDate(135,new Date(antExChuModel.getNextCheckTime().getTime())); | |
391 | + }else{ | |
392 | + ps.setNull(135,Types.DATE); | |
393 | + } | |
394 | + String hospital = ""; | |
395 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getHospitalId())) { | |
396 | + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getHospitalId())); | |
397 | + if (organization != null && organization.getYn() == YnEnums.YES.getId()) { | |
398 | + hospital = organization.getName(); | |
399 | + } | |
400 | + } | |
401 | + ps.setString(136, hospital); | |
402 | + int inCount = ps.executeUpdate(); | |
403 | + if(inCount > 0){ | |
404 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
405 | + br.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
406 | + return br; | |
407 | + } | |
408 | + } | |
409 | + } | |
410 | + }catch (Exception e){ | |
411 | + e.printStackTrace(); | |
106 | 412 | } |
107 | 413 | |
108 | 414 | |
109 | 415 | return null; |
110 | 416 | } |
111 | - | |
112 | 417 | |
113 | 418 | |
114 | 419 |