Commit 8c253163263b9da9a2a1685f1763cd2a31c97ab8
1 parent
d223d49882
Exists in
master
and in
6 other branches
秦皇岛天英接口修改
Showing 1 changed file with 127 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdTyInterface.java
View file @
8c25316
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | import com.lyms.platform.permission.service.OrganizationService; |
| 14 | 14 | import com.lyms.platform.permission.service.UsersService; |
| 15 | 15 | import com.lyms.platform.pojo.AntExChuModel; |
| 16 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 16 | 17 | import com.lyms.platform.pojo.Patients; |
| 17 | 18 | import org.apache.commons.collections.MapUtils; |
| 18 | 19 | import org.apache.commons.lang.StringUtils; |
| ... | ... | @@ -415,6 +416,132 @@ |
| 415 | 416 | return null; |
| 416 | 417 | } |
| 417 | 418 | |
| 419 | + | |
| 420 | + | |
| 421 | + //复诊 | |
| 422 | + public BaseObjectResponse saveCHANJIAN(AntenatalExaminationModel data){ | |
| 423 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 424 | + Connection conn = ConnTools.makeQhdTyConnection(); | |
| 425 | + PreparedStatement ps = null; | |
| 426 | + ResultSet rs = null; | |
| 427 | + int result = 0; | |
| 428 | + int cjcs = 2; | |
| 429 | + try{ | |
| 430 | + if(data != null){ | |
| 431 | + String selSql = "select count(*) from CHANJIAN where ID='"+data.getId()+"'"; | |
| 432 | + ps = conn.prepareStatement(selSql); | |
| 433 | + rs = ps.executeQuery(); | |
| 434 | + while(rs.next()){ | |
| 435 | + result = rs.getInt(1); | |
| 436 | + } | |
| 437 | + if(result > 0){ | |
| 438 | + String delSql = "delete from CHANJIAN where ID='"+data.getId()+"'"; | |
| 439 | + ps = conn.prepareStatement(delSql); | |
| 440 | + int delCount = ps.executeUpdate(); | |
| 441 | + if(delCount > 0){ | |
| 442 | + System.out.print("复诊数据删除完毕,请重新插入数据!"); | |
| 443 | + } | |
| 444 | + } | |
| 445 | + String selSql2 = "select count(*) from CHANJIAN where ID='"+data.getId()+"'"; | |
| 446 | + ps = conn.prepareStatement(selSql2); | |
| 447 | + rs = ps.executeQuery(); | |
| 448 | + while(rs.next()){ | |
| 449 | + cjcs+=rs.getInt(1); | |
| 450 | + } | |
| 451 | + Patients patients = patientsService.findOnePatientById(data.getParentId()); | |
| 452 | + //插入数据 | |
| 453 | + String inSql = "insert into CHANJIAN(ID,DOCID,IDCARD,CJCS,JCRQ,GWYS,YZZS,YZTS,ZHUSU,TIZHONG,XUEYAGY,XUEYADY,\n" + | |
| 454 | + "GDGD,FUWEI,TAIXUNLV,TAIFANGWEI,XLJXJQK,FUZHONG,XHDBZ,NDB,QTFZJC,BCHAO,XTSC,GWPF,FENLEI,ZHIDAO,\n" + | |
| 455 | + "ZHUANZHEN,ZZUANYIN,ZZJGJKS,YYXCJCRQ,YSQM,JCJG) " + | |
| 456 | + "values(????????????????????????????????)"; | |
| 457 | + ps = conn.prepareStatement(inSql); | |
| 458 | + ps.setString(1,data.getId()); | |
| 459 | + ps.setString(2,patients.getId()); | |
| 460 | + ps.setString(3,patients.getCardNo()); | |
| 461 | + ps.setString(4,String.valueOf(cjcs)); | |
| 462 | + if(data.getCheckDate() != null){ | |
| 463 | + ps.setDate(5, new Date(data.getCheckDate().getTime())); | |
| 464 | + }else{ | |
| 465 | + ps.setNull(5, Types.DATE); | |
| 466 | + } | |
| 467 | + ps.setString(6,null); | |
| 468 | + String cDueWeek = ResolveUtils.getPregnancyWeek(patients.getLastMenses(), data.getCheckDate()); | |
| 469 | + int week = Integer.parseInt(cDueWeek.substring(1, cDueWeek.indexOf("周"))); | |
| 470 | + int day = Integer.parseInt(cDueWeek.substring(cDueWeek.indexOf("+")+1, cDueWeek.indexOf("天"))); | |
| 471 | + ps.setString(7,String.valueOf(week)); | |
| 472 | + ps.setString(8,String.valueOf(day)); | |
| 473 | + ps.setString(9,data.getChiefComplaint()); | |
| 474 | + if(data.getWeight() != null){ | |
| 475 | + ps.setString(10,String.valueOf(data.getWeight())); | |
| 476 | + }else{ | |
| 477 | + ps.setString(10,null); | |
| 478 | + } | |
| 479 | + String ssy = null; | |
| 480 | + String szy = null; | |
| 481 | + if(data.getBp() != null){ | |
| 482 | + Map<String, String> chBpMap = JsonUtil.getMap(data.getBp()); | |
| 483 | + if (MapUtils.isNotEmpty(chBpMap)) { | |
| 484 | + ssy = chBpMap.get("ssy"); | |
| 485 | + szy = chBpMap.get("szy"); | |
| 486 | + } | |
| 487 | + ps.setString(11,ssy); | |
| 488 | + ps.setString(12,szy); | |
| 489 | + }else{ | |
| 490 | + ps.setString(11,ssy); | |
| 491 | + ps.setString(12, szy); | |
| 492 | + } | |
| 493 | + ps.setString(13,data.getGongGao()); | |
| 494 | + ps.setString(14,data.getAbdominalCircumference()); | |
| 495 | + ps.setString(15,null); | |
| 496 | + ps.setString(16,null); | |
| 497 | + ps.setString(17,null); | |
| 498 | + ps.setString(18,null); | |
| 499 | + ps.setString(19,data.getHemoglobin()); | |
| 500 | + ps.setString(20,data.getUrineProtein()); | |
| 501 | + ps.setString(21,null); | |
| 502 | + ps.setString(22,data.getbChao()); | |
| 503 | + ps.setString(23, null); | |
| 504 | + ps.setNull(24, Types.INTEGER); | |
| 505 | + ps.setString(25, null); | |
| 506 | + ps.setString(26, null); | |
| 507 | + ps.setString(27, null); | |
| 508 | + ps.setString(28, null); | |
| 509 | + ps.setString(29,null); | |
| 510 | + if(data.getNextCheckTime() != null){ | |
| 511 | + ps.setDate(30,new Date(data.getNextCheckTime().getTime())); | |
| 512 | + }else{ | |
| 513 | + ps.setNull(30,Types.DATE); | |
| 514 | + } | |
| 515 | + String checkDoctor = ""; | |
| 516 | + | |
| 517 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(data.getCheckDoctor())) { | |
| 518 | + Users users = usersService.getUsers(Integer.parseInt(data.getCheckDoctor())); | |
| 519 | + if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 520 | + checkDoctor = users.getName(); | |
| 521 | + } | |
| 522 | + } | |
| 523 | + ps.setString(31,checkDoctor); | |
| 524 | + String hospital = ""; | |
| 525 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(patients.getHospitalId())) { | |
| 526 | + Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getHospitalId())); | |
| 527 | + if (organization != null && organization.getYn() == YnEnums.YES.getId()) { | |
| 528 | + hospital = organization.getName(); | |
| 529 | + } | |
| 530 | + } | |
| 531 | + ps.setString(32, hospital); | |
| 532 | + int inCount = ps.executeUpdate(); | |
| 533 | + if(inCount > 0){ | |
| 534 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 535 | + br.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
| 536 | + return br; | |
| 537 | + } | |
| 538 | + } | |
| 539 | + }catch (Exception e){ | |
| 540 | + e.printStackTrace(); | |
| 541 | + } | |
| 542 | + | |
| 543 | + return null; | |
| 544 | + } | |
| 418 | 545 | |
| 419 | 546 | |
| 420 | 547 | } |