Commit d20d5b3d564e3b284617a4a8f576ce87f7ea26f3
1 parent
955bb50313
Exists in
master
and in
6 other branches
承德公共卫生接口第一次产前随访
Showing 1 changed file with 147 additions and 14 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java
View file @
d20d5b3
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | import com.lyms.platform.operate.web.facade.ViewFacade; |
12 | 12 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
13 | 13 | import com.lyms.platform.pojo.AntExChuModel; |
14 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
14 | 15 | import com.lyms.platform.pojo.Patients; |
15 | 16 | import org.apache.commons.dbutils.DbUtils; |
16 | 17 | import org.apache.commons.dbutils.QueryRunner; |
17 | 18 | |
... | ... | @@ -18,17 +19,12 @@ |
18 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
19 | 20 | import org.springframework.stereotype.Service; |
20 | 21 | |
21 | -import java.sql.Connection; | |
22 | -import java.sql.Date; | |
23 | -import java.sql.PreparedStatement; | |
24 | -import java.sql.Types; | |
25 | -import java.sql.ResultSet; | |
22 | +import java.sql.*; | |
26 | 23 | import java.util.Map; |
27 | 24 | |
28 | 25 | /** |
29 | 26 | * Created by Administrator on 2018/6/25. |
30 | 27 | * 承德公共卫生系统接口(gxk) |
31 | - * 保存个人基本信息,保存地址信息 | |
32 | 28 | */ |
33 | 29 | @Service("cdGwInterface") |
34 | 30 | public class CdGwInterface { |
... | ... | @@ -70,7 +66,7 @@ |
70 | 66 | "CONTACT_NAME,CONTACT_TEL_NO,NATIONALITY_CODE,ABO_CODE,RH_CODE,\n" + |
71 | 67 | "EDUCATION_CODE,OCCUPATION_CODE,MARRIAGE_CODE,DRUG_ALLERGY_MARK,OP_HISTORY_MARK,TRAUMA_HISTORY_MARK,\n" + |
72 | 68 | "BLOOD_TRANSF_MARK,GENETIC_DISEASE_HISTORY,OPERATION_HISTORY,Sec_Type_Code,Employer_Tel_No,DELETE_MARK)\n" + |
73 | - "vakues(\""+patient.getHospitalId()+"\",\""+patient.getId()+"\",\""+patient.getVcCardNo()+"\",\"03\",\""+patient.getUsername()+"\",\n" + | |
69 | + "values(\""+patient.getHospitalId()+"\",\""+patient.getId()+"\",\""+patient.getVcCardNo()+"\",\"03\",\""+patient.getUsername()+"\",\n" + | |
74 | 70 | "\"2\",\""+patient.getBirth()+"\",\"01\",\""+patient.getCardNo()+"\",\""+patient.getPworkUnit()+"\",\""+patient.getPhone()+"\",\n" + |
75 | 71 | "\""+patient.getHusbandName()+"\",\""+patient.getHusbandPhone()+"\",\""+patient.getPnationId()+"\",\"5\",\"4\",\n" + |
76 | 72 | "\"\",\""+patient.getPprofessionTypeId()+"\",\"20\",\"0\",\"0\",\"0\",\n" + |
... | ... | @@ -137,7 +133,13 @@ |
137 | 133 | } |
138 | 134 | |
139 | 135 | |
140 | - //第一次产检随访服务 | |
136 | + | |
137 | + | |
138 | + /** | |
139 | + * 第一次产检随访服务(初诊) | |
140 | + * @param antExChuModel | |
141 | + * @return | |
142 | + */ | |
141 | 143 | public BaseObjectResponse saveWOMAN_PREFIRSTVISIT(AntExChuModel antExChuModel){ |
142 | 144 | BaseObjectResponse brp = new BaseObjectResponse(); |
143 | 145 | Connection conn = ConnTools.makeGwConnection(); |
... | ... | @@ -146,6 +148,7 @@ |
146 | 148 | int result = 0; |
147 | 149 | |
148 | 150 | try{ |
151 | + conn.setAutoCommit(false); | |
149 | 152 | Patients patients = patientsService.findOnePatientById(antExChuModel.getParentId()); |
150 | 153 | BaseObjectResponse br = viewFacade.findAntExChu(antExChuModel.getId()); |
151 | 154 | |
152 | 155 | |
153 | 156 | |
154 | 157 | |
155 | 158 | |
156 | 159 | |
... | ... | @@ -347,27 +350,88 @@ |
347 | 350 | ps.setString(79,null); |
348 | 351 | ps.setString(80,null); |
349 | 352 | ps.setString(81,null); |
350 | - ps.setString(82,null); | |
353 | + ps.setString(82, null); | |
351 | 354 | if(map.get("checkDoctor") != null){ |
352 | 355 | ps.setString(83,map.get("checkDoctor").toString()); |
353 | 356 | }else{ |
354 | 357 | ps.setString(83,null); |
355 | 358 | } |
356 | 359 | ps.setDate(84, new Date(antExChuModel.getCheckTime().getTime())); |
357 | - ps.setDate(85,new Date(antExChuModel.getNextCheckTime().getTime())); | |
360 | + ps.setDate(85, new Date(antExChuModel.getNextCheckTime().getTime())); | |
358 | 361 | ps.setString(86,null); |
362 | + ps.executeUpdate(); | |
359 | 363 | |
360 | - int status = ps.executeUpdate(); | |
361 | - if(status > 0){ | |
362 | - System.out.print("保存成功!"); | |
363 | - return br; | |
364 | + //个人史 | |
365 | + if(!"无".equals(map.get("personalHistory").toString()) && StringUtils.isNotEmpty(antExChuModel.getPersonalHistory()) | |
366 | + && !"".equals(antExChuModel.getPersonalHistory())){ | |
367 | + | |
368 | + String inPerSql = "insert into WOMAN_PREFIRST_PERSONAL(LAST_UPDATE_DTIME,ORG_CODE,PREN_VISIT_FORM_NO,\n" + | |
369 | + "ID,HARM_FACTOR_CODE) \n" + | |
370 | + "values(?,?,?,?,?)"; | |
371 | + | |
372 | + ps = conn.prepareStatement(inPerSql); | |
373 | + ps.setDate(1,new Date(antExChuModel.getModified().getTime())); | |
374 | + ps.setString(2, patients.getHospitalId()); | |
375 | + ps.setString(3,antExChuModel.getId()); | |
376 | + ps.setString(4,antExChuModel.getId()); | |
377 | + ps.setString(5,map.get("personalHistory").toString()); | |
378 | + ps.executeUpdate(); | |
364 | 379 | } |
365 | 380 | |
381 | + //既往史 | |
382 | + if(!"无".equals(map.get("pastHistory").toString()) && StringUtils.isNotEmpty(antExChuModel.getPastHistory()) | |
383 | + && !"".equals(antExChuModel.getPastHistory())){ | |
384 | + | |
385 | + String inPastSSql = "insert into WOMAN_PREFIRSTVISIT_DISEASEHIS(LAST_UPDATE_DTIME,ORG_CODE,PREN_VISIT_FORM_NO,\n" + | |
386 | + "ID,PAST_SICKNESS_TYPE_CODE,PAST_SICKNESS_CONFIRM_DATE,PAST_DISEASE_HISTORY) \n" + | |
387 | + "values(?,?,?,?,?,?,?)"; | |
388 | + ps = conn.prepareStatement(inPastSSql); | |
389 | + ps.setDate(1,new Date(antExChuModel.getModified().getTime())); | |
390 | + ps.setString(2, patients.getHospitalId()); | |
391 | + ps.setString(3, antExChuModel.getId()); | |
392 | + ps.setString(4, antExChuModel.getId()); | |
393 | + ps.setString(5,null); | |
394 | + ps.setDate(6, null); | |
395 | + ps.setString(7, map.get("pastHistory").toString()); | |
396 | + ps.executeUpdate(); | |
397 | + | |
398 | + } | |
399 | + | |
400 | + //家族史 | |
401 | + if(!"无".equals(map.get("familyHistory").toString()) && StringUtils.isNotEmpty(antExChuModel.getFamilyHistory()) | |
402 | + && !"".equals(antExChuModel.getFamilyHistory())){ | |
403 | + | |
404 | + String inFamSql = "insert into WOMAN_PREFIRSTVISIT_FAMHIS(LAST_UPDATE_DTIME,ORG_CODE,PREN_VISIT_FORM_NO,\n" + | |
405 | + "ID,PATIENT_RELATION_CODE,FAMILY_DISEASE_HISTORY_CODE,FAMILY_PAST_DISEASE_CODE) \n" + | |
406 | + "values(?,?,?,?,?,?,?)"; | |
407 | + ps = conn.prepareStatement(inFamSql); | |
408 | + ps.setDate(1, new Date(antExChuModel.getModified().getTime())); | |
409 | + ps.setString(2, patients.getHospitalId()); | |
410 | + ps.setString(3, antExChuModel.getId()); | |
411 | + ps.setString(4, antExChuModel.getId()); | |
412 | + ps.setString(5, null); | |
413 | + ps.setString(6,null); | |
414 | + ps.setString(7,null); | |
415 | + ps.executeUpdate(); | |
416 | + | |
417 | + } | |
418 | + | |
419 | + | |
420 | + | |
421 | + | |
422 | + conn.commit();//提交事务 | |
423 | + return br; | |
366 | 424 | } |
367 | 425 | |
368 | 426 | } |
369 | 427 | |
370 | 428 | }catch (Exception e){ |
429 | + try{ | |
430 | + conn.rollback();//出现错误回滚事务 | |
431 | + }catch (SQLException exc){ | |
432 | + exc.printStackTrace(); | |
433 | + } | |
434 | + | |
371 | 435 | e.printStackTrace(); |
372 | 436 | }finally { |
373 | 437 | try{ |
... | ... | @@ -389,6 +453,75 @@ |
389 | 453 | return null; |
390 | 454 | } |
391 | 455 | |
456 | + | |
457 | + | |
458 | + /** | |
459 | + * 非第一次产检随访服务(复诊) | |
460 | + * @param antenatalExaminationModel | |
461 | + * @return | |
462 | + */ | |
463 | + public BaseObjectResponse saveWOMAN_PREOTHERVISIT(AntenatalExaminationModel antenatalExaminationModel){ | |
464 | + | |
465 | + BaseObjectResponse brp = new BaseObjectResponse(); | |
466 | + Connection conn = ConnTools.makeGwConnection(); | |
467 | + PreparedStatement ps = null; | |
468 | + ResultSet rs = null; | |
469 | + int result = 0; | |
470 | + | |
471 | + try{ | |
472 | + conn.setAutoCommit(false); | |
473 | + Patients patients = patientsService.findOnePatientById(antenatalExaminationModel.getParentId()); | |
474 | + | |
475 | + BaseObjectResponse br = viewFacade.findAntenatalExamination(antenatalExaminationModel.getId()); | |
476 | + | |
477 | + if(patients != null && br.getData() != null){ | |
478 | + | |
479 | + if(StringUtils.isNotEmpty(patients.getId()) && StringUtils.isNotEmpty(antenatalExaminationModel.getId())){ | |
480 | + | |
481 | + String selSql = "select count(*) from WOMAN_PREOTHERVISIT where PATIENT_ID=\""+patients.getId()+"\" " + | |
482 | + "and PREN_VISIT_FORM_NO=\""+antenatalExaminationModel.getId()+"\""; | |
483 | + | |
484 | + ps = conn.prepareStatement(selSql); | |
485 | + rs = ps.executeQuery(); | |
486 | + while(rs.next()){ | |
487 | + result = rs.getInt(1); | |
488 | + } | |
489 | + | |
490 | + if(result > 0){ | |
491 | + String delSql = "delete grom WOMAN_PREOTHERVISIT where PATIENT_ID=\""+patients.getId()+"\" " + | |
492 | + "and PREN_VISIT_FORM_NO=\""+antenatalExaminationModel.getId()+"\""; | |
493 | + ps = conn.prepareStatement(delSql); | |
494 | + int delCount =ps.executeUpdate(); | |
495 | + if(delCount > 0){ | |
496 | + System.out.print("复诊数据删除成功,请重新插入!"); | |
497 | + } | |
498 | + } | |
499 | + | |
500 | + //插入数据 | |
501 | + Map<String,Object> map = (Map)br.getData(); | |
502 | + | |
503 | + String inSql = "insert into WOMAN_PREOTHERVISIT(LAST_UPDATE_DTIME,ORG_CODE,PATIENT_ID,PREN_VISIT_FORM_NO,\n" + | |
504 | + "GEST_WEEKS,WEIGHT,CHIEF_COMPLAINT,FUNDUS_HEIGHT,ABDOMEN_CIRCUM,FETUS_POSITION_CODE,FETAL_HEART_RATE,\n" + | |
505 | + "SBP,DBP,HGB,PRO_QUAN_TEST_VALUE,PRO_QUAL_RESULT_CODE,PREG_HEALTH_ABNORM_MARK,PREG_HEALTH_ABNORM_DESCR,\n" + | |
506 | + "REFERRAL_MARK,REFERTO_ORG_NAME,REFERTO_DEPT_NAME,REFERRAL_REASON,VISIT_DOCTOR_NAME,THIS_VISIT_DATE,\n" + | |
507 | + "NEXT_VISIT_DATE) " + | |
508 | + "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
509 | + ps = conn.prepareStatement(inSql); | |
510 | + | |
511 | + } | |
512 | + | |
513 | + } | |
514 | + | |
515 | + | |
516 | + | |
517 | + | |
518 | + | |
519 | + }catch (Exception e){ | |
520 | + e.printStackTrace(); | |
521 | + } | |
522 | + | |
523 | + return null; | |
524 | + } | |
392 | 525 | |
393 | 526 | |
394 | 527 |