Commit ae88611a09a8006536b8684cee61529dd4bf2519
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
View file @
ae88611
| ... | ... | @@ -93,35 +93,43 @@ |
| 93 | 93 | |
| 94 | 94 | @Override |
| 95 | 95 | public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId) { |
| 96 | -// List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId); | |
| 96 | + boolean flag = false; | |
| 97 | + // List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId); | |
| 97 | 98 | Criteria criteria = Criteria.where("yn").is(1); //.and("hospitalId").in(hospitalIds); |
| 98 | 99 | Criteria pCriteria = Criteria.where("yn").is(1); //.and("hospitalId").in(hospitalIds); |
| 99 | 100 | if(StringUtils.isNotEmpty(key)) { |
| 101 | + flag = true; | |
| 100 | 102 | pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key)); |
| 101 | 103 | } |
| 102 | 104 | if(StringUtils.isNotEmpty(vcCardNo)) { |
| 105 | + flag = true; | |
| 103 | 106 | pCriteria.and("vcCardNo").is(vcCardNo); |
| 104 | 107 | } |
| 105 | 108 | if(weekStart != null && weekEnd != null) { |
| 106 | 109 | Date start = DateUtil.getWeekStart(weekEnd); |
| 107 | 110 | Date end = DateUtil.getWeekEnd(weekStart); |
| 108 | 111 | pCriteria.and("lastMenses").gt(start).lte(end); |
| 112 | + flag = true; | |
| 109 | 113 | } |
| 110 | 114 | if(age != null) { |
| 111 | 115 | Date start = DateUtil.getBeforeAge(age); |
| 112 | 116 | Date end = DateUtil.getBeforeAge(age + 1); |
| 113 | 117 | pCriteria.and("birth").gt(end).lte(start); |
| 118 | + flag = true; | |
| 114 | 119 | } |
| 115 | - List<Patients> patients = mongoTemplate.find(Query.query(pCriteria), Patients.class); | |
| 116 | - List<String> ids = new ArrayList<>(); | |
| 117 | - if(CollectionUtils.isNotEmpty(patients)) { | |
| 118 | - for (Patients patient : patients) { | |
| 120 | + if(flag) { | |
| 121 | + List<Patients> patients = mongoTemplate.find(Query.query(pCriteria), Patients.class); | |
| 122 | + List<String> ids = new ArrayList<>(); | |
| 123 | + if(CollectionUtils.isNotEmpty(patients)) { | |
| 124 | + for (Patients patient : patients) { | |
| 119 | 125 | // ids.add(patient.getId()); |
| 120 | - ids.add(patient.getPid()); | |
| 126 | + ids.add(patient.getPid()); | |
| 127 | + } | |
| 121 | 128 | } |
| 122 | - } | |
| 123 | 129 | // criteria.and("parentId").in(ids); |
| 124 | - criteria.and("pid").in(ids); | |
| 130 | + criteria.and("pid").in(ids); | |
| 131 | + } | |
| 132 | + | |
| 125 | 133 | PageResult pageResult = findMongoPage(BloodPressure.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); |
| 126 | 134 | List<BloodPressure> bloodPressures = (List<BloodPressure>) pageResult.getGrid(); |
| 127 | 135 | List<Map<String, Object>> restList = new ArrayList<>(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
ae88611
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import com.lyms.platform.common.result.RespBuilder; |
| 12 | 12 | import com.lyms.platform.common.utils.DateUtil; |
| 13 | 13 | import com.lyms.platform.common.utils.EnumUtil; |
| 14 | +import com.lyms.platform.common.utils.StringUtils; | |
| 14 | 15 | import com.lyms.platform.operate.web.facade.AccessPermissionFacade; |
| 15 | 16 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 16 | 17 | import com.lyms.platform.operate.web.service.IBloodSugarService; |
| 17 | 18 | |
| ... | ... | @@ -70,9 +71,15 @@ |
| 70 | 71 | |
| 71 | 72 | @Override |
| 72 | 73 | public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId) { |
| 74 | + boolean flag = false; | |
| 75 | + if(StringUtils.isNotEmpty(key) || StringUtils.isNotEmpty(vcCardNo) || weekEnd != null || weekStart != null || age != null) { | |
| 76 | + flag = true; | |
| 77 | + } | |
| 73 | 78 | Criteria criteria = Criteria.where("yn").is(1); |
| 74 | - List<String> pids = mongoUtil.getPidsByCondition2(null, key, vcCardNo, weekStart, weekEnd, age); | |
| 75 | - criteria.and("pid").in(pids); | |
| 79 | + if(flag) { | |
| 80 | + List<String> pids = mongoUtil.getPidsByCondition2(null, key, vcCardNo, weekStart, weekEnd, age); | |
| 81 | + criteria.and("pid").in(pids); | |
| 82 | + } | |
| 76 | 83 | PageResult pageResult = findMongoPage(BloodSugar.class, Query.query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); |
| 77 | 84 | List<BloodSugar> bloodSugars = (List<BloodSugar>) pageResult.getGrid(); |
| 78 | 85 | List<Map<String, Object>> restList = new ArrayList<>(); |