Commit 951ceb927aa040596a11b5dd26d2ece602817d5c
1 parent
d813d21bec
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 22 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/CervicalCancerServiceImpl.java
View file @
951ceb9
| 1 | 1 | package com.lyms.platform.operate.web.service.impl; |
| 2 | 2 | |
| 3 | +import java.util.ArrayList; | |
| 3 | 4 | import java.util.Date; |
| 4 | 5 | import java.util.LinkedList; |
| 5 | 6 | import java.util.List; |
| 6 | 7 | |
| ... | ... | @@ -208,9 +209,10 @@ |
| 208 | 209 | if (StringUtils.isEmpty(cardNo)) { |
| 209 | 210 | return new BaseResponse("参数缺失",ErrorCodeConstants.PARAMETER_ERROR); |
| 210 | 211 | } |
| 211 | - CervicalCancerModel modelByIdCardNo = mongoTemplate.findOne(Query.query(Criteria.where("idCardNo").is(cardNo)), CervicalCancerModel.class); | |
| 212 | + BaseResponse baseResponse = new BaseResponse(); | |
| 213 | + List<CervicalCancerModel> modelByIdCardNos = mongoTemplate.find(Query.query(Criteria.where("idCardNo").is(cardNo)), CervicalCancerModel.class); | |
| 212 | 214 | CervicalCancerModelResult result = new CervicalCancerModelResult(); |
| 213 | - if (modelByIdCardNo == null) { | |
| 215 | + if (CollectionUtils.isEmpty(modelByIdCardNos)) { | |
| 214 | 216 | List<ResidentsArchiveModel> models = mongoTemplate.find(Query.query(Criteria.where("certificateNum").is(cardNo)).with(new Sort(Sort.Direction.DESC, "created")), ResidentsArchiveModel.class); |
| 215 | 217 | if (CollectionUtils.isEmpty(models)) { |
| 216 | 218 | return new BaseResponse("查无数据,请先到妇女建档进行建档操作", ErrorCodeConstants.NO_DATA); |
| 217 | 219 | |
| 218 | 220 | |
| 219 | 221 | |
| ... | ... | @@ -242,14 +244,28 @@ |
| 242 | 244 | result.setPhone(model.getPhone()); |
| 243 | 245 | result.setParentId(model.getId()); |
| 244 | 246 | result.setIdCardNo(model.getCertificateNum()); |
| 245 | - BaseResponse baseResponse = new BaseResponse(); | |
| 247 | + | |
| 246 | 248 | baseResponse.setObject(result); |
| 247 | 249 | return baseResponse; |
| 248 | 250 | } |
| 251 | + baseResponse.setObject(getCervcalList(modelByIdCardNos)); | |
| 252 | + return baseResponse; | |
| 253 | + } | |
| 249 | 254 | |
| 250 | - CervicalCancerRequest request = new CervicalCancerRequest(); | |
| 251 | - request.setId(modelByIdCardNo.getId()); | |
| 252 | - return detail(request); | |
| 255 | + private List<CervicalCancerModelResult> getCervcalList(List<CervicalCancerModel> modelByIdCardNos) | |
| 256 | + { | |
| 257 | + List<CervicalCancerModelResult> list = new ArrayList<>(); | |
| 258 | + for (CervicalCancerModel model : modelByIdCardNos) | |
| 259 | + { | |
| 260 | + CervicalCancerModelResult result = new CervicalCancerModelResult(); | |
| 261 | + if (model != null) { | |
| 262 | + BeanUtils.copyProperties(model, result); | |
| 263 | + } | |
| 264 | + list.add(result); | |
| 265 | + } | |
| 266 | + return list; | |
| 253 | 267 | } |
| 268 | + | |
| 269 | + | |
| 254 | 270 | } |