Commit 6a22d36967fe1817f6d610e727513b928f552f00
1 parent
5667b3eec6
Exists in
master
and in
6 other branches
update code
Showing 1 changed file with 12 additions and 128 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/dzfy/DzfyFmService.java
View file @
6a22d36
| ... | ... | @@ -56,9 +56,8 @@ |
| 56 | 56 | @Autowired |
| 57 | 57 | private BabyBookbuildingFacade babyBookbuildingFacade; |
| 58 | 58 | |
| 59 | - @Autowired | |
| 60 | - private QhdfyHisService qhdfyHisService; | |
| 61 | 59 | |
| 60 | + | |
| 62 | 61 | @Autowired |
| 63 | 62 | private DzfyHisService dzfyHisService; |
| 64 | 63 | |
| 65 | 64 | |
| 66 | 65 | |
| 67 | 66 | |
| 68 | 67 | |
| ... | ... | @@ -111,78 +110,17 @@ |
| 111 | 110 | Date start = new Date(end.getTime()-1000*60*60); |
| 112 | 111 | String startStr = fmt.format(start); |
| 113 | 112 | String endStr = fmt.format(end); |
| 114 | - System.out.println("start="+startStr+"end="+endStr); | |
| 115 | - ExceptionUtils.catchException("start=" + startStr + "end=" + endStr); | |
| 116 | - queryFmPatient(startStr, endStr,null); | |
| 113 | + System.out.println("start=" + startStr + "end=" + endStr); | |
| 114 | + queryFmPatient(startStr, endStr, null); | |
| 117 | 115 | } |
| 118 | 116 | |
| 119 | - public void syncWorker(String startStr,String endStr) { | |
| 120 | - System.out.println("sync start="+startStr+"end="+endStr); | |
| 121 | - ExceptionUtils.catchException("start="+startStr+"end="+endStr); | |
| 122 | - queryFmPatient(startStr, endStr,null); | |
| 123 | - } | |
| 124 | 117 | |
| 125 | - /** | |
| 126 | - * 处理以前没有基本信息的记录 | |
| 127 | - */ | |
| 128 | - public void handleHistorData() | |
| 129 | - { | |
| 130 | - | |
| 131 | - Date birthEnd = new Date(); | |
| 132 | - Date birthStart = new Date(birthEnd.getTime()-1000*60*60*24*30); | |
| 133 | - | |
| 134 | - MongoCondition condition = MongoCondition.newInstance(); | |
| 135 | - Criteria c = null; | |
| 136 | - if (null != birthStart) { | |
| 137 | - c = Criteria.where("time").gte(birthStart); | |
| 138 | - } | |
| 139 | - | |
| 140 | - if (null != birthEnd) { | |
| 141 | - if (null != c) { | |
| 142 | - c = c.lte(birthEnd); | |
| 143 | - } else { | |
| 144 | - c = Criteria.where("time").lte(birthEnd); | |
| 145 | - } | |
| 146 | - } | |
| 147 | - | |
| 148 | - MongoQuery query = new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
| 149 | - | |
| 150 | - List<FmRecordModel> list = babyBookbuildingFacade.queryFmHistoryData(query); | |
| 151 | - if (CollectionUtils.isNotEmpty(list)) | |
| 152 | - { | |
| 153 | - SimpleDateFormat formt = new SimpleDateFormat("yyyy-MM-dd"); | |
| 154 | - String start = null; | |
| 155 | - try { | |
| 156 | - start = formt.format(formt.parse("2000-01-01")); | |
| 157 | - } catch (ParseException e) { | |
| 158 | - e.printStackTrace(); | |
| 159 | - } | |
| 160 | - String end = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 161 | - for (FmRecordModel fm : list) | |
| 162 | - { | |
| 163 | - queryFmPatient(start,end,fm.getSyxh()); | |
| 164 | - } | |
| 165 | - } | |
| 166 | - | |
| 118 | + public void syncByPhone(String startStr,String endStr,String phone) { | |
| 119 | + queryFmPatient(startStr, endStr,phone); | |
| 167 | 120 | } |
| 168 | 121 | |
| 169 | - /** | |
| 170 | - * 删除历史分娩记录 | |
| 171 | - * @param syxh | |
| 172 | - */ | |
| 173 | - private void deleteFmHistoryRecord(String syxh) | |
| 174 | - { | |
| 175 | - MongoCondition condition = MongoCondition.newInstance(); | |
| 176 | - condition = condition.and("syxh", syxh, MongoOper.IS); | |
| 177 | - babyBookbuildingFacade.deleteFmHistoryRecord(condition.toMongoQuery()); | |
| 178 | - } | |
| 122 | + public void queryFmPatient(String start,String end,String phone) { | |
| 179 | 123 | |
| 180 | - public void syncByPhone(String startStr,String endStr,String syxh) { | |
| 181 | - queryFmPatient(startStr, endStr,syxh); | |
| 182 | - } | |
| 183 | - | |
| 184 | - public void queryFmPatient(String start,String end,String syxh) { | |
| 185 | - | |
| 186 | 124 | String cloumns = " ID as ID,\n" + |
| 187 | 125 | " BHNUM as BHNUM,\n" + |
| 188 | 126 | " VCCARDNO as VCCARDNO,\n" + |
| 189 | 127 | |
| 190 | 128 | |
| 191 | 129 | |
| ... | ... | @@ -218,18 +156,17 @@ |
| 218 | 156 | " DELIVER_HOSPITAL as DELIVER_HOSPITAL,\n" + |
| 219 | 157 | " DELIVER_DOCTOR as DELIVER_DOCTOR"; |
| 220 | 158 | |
| 221 | - | |
| 222 | - String idSql = " ID as ID"; | |
| 223 | - | |
| 224 | 159 | Connection conn = com.lyms.hospitalapi.dzfy.ConnTools.makeHisConnection(); |
| 225 | 160 | QueryRunner queryRunner = new QueryRunner(); |
| 226 | 161 | SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 227 | - SimpleDateFormat fmt2 = new SimpleDateFormat("yyyyMMdd"); | |
| 228 | - SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 229 | 162 | try { |
| 230 | - String sql ="select "+idSql+" from zlhis.v_deliveryinfo where " + | |
| 231 | - " to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') > to_date('"+start+"', 'yyyy-mm-dd hh24:mm:ss') and to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') <= to_date('"+end+"', 'yyyy-mm-dd hh24:mm:ss')" ; | |
| 232 | 163 | |
| 164 | + String sql ="select ID as ID from zlhis.v_deliveryinfo where " + | |
| 165 | + " to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') > to_date('"+start+"', 'yyyy-mm-dd hh24:mm:ss') and to_date(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mm:ss') <= to_date('"+end+"', 'yyyy-mm-dd hh24:mm:ss')" ; | |
| 166 | + if (phone != null) | |
| 167 | + { | |
| 168 | + sql+=" and phone = '"+phone+"'"; | |
| 169 | + } | |
| 233 | 170 | List<Fm> list = queryRunner.query(conn, sql, new BeanListHandler<Fm>(Fm.class)); |
| 234 | 171 | ExceptionUtils.catchException("size====" + list.size()); |
| 235 | 172 | |
| ... | ... | @@ -284,7 +221,6 @@ |
| 284 | 221 | continue; |
| 285 | 222 | } |
| 286 | 223 | |
| 287 | - | |
| 288 | 224 | PatientsQuery query = new PatientsQuery(); |
| 289 | 225 | query.setYn(YnEnums.YES.getId()); |
| 290 | 226 | query.setType(1); //孕妇 |
| ... | ... | @@ -504,8 +440,6 @@ |
| 504 | 440 | buildBaby(fmitem, patient,allFm, dueDate, babyName); |
| 505 | 441 | |
| 506 | 442 | } |
| 507 | - | |
| 508 | - | |
| 509 | 443 | } |
| 510 | 444 | |
| 511 | 445 | if(a==0){ |
| 512 | 446 | |
| ... | ... | @@ -516,12 +450,7 @@ |
| 516 | 450 | matDeliverFacade.addOrUpdateMatDeliver(deliverAddRequest, users.get(0).getId()); |
| 517 | 451 | } |
| 518 | 452 | } |
| 519 | - | |
| 520 | - | |
| 521 | 453 | } |
| 522 | - | |
| 523 | - | |
| 524 | - | |
| 525 | 454 | } |
| 526 | 455 | DbUtils.closeQuietly(conn); |
| 527 | 456 | } catch (Exception e) { |
| ... | ... | @@ -571,14 +500,6 @@ |
| 571 | 500 | } |
| 572 | 501 | } |
| 573 | 502 | |
| 574 | - private void saveFmrecord(String syxh,Date time) | |
| 575 | - { | |
| 576 | - FmRecordModel fmRecordModel = new FmRecordModel(); | |
| 577 | - fmRecordModel.setSyxh(syxh); | |
| 578 | - fmRecordModel.setTime(time); | |
| 579 | - babyBookbuildingFacade.saveFmrecord(fmRecordModel); | |
| 580 | - } | |
| 581 | - | |
| 582 | 503 | public void buildBaby(FmItem item,Patients patInfo,Fm fm, Date dueDate, String babyName) |
| 583 | 504 | { |
| 584 | 505 | try{ |
| ... | ... | @@ -613,11 +534,6 @@ |
| 613 | 534 | } |
| 614 | 535 | } |
| 615 | 536 | |
| 616 | - | |
| 617 | - | |
| 618 | - | |
| 619 | - | |
| 620 | - | |
| 621 | 537 | if (org.apache.commons.lang.StringUtils.isNotEmpty(fm.getIDCARD())) |
| 622 | 538 | { |
| 623 | 539 | request.setMommyCertificateTypeId("70ae1d93-2964-46bc-83fa-bec9ff605b1c"); //证件类型 (身份证号码) |
| 624 | 540 | |
| ... | ... | @@ -713,38 +629,6 @@ |
| 713 | 629 | ExceptionUtils.catchException(e, "buildBaby exception"); |
| 714 | 630 | e.printStackTrace(); |
| 715 | 631 | } |
| 716 | - | |
| 717 | - | |
| 718 | 632 | } |
| 719 | - | |
| 720 | - /** | |
| 721 | - *查询通过分娩的syxh来查询对应孕妇的基本信息 | |
| 722 | - * @param syxh | |
| 723 | - * @return | |
| 724 | - */ | |
| 725 | - public FmPatInfo getFmPatInfoById(String syxh) | |
| 726 | - { | |
| 727 | - Connection conn = ConnTools.makeHisConnection(); | |
| 728 | - QueryRunner queryRunner = new QueryRunner(); | |
| 729 | - try { | |
| 730 | - FmPatInfo patInfo = null; | |
| 731 | - | |
| 732 | - List<FmPatInfo> list = queryRunner.query(conn, "SELECT ID as syxh,NAME as name,IDCARD as cardNo,PHONE as phone FROM zlhis.v_deliveryinfo WHERE PHONE is not null and IDCARD is not null and length(PHONE) = 11 and ID = '"+syxh+"'", new BeanListHandler<FmPatInfo>(FmPatInfo.class)); | |
| 733 | - if (CollectionUtils.isNotEmpty(list)) { | |
| 734 | - patInfo = list.get(0); | |
| 735 | - } | |
| 736 | - | |
| 737 | - DbUtils.closeQuietly(conn); | |
| 738 | - return patInfo; | |
| 739 | - | |
| 740 | - } catch (SQLException e) { | |
| 741 | - DbUtils.closeQuietly(conn); | |
| 742 | - e.printStackTrace(); | |
| 743 | - } | |
| 744 | - return null; | |
| 745 | - } | |
| 746 | - | |
| 747 | - | |
| 748 | - | |
| 749 | 633 | } |