Commit e32af0fc92d5b6af6c3f40a8936dd4cce6ace4bb

Authored by jiangjiazhi
1 parent 54cf10341b

修改新电子病历

Showing 2 changed files with 66 additions and 67 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java View file @ e32af0f
... ... @@ -51,7 +51,7 @@
51 51 public List<Patients> queryPatient(PatientsQuery patientsQuery) {
52 52 MongoQuery query = patientsQuery.convertToQuery();
53 53 if (StringUtils.isNotEmpty(patientsQuery.getNeed())) {
54   - patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(patientsQuery.convertToQuery()));
  54 + patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(query));
55 55 query.start(patientsQuery.getOffset()).end(patientsQuery.getLimit());
56 56 }
57 57  
... ... @@ -65,7 +65,7 @@
65 65 public List<Patients> queryPatient1(PatientsQuery patientsQuery,String field) {
66 66 MongoQuery query = patientsQuery.convertToQuery();
67 67 if (StringUtils.isNotEmpty(patientsQuery.getNeed())) {
68   - patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(patientsQuery.convertToQuery()));
  68 + patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(query));
69 69 query.start(patientsQuery.getOffset()).end(patientsQuery.getLimit());
70 70 }
71 71  
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ e32af0f
... ... @@ -575,10 +575,9 @@
575 575 if (null != pid) {
576 576 condition = condition.and("pid", pid, MongoOper.IS);
577 577 }
578   -
  578 + Criteria c1 = null;
579 579 if (fmDateStart != null && fmDateEnd != null) {
580   - Criteria cr = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
581   - condition.andCondition(new MongoCondition(cr));
  580 + c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
582 581 }
583 582  
584 583 if (null != serviceType) {
585 584  
586 585  
587 586  
588 587  
589 588  
590 589  
591 590  
592 591  
593 592  
594 593  
595 594  
596 595  
597 596  
598 597  
599 598  
600 599  
601 600  
602 601  
603 602  
604 603  
605 604  
606 605  
607 606  
... ... @@ -615,108 +614,108 @@
615 614 if (-1 != type) {
616 615 condition = condition.and("type", type, MongoOper.IS);
617 616 }
618   - boolean isAddStart = Boolean.FALSE;
619 617  
620   - Criteria c = null;
621   - if (null != lastMensesStart) {
622   - c = Criteria.where("lastMenses").gte(lastMensesStart);
623   - isAddStart = Boolean.TRUE;
624   - }
625   - if (null != lastMensesEnd) {
626   - if (isAddStart) {
627   - c = c.lte(lastMensesEnd);
628   - } else {
629   - c = Criteria.where("lastMenses").lte(lastMensesEnd);
  618 + if (null != lastRhTimeStart) {
  619 + if(null!=c1){
  620 + c1 = c1.where("lastRhTime").gte(lastRhTimeStart);
  621 + }else {
  622 + c1 = Criteria.where("lastRhTime").gte(lastRhTimeStart);
630 623 }
631 624 }
632   - if (null != c) {
633   - condition = condition.andCondition(new MongoCondition(c));
634   - }
635   - isAddStart = Boolean.FALSE;
636   - Criteria c1 = null;
637   - if (null != lastRhTimeStart) {
638   - c1 = Criteria.where("lastRhTime").gte(lastRhTimeStart);
639   - isAddStart = Boolean.TRUE;
640   - }
641 625 if (null != lastRhTimeEnd) {
642   - if (isAddStart) {
  626 + if (null!=c1) {
643 627 c1 = c1.lte(lastRhTimeEnd);
644 628 } else {
645 629 c1 = Criteria.where("lastRhTime").lte(lastRhTimeEnd);
646 630 }
647 631 }
648   - if (null != c1) {
649   - condition = condition.andCondition(new MongoCondition(c1));
650   - }
651   - isAddStart = Boolean.FALSE;
652 632 if (null != hScoreStart) {
653   - Criteria c2 = null;
654 633 if (null != hScoreStart) {
655   - c2 = Criteria.where("riskScore").gte(hScoreStart);
656   - isAddStart = Boolean.TRUE;
  634 + if(null!=c1){
  635 + c1 = c1.where("riskScore").gte(hScoreStart);
  636 + }else{
  637 + c1 = Criteria.where("riskScore").gte(hScoreStart);
  638 + }
657 639 }
658 640 if (null != hScoreEnd) {
659   - if (isAddStart) {
660   - c2 = c2.lte(hScoreEnd);
  641 + if (null!=c1) {
  642 + c1 = c1.lte(hScoreEnd);
661 643 } else {
662   - c2 = Criteria.where("riskScore").lte(hScoreEnd);
  644 + c1 = Criteria.where("riskScore").lte(hScoreEnd);
663 645 }
664 646 }
665   - if (null != c2) {
666   - condition = condition.andCondition(new MongoCondition(c2));
667   - }
668 647 } else if (null != isHighRisk) {
669 648 condition = condition.and("riskScore", 0, MongoOper.GT);
670 649 }
671   - isAddStart = Boolean.FALSE;
672   - Criteria c3 = null;
  650 +
673 651 if (null != bookbuildingDateStart) {
674   - c3 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart);
675   - isAddStart = Boolean.TRUE;
  652 + if(c1!=null){
  653 + c1 = c1.where("bookbuildingDate").gte(bookbuildingDateStart);
  654 + }else{
  655 + c1 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart);
  656 + }
676 657 }
677 658 if (null != bookbuildingDateEnd) {
678   - if (isAddStart) {
679   - c3 = c3.lte(bookbuildingDateEnd);
  659 + if (null!=c1) {
  660 + c1 = c1.lte(bookbuildingDateEnd);
680 661 } else {
681   - c3 = Criteria.where("bookbuildingDate").lte(bookbuildingDateEnd);
  662 + c1 = Criteria.where("bookbuildingDate").lte(bookbuildingDateEnd);
682 663 }
683 664 }
684 665  
685   - if (null != c3) {
686   - condition = condition.andCondition(new MongoCondition(c3));
687   - }
688   - Criteria c4 = null;
689   - isAddStart = Boolean.FALSE;
690   - if (null != dueDateStart) {
691   - c4 = Criteria.where("dueDate").gte(dueDateStart);
  666 +// Criteria cr1 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart).lte(bookbuildingDateEnd);
  667 +// Criteria cr = cr1.where("lastMenses").gte(lastMensesStart).lte(lastMensesEnd);
  668 +
  669 + /*if(null!=c1){
  670 + return new MongoCondition(condition.getCriteria().andOperator(new Criteria[]{c1})).toMongoQuery();
  671 + }*/
  672 + /*Criteria c = null;
  673 + if (null != lastMensesStart) {
  674 + c = Criteria.where("lastMenses").gte(lastMensesStart);
692 675 isAddStart = Boolean.TRUE;
693 676 }
694   - if (null != dueDateEnd) {
  677 + if (null != lastMensesEnd) {
695 678 if (isAddStart) {
696   - c4 = c4.lte(dueDateEnd);
  679 + c = c.lte(lastMensesEnd);
697 680 } else {
698   - c4 = Criteria.where("dueDate").lte(dueDateEnd);
  681 + c = Criteria.where("lastMenses").lte(lastMensesEnd);
699 682 }
700 683 }
701   - if (null != c4) {
702   - condition = condition.andCondition(new MongoCondition(c4));
  684 + if (null != c) {
  685 + condition.andCondition(new MongoCondition(c));
  686 + }*/
  687 +
  688 + if (null != dueDateStart) {
  689 + if(null!=c1){
  690 + c1 = c1.where("dueDate").gte(dueDateStart);
  691 + }else{
  692 + c1 = Criteria.where("dueDate").gte(dueDateStart);
  693 + }
703 694 }
704   - boolean isAddStart1 = Boolean.FALSE;
705   - Criteria c5 = null;
  695 + if (null != dueDateEnd) {
  696 + if (null!=c1) {
  697 + c1 = c1.lte(dueDateEnd);
  698 + } else {
  699 + c1 = Criteria.where("dueDate").lte(dueDateEnd);
  700 + }
  701 + }
706 702 if (null != birthStart) {
707   - c5 = Criteria.where("birth").gte(birthStart);
708   - isAddStart1 = Boolean.TRUE;
  703 + if (null!=c1) {
  704 + c1 = c1.where("birth").gte(birthStart);
  705 + }else {
  706 + c1 = Criteria.where("birth").gte(birthStart);
  707 + }
709 708 }
710 709  
711 710 if (null != birthEnd) {
712   - if (isAddStart1) {
713   - c5 = c5.lte(birthEnd);
  711 + if (null!=c1) {
  712 + c1 = c1.lte(birthEnd);
714 713 } else {
715   - c5 = Criteria.where("birth").lte(birthEnd);
  714 + c1 = Criteria.where("birth").lte(birthEnd);
716 715 }
717 716 }
718   - if (null != c5) {
719   - condition = condition.andCondition(new MongoCondition(c5));
  717 + if (null != c1) {
  718 + condition = condition.andCondition(new MongoCondition(c1));
720 719 }
721 720 return condition.toMongoQuery();
722 721 }