Commit 14737cc1dbd308c8d2356d969dd0a78e0b068815
1 parent
9ea53cd1ad
Exists in
master
and in
8 other branches
修改新电子病历
Showing 4 changed files with 335 additions and 14 deletions
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/StopPregQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
14737cc
... | ... | @@ -71,6 +71,9 @@ |
71 | 71 | //创建时间 |
72 | 72 | private Date created; |
73 | 73 | |
74 | + private Date bookbuildingDateStart; | |
75 | + private Date bookbuildingDateEnd; | |
76 | + | |
74 | 77 | private String pid; |
75 | 78 | |
76 | 79 | public Date getCreated() { |
... | ... | @@ -218,6 +221,22 @@ |
218 | 221 | this.lastMensesEnd = lastMensesEnd; |
219 | 222 | } |
220 | 223 | |
224 | + public Date getBookbuildingDateEnd() { | |
225 | + return bookbuildingDateEnd; | |
226 | + } | |
227 | + | |
228 | + public void setBookbuildingDateEnd(Date bookbuildingDateEnd) { | |
229 | + this.bookbuildingDateEnd = bookbuildingDateEnd; | |
230 | + } | |
231 | + | |
232 | + public Date getBookbuildingDateStart() { | |
233 | + return bookbuildingDateStart; | |
234 | + } | |
235 | + | |
236 | + public void setBookbuildingDateStart(Date bookbuildingDateStart) { | |
237 | + this.bookbuildingDateStart = bookbuildingDateStart; | |
238 | + } | |
239 | + | |
221 | 240 | public Date getLastMensesStart() { |
222 | 241 | return lastMensesStart; |
223 | 242 | } |
... | ... | @@ -566,6 +585,22 @@ |
566 | 585 | } |
567 | 586 | isAddStart = Boolean.TRUE; |
568 | 587 | } |
588 | + | |
589 | + | |
590 | + if (null != bookbuildingDateStart) { | |
591 | + c = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart); | |
592 | + isAddStart = Boolean.TRUE; | |
593 | + } | |
594 | + if (null != bookbuildingDateEnd) { | |
595 | + if (isAddStart) { | |
596 | + c = c.lte(bookbuildingDateEnd); | |
597 | + } else { | |
598 | + c = Criteria.where("bookbuildingDate").lte(bookbuildingDateEnd); | |
599 | + } | |
600 | + isAddStart = Boolean.TRUE; | |
601 | + } | |
602 | + | |
603 | + | |
569 | 604 | if (isAddStart) { |
570 | 605 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
571 | 606 | } |
platform-dal/src/main/java/com/lyms/platform/query/StopPregQuery.java
View file @
14737cc
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | private String inPerson; |
34 | 34 | |
35 | 35 | private Integer yn; |
36 | + private String pid; | |
36 | 37 | |
37 | 38 | @Override |
38 | 39 | public MongoQuery convertToQuery() { |
... | ... | @@ -47,7 +48,9 @@ |
47 | 48 | if (-1 != yn) { |
48 | 49 | condition = condition.and("yn", yn, MongoOper.IS); |
49 | 50 | } |
50 | - | |
51 | + if (null!= pid) { | |
52 | + condition = condition.and("pid", pid, MongoOper.IS); | |
53 | + } | |
51 | 54 | return condition.toMongoQuery(); |
52 | 55 | } |
53 | 56 | |
... | ... | @@ -105,6 +108,14 @@ |
105 | 108 | |
106 | 109 | public void setInPerson(String inPerson) { |
107 | 110 | this.inPerson = inPerson; |
111 | + } | |
112 | + | |
113 | + public String getPid() { | |
114 | + return pid; | |
115 | + } | |
116 | + | |
117 | + public void setPid(String pid) { | |
118 | + this.pid = pid; | |
108 | 119 | } |
109 | 120 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
View file @
14737cc
... | ... | @@ -116,7 +116,7 @@ |
116 | 116 | @ResponseBody |
117 | 117 | @TokenRequired |
118 | 118 | public BaseResponse findAntExList(@Valid AntExListQueryRequest exListQueryRequest) { |
119 | - return antenatalExaminationFacade.findAntExList(exListQueryRequest); | |
119 | + return antenatalExaminationFacade.findAntExListTwo(exListQueryRequest); | |
120 | 120 | } |
121 | 121 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
14737cc
... | ... | @@ -3,6 +3,7 @@ |
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; | |
6 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
7 | 8 | import com.lyms.platform.common.result.BaseResponse; |
8 | 9 | import com.lyms.platform.common.utils.Assert; |
... | ... | @@ -374,6 +375,280 @@ |
374 | 375 | } |
375 | 376 | |
376 | 377 | /** |
378 | + * 电子病历方法 | |
379 | + * | |
380 | + * @param exListQueryRequest | |
381 | + * @return | |
382 | + */ | |
383 | + public BaseResponse findAntExListTwo(AntExListQueryRequest exListQueryRequest) { | |
384 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
385 | + patientsQuery.setCardNo(exListQueryRequest.getCardNo()); | |
386 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
387 | + patientsQuery.setPhone(exListQueryRequest.getPhone()); | |
388 | + patientsQuery.setPid(exListQueryRequest.getPid()); | |
389 | + //获取所有的建档记录 | |
390 | + List<Patients> list = patientsService.queryPatient(patientsQuery); | |
391 | + | |
392 | + Map map = new HashMap(); | |
393 | + | |
394 | + List sortList = new ArrayList(); | |
395 | + | |
396 | + List<SortIn> listDate = new ArrayList(); | |
397 | + int index = 0; | |
398 | + if (CollectionUtils.isNotEmpty(list)) { | |
399 | + | |
400 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
401 | + matDeliverQuery.setPid(list.get(0).getPid()); | |
402 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
403 | + //分娩记录 | |
404 | + List<MaternalDeliverModel> modelList = matDeliverService.query(matDeliverQuery); | |
405 | + for (MaternalDeliverModel model : modelList) { | |
406 | + listDate.add(new SortIn(model)); | |
407 | + map.put(model.getId(), model); | |
408 | + } | |
409 | + //终止妊娠记录 | |
410 | + StopPregQuery query = new StopPregQuery(); | |
411 | + query.setYn(YnEnums.YES.getId()); | |
412 | + query.setPid(list.get(0).getPid()); | |
413 | + List<StopPregModel> stopPregs = stopPregnancyService.queryStopPreg(query); | |
414 | + for (StopPregModel stopPregModel : stopPregs) { | |
415 | + listDate.add(new SortIn(stopPregModel)); | |
416 | + map.put(stopPregModel.getId(), stopPregModel); | |
417 | + } | |
418 | + //排序集合 | |
419 | + sortList(listDate); | |
420 | + | |
421 | + //TODO 需要过滤掉建档就分娩的情况 | |
422 | + Date dueDate = new Date(); | |
423 | + if (CollectionUtils.isNotEmpty(listDate)) { | |
424 | + String pid=""; | |
425 | + for (int i = 0; i < listDate.size(); i++) { | |
426 | + dueDate = listDate.get(i).getDate(); | |
427 | + List listData = new ArrayList(); | |
428 | + Organization organization = null; | |
429 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
430 | + patientsQuery1.setBookbuildingDateEnd(new Date(listDate.get(i).getDate().getTime()+i)); | |
431 | + if (listDate.size() > i + 1) { | |
432 | + patientsQuery1.setBookbuildingDateStart(listDate.get(i + 1).getDate()); | |
433 | + }else{ | |
434 | + patientsQuery1.setBookbuildingDateStart(new Date()); | |
435 | + } | |
436 | + pid=list.get(0).getPid(); | |
437 | + patientsQuery1.setPid(pid); | |
438 | + List<Patients> patientses = patientsService.queryPatient1(patientsQuery1); | |
439 | + Iterator<Patients> iterator=patientses.iterator(); | |
440 | + while(iterator.hasNext()){ | |
441 | + Patients patients= iterator.next(); | |
442 | + Date date = DateUtil.addWeek(patients.getLastMenses(),42); | |
443 | + Date currentDate = DateUtil.formatDate(patients.getBookbuildingDate()); | |
444 | + if (date.getTime() <= currentDate.getTime()) | |
445 | + { | |
446 | + //建档记录 | |
447 | + if (null != patients.getHospitalId()) { | |
448 | + organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId())); | |
449 | + } | |
450 | + pid = patients.getPid(); | |
451 | + listData.add(new AntData(patients, null != organization ? organization.getName() : "")); | |
452 | + iterator.remove(); | |
453 | + | |
454 | + | |
455 | + PostReviewQuery postReviewQuery = new PostReviewQuery(); | |
456 | + if (list.size() - 1 > i) { | |
457 | + postReviewQuery.setStart(dueDate); | |
458 | + //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示 | |
459 | + postReviewQuery.setEnd(patientses.get(0).getBookbuildingDate()); | |
460 | + } | |
461 | + postReviewQuery.setPid(pid); | |
462 | +// Object obj = map.get(listDate.get(i).getId()); | |
463 | + /* if (obj instanceof MaternalDeliverModel) { | |
464 | + listData.add(new AntData((MaternalDeliverModel) obj, patientses.get(0).getLastMenses(), null != organization ? organization.getName() : "")); | |
465 | + } else if (obj instanceof StopPregModel) { | |
466 | + listData.add(new AntData(stopPregs.get(0), patientses.get(0).getLastMenses(), null != organization ? organization.getName() : "")); | |
467 | + }*/ | |
468 | + | |
469 | + //产后复查记录 | |
470 | + List<PostReviewModel> reviewModels = postReviewService.findWithList(postReviewQuery); | |
471 | + if (CollectionUtils.isNotEmpty(reviewModels)) { | |
472 | + for (PostReviewModel postReviewModel : reviewModels) { | |
473 | + if (null != postReviewModel.getHospitalId()) { | |
474 | + organization = organizationService.getOrganization(Integer.valueOf(postReviewModel.getHospitalId())); | |
475 | + } | |
476 | + listData.add(new AntData(postReviewModel, null != organization ? organization.getName() : "", patientses.get(0).getFmDate())); | |
477 | + } | |
478 | + } | |
479 | + sortList.add(listData); | |
480 | + listData=new ArrayList(); | |
481 | + } | |
482 | + } | |
483 | + if(CollectionUtils.isNotEmpty(patientses)){ | |
484 | + buildPatientList(dueDate,patientses,listData); | |
485 | + | |
486 | + PostReviewQuery postReviewQuery = new PostReviewQuery(); | |
487 | + if (list.size() - 1 > i) { | |
488 | + postReviewQuery.setStart(dueDate); | |
489 | + //下次建档记录前都是产后复查,如果没有下个产程的数据就直接显示 | |
490 | + postReviewQuery.setEnd(patientses.get(0).getBookbuildingDate()); | |
491 | + } | |
492 | + postReviewQuery.setPid(pid); | |
493 | + Object obj = map.get(listDate.get(i).getId()); | |
494 | + if (obj instanceof MaternalDeliverModel) { | |
495 | + listData.add(new AntData((MaternalDeliverModel) obj, patientses.get(0).getLastMenses(), null != organization ? organization.getName() : "")); | |
496 | + } else if (obj instanceof StopPregModel) { | |
497 | + listData.add(new AntData(stopPregs.get(0), patientses.get(0).getLastMenses(), null != organization ? organization.getName() : "")); | |
498 | + } | |
499 | + | |
500 | + //产后复查记录 | |
501 | + List<PostReviewModel> reviewModels = postReviewService.findWithList(postReviewQuery); | |
502 | + if (CollectionUtils.isNotEmpty(reviewModels)) { | |
503 | + for (PostReviewModel postReviewModel : reviewModels) { | |
504 | + if (null != postReviewModel.getHospitalId()) { | |
505 | + organization = organizationService.getOrganization(Integer.valueOf(postReviewModel.getHospitalId())); | |
506 | + } | |
507 | + listData.add(new AntData(postReviewModel, null != organization ? organization.getName() : "", patientses.get(0).getFmDate())); | |
508 | + } | |
509 | + } | |
510 | + } | |
511 | + sortList.add(listData); | |
512 | + } | |
513 | + PatientsQuery patientsQuery1=new PatientsQuery(); | |
514 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
515 | + patientsQuery1.setPid(pid); | |
516 | + patientsQuery1.setBookbuildingDateStart(new Date(listDate.get(0).getDate().getTime()+1000)); | |
517 | + patientsQuery1.setType(1); | |
518 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery1); | |
519 | + List list1=new ArrayList(); | |
520 | + sortList.add(buildPatientList(dueDate, patientsList, list1)); | |
521 | + }else{ | |
522 | + List list1=new ArrayList(); | |
523 | + sortList.add(buildPatientList(dueDate, list,list1)); | |
524 | + } | |
525 | + } | |
526 | + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(sortList); | |
527 | + } | |
528 | + | |
529 | + | |
530 | + | |
531 | + | |
532 | + private List buildPatientList(Date dueDate, List<Patients> patientses,List listData) { | |
533 | + | |
534 | + Organization organization = null; | |
535 | + String pid = ""; | |
536 | + for (Patients patients : patientses) { | |
537 | + //建档记录 | |
538 | + if (null != patients.getHospitalId()) { | |
539 | + organization = organizationService.getOrganization(Integer.valueOf(patients.getHospitalId())); | |
540 | + } | |
541 | + pid = patients.getPid(); | |
542 | + listData.add(new AntData(patients, null != organization ? organization.getName() : "")); | |
543 | + } | |
544 | + | |
545 | + | |
546 | + if (null != dueDate) { | |
547 | + //初诊记录 | |
548 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
549 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
550 | + antExChuQuery.setStart(patientses.get(0).getBookbuildingDate()); | |
551 | + antExChuQuery.setEnd(new Date(dueDate.getTime() + 86398000)); | |
552 | + antExChuQuery.setPid(pid); | |
553 | + | |
554 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
555 | + if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
556 | + for (AntExChuModel an : antExChuModels) { | |
557 | + if (null != an.getHospitalId()) { | |
558 | + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId())); | |
559 | + } | |
560 | + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses())); | |
561 | + } | |
562 | + } | |
563 | + | |
564 | + //复诊记录 | |
565 | + AntExQuery antExQuery = new AntExQuery(); | |
566 | + antExQuery.setYn(YnEnums.YES.getId()); | |
567 | + antExQuery.setPid(pid); | |
568 | + antExQuery.setStart(patientses.get(0).getBookbuildingDate()); | |
569 | + antExQuery.setEnd(new Date(dueDate.getTime() + 86398000)); | |
570 | + List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
571 | + if (CollectionUtils.isNotEmpty(list1)) { | |
572 | + for (AntenatalExaminationModel an : list1) { | |
573 | + if (null != an.getHospitalId()) { | |
574 | + organization = organizationService.getOrganization(Integer.valueOf(an.getHospitalId())); | |
575 | + } | |
576 | + listData.add(new AntData(an, null != organization ? organization.getName() : "", patientses.get(0).getLastMenses())); | |
577 | + } | |
578 | + } | |
579 | + } | |
580 | + return listData; | |
581 | + } | |
582 | + | |
583 | + private void sortList(List listDate) { | |
584 | + //按照数据排序 | |
585 | + Collections.sort(listDate, new Comparator<SortIn>() { | |
586 | + @Override | |
587 | + public int compare(SortIn o1, SortIn o2) { | |
588 | + if (o1.getDate().after(o2.getDate())) { | |
589 | + return -1; | |
590 | + } | |
591 | + if (o1.getDate().before(o2.getDate())) { | |
592 | + return 1; | |
593 | + } | |
594 | + return 0; | |
595 | + } | |
596 | + }); | |
597 | + } | |
598 | + | |
599 | + | |
600 | + public class SortIn { | |
601 | + | |
602 | + public SortIn(Patients patients) { | |
603 | + this.id = patients.getId(); | |
604 | + this.date = patients.getBookbuildingDate(); | |
605 | + this.type = 2; | |
606 | + } | |
607 | + | |
608 | + public SortIn(StopPregModel stopPregModel) { | |
609 | + this.id = stopPregModel.getId(); | |
610 | + this.date = stopPregModel.getStopDate(); | |
611 | + this.type = 1; | |
612 | + } | |
613 | + | |
614 | + public SortIn(MaternalDeliverModel maternalDeliverModel) { | |
615 | + this.id = maternalDeliverModel.getId(); | |
616 | + this.date = DateUtil.parseYMD(maternalDeliverModel.getDueDate()); | |
617 | + this.type = 3; | |
618 | + } | |
619 | + | |
620 | + | |
621 | + private String id; | |
622 | + //type为1 表示终止妊娠数据 2 表示自然分娩数据 | |
623 | + private int type; | |
624 | + private Date date; | |
625 | + | |
626 | + public Date getDate() { | |
627 | + return date; | |
628 | + } | |
629 | + | |
630 | + public int getType() { | |
631 | + return type; | |
632 | + } | |
633 | + | |
634 | + public void setType(int type) { | |
635 | + this.type = type; | |
636 | + } | |
637 | + | |
638 | + public void setDate(Date date) { | |
639 | + this.date = date; | |
640 | + } | |
641 | + | |
642 | + public String getId() { | |
643 | + return id; | |
644 | + } | |
645 | + | |
646 | + public void setId(String id) { | |
647 | + this.id = id; | |
648 | + } | |
649 | + } | |
650 | + | |
651 | + /** | |
377 | 652 | * 查询产妇所有产检的数据 |
378 | 653 | * |
379 | 654 | * @param exListQueryRequest |
... | ... | @@ -740,12 +1015,12 @@ |
740 | 1015 | data = patients.getLastMenses(); |
741 | 1016 | } |
742 | 1017 | |
743 | - String doctorId = examinationModel.getCheckDoctor(); | |
744 | - Users users= usersService.getUsers(Integer.valueOf(doctorId)); | |
745 | - Map<String,String> map1 =new HashMap<>(); | |
746 | - if(null!=users){ | |
747 | - map1.put("id",users.getId()+""); | |
748 | - map1.put("name",users.getName()); | |
1018 | + String doctorId = examinationModel.getCheckDoctor(); | |
1019 | + Users users = usersService.getUsers(Integer.valueOf(doctorId)); | |
1020 | + Map<String, String> map1 = new HashMap<>(); | |
1021 | + if (null != users) { | |
1022 | + map1.put("id", users.getId() + ""); | |
1023 | + map1.put("name", users.getName()); | |
749 | 1024 | } |
750 | 1025 | antenatalExaminationResult.setCheckDoctor(map1); |
751 | 1026 | antenatalExaminationResult.setIsSieve(cap(data, examinationModel.getParentId())); |
... | ... | @@ -778,12 +1053,12 @@ |
778 | 1053 | } |
779 | 1054 | } catch (Exception e) { |
780 | 1055 | } |
781 | - String doctorId = antExChuModel.getProdDoctor(); | |
782 | - Users users= usersService.getUsers(Integer.valueOf(doctorId)); | |
783 | - Map<String,String> map1 =new HashMap<>(); | |
784 | - if(null!=users){ | |
785 | - map1.put("id",users.getId()+""); | |
786 | - map1.put("name",users.getName()); | |
1056 | + String doctorId = antExChuModel.getProdDoctor(); | |
1057 | + Users users = usersService.getUsers(Integer.valueOf(doctorId)); | |
1058 | + Map<String, String> map1 = new HashMap<>(); | |
1059 | + if (null != users) { | |
1060 | + map1.put("id", users.getId() + ""); | |
1061 | + map1.put("name", users.getName()); | |
787 | 1062 | } |
788 | 1063 | antexChuResult.setProdDoctor(map1); |
789 | 1064 | ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery(); |