Commit b83590c296d3111ba92ecfb96235ef946f2d99cb
1 parent
4444bf9bea
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 15 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
b83590c
... | ... | @@ -3424,16 +3424,25 @@ |
3424 | 3424 | query.addCriteria(Criteria.where("heartMurmur").is(heartMurmur)); |
3425 | 3425 | } |
3426 | 3426 | if(null!=cyNumType){ |
3427 | - query.addCriteria(Criteria.where("cyNumType").is(cyNumType)); | |
3427 | + if(cyNumType==1){//正常 | |
3428 | + Criteria criteria = new Criteria(); | |
3429 | + Criteria criteria1= Criteria.where("cyNumType").is(cyNumType); | |
3430 | + Criteria criteria2= Criteria.where("cyNumType").exists(false); | |
3431 | + criteria.orOperator(criteria2,criteria1); | |
3432 | + query.addCriteria(criteria1);//如需兼容历史数据用criteria。没有该字段的暂时默认正常 | |
3433 | + } | |
3434 | + if(cyNumType==2){//异常 | |
3435 | + query.addCriteria(Criteria.where("cyNumType").is(cyNumType)); | |
3436 | + } | |
3428 | 3437 | } |
3429 | 3438 | if(null!=qcNumType){ |
3430 | - if(qcNumType==1){//正常 | |
3431 | - query.addCriteria(Criteria.where("qcNum").is(0)); | |
3432 | - } | |
3433 | 3439 | if(qcNumType==2){//异常 |
3434 | - query.addCriteria(Criteria.where("qcNum").gt(0)); | |
3440 | + //字符串判断大小 | |
3441 | + String formatQcNum = String.format("function() {\n" + | |
3442 | + " return this.qcNum > %s \n" + | |
3443 | + " }","0"); | |
3444 | + query.addCriteria(Criteria.where("$where").is(formatQcNum)); | |
3435 | 3445 | } |
3436 | - | |
3437 | 3446 | } |
3438 | 3447 | |
3439 | 3448 | final BabyCheckModel checkModel = mongoTemplate.findOne(query, BabyCheckModel.class); |