Commit 2403f72737414e56c81c7ef3675f220525fa6e92
1 parent
315a44240d
Exists in
master
and in
6 other branches
承德市妇幼上线两癌需求-乳腺和宫颈添加追访随访逻辑。修改之前检查记录不能影像最后一次检查记录的追访信息(因为只会有一条追访,记录的是最后一次检查的追访信息)
Showing 2 changed files with 43 additions and 23 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CancerScreeningFacade.java
View file @
2403f72
... | ... | @@ -33,6 +33,7 @@ |
33 | 33 | import org.apache.commons.lang.math.NumberUtils; |
34 | 34 | import org.springframework.beans.*; |
35 | 35 | import org.springframework.beans.factory.annotation.Autowired; |
36 | +import org.springframework.data.domain.Sort; | |
36 | 37 | import org.springframework.data.mongodb.core.MongoTemplate; |
37 | 38 | import org.springframework.data.mongodb.core.query.Criteria; |
38 | 39 | import org.springframework.data.mongodb.core.query.Query; |
... | ... | @@ -376,17 +377,27 @@ |
376 | 377 | cancerScr.setOperator(id); |
377 | 378 | cancerScr.setIsSync(1); |
378 | 379 | cancerScreenService.updateOneCancerScreen(cancerScr, cancerScr.getId()); |
379 | - //修改乳腺癌追访 | |
380 | - BreastAfterVisitQuery breastAfterVisitQuery=new BreastAfterVisitQuery(); | |
381 | - breastAfterVisitQuery.setYn(1); | |
382 | - breastAfterVisitQuery.setQueryNo(cancerScr.getCertificateNum()); | |
383 | - List<BreastAfterVisitModel> breastAfterVisitModels = breastAfterVisitService.queryBreastAfterVisitList(breastAfterVisitQuery); | |
384 | - if(CollectionUtils.isNotEmpty(breastAfterVisitModels)){ | |
385 | - //如果多次检查不需要新增追访信息,更新之前信息 | |
386 | - cancerScr.setId(breastAfterVisitModels.get(0).getParentId()); | |
387 | - breastAfterVisitAdd(cancerScr,2); | |
388 | - }else { | |
389 | - breastAfterVisitAdd(cancerScr,1); | |
380 | + //修改之前检查记录不能影像最后一次检查记录的追访信息(因为只会有一条追访,记录的是最后一次检查的追访信息) | |
381 | + Query query=new Query(); | |
382 | + Criteria criteria = Criteria.where("residentId").is(cancerScr.getResidentId()); | |
383 | + query.addCriteria(criteria); | |
384 | + query.with(new Sort(Sort.Direction.DESC, "created")); | |
385 | + List<CancerScreeningModel> models = mongoTemplate.find(query, CancerScreeningModel.class); | |
386 | + if(models.size()>1){ | |
387 | + if (models.get(0).getId().equals(cancerScr.getId())) { | |
388 | + //修改乳腺癌追访 | |
389 | + BreastAfterVisitQuery breastAfterVisitQuery=new BreastAfterVisitQuery(); | |
390 | + breastAfterVisitQuery.setYn(1); | |
391 | + breastAfterVisitQuery.setQueryNo(cancerScr.getCertificateNum()); | |
392 | + List<BreastAfterVisitModel> breastAfterVisitModels = breastAfterVisitService.queryBreastAfterVisitList(breastAfterVisitQuery); | |
393 | + if(CollectionUtils.isNotEmpty(breastAfterVisitModels)){ | |
394 | + //如果多次检查不需要新增追访信息,更新之前信息 | |
395 | + cancerScr.setId(breastAfterVisitModels.get(0).getParentId()); | |
396 | + breastAfterVisitAdd(cancerScr,2); | |
397 | + }else { | |
398 | + breastAfterVisitAdd(cancerScr,1); | |
399 | + } | |
400 | + } | |
390 | 401 | } |
391 | 402 | return new BaseResponse("成功", ErrorCodeConstants.SUCCESS); |
392 | 403 | } catch (Exception e) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/CervicalCancerServiceImpl.java
View file @
2403f72
... | ... | @@ -108,17 +108,27 @@ |
108 | 108 | Update update = MongoConvertHelper |
109 | 109 | .convertToNativeUpdate(ReflectionUtils.getUpdateField(param)); |
110 | 110 | mongoTemplate.updateFirst(query, update, CervicalCancerModel.class); |
111 | - //添加宫颈癌追访 | |
112 | - CervixVisitQuery cervixVisitQuery=new CervixVisitQuery(); | |
113 | - cervixVisitQuery.setYn(1); | |
114 | - cervixVisitQuery.setQueryNo(param.getIdCardNo()); | |
115 | - List<CervixVisitModel> cervixVisitModels = cervixVisitService.queryCervixVisitList(cervixVisitQuery); | |
116 | - if(CollectionUtils.isNotEmpty(cervixVisitModels)){ | |
117 | - //如果多次检查不需要新增追访信息,更新之前信息 | |
118 | - param.setId(cervixVisitModels.get(0).getParentId()); | |
119 | - cervixVisitAdd(param,2); | |
120 | - }else { | |
121 | - cervixVisitAdd(param,1); | |
111 | + //修改之前检查记录不能影像最后一次检查记录的随访信息(因为只会有一条随访,记录的是最后一次检查的随访信息) | |
112 | + Query query2=new Query(); | |
113 | + Criteria criteria = Criteria.where("parentId").is(param.getParentId()); | |
114 | + query2.addCriteria(criteria); | |
115 | + query2.with(new Sort(Sort.Direction.DESC, "created")); | |
116 | + List<CervicalCancerModel> models = mongoTemplate.find(query2, CervicalCancerModel.class); | |
117 | + if(models.size()>1){ | |
118 | + if (models.get(0).getId().equals(param.getId())) { | |
119 | + //添加宫颈癌追访 | |
120 | + CervixVisitQuery cervixVisitQuery=new CervixVisitQuery(); | |
121 | + cervixVisitQuery.setYn(1); | |
122 | + cervixVisitQuery.setQueryNo(param.getIdCardNo()); | |
123 | + List<CervixVisitModel> cervixVisitModels = cervixVisitService.queryCervixVisitList(cervixVisitQuery); | |
124 | + if(CollectionUtils.isNotEmpty(cervixVisitModels)){ | |
125 | + //如果多次检查不需要新增追访信息,更新之前信息 | |
126 | + param.setId(cervixVisitModels.get(0).getParentId()); | |
127 | + cervixVisitAdd(param,2); | |
128 | + }else { | |
129 | + cervixVisitAdd(param,1); | |
130 | + } | |
131 | + } | |
122 | 132 | } |
123 | 133 | return new BaseResponse("成功", ErrorCodeConstants.SUCCESS); |
124 | 134 | } catch (Exception e) { |
... | ... | @@ -209,7 +219,6 @@ |
209 | 219 | } |
210 | 220 | } |
211 | 221 | query.with(new Sort(Sort.Direction.DESC, "created")); |
212 | - System.out.println(query.toString()); | |
213 | 222 | long count = mongoTemplate.count(query, CervicalCancerModel.class); |
214 | 223 | param.mysqlBuild((int) count); |
215 | 224 | query.skip(param.getOffset()).limit(param.getLimit()); |