Commit 2420892a9cdaf58a8f8d7abdf3d3711cdc25f112

Authored by wtt
1 parent 2fef97cb78
Exists in master and in 1 other branch dev

update

Showing 1 changed file with 11 additions and 26 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 2420892
... ... @@ -835,7 +835,6 @@
835 835 List<Map> data = new ArrayList<>();
836 836 List<String> idsMd = new ArrayList<>();
837 837 List<String> idsPW = new ArrayList<>();
838   - List<String> gteList = new ArrayList<>();
839 838 if (CollectionUtils.isNotEmpty(patientses)) {
840 839 for (Patients patients : patientses) {
841 840 //儿童体重大于等于4000克
842 841  
843 842  
844 843  
... ... @@ -854,34 +853,20 @@
854 853 if(StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiStart()) && StringUtils.isNotEmpty(riskPatientsQueryRequest.getBmiEnd()) && CollectionUtils.isNotEmpty(idsMd)){
855 854 bmiSta = false;
856 855 for (String id : idsMd) {
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;
  856 + Query query = Query.query(Criteria.where("patientId").is(id).and("yn").ne("0"));
  857 + List<PatientWeight> patientWeightList = mongoTemplate.find(query, PatientWeight.class);
  858 + if(CollectionUtils.isNotEmpty(patientWeightList)){
  859 + PatientWeight patientWeight = patientWeightList.get(0);
  860 + if(patientWeight!=null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patientWeight.getBmi())){
  861 + double bmid = Double.parseDouble(patientWeight.getBmi());
  862 + double bmidStart = Double.parseDouble(riskPatientsQueryRequest.getBmiStart());
  863 + double bmidEnd = Double.parseDouble(riskPatientsQueryRequest.getBmiEnd());
  864 + if(bmid >= bmidStart && bmid < bmidEnd){
  865 + idsPW.add(id);
  866 + bmiSta = true;
865 867 }
866   - gteList.add(p.getId());
867 868 }
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 869 }
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);
879   - if(patientWeight!=null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patientWeight.getBmi())){
880   - idsPW.add(id);
881   - bmiSta = true;
882   - }
883   - }
884   -
885 870 }
886 871 }
887 872 if((CollectionUtils.isNotEmpty(idsMd) || CollectionUtils.isNotEmpty(idsPW)) && bmiSta){