Commit 10e72498165d4e6cef50d6dd2ff062539633d5de
1 parent
780fbd1fc4
Exists in
master
and in
1 other branch
产妇增加字段
Showing 1 changed file with 189 additions and 83 deletions
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
10e7249
| ... | ... | @@ -5,25 +5,22 @@ |
| 5 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; |
| 6 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
| 7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 8 | -import org.bson.types.ObjectId; | |
| 9 | 8 | import org.springframework.data.mongodb.core.query.Criteria; |
| 10 | 9 | |
| 11 | 10 | import java.util.Date; |
| 12 | 11 | |
| 13 | 12 | /** |
| 14 | - * | |
| 15 | 13 | * 产妇模型定义 |
| 16 | - * | |
| 17 | - * @author Administrator | |
| 18 | 14 | * |
| 15 | + * @author Administrator | |
| 19 | 16 | */ |
| 20 | -public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery{ | |
| 21 | - | |
| 17 | +public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 18 | + | |
| 22 | 19 | private String id; |
| 23 | 20 | |
| 24 | - /** | |
| 25 | - * 关键字 | |
| 26 | - */ | |
| 21 | + /** | |
| 22 | + * 关键字 | |
| 23 | + */ | |
| 27 | 24 | private String keyword; |
| 28 | 25 | /** |
| 29 | 26 | * 是否分配社区 |
| 30 | 27 | |
| 31 | 28 | |
| ... | ... | @@ -49,20 +46,13 @@ |
| 49 | 46 | /** |
| 50 | 47 | * 访视状态 |
| 51 | 48 | */ |
| 52 | - private int visitstatus=-1; | |
| 49 | + private int visitstatus = -1; | |
| 53 | 50 | |
| 54 | 51 | private String areaId; |
| 55 | 52 | //社区id |
| 56 | 53 | private String areaIdOrRestId; |
| 57 | 54 | |
| 58 | - public String getAreaIdOrRestId() { | |
| 59 | - return areaIdOrRestId; | |
| 60 | - } | |
| 61 | 55 | |
| 62 | - public void setAreaIdOrRestId(String areaIdOrRestId) { | |
| 63 | - this.areaIdOrRestId = areaIdOrRestId; | |
| 64 | - } | |
| 65 | - | |
| 66 | 56 | /** |
| 67 | 57 | * 产妇手机号 |
| 68 | 58 | */ |
| 69 | 59 | |
| ... | ... | @@ -71,9 +61,9 @@ |
| 71 | 61 | * 产妇分娩日期 |
| 72 | 62 | */ |
| 73 | 63 | private Date dueDateStart; |
| 74 | - | |
| 64 | + | |
| 75 | 65 | private Date dueDateEnd; |
| 76 | - | |
| 66 | + | |
| 77 | 67 | /** |
| 78 | 68 | * 地址 |
| 79 | 69 | */ |
| ... | ... | @@ -82,7 +72,7 @@ |
| 82 | 72 | * 社区id |
| 83 | 73 | */ |
| 84 | 74 | private String communityId; |
| 85 | - | |
| 75 | + | |
| 86 | 76 | /** |
| 87 | 77 | * 身份证号码 |
| 88 | 78 | */ |
| 89 | 79 | |
| 90 | 80 | |
| 91 | 81 | |
| 92 | 82 | |
| 93 | 83 | |
| 94 | 84 | |
| 95 | 85 | |
| 96 | 86 | |
| ... | ... | @@ -101,41 +91,43 @@ |
| 101 | 91 | * 生日 |
| 102 | 92 | */ |
| 103 | 93 | private Date birthEnd; |
| 94 | + /** | |
| 95 | + * 服务类型 | |
| 96 | + */ | |
| 97 | + private String serviceType; | |
| 104 | 98 | |
| 105 | - public String getAreaId() { | |
| 106 | - return areaId; | |
| 107 | - } | |
| 99 | + private String serviceStatus; | |
| 108 | 100 | |
| 109 | - public void setAreaId(String areaId) { | |
| 110 | - this.areaId = areaId; | |
| 111 | - } | |
| 101 | + /** | |
| 102 | + * 风险等级 | |
| 103 | + */ | |
| 104 | + private String rLevel; | |
| 105 | + /** | |
| 106 | + * 高危评分 | |
| 107 | + */ | |
| 108 | + private String hScore; | |
| 109 | + /** | |
| 110 | + * 高危因素 | |
| 111 | + */ | |
| 112 | + private String rFactor; | |
| 112 | 113 | |
| 113 | - public Date getBirthEnd() { | |
| 114 | - return birthEnd; | |
| 115 | - } | |
| 116 | 114 | |
| 117 | - public void setBirthEnd(Date birthEnd) { | |
| 118 | - this.birthEnd = birthEnd; | |
| 119 | - } | |
| 120 | - | |
| 121 | - public Date getBirthStart() { | |
| 122 | - return birthStart; | |
| 123 | - } | |
| 124 | - | |
| 125 | - public void setBirthStart(Date birthStart) { | |
| 126 | - this.birthStart = birthStart; | |
| 127 | - } | |
| 128 | - | |
| 129 | 115 | /** |
| 130 | 116 | * 是否有效 |
| 131 | 117 | */ |
| 132 | - private int yn=-1; | |
| 118 | + private int yn = -1; | |
| 133 | 119 | /** |
| 134 | 120 | * 1:孕妇,2:儿童 |
| 135 | 121 | */ |
| 136 | - private int type=-1; | |
| 122 | + private int type = -1; | |
| 137 | 123 | |
| 124 | + public String getServiceStatus() { | |
| 125 | + return serviceStatus; | |
| 126 | + } | |
| 138 | 127 | |
| 128 | + public void setServiceStatus(String serviceStatus) { | |
| 129 | + this.serviceStatus = serviceStatus; | |
| 130 | + } | |
| 139 | 131 | |
| 140 | 132 | public int getType() { |
| 141 | 133 | return type; |
| 142 | 134 | |
| 143 | 135 | |
| 144 | 136 | |
| 145 | 137 | |
| 146 | 138 | |
| 147 | 139 | |
| 148 | 140 | |
| 149 | 141 | |
| 150 | 142 | |
| 151 | 143 | |
| 152 | 144 | |
| 153 | 145 | |
| 154 | 146 | |
| 155 | 147 | |
| 156 | 148 | |
| 157 | 149 | |
| 158 | 150 | |
| 159 | 151 | |
| 160 | 152 | |
| 161 | 153 | |
| 162 | 154 | |
| 163 | 155 | |
| 164 | 156 | |
| 165 | 157 | |
| 166 | 158 | |
| 167 | 159 | |
| 168 | 160 | |
| 169 | 161 | |
| 170 | 162 | |
| 171 | 163 | |
| 172 | 164 | |
| 173 | 165 | |
| 174 | 166 | |
| 175 | 167 | |
| 176 | 168 | |
| ... | ... | @@ -148,122 +140,234 @@ |
| 148 | 140 | public String getCardNo() { |
| 149 | 141 | return cardNo; |
| 150 | 142 | } |
| 143 | + | |
| 151 | 144 | public void setCardNo(String cardNo) { |
| 152 | 145 | this.cardNo = cardNo; |
| 153 | 146 | } |
| 147 | + | |
| 154 | 148 | public int getVisitstatus() { |
| 155 | 149 | return visitstatus; |
| 156 | 150 | } |
| 151 | + | |
| 157 | 152 | public void setVisitstatus(int visitstatus) { |
| 158 | 153 | this.visitstatus = visitstatus; |
| 159 | 154 | } |
| 155 | + | |
| 160 | 156 | public String getKeyword() { |
| 161 | 157 | return keyword; |
| 162 | 158 | } |
| 159 | + | |
| 163 | 160 | public void setKeyword(String keyword) { |
| 164 | 161 | this.keyword = keyword; |
| 165 | 162 | } |
| 163 | + | |
| 166 | 164 | public Date getDueDateStart() { |
| 167 | 165 | return dueDateStart; |
| 168 | 166 | } |
| 167 | + | |
| 169 | 168 | public void setDueDateStart(Date dueDateStart) { |
| 170 | 169 | this.dueDateStart = dueDateStart; |
| 171 | 170 | } |
| 171 | + | |
| 172 | 172 | public Date getDueDateEnd() { |
| 173 | 173 | return dueDateEnd; |
| 174 | 174 | } |
| 175 | + | |
| 175 | 176 | public void setDueDateEnd(Date dueDateEnd) { |
| 176 | 177 | this.dueDateEnd = dueDateEnd; |
| 177 | 178 | } |
| 178 | - | |
| 179 | - | |
| 180 | - | |
| 179 | + | |
| 180 | + public String getAreaIdOrRestId() { | |
| 181 | + return areaIdOrRestId; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public void setAreaIdOrRestId(String areaIdOrRestId) { | |
| 185 | + this.areaIdOrRestId = areaIdOrRestId; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public String gethScore() { | |
| 189 | + return hScore; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public void sethScore(String hScore) { | |
| 193 | + this.hScore = hScore; | |
| 194 | + } | |
| 195 | + | |
| 196 | + public String getrFactor() { | |
| 197 | + return rFactor; | |
| 198 | + } | |
| 199 | + | |
| 200 | + public void setrFactor(String rFactor) { | |
| 201 | + this.rFactor = rFactor; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public String getrLevel() { | |
| 205 | + return rLevel; | |
| 206 | + } | |
| 207 | + | |
| 208 | + public void setrLevel(String rLevel) { | |
| 209 | + this.rLevel = rLevel; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public String getServiceType() { | |
| 213 | + return serviceType; | |
| 214 | + } | |
| 215 | + | |
| 216 | + public void setServiceType(String serviceType) { | |
| 217 | + this.serviceType = serviceType; | |
| 218 | + } | |
| 219 | + | |
| 220 | + public String getAreaId() { | |
| 221 | + return areaId; | |
| 222 | + } | |
| 223 | + | |
| 224 | + public void setAreaId(String areaId) { | |
| 225 | + this.areaId = areaId; | |
| 226 | + } | |
| 227 | + | |
| 228 | + public Date getBirthEnd() { | |
| 229 | + return birthEnd; | |
| 230 | + } | |
| 231 | + | |
| 232 | + public void setBirthEnd(Date birthEnd) { | |
| 233 | + this.birthEnd = birthEnd; | |
| 234 | + } | |
| 235 | + | |
| 236 | + public Date getBirthStart() { | |
| 237 | + return birthStart; | |
| 238 | + } | |
| 239 | + | |
| 240 | + public void setBirthStart(Date birthStart) { | |
| 241 | + this.birthStart = birthStart; | |
| 242 | + } | |
| 243 | + | |
| 181 | 244 | public int getYn() { |
| 182 | 245 | return yn; |
| 183 | 246 | } |
| 247 | + | |
| 184 | 248 | public void setYn(int yn) { |
| 185 | 249 | this.yn = yn; |
| 186 | 250 | } |
| 251 | + | |
| 187 | 252 | public String getName() { |
| 188 | 253 | return name; |
| 189 | 254 | } |
| 255 | + | |
| 190 | 256 | public void setName(String name) { |
| 191 | 257 | this.name = name; |
| 192 | 258 | } |
| 259 | + | |
| 193 | 260 | public int getAge() { |
| 194 | 261 | return age; |
| 195 | 262 | } |
| 263 | + | |
| 196 | 264 | public void setAge(int age) { |
| 197 | 265 | this.age = age; |
| 198 | 266 | } |
| 267 | + | |
| 199 | 268 | public String getPhone() { |
| 200 | 269 | return phone; |
| 201 | 270 | } |
| 271 | + | |
| 202 | 272 | public void setPhone(String phone) { |
| 203 | 273 | this.phone = phone; |
| 204 | 274 | } |
| 205 | - | |
| 275 | + | |
| 206 | 276 | public String getAddress() { |
| 207 | 277 | return address; |
| 208 | 278 | } |
| 279 | + | |
| 209 | 280 | public void setAddress(String address) { |
| 210 | 281 | this.address = address; |
| 211 | 282 | } |
| 283 | + | |
| 212 | 284 | public String getCommunityId() { |
| 213 | 285 | return communityId; |
| 214 | 286 | } |
| 287 | + | |
| 215 | 288 | public void setCommunityId(String communityId) { |
| 216 | 289 | this.communityId = communityId; |
| 217 | 290 | } |
| 291 | + | |
| 218 | 292 | public MongoQuery convertToQuery() { |
| 219 | - MongoCondition condition = MongoCondition.newInstance(); | |
| 220 | - if(null!=keyword){ | |
| 221 | - MongoCondition con1= MongoCondition.newInstance("phone", "^"+keyword, MongoOper.LIKE); | |
| 222 | - MongoCondition con = MongoCondition.newInstance("username", "^"+keyword, MongoOper.LIKE); | |
| 223 | - condition = condition.orCondition(new MongoCondition[]{con1,con}); | |
| 293 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 294 | + if (null != keyword) { | |
| 295 | + MongoCondition con1 = MongoCondition.newInstance("phone", "^" + keyword, MongoOper.LIKE); | |
| 296 | + MongoCondition con = MongoCondition.newInstance("username", "^" + keyword, MongoOper.LIKE); | |
| 297 | + condition = condition.orCondition(new MongoCondition[]{con1, con}); | |
| 224 | 298 | } |
| 225 | - if(null!=areaIdOrRestId){ | |
| 226 | - MongoCondition con1= MongoCondition.newInstance("areaId", areaIdOrRestId, MongoOper.IS); | |
| 227 | - MongoCondition con = MongoCondition.newInstance("areaPostRestId", areaIdOrRestId, MongoOper.IS); | |
| 228 | - condition=condition.orCondition(new MongoCondition[]{con1, con}); | |
| 299 | + if (null != areaIdOrRestId) { | |
| 300 | + MongoCondition con1 = MongoCondition.newInstance("areaId", areaIdOrRestId, MongoOper.IS); | |
| 301 | + MongoCondition con = MongoCondition.newInstance("areaPostRestId", areaIdOrRestId, MongoOper.IS); | |
| 302 | + condition = condition.orCondition(new MongoCondition[]{con1, con}); | |
| 229 | 303 | } |
| 230 | - if(visitstatus!=-1){ | |
| 231 | - condition= condition.and("isVisit", visitstatus, MongoOper.IS); | |
| 304 | + if (visitstatus != -1) { | |
| 305 | + condition = condition.and("isVisit", visitstatus, MongoOper.IS); | |
| 232 | 306 | } |
| 233 | - if(null!=communityId&&!"-1".equals(communityId)){ | |
| 234 | - condition= condition.and("communityId", communityId, MongoOper.IS); | |
| 307 | + if (null != communityId && !"-1".equals(communityId)) { | |
| 308 | + condition = condition.and("communityId", communityId, MongoOper.IS); | |
| 235 | 309 | } |
| 236 | - if(null!=areaId){ | |
| 237 | - condition= condition.and("areaId", areaId, MongoOper.IS); | |
| 310 | + if (null != areaId) { | |
| 311 | + condition = condition.and("areaId", areaId, MongoOper.IS); | |
| 238 | 312 | } |
| 239 | - if(null!=id){ | |
| 240 | - condition= condition.and("id", id, MongoOper.IS); | |
| 313 | + if (null != id) { | |
| 314 | + condition = condition.and("id", id, MongoOper.IS); | |
| 241 | 315 | } |
| 242 | - if(null!=vcCardNo){ | |
| 243 | - condition= condition.and("vcCardNo", vcCardNo, MongoOper.IS); | |
| 316 | + if (null != vcCardNo) { | |
| 317 | + condition = condition.and("vcCardNo", vcCardNo, MongoOper.IS); | |
| 244 | 318 | } |
| 245 | - if(null!=cardNo){ | |
| 246 | - condition=condition.and("cardno", cardNo, MongoOper.IS); | |
| 319 | + if (null != cardNo) { | |
| 320 | + condition = condition.and("cardno", cardNo, MongoOper.IS); | |
| 247 | 321 | |
| 248 | 322 | } |
| 249 | - if(null!=phone){ | |
| 250 | - condition=condition.and("phone", phone, MongoOper.IS); | |
| 323 | + if (null != phone) { | |
| 324 | + condition = condition.and("phone", phone, MongoOper.IS); | |
| 251 | 325 | } |
| 252 | - if(null!=name){ | |
| 253 | - condition=condition.and("username", name, MongoOper.IS); | |
| 326 | + if (null != name) { | |
| 327 | + condition = condition.and("username", name, MongoOper.IS); | |
| 254 | 328 | } |
| 255 | - | |
| 256 | - | |
| 257 | - if(-1!=yn){ | |
| 258 | - condition=condition.and("yn", yn, MongoOper.IS); | |
| 329 | + /* *//** | |
| 330 | + * 服务类型 | |
| 331 | + *//* | |
| 332 | + private String serviceType; | |
| 333 | + *//** | |
| 334 | + * 风险等级 | |
| 335 | + *//* | |
| 336 | + private String rLevel; | |
| 337 | + *//** | |
| 338 | + * 高危评分 | |
| 339 | + *//* | |
| 340 | + private String hScore; | |
| 341 | + *//** | |
| 342 | + * 高危因素 | |
| 343 | + *//* | |
| 344 | + private String rFactor*/ | |
| 345 | + if (null != serviceType) { | |
| 346 | + condition = condition.and("serviceType", serviceType, MongoOper.IS); | |
| 259 | 347 | } |
| 260 | - if(null!=isNull){ | |
| 261 | - condition=condition.and("communityId", null, MongoOper.IS); | |
| 348 | + if(null!=serviceStatus){ | |
| 349 | + condition = condition.and("serviceStatus", serviceStatus, MongoOper.IS); | |
| 262 | 350 | } |
| 351 | + if (null != rLevel) { | |
| 352 | + condition = condition.and("riskLevelId", rLevel, MongoOper.IS); | |
| 353 | + } | |
| 354 | + if (null != hScore) { | |
| 355 | + condition = condition.and("riskScore", hScore, MongoOper.IS); | |
| 356 | + } | |
| 357 | + if (null != hScore) { | |
| 358 | + condition = condition.and("riskFactorId", rFactor, MongoOper.ALL); | |
| 359 | + } | |
| 360 | + if (-1 != yn) { | |
| 361 | + condition = condition.and("yn", yn, MongoOper.IS); | |
| 362 | + } | |
| 363 | + if (null != isNull) { | |
| 364 | + condition = condition.and("communityId", null, MongoOper.IS); | |
| 365 | + } | |
| 263 | 366 | //去掉type为3 的情况 |
| 264 | - /* if(-1!=type){ | |
| 265 | - condition=condition.and("type", type, MongoOper.IS); | |
| 266 | - }*/ | |
| 367 | + /* */ | |
| 368 | + if (-1 != type) { | |
| 369 | + condition = condition.and("type", type, MongoOper.IS); | |
| 370 | + } | |
| 267 | 371 | |
| 268 | 372 | boolean isAddStart = Boolean.FALSE; |
| 269 | 373 | Criteria c = null; |
| ... | ... | @@ -274,7 +378,7 @@ |
| 274 | 378 | |
| 275 | 379 | if (null != dueDateEnd) { |
| 276 | 380 | if (isAddStart) { |
| 277 | - c=c.lte(dueDateEnd); | |
| 381 | + c = c.lte(dueDateEnd); | |
| 278 | 382 | } else { |
| 279 | 383 | c = Criteria.where("dueDate").lte(dueDateEnd); |
| 280 | 384 | } |
| 281 | 385 | |
| 282 | 386 | |
| ... | ... | @@ -297,14 +401,16 @@ |
| 297 | 401 | } |
| 298 | 402 | isAddStart1 = Boolean.TRUE; |
| 299 | 403 | } |
| 300 | - if (isAddStart ||isAddStart1) { | |
| 404 | + if (isAddStart || isAddStart1) { | |
| 301 | 405 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
| 302 | 406 | } |
| 303 | 407 | return condition.toMongoQuery(); |
| 304 | 408 | } |
| 409 | + | |
| 305 | 410 | public String getId() { |
| 306 | 411 | return id; |
| 307 | 412 | } |
| 413 | + | |
| 308 | 414 | public void setId(String id) { |
| 309 | 415 | this.id = id; |
| 310 | 416 | } |