Commit 47d649fadbee9f186f2d1ac7ea9176cb53f10960
1 parent
890c1a1c97
Exists in
master
and in
1 other branch
修改新电子病历
Showing 1 changed file with 108 additions and 67 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
47d649f
| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | import com.lyms.platform.biz.service.*; |
| 4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 5 | import com.lyms.platform.common.enums.*; |
| 6 | -import com.lyms.platform.common.result.BaseListResponse; | |
| 7 | 6 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 8 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 9 | 8 | import com.lyms.platform.common.utils.Assert; |
| ... | ... | @@ -241,7 +240,47 @@ |
| 241 | 240 | * @return |
| 242 | 241 | */ |
| 243 | 242 | public HighScoreResult findLastRisk(String pid, boolean needLevel) { |
| 244 | - HighScoreResult highScoreResult = getPatLastRiskByDate(pid, needLevel, null); | |
| 243 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 244 | + matDeliverQuery.setPid(pid); | |
| 245 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
| 246 | + List<SortIn> listDate = new ArrayList<>(); | |
| 247 | + //分娩记录 | |
| 248 | + List<MaternalDeliverModel> modelList = matDeliverService.query(matDeliverQuery); | |
| 249 | + if(CollectionUtils.isNotEmpty(modelList)){ | |
| 250 | + for (MaternalDeliverModel model : modelList) { | |
| 251 | + listDate.add(new SortIn(model)); | |
| 252 | + } | |
| 253 | + } | |
| 254 | + | |
| 255 | + //终止妊娠记录 | |
| 256 | + StopPregQuery query = new StopPregQuery(); | |
| 257 | + query.setYn(YnEnums.YES.getId()); | |
| 258 | + query.setPid(pid); | |
| 259 | + List<StopPregModel> stopPregs = stopPregnancyService.queryStopPreg(query); | |
| 260 | + if(CollectionUtils.isNotEmpty(stopPregs)) { | |
| 261 | + for (StopPregModel stopPregModel : stopPregs) { | |
| 262 | + listDate.add(new SortIn(stopPregModel)); | |
| 263 | + } | |
| 264 | + } | |
| 265 | + PatientsQuery patientsQuery=new PatientsQuery(); | |
| 266 | + patientsQuery.setPid(pid); | |
| 267 | + patientsQuery.setType(3); | |
| 268 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 269 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 270 | + if(CollectionUtils.isNotEmpty(patientses)) { | |
| 271 | + for (Patients patients : patientses) { | |
| 272 | + listDate.add(new SortIn(patients, 1)); | |
| 273 | + } | |
| 274 | + } | |
| 275 | + //排序集合 | |
| 276 | + sortList(listDate); | |
| 277 | + | |
| 278 | + Date max = null; | |
| 279 | + if (!listDate.isEmpty()) { | |
| 280 | + max = listDate.get(0).getDate(); | |
| 281 | + } | |
| 282 | + | |
| 283 | + HighScoreResult highScoreResult = getPatLastRiskByDate(pid, needLevel, max); | |
| 245 | 284 | return highScoreResult; |
| 246 | 285 | } |
| 247 | 286 | |
| 248 | 287 | |
| 249 | 288 | |
| 250 | 289 | |
| 251 | 290 | |
| 252 | 291 | |
| 253 | 292 | |
| ... | ... | @@ -426,31 +465,30 @@ |
| 426 | 465 | //需要过滤掉建档就分娩的情况 |
| 427 | 466 | Date dueDate = new Date(); |
| 428 | 467 | if (CollectionUtils.isNotEmpty(listDate)) { |
| 429 | - String pid=""; | |
| 468 | + String pid = ""; | |
| 430 | 469 | for (int i = 0; i < listDate.size(); i++) { |
| 431 | 470 | dueDate = listDate.get(i).getDate(); |
| 432 | - Date end =new Date(listDate.get(i).getDate().getTime()+86398000); | |
| 471 | + Date end = new Date(listDate.get(i).getDate().getTime() + 86398000); | |
| 433 | 472 | List listData = new ArrayList(); |
| 434 | 473 | Organization organization = null; |
| 435 | 474 | PatientsQuery patientsQuery1 = new PatientsQuery(); |
| 436 | 475 | patientsQuery1.setBookbuildingDateEnd(end); |
| 437 | 476 | if (listDate.size() > i + 1) { |
| 438 | - patientsQuery1.setBookbuildingDateStart(new Date(listDate.get(i + 1).getDate().getTime()+86398000)); | |
| 477 | + patientsQuery1.setBookbuildingDateStart(new Date(listDate.get(i + 1).getDate().getTime() + 86398000)); | |
| 439 | 478 | }/*else if(listDate.size()==i){ |
| 440 | 479 | patientsQuery1.setBookbuildingDateStart(new Date()); |
| 441 | 480 | }*/ |
| 442 | - pid=list.get(0).getPid(); | |
| 481 | + pid = list.get(0).getPid(); | |
| 443 | 482 | patientsQuery1.setPid(pid); |
| 444 | 483 | List<Patients> patientses = patientsService.queryPatient1(patientsQuery1); |
| 445 | - if(CollectionUtils.isNotEmpty(patientses)){ | |
| 446 | - Iterator<Patients> iterator=patientses.iterator(); | |
| 447 | - while(iterator.hasNext()){ | |
| 448 | - Patients patients= iterator.next(); | |
| 484 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 485 | + Iterator<Patients> iterator = patientses.iterator(); | |
| 486 | + while (iterator.hasNext()) { | |
| 487 | + Patients patients = iterator.next(); | |
| 449 | 488 | //处理建档就分娩的情况 |
| 450 | - Date date = DateUtil.addWeek(patients.getLastMenses(),42); | |
| 489 | + Date date = DateUtil.addWeek(patients.getLastMenses(), 42); | |
| 451 | 490 | Date currentDate = DateUtil.formatDate(patients.getBookbuildingDate()); |
| 452 | - if (date.getTime() <= currentDate.getTime()) | |
| 453 | - { | |
| 491 | + if (date.getTime() <= currentDate.getTime()) { | |
| 454 | 492 | //建档记录 |
| 455 | 493 | if (null != patients.getHospitalId()) { |
| 456 | 494 | organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId())); |
| 457 | 495 | |
| 458 | 496 | |
| 459 | 497 | |
| 460 | 498 | |
| 461 | 499 | |
| 462 | 500 | |
| ... | ... | @@ -479,30 +517,30 @@ |
| 479 | 517 | } |
| 480 | 518 | } |
| 481 | 519 | sortList.add(listData); |
| 482 | - listData=new ArrayList(); | |
| 520 | + listData = new ArrayList(); | |
| 483 | 521 | } |
| 484 | 522 | } |
| 485 | 523 | } |
| 486 | 524 | |
| 487 | - if(CollectionUtils.isNotEmpty(patientses)){ | |
| 525 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 488 | 526 | |
| 489 | - List<SortIn> tmp =new ArrayList(); | |
| 490 | - for(Patients patients:patientses){ | |
| 527 | + List<SortIn> tmp = new ArrayList(); | |
| 528 | + for (Patients patients : patientses) { | |
| 491 | 529 | tmp.add(new SortIn(patients)); |
| 492 | 530 | } |
| 493 | 531 | sortList(tmp); |
| 494 | - Date min=null; | |
| 495 | - if(!tmp.isEmpty()){ | |
| 496 | - min=tmp.get(tmp.size()-1).getDate(); | |
| 532 | + Date min = null; | |
| 533 | + if (!tmp.isEmpty()) { | |
| 534 | + min = tmp.get(tmp.size() - 1).getDate(); | |
| 497 | 535 | } |
| 498 | 536 | //分娩前的数据 |
| 499 | - buildPatientList(dueDate,patientses,listData,min,false); | |
| 537 | + buildPatientList(dueDate, patientses, listData, min, false); | |
| 500 | 538 | |
| 501 | 539 | PostReviewQuery postReviewQuery = new PostReviewQuery(); |
| 502 | 540 | postReviewQuery.setStart(dueDate); |
| 503 | - if ( i>0) { | |
| 541 | + if (i > 0) { | |
| 504 | 542 | //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示 |
| 505 | - postReviewQuery.setEnd(listDate.get(i-1).getDate()); | |
| 543 | + postReviewQuery.setEnd(listDate.get(i - 1).getDate()); | |
| 506 | 544 | } |
| 507 | 545 | postReviewQuery.setPid(pid); |
| 508 | 546 | Object obj = map.get(listDate.get(i).getId()); |
| 509 | 547 | |
| 510 | 548 | |
| 511 | 549 | |
| 512 | 550 | |
| 513 | 551 | |
| 514 | 552 | |
| 515 | 553 | |
| ... | ... | @@ -523,45 +561,45 @@ |
| 523 | 561 | } |
| 524 | 562 | } |
| 525 | 563 | } |
| 526 | - if(!listData.isEmpty()){ | |
| 564 | + if (!listData.isEmpty()) { | |
| 527 | 565 | sort(listData); |
| 528 | 566 | sortList.add(listData); |
| 529 | 567 | } |
| 530 | 568 | } |
| 531 | - PatientsQuery patientsQuery1=new PatientsQuery(); | |
| 569 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 532 | 570 | patientsQuery1.setYn(YnEnums.YES.getId()); |
| 533 | 571 | patientsQuery1.setPid(pid); |
| 534 | 572 | patientsQuery1.setBookbuildingDateStart(new Date(listDate.get(0).getDate().getTime())); |
| 535 | 573 | patientsQuery1.setType(1); |
| 536 | - List<Patients> patientsList = patientsService.queryPatient(patientsQuery1); | |
| 537 | - List list1=new ArrayList(); | |
| 538 | - List<SortIn> tmp =new ArrayList(); | |
| 539 | - for(Patients patients:patientsList){ | |
| 574 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery1); | |
| 575 | + List list1 = new ArrayList(); | |
| 576 | + List<SortIn> tmp = new ArrayList(); | |
| 577 | + for (Patients patients : patientsList) { | |
| 540 | 578 | tmp.add(new SortIn(patients)); |
| 541 | 579 | } |
| 542 | 580 | sortList(tmp); |
| 543 | - Date min=null; | |
| 544 | - if(!tmp.isEmpty()){ | |
| 545 | - min=tmp.get(tmp.size()-1).getDate(); | |
| 581 | + Date min = null; | |
| 582 | + if (!tmp.isEmpty()) { | |
| 583 | + min = tmp.get(tmp.size() - 1).getDate(); | |
| 546 | 584 | } |
| 547 | - List l= buildPatientList(new Date(), patientsList, list1,min,false); | |
| 548 | - if(!l.isEmpty()){ | |
| 585 | + List l = buildPatientList(new Date(), patientsList, list1, min, false); | |
| 586 | + if (!l.isEmpty()) { | |
| 549 | 587 | sort(l); |
| 550 | 588 | sortList.add(l); |
| 551 | 589 | } |
| 552 | - }else{ | |
| 553 | - List list1=new ArrayList(); | |
| 554 | - List<SortIn> tmp =new ArrayList(); | |
| 555 | - for(Patients patients:list){ | |
| 590 | + } else { | |
| 591 | + List list1 = new ArrayList(); | |
| 592 | + List<SortIn> tmp = new ArrayList(); | |
| 593 | + for (Patients patients : list) { | |
| 556 | 594 | tmp.add(new SortIn(patients)); |
| 557 | 595 | } |
| 558 | 596 | sortList(tmp); |
| 559 | - Date min=null; | |
| 560 | - if(!tmp.isEmpty()){ | |
| 561 | - min=tmp.get(tmp.size()-1).getDate(); | |
| 597 | + Date min = null; | |
| 598 | + if (!tmp.isEmpty()) { | |
| 599 | + min = tmp.get(tmp.size() - 1).getDate(); | |
| 562 | 600 | } |
| 563 | - List l=buildPatientList(dueDate, list, list1,min,true); | |
| 564 | - if(!l.isEmpty()){ | |
| 601 | + List l = buildPatientList(dueDate, list, list1, min, true); | |
| 602 | + if (!l.isEmpty()) { | |
| 565 | 603 | sort(l); |
| 566 | 604 | sortList.add(l); |
| 567 | 605 | } |
| 568 | 606 | |
| 569 | 607 | |
| 570 | 608 | |
| ... | ... | @@ -570,18 +608,19 @@ |
| 570 | 608 | antexListResult.setData(sortList); |
| 571 | 609 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(antexListResult); |
| 572 | 610 | } |
| 573 | - private void sort(List<AntData> listData){ | |
| 611 | + | |
| 612 | + private void sort(List<AntData> listData) { | |
| 574 | 613 | Collections.sort(listData, new Comparator<AntData>() { |
| 575 | 614 | @Override |
| 576 | 615 | public int compare(AntData o1, AntData o2) { |
| 577 | 616 | |
| 578 | - if(Integer.valueOf(o1.getType())>Integer.valueOf(o2.getType())){ | |
| 617 | + if (Integer.valueOf(o1.getType()) > Integer.valueOf(o2.getType())) { | |
| 579 | 618 | return 1; |
| 580 | 619 | } |
| 581 | - if(Integer.valueOf(o1.getType())<Integer.valueOf(o2.getType())){ | |
| 620 | + if (Integer.valueOf(o1.getType()) < Integer.valueOf(o2.getType())) { | |
| 582 | 621 | return -1; |
| 583 | 622 | } |
| 584 | - if(Integer.valueOf(o1.getType())==Integer.valueOf(o2.getType())) { | |
| 623 | + if (Integer.valueOf(o1.getType()) == Integer.valueOf(o2.getType())) { | |
| 585 | 624 | if (o1.getCreated().after(o2.getCreated())) { |
| 586 | 625 | return 1; |
| 587 | 626 | } |
| ... | ... | @@ -595,9 +634,8 @@ |
| 595 | 634 | } |
| 596 | 635 | |
| 597 | 636 | |
| 598 | - | |
| 599 | - private List buildPatientList(Date end, List<Patients> patientses,List listData,Date min,boolean f) { | |
| 600 | - if(CollectionUtils.isEmpty(patientses)){ | |
| 637 | + private List buildPatientList(Date end, List<Patients> patientses, List listData, Date min, boolean f) { | |
| 638 | + if (CollectionUtils.isEmpty(patientses)) { | |
| 601 | 639 | return listData; |
| 602 | 640 | } |
| 603 | 641 | Organization organization = null; |
| 604 | 642 | |
| ... | ... | @@ -616,11 +654,11 @@ |
| 616 | 654 | //初诊记录 |
| 617 | 655 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
| 618 | 656 | antExChuQuery.setYn(YnEnums.YES.getId()); |
| 619 | - if(!f){ | |
| 620 | - if(null==min){ | |
| 657 | + if (!f) { | |
| 658 | + if (null == min) { | |
| 621 | 659 | antExChuQuery.setStart(patientses.get(0).getBookbuildingDate()); |
| 622 | - antExChuQuery.setEnd(new Date(end.getTime()+86398000)); | |
| 623 | - }else{ | |
| 660 | + antExChuQuery.setEnd(new Date(end.getTime() + 86398000)); | |
| 661 | + } else { | |
| 624 | 662 | antExChuQuery.setStart(min); |
| 625 | 663 | antExChuQuery.setEnd(end); |
| 626 | 664 | } |
| ... | ... | @@ -641,7 +679,7 @@ |
| 641 | 679 | AntExQuery antExQuery = new AntExQuery(); |
| 642 | 680 | antExQuery.setYn(YnEnums.YES.getId()); |
| 643 | 681 | antExQuery.setPid(pid); |
| 644 | - if(!f) { | |
| 682 | + if (!f) { | |
| 645 | 683 | if (null == min) { |
| 646 | 684 | antExQuery.setStart(patientses.get(0).getBookbuildingDate()); |
| 647 | 685 | antExQuery.setEnd(new Date(end.getTime() + 86398000)); |
| ... | ... | @@ -688,7 +726,11 @@ |
| 688 | 726 | this.date = patients.getBookbuildingDate(); |
| 689 | 727 | this.type = 2; |
| 690 | 728 | } |
| 691 | - | |
| 729 | + public SortIn(Patients patients,int i) { | |
| 730 | + this.id = patients.getId(); | |
| 731 | + this.date = patients.getFmDate(); | |
| 732 | + this.type = 2; | |
| 733 | + } | |
| 692 | 734 | public SortIn(StopPregModel stopPregModel) { |
| 693 | 735 | this.id = stopPregModel.getId(); |
| 694 | 736 | this.date = stopPregModel.getStopDate(); |
| 695 | 737 | |
| 696 | 738 | |
| 697 | 739 | |
| 698 | 740 | |
| 699 | 741 | |
| 700 | 742 | |
| 701 | 743 | |
| 702 | 744 | |
| ... | ... | @@ -992,44 +1034,43 @@ |
| 992 | 1034 | } |
| 993 | 1035 | |
| 994 | 1036 | |
| 995 | - MatDeliverQuery matDeliverQuery=new MatDeliverQuery(); | |
| 1037 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 996 | 1038 | |
| 997 | 1039 | matDeliverQuery.setPid(patients.getPid()); |
| 998 | 1040 | matDeliverQuery.setYn(YnEnums.YES.getId()); |
| 999 | 1041 | |
| 1000 | - List<MaternalDeliverModel> list1 = matDeliverService.query(matDeliverQuery); | |
| 1042 | + List<MaternalDeliverModel> list1 = matDeliverService.query(matDeliverQuery); | |
| 1001 | 1043 | |
| 1002 | - StopPregQuery stopPregQuery=new StopPregQuery(); | |
| 1044 | + StopPregQuery stopPregQuery = new StopPregQuery(); | |
| 1003 | 1045 | |
| 1004 | 1046 | stopPregQuery.setPid(patients.getPid()); |
| 1005 | 1047 | stopPregQuery.setYn(YnEnums.YES.getId()); |
| 1006 | 1048 | |
| 1007 | - List<StopPregModel> list2= stopPregnancyService.queryStopPreg(stopPregQuery); | |
| 1049 | + List<StopPregModel> list2 = stopPregnancyService.queryStopPreg(stopPregQuery); | |
| 1008 | 1050 | |
| 1009 | 1051 | |
| 1010 | 1052 | List<SortIn> sortList = new ArrayList<>(); |
| 1011 | - if(CollectionUtils.isNotEmpty(list1)){ | |
| 1012 | - for(MaternalDeliverModel model:list1){ | |
| 1053 | + if (CollectionUtils.isNotEmpty(list1)) { | |
| 1054 | + for (MaternalDeliverModel model : list1) { | |
| 1013 | 1055 | sortList.add(new SortIn(model)); |
| 1014 | 1056 | } |
| 1015 | 1057 | |
| 1016 | 1058 | } |
| 1017 | - if(CollectionUtils.isNotEmpty(list2)) { | |
| 1059 | + if (CollectionUtils.isNotEmpty(list2)) { | |
| 1018 | 1060 | for (StopPregModel model : list2) { |
| 1019 | 1061 | sortList.add(new SortIn(model)); |
| 1020 | 1062 | } |
| 1021 | 1063 | } |
| 1022 | 1064 | |
| 1023 | 1065 | |
| 1024 | - | |
| 1025 | 1066 | AntexListResult antexListResult = new AntexListResult(); |
| 1026 | 1067 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
| 1027 | 1068 | antExChuQuery.setPid(patients.getPid()); |
| 1028 | 1069 | antExChuQuery.setYn(YnEnums.YES.getId()); |
| 1029 | - Date max=null; | |
| 1030 | - if(!sortList.isEmpty()){ | |
| 1070 | + Date max = null; | |
| 1071 | + if (!sortList.isEmpty()) { | |
| 1031 | 1072 | sortList(sortList); |
| 1032 | - max =new Date( sortList.get(0).getDate().getTime()+400000); | |
| 1073 | + max = new Date(sortList.get(0).getDate().getTime() + 400000); | |
| 1033 | 1074 | } |
| 1034 | 1075 | antExChuQuery.setStart(max); |
| 1035 | 1076 | //获取初诊记录 |