Commit 9143ec1ae4787eff84f4eb314931582624200247
1 parent
26bdbc9bda
Exists in
master
and in
6 other branches
count
Showing 1 changed file with 11 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
9143ec1
| ... | ... | @@ -227,15 +227,20 @@ |
| 227 | 227 | public BaseResponse wxInfo(String parentId, Integer type) { |
| 228 | 228 | List<Map<String, Object>> restList = new ArrayList<>(); |
| 229 | 229 | List<BloodSugar> bloodSugars = mongoTemplate.find(Query.query(Criteria.where("parentId").is(parentId).and("bloodSugarType").is(type)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); |
| 230 | + Set<String> dayCountSet = new HashSet<>(); | |
| 230 | 231 | for (BloodSugar bloodSugar : bloodSugars) { |
| 231 | - Map<String, Object> temp = new HashMap<>(); | |
| 232 | - temp.put("bloodSugar", bloodSugar.getBloodSugar()); | |
| 233 | - temp.put("craeted", DateUtil.getyyyy_MM_dd_hms(bloodSugar.getCreated())); | |
| 234 | - temp.put("type", bloodSugar.getBloodSugarType()); | |
| 235 | - restList.add(temp); | |
| 232 | + if(bloodSugar.getBloodSugarType() == type) { | |
| 233 | + Map<String, Object> temp = new HashMap<>(); | |
| 234 | + temp.put("bloodSugar", bloodSugar.getBloodSugar()); | |
| 235 | + temp.put("craeted", DateUtil.getyyyy_MM_dd_hms(bloodSugar.getCreated())); | |
| 236 | + temp.put("type", bloodSugar.getBloodSugarType()); | |
| 237 | + restList.add(temp); | |
| 238 | + | |
| 239 | + dayCountSet.add(DateUtil.getyyyy_MM_dd(bloodSugar.getCreated())); | |
| 240 | + } | |
| 236 | 241 | } |
| 237 | 242 | |
| 238 | - return RespBuilder.buildSuccess("restList", restList, "count", 11, "dayCount", 1); | |
| 243 | + return RespBuilder.buildSuccess("restList", restList, "count", bloodSugars.size(), "dayCount", dayCountSet.size()); | |
| 239 | 244 | } |
| 240 | 245 | |
| 241 | 246 | } |