Commit 2fef97cb785446940d358b168210ef1f3af3fd7f

Authored by wtt
1 parent 77f22eb506

update

Showing 2 changed files with 32 additions and 10 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 2fef97c
... ... @@ -805,6 +805,8 @@
805 805 //分娩档案
806 806 String hospital = autoMatchFacade.getHospitalId(userId);
807 807 PatientsQuery patientsQuery = new PatientsQuery();
  808 + PatientsQuery pq = new PatientsQuery();
  809 +
808 810 patientsQuery.setYn(YnEnums.YES.getId());
809 811 patientsQuery.setType(3);
810 812 patientsQuery.setSort(" created ");
... ... @@ -816,6 +818,7 @@
816 818 patientsQuery.setIsAutoFm(YnEnums.NO.getId());
817 819 patientsQuery.setFmHospital(hospital);
818 820 patientsQuery.setCardNo(riskPatientsQueryRequest.getCardNo());
  821 + patientsQuery.setQueryNo(riskPatientsQueryRequest.getQueryNo());
819 822 patientsQuery.setLastMensesStart(riskPatientsQueryRequest.capEnd());
820 823 patientsQuery.setLastMensesEnd(riskPatientsQueryRequest.capStart());
821 824 patientsQuery.setrLevel(riskPatientsQueryRequest.getrLevel());
... ... @@ -832,6 +835,7 @@
832 835 List<Map> data = new ArrayList<>();
833 836 List<String> idsMd = new ArrayList<>();
834 837 List<String> idsPW = new ArrayList<>();
  838 + List<String> gteList = new ArrayList<>();
835 839 if (CollectionUtils.isNotEmpty(patientses)) {
836 840 for (Patients patients : patientses) {
837 841 //儿童体重大于等于4000克
838 842  
839 843  
840 844  
841 845  
842 846  
... ... @@ -845,25 +849,43 @@
845 849 }
846 850 }
847 851 }
848   -
  852 + boolean bmiSta = true;
849 853 //孕妇体重
850 854 if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiStart()) && StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiEnd()) && CollectionUtils.isNotEmpty(idsMd)){
  855 + bmiSta = false;
851 856 for (String id : idsMd) {
852   - Query query = Query.query(Criteria.where("patientId").is(id)
853   - .and("yn").ne("0").and("bmi").gte(riskPatientsQueryRequest.getBmiStart()).lte(riskPatientsQueryRequest.getBmiEnd()));
854   - List<PatientWeight> patientWeightList = mongoTemplate.find(query, PatientWeight.class);
855   - if(CollectionUtils.isNotEmpty(patientWeightList)){
856   - PatientWeight patientWeight = patientWeightList.get(0);
  857 +
  858 + Query gtequery = Query.query(Criteria.where("patientId").is(id).and("yn").ne("0").and("$where").is("(this.bmi >= "+riskPatientsQueryRequest.getBmiStart()+" )"));
  859 + Query ltequery = null;
  860 + List<PatientWeight> gteWeightList = mongoTemplate.find(gtequery, PatientWeight.class);
  861 + if(CollectionUtils.isNotEmpty(gteWeightList)){
  862 + for (PatientWeight p:gteWeightList) {
  863 + if(StringUtils.isEmpty(p.getId())){
  864 + continue;
  865 + }
  866 + gteList.add(p.getId());
  867 + }
  868 + ltequery= Query.query(Criteria.where("patientId").is(id).and("yn").ne("0").and("id").in(gteList)
  869 + .and("$where").is("(this.bmi <= " + riskPatientsQueryRequest.getBmiEnd() + " )"));
  870 + }else {
  871 + ltequery= Query.query(Criteria.where("patientId").is(id).and("yn").ne("0")
  872 + .and("$where").is("(this.bmi <= " + riskPatientsQueryRequest.getBmiEnd() + " )"));
  873 + }
  874 + List<PatientWeight> lteWeightList = mongoTemplate.find(ltequery, PatientWeight.class);
  875 +// Query query = Query.query(Criteria.where("patientId").is(id).and("yn").ne("0").and("bmi").gte(riskPatientsQueryRequest.getBmiStart()).lte(riskPatientsQueryRequest.getBmiEnd()));
  876 +// List<PatientWeight> patientWeightList = mongoTemplate.find(query, PatientWeight.class);
  877 + if(CollectionUtils.isNotEmpty(lteWeightList)){
  878 + PatientWeight patientWeight = lteWeightList.get(0);
857 879 if(patientWeight!=null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patientWeight.getBmi())){
858 880 idsPW.add(id);
  881 + bmiSta = true;
859 882 }
860 883 }
861 884  
862 885 }
863 886 }
864   - if(CollectionUtils.isNotEmpty(idsMd) || CollectionUtils.isNotEmpty(idsPW)){
  887 + if((CollectionUtils.isNotEmpty(idsMd) || CollectionUtils.isNotEmpty(idsPW)) && bmiSta){
865 888 //获取bmi大于 25 &筛选bmi条件
866   - PatientsQuery pq = new PatientsQuery();
867 889 pq.setIds(CollectionUtils.isEmpty(idsPW)? idsMd : idsPW);
868 890 pq.setPage(riskPatientsQueryRequest.getPage());
869 891 pq.setLimit(riskPatientsQueryRequest.getLimit());
... ... @@ -873,7 +895,7 @@
873 895 }
874 896 }
875 897 }
876   - return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery.getPageInfo());
  898 + return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(pq.getPageInfo());
877 899 }
878 900  
879 901 public void exportQueryAbnormalWeight(RiskPatientsQueryRequest riskPatientsQueryRequest, Integer id, HttpServletResponse response) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanWeightWorker.java View file @ 2fef97c
... ... @@ -119,7 +119,7 @@
119 119 for(Map.Entry<String, String> entry : patientWeight.getDayWeights().entrySet()){
120 120 String mapKey = entry.getKey();
121 121 String mapValue = entry.getValue();
122   - System.out.println(mapKey + "/" + mapValue);
  122 +// System.out.println(mapKey + "/" + mapValue);
123 123 map.put("dayWeights"+i++, mapKey + "/" + mapValue);
124 124 }
125 125