Commit dbab25522ddb61329ba5799a0ad277f28be401fa

Authored by jiangjiazhi
1 parent d2245e7e4c

修改新电子病历

Showing 1 changed file with 51 additions and 70 deletions

platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ dbab255
... ... @@ -134,7 +134,6 @@
134 134 private Date lastMensesEnd;
135 135  
136 136  
137   -
138 137 /**
139 138 * 地址
140 139 */
141 140  
142 141  
143 142  
... ... @@ -519,19 +518,19 @@
519 518 condition = condition.and("dueStatus", dueStatus, MongoOper.IS);
520 519 }
521 520 if (buildType != -1) {
522   - MongoCondition mongoCondition=MongoCondition.newInstance("buildType",3,MongoOper.IS);
523   - MongoCondition condition1=mongoCondition.and("enable", "1", MongoOper.IS);
  521 + MongoCondition mongoCondition = MongoCondition.newInstance("buildType", 3, MongoOper.IS);
  522 + MongoCondition condition1 = mongoCondition.and("enable", "1", MongoOper.IS);
524 523  
525 524 MongoCondition condition12 = MongoCondition.newInstance("buildType", buildType, MongoOper.NE);
526 525  
527 526 condition = condition.orCondition(new MongoCondition[]{condition12, condition1});
528   - }else if(null!=buildTypeList){
529   - MongoCondition mongoCondition=MongoCondition.newInstance("buildType",3,MongoOper.IS);
530   - MongoCondition condition1=mongoCondition.and("enable", "1", MongoOper.IS);
  527 + } else if (null != buildTypeList) {
  528 + MongoCondition mongoCondition = MongoCondition.newInstance("buildType", 3, MongoOper.IS);
  529 + MongoCondition condition1 = mongoCondition.and("enable", "1", MongoOper.IS);
531 530  
532   - MongoCondition condition2=MongoCondition.newInstance("buildType", buildTypeList, MongoOper.IN);
  531 + MongoCondition condition2 = MongoCondition.newInstance("buildType", buildTypeList, MongoOper.IN);
533 532  
534   - condition = condition.orCondition(new MongoCondition[]{condition1,condition2});
  533 + condition = condition.orCondition(new MongoCondition[]{condition1, condition2});
535 534 }
536 535  
537 536 if (buildTypeEq != null) {
... ... @@ -546,9 +545,7 @@
546 545 if (null != created) {
547 546 condition = condition.and("created", created, MongoOper.LTE);
548 547 }
549   -
550   -
551   - if (StringUtils.isNotEmpty( rLevel)) {
  548 + if (StringUtils.isNotEmpty(rLevel)) {
552 549 condition = condition.and("riskLevelId", rLevel, MongoOper.LIKE);
553 550 }
554 551 if (null != areaId) {
... ... @@ -564,7 +561,7 @@
564 561 condition = condition.and("cardNo", cardNo, MongoOper.IS);
565 562  
566 563 }
567   - if (StringUtils.isNotEmpty( phone)) {
  564 + if (StringUtils.isNotEmpty(phone)) {
568 565 condition = condition.and("phone", phone, MongoOper.IS);
569 566 }
570 567 if (StringUtils.isNotEmpty(name)) {
571 568  
... ... @@ -579,29 +576,11 @@
579 576 condition = condition.and("pid", pid, MongoOper.IS);
580 577 }
581 578  
582   - if (fmDateStart != null && fmDateEnd != null)
583   - {
  579 + if (fmDateStart != null && fmDateEnd != null) {
584 580 Criteria cr = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
585 581 condition.andCondition(new MongoCondition(cr));
586 582 }
587 583  
588   -
589   - /* *//**
590   - * 服务类型
591   - *//*
592   - private String serviceType;
593   - *//**
594   - * 风险等级
595   - *//*
596   - private String rLevel;
597   - *//**
598   - * 高危评分
599   - *//*
600   - private String hScore;
601   - *//**
602   - * 高危因素
603   - *//*
604   - private String rFactor*/
605 584 if (null != serviceType) {
606 585 condition = condition.and("serviceType", serviceType, MongoOper.IS);
607 586 }
... ... @@ -617,8 +596,6 @@
617 596  
618 597 if (null != orServiceStatus && orServiceStatus.length > 1) {
619 598 condition = condition.and("serviceStatus", Arrays.asList(orServiceStatus), MongoOper.IN);
620   -// Criteria c = Criteria.where("serviceStatus").in(orServiceStatus[0], orServiceStatus[1]);
621   -// condition.andCondition(new MongoCondition(c));
622 599 }
623 600 if (null != hcertificateNum) {
624 601 condition = condition.and("hcertificateNum", hcertificateNum, MongoOper.LIKE);
... ... @@ -635,7 +612,6 @@
635 612 condition = condition.and("communityId", null, MongoOper.IS);
636 613 }
637 614 //去掉type为3 的情况
638   - /* */
639 615 if (-1 != type) {
640 616 condition = condition.and("type", type, MongoOper.IS);
641 617 }
642 618  
643 619  
644 620  
645 621  
646 622  
647 623  
648 624  
649 625  
650 626  
651 627  
652 628  
653 629  
654 630  
655 631  
656 632  
657 633  
658 634  
659 635  
660 636  
661 637  
662 638  
663 639  
664 640  
665 641  
666 642  
667 643  
668 644  
669 645  
670 646  
671 647  
... ... @@ -652,90 +628,95 @@
652 628 } else {
653 629 c = Criteria.where("lastMenses").lte(lastMensesEnd);
654 630 }
655   - isAddStart = Boolean.TRUE;
656 631 }
657   -
658   - if(null!=lastRhTimeStart){
659   - c = Criteria.where("lastRhTime").gte(lastRhTimeStart);
  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);
660 639 isAddStart = Boolean.TRUE;
661 640 }
662 641 if (null != lastRhTimeEnd) {
663 642 if (isAddStart) {
664   - c = c.lte(lastRhTimeEnd);
  643 + c1 = c1.lte(lastRhTimeEnd);
665 644 } else {
666   - c = Criteria.where("lastRhTime").lte(lastRhTimeEnd);
  645 + c1 = Criteria.where("lastRhTime").lte(lastRhTimeEnd);
667 646 }
668   - isAddStart = Boolean.TRUE;
669 647 }
670   -
  648 + if (null != c1) {
  649 + condition = condition.andCondition(new MongoCondition(c1));
  650 + }
  651 + isAddStart = Boolean.FALSE;
671 652 if (null != hScoreStart) {
672   -// condition = condition.and("riskScore", hScore, MongoOper.IS);
673   -
  653 + Criteria c2 = null;
674 654 if (null != hScoreStart) {
675   - c = Criteria.where("riskScore").gte(hScoreStart);
  655 + c2 = Criteria.where("riskScore").gte(hScoreStart);
676 656 isAddStart = Boolean.TRUE;
677 657 }
678 658 if (null != hScoreEnd) {
679 659 if (isAddStart) {
680   - c = c.lte(hScoreEnd);
  660 + c2 = c2.lte(hScoreEnd);
681 661 } else {
682   - c = Criteria.where("riskScore").lte(hScoreEnd);
  662 + c2 = Criteria.where("riskScore").lte(hScoreEnd);
683 663 }
684   - isAddStart = Boolean.TRUE;
685 664 }
686   - }else if (null != isHighRisk) {
  665 + if (null != c2) {
  666 + condition = condition.andCondition(new MongoCondition(c2));
  667 + }
  668 + } else if (null != isHighRisk) {
687 669 condition = condition.and("riskScore", 0, MongoOper.GT);
688 670 }
689   -
  671 + isAddStart = Boolean.FALSE;
  672 + Criteria c3 = null;
690 673 if (null != bookbuildingDateStart) {
691   - c = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart);
  674 + c3 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart);
692 675 isAddStart = Boolean.TRUE;
693 676 }
694 677 if (null != bookbuildingDateEnd) {
695 678 if (isAddStart) {
696   - c = c.lte(bookbuildingDateEnd);
  679 + c3 = c3.lte(bookbuildingDateEnd);
697 680 } else {
698   - c = Criteria.where("bookbuildingDate").lte(bookbuildingDateEnd);
  681 + c3 = Criteria.where("bookbuildingDate").lte(bookbuildingDateEnd);
699 682 }
700   - isAddStart = Boolean.TRUE;
701 683 }
702 684  
703   -
704   - if (isAddStart) {
705   - return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery();
  685 + if (null != c3) {
  686 + condition = condition.andCondition(new MongoCondition(c3));
706 687 }
  688 + Criteria c4 = null;
  689 + isAddStart = Boolean.FALSE;
707 690 if (null != dueDateStart) {
708   - c = Criteria.where("dueDate").gte(dueDateStart);
  691 + c4 = Criteria.where("dueDate").gte(dueDateStart);
709 692 isAddStart = Boolean.TRUE;
710 693 }
711   -
712 694 if (null != dueDateEnd) {
713 695 if (isAddStart) {
714   - c = c.lte(dueDateEnd);
  696 + c4 = c4.lte(dueDateEnd);
715 697 } else {
716   - c = Criteria.where("dueDate").lte(dueDateEnd);
  698 + c4 = Criteria.where("dueDate").lte(dueDateEnd);
717 699 }
718   - isAddStart = Boolean.TRUE;
719 700 }
720   - if (isAddStart) {
721   - return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery();
  701 + if (null != c4) {
  702 + condition = condition.andCondition(new MongoCondition(c4));
722 703 }
723 704 boolean isAddStart1 = Boolean.FALSE;
  705 + Criteria c5 = null;
724 706 if (null != birthStart) {
725   - c = Criteria.where("birth").gte(birthStart);
  707 + c5 = Criteria.where("birth").gte(birthStart);
726 708 isAddStart1 = Boolean.TRUE;
727 709 }
728 710  
729 711 if (null != birthEnd) {
730 712 if (isAddStart1) {
731   - c = c.lte(birthEnd);
  713 + c5 = c5.lte(birthEnd);
732 714 } else {
733   - c = Criteria.where("birth").lte(birthEnd);
  715 + c5 = Criteria.where("birth").lte(birthEnd);
734 716 }
735   - isAddStart1 = Boolean.TRUE;
736 717 }
737   - if (isAddStart || isAddStart1) {
738   - return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery();
  718 + if (null != c5) {
  719 + condition = condition.andCondition(new MongoCondition(c5));
739 720 }
740 721 return condition.toMongoQuery();
741 722 }