Commit bd0f9a45f4176a479bbe3489b3e4b68ef79ed302
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 5 changed files
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VisitFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyVisitAddRequest.java
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
bd0f9a4
| 1 | 1 | package com.lyms.platform.query; | 
| 2 | 2 | |
| 3 | -import java.util.Date; | |
| 4 | - | |
| 5 | -import org.bson.types.ObjectId; | |
| 6 | -import org.springframework.data.mongodb.core.query.Criteria; | |
| 7 | - | |
| 8 | 3 | import com.lyms.platform.common.base.IConvertToNativeQuery; | 
| 9 | 4 | import com.lyms.platform.common.dao.BaseQuery; | 
| 10 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; | 
| 11 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; | 
| 12 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; | 
| 8 | +import org.bson.types.ObjectId; | |
| 9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 13 | 10 | |
| 11 | +import java.util.Date; | |
| 12 | + | |
| 14 | 13 | /** | 
| 15 | 14 | * 新生儿查询模型 | 
| 16 | - * | |
| 15 | + * | |
| 17 | 16 | * @author Administrator | 
| 18 | 17 | */ | 
| 19 | 18 | public class BabyModelQuery extends BaseQuery implements IConvertToNativeQuery { | 
| ... | ... | @@ -79,7 +78,7 @@ | 
| 79 | 78 | */ | 
| 80 | 79 | private int visitstatus = -1; | 
| 81 | 80 | |
| 82 | - private int yn= -1; | |
| 81 | + private int yn = -1; | |
| 83 | 82 | |
| 84 | 83 | public int getYn() { | 
| 85 | 84 | return yn; | 
| 86 | 85 | |
| 87 | 86 | |
| 88 | 87 | |
| 89 | 88 | |
| 90 | 89 | |
| ... | ... | @@ -156,24 +155,30 @@ | 
| 156 | 155 | if (null != id) { | 
| 157 | 156 | condition = condition.and("id", new ObjectId(id), MongoOper.IS); | 
| 158 | 157 | } | 
| 159 | - if(-1!=yn){ | |
| 158 | + if (-1 != yn) { | |
| 160 | 159 | condition = condition.and("yn", yn, MongoOper.IS); | 
| 161 | 160 | } | 
| 162 | - if(null!=areaId){ | |
| 161 | + if (null != areaId) { | |
| 163 | 162 | condition = condition.and("areaId", areaId, MongoOper.IS); | 
| 164 | 163 | } | 
| 165 | - /* | |
| 166 | - * if(null!=keyword){ if(null!=keyword){ MongoCondition con1= MongoCondition.newInstance("phone", keyword, MongoOper.LIKE); MongoCondition con | |
| 167 | - * = MongoCondition.newInstance("name", keyword, MongoOper.LIKE); condition = condition.orCondition(new MongoCondition[]{con1,con}); } } | |
| 168 | - */ | |
| 169 | 164 | |
| 165 | + if (null != keyword) { | |
| 166 | + if (null != keyword) { | |
| 167 | + MongoCondition con1 = MongoCondition.newInstance("mphone", "^"+keyword, MongoOper.LIKE); | |
| 168 | + MongoCondition con | |
| 169 | + = MongoCondition.newInstance("mname", "^"+keyword, MongoOper.LIKE); | |
| 170 | + condition = condition.orCondition(new MongoCondition[]{con1, con}); | |
| 171 | + } | |
| 172 | + } | |
| 173 | + | |
| 174 | + | |
| 170 | 175 | if (null != parentId) { | 
| 171 | 176 | condition = condition.and("parentid", parentId, MongoOper.IS); | 
| 172 | 177 | } | 
| 173 | - if(null!=mphone){ | |
| 178 | + if (null != mphone) { | |
| 174 | 179 | condition = condition.and("mphone", mphone, MongoOper.IS); | 
| 175 | 180 | } | 
| 176 | - if(null!=mname){ | |
| 181 | + if (null != mname) { | |
| 177 | 182 | condition = condition.and("mname", mname, MongoOper.IS); | 
| 178 | 183 | } | 
| 179 | 184 | Criteria c = null; | 
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
bd0f9a4
| ... | ... | @@ -189,8 +189,8 @@ | 
| 189 | 189 | public MongoQuery convertToQuery() { | 
| 190 | 190 | MongoCondition condition = MongoCondition.newInstance(); | 
| 191 | 191 | if(null!=keyword){ | 
| 192 | - MongoCondition con1= MongoCondition.newInstance("phone", keyword, MongoOper.LIKE); | |
| 193 | - MongoCondition con = MongoCondition.newInstance("username", keyword, MongoOper.LIKE); | |
| 192 | + MongoCondition con1= MongoCondition.newInstance("phone", "^"+keyword, MongoOper.LIKE); | |
| 193 | + MongoCondition con = MongoCondition.newInstance("username", "^"+keyword, MongoOper.LIKE); | |
| 194 | 194 | condition = condition.orCondition(new MongoCondition[]{con1,con}); | 
| 195 | 195 | } | 
| 196 | 196 | if(visitstatus!=-1){ | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
View file @
bd0f9a4
| ... | ... | @@ -90,6 +90,7 @@ | 
| 90 | 90 | babyQuery.setBirthEnd(date); | 
| 91 | 91 | babyQuery.setBirthStart(DateUtil.parseYMD(babyManagerRequest.getdStart())); | 
| 92 | 92 | babyQuery.setVisitstatus(babyManagerRequest.getVisitstatus()); | 
| 93 | + babyQuery.setKeyword(babyManagerRequest.getKeyword()); | |
| 93 | 94 | babyQuery.setMphone(babyManagerRequest.getPhone()); | 
| 94 | 95 | babyQuery.setPage(babyManagerRequest.getPage()); | 
| 95 | 96 | babyQuery.setMname(babyManagerRequest.getName()); | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VisitFacade.java
View file @
bd0f9a4
| ... | ... | @@ -240,6 +240,15 @@ | 
| 240 | 240 | public BaseResponse addOrUpdateBabyAndVisit(BabyVisitAddRequest babyVisitAddRequest) { | 
| 241 | 241 | |
| 242 | 242 | String babyId = babyVisitAddRequest.getParentId(); | 
| 243 | + String currentTime = babyVisitAddRequest.getCurrentVisit(); | |
| 244 | + if (StringUtils.isNotEmpty(currentTime)&&StringUtils.isNotEmpty(babyVisitAddRequest.getBirth())) { | |
| 245 | + Date currentVisit = DateUtil.parseYMD(babyVisitAddRequest.getCurrentVisit()); | |
| 246 | + Date birth = DateUtil.parseYMD(babyVisitAddRequest.getBirth()); | |
| 247 | + boolean f = currentVisit.before(birth); | |
| 248 | + if (f) { | |
| 249 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("检查时间必须大于小孩出生时间"); | |
| 250 | + } | |
| 251 | + } | |
| 243 | 252 | // 访视记录id为空表示新增 | 
| 244 | 253 | BabyVisitModel babyVisitModel = babyVisitAddRequest.convertToDataModel(); | 
| 245 | 254 | //表示需要新增小孩的数据 | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyVisitAddRequest.java
View file @
bd0f9a4
| ... | ... | @@ -9,6 +9,7 @@ | 
| 9 | 9 | import com.lyms.platform.pojo.BabyVisitModel; | 
| 10 | 10 | import com.lyms.platform.pojo.Patients; | 
| 11 | 11 | import org.apache.commons.lang.StringUtils; | 
| 12 | +import org.hibernate.validator.constraints.NotEmpty; | |
| 12 | 13 | |
| 13 | 14 | import java.util.Map; | 
| 14 | 15 | |
| ... | ... | @@ -66,7 +67,7 @@ | 
| 66 | 67 | |
| 67 | 68 | // 性别 | 
| 68 | 69 | private int sex; | 
| 69 | - | |
| 70 | + @NotEmpty(message = "生日不能为空") | |
| 70 | 71 | // 生日 | 
| 71 | 72 | private String birth; | 
| 72 | 73 | |
| ... | ... | @@ -203,7 +204,7 @@ | 
| 203 | 204 | |
| 204 | 205 | // 指导 | 
| 205 | 206 | private Map guide; | 
| 206 | - | |
| 207 | + @NotEmpty(message = "本次访视时间不能为空") | |
| 207 | 208 | // 本次访视时间 | 
| 208 | 209 | private String currentVisit; | 
| 209 | 210 |