Commit 3b7b41a51cd5536a64682e1102a4501fa78b2682
1 parent
74197253f7
Exists in
master
and in
6 other branches
儿童贫血统计判断字符串大小bug
Showing 2 changed files with 13 additions and 4 deletions
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java
View file @
3b7b41a
| ... | ... | @@ -271,18 +271,26 @@ |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if(StringUtils.isNotEmpty(hemoglobinStart) && StringUtils.isNotEmpty(hemoglobinEnd)){ |
| 274 | + //字符串判断大小 | |
| 275 | + String formatXhdb = String.format("function() {\n" + | |
| 276 | + " return this.hemoglobin >= %s &&this.hemoglobin <= %s \n" + | |
| 277 | + " }",hemoglobinStart,hemoglobinEnd); | |
| 274 | 278 | if(null != c){ |
| 275 | - c = c.and("hemoglobin").gte(hemoglobinStart).lte(hemoglobinEnd); | |
| 279 | + c = c.and("$where").is(formatXhdb).ne("");//加ne:该字段在mongo中是”“ ,如果表达式有>=0也可查出。可以避免空数据 | |
| 276 | 280 | }else{ |
| 277 | - c = Criteria.where("hemoglobin").gte(createdTimeStart).lte(createdTimeEnd); | |
| 281 | + c = Criteria.where("$where").is(formatXhdb).ne(""); | |
| 278 | 282 | } |
| 279 | 283 | } |
| 280 | 284 | |
| 281 | 285 | if(StringUtils.isNotEmpty(hemoglobinLt)){ |
| 286 | + String formatXhdb = String.format("function() {\n" + | |
| 287 | + " return this.hemoglobin < %s \n" + | |
| 288 | + " }",hemoglobinLt); | |
| 282 | 289 | if(null != c){ |
| 283 | - c = c.and("hemoglobin").gte("0").lt(hemoglobinLt); | |
| 290 | + | |
| 291 | + c = c.and("$where").is(formatXhdb).ne("");//加ne:该字段在mongo中是”“ ,如果表达式有>=0也可查出。可以避免空数据 | |
| 284 | 292 | }else{ |
| 285 | - c = Criteria.where("hemoglobin").gte("0").lt(hemoglobinLt); | |
| 293 | + c = Criteria.where("$where").is(formatXhdb).ne(""); | |
| 286 | 294 | } |
| 287 | 295 | } |
| 288 | 296 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
3b7b41a
| ... | ... | @@ -4743,6 +4743,7 @@ |
| 4743 | 4743 | query.setHemoglobinStart(null); |
| 4744 | 4744 | query.setHemoglobinEnd(null); |
| 4745 | 4745 | query.setHemoglobinLt(severityHll); |
| 4746 | + System.out.println(query.convertToQuery().convertToMongoQuery().toString()); | |
| 4746 | 4747 | int severity =babyCheckService.queryBabyCheckCount(query); |
| 4747 | 4748 | map.put("severity"+i,severity); |
| 4748 | 4749 | //月龄区间总数 |