Commit 3a74ded886ea1993dab86f03506afd3f35be0a3c
1 parent
88f9184ba5
Exists in
master
and in
6 other branches
实时添加追访记录
Showing 5 changed files with 120 additions and 59 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyAfterVisitService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyAfterVisitServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyAfterVisitInfoModelWork.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
3a74ded
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | import com.lyms.platform.operate.web.request.BabyCheckRequest; |
| 14 | 14 | import com.lyms.platform.operate.web.request.WxBabyMeasureRequest; |
| 15 | 15 | import com.lyms.platform.operate.web.result.*; |
| 16 | +import com.lyms.platform.operate.web.service.BabyAfterVisitService; | |
| 16 | 17 | import com.lyms.platform.operate.web.service.PatientWeightService; |
| 17 | 18 | import com.lyms.platform.operate.web.service.impl.BaseServiceImpl; |
| 18 | 19 | import com.lyms.platform.operate.web.utils.MongoUtil; |
| ... | ... | @@ -34,6 +35,8 @@ |
| 34 | 35 | import java.util.*; |
| 35 | 36 | import java.util.regex.Pattern; |
| 36 | 37 | |
| 38 | +import static com.lyms.platform.operate.web.service.BabyAfterVisitService.*; | |
| 39 | + | |
| 37 | 40 | @Component |
| 38 | 41 | public class BabyCheckFacade extends BaseServiceImpl { |
| 39 | 42 | |
| ... | ... | @@ -106,6 +109,9 @@ |
| 106 | 109 | @Autowired |
| 107 | 110 | private MeasureDataInfoService measureDataInfoService; |
| 108 | 111 | |
| 112 | + @Autowired | |
| 113 | + private BabyAfterVisitService babyAfterVisitService; | |
| 114 | + | |
| 109 | 115 | public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version"); |
| 110 | 116 | |
| 111 | 117 | /** |
| ... | ... | @@ -515,6 +521,14 @@ |
| 515 | 521 | model.setHospitalId(hospitalId); |
| 516 | 522 | model.setCreated(new Date()); |
| 517 | 523 | model = babyCheckService.addBabyCheck(model); |
| 524 | + | |
| 525 | + // 添加追访记录 | |
| 526 | + Date nextDate = model.getNextDate(); | |
| 527 | + if (nextDate != null) { | |
| 528 | + babyAfterVisitService.addOrUpdateAfterVisitData(model, TYPE_CHECK, STATUS_TYPE_NO); | |
| 529 | + } else { | |
| 530 | + babyAfterVisitService.addOrUpdateAfterVisitData(model, TYPE_CHECK, STATUS_TYPE_UPDATE); | |
| 531 | + } | |
| 518 | 532 | |
| 519 | 533 | operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), model, OptActionEnums.ADD.getId(), "添加儿童检查"); |
| 520 | 534 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyAfterVisitService.java
View file @
3a74ded
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.result.BaseModel; |
| 4 | 4 | import com.lyms.platform.common.result.BaseResponse; |
| 5 | +import com.lyms.platform.common.utils.ExpiryMap; | |
| 5 | 6 | import com.lyms.platform.operate.web.request.BabyAfterVisitBuildListRequest; |
| 6 | 7 | import com.lyms.platform.operate.web.request.BabyAfterVisitInfoDetailListRequest; |
| 7 | 8 | import com.lyms.platform.operate.web.request.BabyAfterVisitInfoDetailRequest; |
| 8 | 9 | |
| 9 | 10 | |
| ... | ... | @@ -28,15 +29,17 @@ |
| 28 | 29 | public static final Integer STATUS_TYPE_YES = 1; |
| 29 | 30 | /**状态:作废*/ |
| 30 | 31 | public static final Integer STATUS_TYPE_NO = 2; |
| 32 | + /**状态:更新*/ | |
| 33 | + public static final Integer STATUS_TYPE_UPDATE = 3; | |
| 31 | 34 | /**状态:预建档/临时建档*/ |
| 32 | 35 | public static final Integer STATUS_TYPE_TEMPORARY_DOCUMENT = 4; |
| 33 | 36 | /**状态:正式建档/已建档*/ |
| 34 | 37 | public static final Integer STATUS_TYPE_BUILD= 1; |
| 35 | 38 | |
| 36 | - | |
| 37 | - | |
| 38 | 39 | public static final String BABY_ID = "babyId"; |
| 39 | 40 | public static final String POSITIVE_PROJECT_TYPE = "yang"; |
| 41 | + | |
| 42 | + public static ExpiryMap cacheMap = new ExpiryMap(1000 * 60 * 60 * 7); | |
| 40 | 43 | |
| 41 | 44 | /** |
| 42 | 45 | * 追访管理 - 追访列表 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyAfterVisitServiceImpl.java
View file @
3a74ded
| ... | ... | @@ -17,7 +17,6 @@ |
| 17 | 17 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 18 | 18 | import com.lyms.platform.operate.web.worker.BabyAfterVisitInfoModelWork; |
| 19 | 19 | import com.lyms.platform.operate.web.worker.BabyAfterVisitStatisticsModelWork; |
| 20 | -import com.lyms.platform.permission.dao.master.BabyEyeCheckMapper; | |
| 21 | 20 | import com.lyms.platform.permission.dao.master.BabyPatientExtendEarScreenMapper; |
| 22 | 21 | import com.lyms.platform.permission.dao.master.MasterUsersMapper; |
| 23 | 22 | import com.lyms.platform.permission.model.Users; |
| ... | ... | @@ -26,6 +25,9 @@ |
| 26 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | 26 | import org.springframework.data.domain.Sort; |
| 28 | 27 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 28 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 29 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
| 30 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
| 29 | 31 | import org.springframework.data.mongodb.core.query.Criteria; |
| 30 | 32 | import org.springframework.data.mongodb.core.query.Query; |
| 31 | 33 | import org.springframework.data.mongodb.core.query.Update; |
| ... | ... | @@ -53,7 +55,7 @@ |
| 53 | 55 | private BabyPatientExtendEarScreenMapper screenMapper; |
| 54 | 56 | |
| 55 | 57 | @Autowired |
| 56 | - MasterUsersMapper usersMapper; | |
| 58 | + private MasterUsersMapper usersMapper; | |
| 57 | 59 | |
| 58 | 60 | /** |
| 59 | 61 | * 追访管理 - 追访列表 |
| 60 | 62 | |
| 61 | 63 | |
| 62 | 64 | |
| 63 | 65 | |
| 64 | 66 | |
| 65 | 67 | |
| 66 | 68 | |
| 67 | 69 | |
| 68 | 70 | |
| ... | ... | @@ -148,65 +150,88 @@ |
| 148 | 150 | |
| 149 | 151 | // 档案转正 |
| 150 | 152 | List<BabyAfterVisitInfoModel> infoModels = new ArrayList<>(); |
| 151 | - setSyncAfterVisitInfoList(null, null, infoModels, afterVisitQuery, TYPE_BUILD, startDate, endDate); | |
| 153 | + setSyncAfterVisitInfoList( null, infoModels, afterVisitQuery, TYPE_BUILD, startDate, endDate); | |
| 152 | 154 | mongoTemplate.insert(infoModels, BabyAfterVisitInfoModel.class); |
| 153 | 155 | map.put("infoModels-build", infoModels.size()); |
| 154 | 156 | |
| 155 | - // 儿保检查 todo 分组 | |
| 156 | - List<BabyAfterVisitInfoModel> infoCheckModels = new ArrayList<>(); | |
| 157 | - Query query = new Query(); | |
| 158 | - query.addCriteria(Criteria.where("yn").ne(0).and("dataStatus").ne(1)); | |
| 159 | - query.addCriteria(new Criteria().orOperator( | |
| 160 | - // ( 已建档未做儿保检查) or (sysdate < 下次预约时间) or ( 已做儿保检查 and 下次预约时间 == null) | |
| 161 | - Criteria.where("nextDate").exists(false).and("weakSon").exists(false).and("highRisk").exists(false), | |
| 162 | - Criteria.where("nextDate").gt(new Date()).and("weakSon").exists(true).and("highRisk").exists(true), | |
| 163 | - Criteria.where("nextDate").exists(false).and("weakSon").exists(true).and("highRisk").exists(true) | |
| 164 | - )); | |
| 165 | - List<BabyModel> babyModels = mongoTemplate.find(query, BabyModel.class); | |
| 157 | + // 儿保检查 ( 已建档未做儿保检查) | |
| 166 | 158 | List<String> ids = new ArrayList<>(); |
| 167 | - for (BabyModel model : babyModels) { | |
| 168 | - ids.add(model.getId()); | |
| 159 | + List<BabyAfterVisitInfoModel> infoCheckModels = new ArrayList<>(); | |
| 160 | + Object object = cacheMap.get("buildId"); | |
| 161 | + if (null != object) { | |
| 162 | + ids = (List<String>) object; | |
| 163 | + } else { | |
| 164 | + Query query = new Query(); | |
| 165 | + query.addCriteria(Criteria.where("yn").ne(0).and("dataStatus").ne(1)); | |
| 166 | + query.addCriteria(Criteria.where("nextDate").exists(false).and("weakSon").exists(false).and("highRisk").exists(false)); | |
| 167 | + List<BabyModel> babyModels = mongoTemplate.find(query, BabyModel.class); | |
| 168 | + for (BabyModel model : babyModels) { | |
| 169 | + String modelId = model.getId(); | |
| 170 | + ids.add(modelId); | |
| 171 | + } | |
| 172 | + | |
| 173 | + // 儿保 (sysdate < 下次预约时间) or ( 已做儿保检查 and 下次预约时间 == null) | |
| 174 | + AggregationOperation group = Aggregation.group("buildId").max("created").as("created").addToSet("id").as("babyCheckIds"); | |
| 175 | + Aggregation aggregation = Aggregation.newAggregation(group); | |
| 176 | + AggregationResults<Map> aggregate = mongoTemplate.aggregate(aggregation, BabyCheckModel.class, Map.class); | |
| 177 | + List<Map> mappedResults = aggregate.getMappedResults(); | |
| 178 | + for (Map mappedResult : mappedResults) { | |
| 179 | + List babyCheckIds = (List) mappedResult.get("babyCheckIds"); | |
| 180 | + // 根据建档id分组,获取最新的儿保检查数据 | |
| 181 | + Object babyCheckId = babyCheckIds.get(babyCheckIds.size() - 1); | |
| 182 | + BabyCheckModel babyCheckModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(babyCheckId).orOperator(Criteria.where("nextDate").gte(new Date()), Criteria.where("nextDate").exists(false))), BabyCheckModel.class); | |
| 183 | + if (null != babyCheckModel) { | |
| 184 | + String buildId = babyCheckModel.getBuildId(); | |
| 185 | + boolean contains = ids.contains(babyId); | |
| 186 | + if (!contains) { | |
| 187 | + ids.add(buildId); | |
| 188 | + } | |
| 189 | + } | |
| 190 | + } | |
| 191 | + cacheMap.put("buildId", ids); | |
| 169 | 192 | } |
| 170 | - setSyncAfterVisitInfoList(null, ids, infoCheckModels, afterVisitQuery, TYPE_CHECK, startDate, endDate); | |
| 193 | + | |
| 194 | + setSyncAfterVisitInfoList( ids, infoCheckModels, afterVisitQuery, TYPE_CHECK, startDate, endDate); | |
| 171 | 195 | mongoTemplate.insert(infoCheckModels, BabyAfterVisitInfoModel.class); |
| 172 | 196 | map.put("infoModels-check-size", infoCheckModels.size()); |
| 173 | 197 | |
| 174 | - // 眼保检查 todo 分组 | |
| 198 | + // 眼保检查 | |
| 175 | 199 | List<BabyAfterVisitInfoModel> infoEyeCheckModels = new ArrayList<>(); |
| 176 | - // FIXME: 2019/7/2 已建档未做眼保检查 | |
| 177 | - // todo 分组 | |
| 178 | 200 | Query eyeQuery = new Query(); |
| 179 | 201 | eyeQuery.addCriteria(Criteria.where("yn").ne(0).and("dataStatus").ne(1).and("created").gte(startDate).lte(endDate)); |
| 180 | 202 | List<BabyModel> eyeBabyModels = mongoTemplate.find(eyeQuery, BabyModel.class); |
| 181 | 203 | List<String> babyIds = new ArrayList<>(); |
| 182 | 204 | for (BabyModel babyModel : eyeBabyModels) { |
| 183 | 205 | String babyModelId = babyModel.getId(); |
| 184 | - boolean exists = mongoTemplate.exists(Query.query(Criteria.where("babyId").is(babyModelId)), BabyEyeCheck.class); | |
| 206 | + boolean exists = mongoTemplate.exists(Query.query(Criteria.where(BABY_ID).is(babyModelId)), BabyEyeCheck.class); | |
| 185 | 207 | if (!exists) { |
| 186 | 208 | babyIds.add(babyModel.getId()); |
| 187 | 209 | } |
| 188 | 210 | } |
| 189 | - // sysdate < 下次预约时间 todo 分组 | |
| 190 | - List<String> eyeIds = new ArrayList<>(); | |
| 191 | - List<BabyEyeCheck> babyEyeCheckList = mongoTemplate.find(Query.query(Criteria.where("nextCheckTime").gt(new Date()).and("yn").is("1")), BabyEyeCheck.class); | |
| 192 | - for (BabyEyeCheck babyEyeCheck : babyEyeCheckList) { | |
| 193 | - eyeIds.add(babyEyeCheck.getBabyId()); | |
| 194 | - } | |
| 195 | - // 已做眼保检查 and 下次预约时间 == null todo 分组 | |
| 196 | - babyEyeCheckList = mongoTemplate.find(Query.query(Criteria.where("nextCheckTime").exists(false).and("yn").is("1")), BabyEyeCheck.class); | |
| 197 | - for (BabyEyeCheck babyEyeCheck : babyEyeCheckList) { | |
| 198 | - String babyEyeCheckId = babyEyeCheck.getBabyId(); | |
| 199 | - if (!eyeIds.contains(babyEyeCheckId)) { | |
| 200 | - eyeIds.add(babyEyeCheckId); | |
| 211 | + // sysdate < 下次预约时间 已做眼保检查 and 下次预约时间 == null | |
| 212 | + AggregationOperation group = Aggregation.group(BABY_ID).max("created").as("created").addToSet("id").as("babyEyeCheckIds"); | |
| 213 | + Aggregation aggregation = Aggregation.newAggregation(group); | |
| 214 | + AggregationResults<Map> aggregate = mongoTemplate.aggregate(aggregation, BabyEyeCheck.class, Map.class); | |
| 215 | + List<Map> mappedResults = aggregate.getMappedResults(); | |
| 216 | + for (Map mappedResult : mappedResults) { | |
| 217 | + List babyEyeCheckIds = (List) mappedResult.get("babyEyeCheckIds"); | |
| 218 | + Object babyEyeCheckId = babyEyeCheckIds.get(babyEyeCheckIds.size() - 1); | |
| 219 | + BabyEyeCheck babyEyeCheck = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(babyEyeCheckId). | |
| 220 | + orOperator(Criteria.where("nextCheckTime").gt(new Date()), Criteria.where("nextCheckTime").exists(false))), BabyEyeCheck.class); | |
| 221 | + if (null != babyEyeCheck) { | |
| 222 | + String eyeCheckBabyId = babyEyeCheck.getBabyId(); | |
| 223 | + boolean contains = babyIds.contains(eyeCheckBabyId); | |
| 224 | + if (!contains) { | |
| 225 | + babyIds.add(eyeCheckBabyId); | |
| 226 | + } | |
| 201 | 227 | } |
| 202 | 228 | } |
| 203 | - eyeIds.retainAll(babyIds); | |
| 204 | - eyeIds.addAll(babyIds); | |
| 205 | - setSyncAfterVisitInfoList(eyeIds, babyIds, infoEyeCheckModels, afterVisitQuery, TYPE_EYE_CHECK, startDate, endDate); | |
| 229 | + | |
| 230 | + setSyncAfterVisitInfoList(babyIds, infoEyeCheckModels, afterVisitQuery, TYPE_EYE_CHECK, startDate, endDate); | |
| 206 | 231 | mongoTemplate.insert(infoEyeCheckModels, BabyAfterVisitInfoModel.class); |
| 207 | 232 | map.put("infoModels-eyeCheck-size", infoEyeCheckModels.size()); |
| 208 | 233 | |
| 209 | - // 听力筛查 | |
| 234 | + // TODO 2019/7/5 11:48 dongqing 听力筛查, 郝总都不知道需求是怎么样的 | |
| 210 | 235 | |
| 211 | 236 | response.setObject(map); |
| 212 | 237 | return response; |
| ... | ... | @@ -423,7 +448,7 @@ |
| 423 | 448 | * @throws ExecutionException |
| 424 | 449 | * @throws InterruptedException |
| 425 | 450 | */ |
| 426 | - private void setSyncAfterVisitInfoList(List<String> eyeIds, List<String> ids , List<BabyAfterVisitInfoModel> infoModels, BabyAfterVisitRequest afterVisitQuery, Integer type, Date startDate, Date endDate) throws ExecutionException, InterruptedException { | |
| 451 | + private void setSyncAfterVisitInfoList(List<String> ids , List<BabyAfterVisitInfoModel> infoModels, BabyAfterVisitRequest afterVisitQuery, Integer type, Date startDate, Date endDate) throws ExecutionException, InterruptedException { | |
| 427 | 452 | Query query = new Query(); |
| 428 | 453 | query.addCriteria(Criteria.where("created").gte(startDate).lte(endDate)); |
| 429 | 454 | long count = 0L; |
| ... | ... | @@ -438,7 +463,7 @@ |
| 438 | 463 | } else if (Objects.equals(TYPE_EYE_CHECK, type)) { |
| 439 | 464 | |
| 440 | 465 | // 眼保检查 |
| 441 | - query.addCriteria(Criteria.where("_id").in(eyeIds)); | |
| 466 | + query.addCriteria(Criteria.where("_id").in(ids)); | |
| 442 | 467 | |
| 443 | 468 | } else if (4 == type) { |
| 444 | 469 | // TODO 2019/7/2 14:36 dongqing 听力筛查 |
| 445 | 470 | |
| 446 | 471 | |
| ... | ... | @@ -487,13 +512,13 @@ |
| 487 | 512 | for (int i = currentPage+ 1; i <= lastPage ; i++) { |
| 488 | 513 | afterVisitQuery.setPage(i); |
| 489 | 514 | if (TYPE_BUILD.equals(type)) { |
| 490 | - setSyncAfterVisitInfoList(null, null, infoModels, afterVisitQuery, type, startDate, endDate); | |
| 515 | + setSyncAfterVisitInfoList( null, infoModels, afterVisitQuery, type, startDate, endDate); | |
| 491 | 516 | } |
| 492 | 517 | if (TYPE_CHECK.equals(type)) { |
| 493 | - setSyncAfterVisitInfoList(null, ids, infoModels, afterVisitQuery, type, startDate, endDate); | |
| 518 | + setSyncAfterVisitInfoList( ids, infoModels, afterVisitQuery, type, startDate, endDate); | |
| 494 | 519 | } |
| 495 | 520 | if (TYPE_EYE_CHECK.equals(type)) { |
| 496 | - setSyncAfterVisitInfoList(eyeIds, ids, infoModels, afterVisitQuery, type, startDate, endDate); | |
| 521 | + setSyncAfterVisitInfoList( ids, infoModels, afterVisitQuery, type, startDate, endDate); | |
| 497 | 522 | } |
| 498 | 523 | |
| 499 | 524 | } |
| ... | ... | @@ -508,7 +533,6 @@ |
| 508 | 533 | private void setSyncList(List<BabyAfterVisitStatisticsModel> statisticsModels, BabyAfterVisitRequest afterVisitQuery, Date startDate, Date endDate) throws ExecutionException, InterruptedException { |
| 509 | 534 | |
| 510 | 535 | Query query = new Query(); |
| 511 | -// query.addCriteria(Criteria.where("yn").is(1).and("created").gte(startDate).lte(endDate)); | |
| 512 | 536 | query.addCriteria(Criteria.where("created").gte(startDate).lte(endDate)); |
| 513 | 537 | long count = mongoTemplate.count(query, BabyModel.class); |
| 514 | 538 | afterVisitQuery.mysqlBuild((int) count); |
| ... | ... | @@ -557,7 +581,7 @@ |
| 557 | 581 | |
| 558 | 582 | |
| 559 | 583 | /** |
| 560 | - * 在产妇分娩(MatDeliverFacade)、儿童建档(BabyBookbuildingFacade) | |
| 584 | + * 在产妇分娩(MatDeliverFacade)、儿童建档(BabyBookbuildingFacade)、儿保检查保存(BabyCheckFacade)、眼保检查(BabyEyeCheckServiceImpl) | |
| 561 | 585 | * |
| 562 | 586 | * @param model BabyAfterVisitStatisticsModel or BabyAfterVisitInfoModel |
| 563 | 587 | * @param type 0-追访概况、1-档案转正、2-儿保检查、3-眼保检查 |
| ... | ... | @@ -573,6 +597,7 @@ |
| 573 | 597 | System.out.println("请稍后尝试"); |
| 574 | 598 | } |
| 575 | 599 | }); |
| 600 | + String typeStr = type.toString(); | |
| 576 | 601 | List<BabyModel> models = new ArrayList<>(); |
| 577 | 602 | BabyModel babyModel = (BabyModel) model; |
| 578 | 603 | String babyModelId = babyModel.getId(); |
| ... | ... | @@ -607,7 +632,6 @@ |
| 607 | 632 | if (Objects.equals(STATUS_TYPE_NO, statusType)) { |
| 608 | 633 | |
| 609 | 634 | // 将状态正常更新为作废 |
| 610 | - String typeStr = type.toString(); | |
| 611 | 635 | Query query = Query.query(Criteria.where(BABY_ID).is(babyModelId).and("type").is(typeStr)); |
| 612 | 636 | boolean exists = mongoTemplate.exists(Query.query(Criteria.where(BABY_ID).is(babyModelId).and("type").is(typeStr).and("yn").ne(STATUS_TYPE_NO)), BabyAfterVisitInfoModel.class); |
| 613 | 637 | if (exists) { |
| ... | ... | @@ -620,6 +644,19 @@ |
| 620 | 644 | Future<List<BabyAfterVisitInfoModel>> listFuture = service.submit(new BabyAfterVisitInfoModelWork(models, mongoTemplate, type)); |
| 621 | 645 | List<BabyAfterVisitInfoModel> infoModels = listFuture.get(); |
| 622 | 646 | mongoTemplate.insert(infoModels, BabyAfterVisitInfoModel.class); |
| 647 | + } | |
| 648 | + | |
| 649 | + // 将预约时间更改为null | |
| 650 | + if (Objects.equals(STATUS_TYPE_UPDATE, statusType)) { | |
| 651 | + if (Objects.equals(TYPE_CHECK, type)) { | |
| 652 | + BabyCheckModel babyCheckModel = (BabyCheckModel) model; | |
| 653 | + mongoTemplate.updateFirst(Query.query(Criteria.where(BABY_ID).is(babyCheckModel.getBuildId()).and("type").is(typeStr)), Update.update("appointmentTime", null), BabyAfterVisitInfoModel.class); | |
| 654 | + } | |
| 655 | + if (Objects.equals(TYPE_EYE_CHECK, type)) { | |
| 656 | + BabyEyeCheck babyEyeCheck = (BabyEyeCheck) model; | |
| 657 | + mongoTemplate.updateFirst(Query.query(Criteria.where(BABY_ID).is(babyEyeCheck.getBabyId()).and("type").is(typeStr)), Update.update("appointmentTime", null), BabyAfterVisitInfoModel.class); | |
| 658 | + } | |
| 659 | + | |
| 623 | 660 | } |
| 624 | 661 | logger.info("已自动添加到追访列表中"); |
| 625 | 662 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java
View file @
3a74ded
| ... | ... | @@ -5,12 +5,11 @@ |
| 5 | 5 | import com.lyms.platform.common.pojo.SyncDataModel; |
| 6 | 6 | import com.lyms.platform.common.result.*; |
| 7 | 7 | import com.lyms.platform.common.utils.*; |
| 8 | -import com.lyms.platform.common.utils.ReflectionUtils; | |
| 9 | -import com.lyms.platform.common.utils.StringUtils; | |
| 10 | 8 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 11 | 9 | import com.lyms.platform.operate.web.facade.BasicConfigFacade; |
| 12 | 10 | import com.lyms.platform.operate.web.facade.OperateLogFacade; |
| 13 | 11 | import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade; |
| 12 | +import com.lyms.platform.operate.web.service.BabyAfterVisitService; | |
| 14 | 13 | import com.lyms.platform.operate.web.service.BabyEyeCheckService; |
| 15 | 14 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 16 | 15 | import com.lyms.platform.operate.web.utils.MongoUtil; |
| ... | ... | @@ -18,8 +17,9 @@ |
| 18 | 17 | import com.lyms.platform.operate.web.utils.ResponseUtil; |
| 19 | 18 | import com.lyms.platform.permission.dao.master.BabyEyeCheckMapper; |
| 20 | 19 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| 21 | -import com.lyms.platform.pojo.*; | |
| 22 | -import org.apache.commons.codec.binary.*; | |
| 20 | +import com.lyms.platform.pojo.BabyEyeCheck; | |
| 21 | +import com.lyms.platform.pojo.BabyModel; | |
| 22 | +import com.lyms.platform.pojo.Patients; | |
| 23 | 23 | import org.apache.commons.collections.map.HashedMap; |
| 24 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 25 | import org.springframework.data.domain.Sort; |
| ... | ... | @@ -33,6 +33,8 @@ |
| 33 | 33 | import java.io.Serializable; |
| 34 | 34 | import java.util.*; |
| 35 | 35 | |
| 36 | +import static com.lyms.platform.operate.web.service.BabyAfterVisitService.*; | |
| 37 | + | |
| 36 | 38 | /** |
| 37 | 39 | * Created by lt on 2017/8/5 0005 |
| 38 | 40 | */ |
| ... | ... | @@ -62,6 +64,8 @@ |
| 62 | 64 | @Autowired |
| 63 | 65 | private CouponMapper couponMapper; |
| 64 | 66 | |
| 67 | + @Autowired | |
| 68 | + private BabyAfterVisitService babyAfterVisitService; | |
| 65 | 69 | |
| 66 | 70 | @Autowired |
| 67 | 71 | private OperateLogFacade operateLogFacade; |
| ... | ... | @@ -97,6 +101,14 @@ |
| 97 | 101 | } |
| 98 | 102 | syncData("ADD", babyEyeCheck, ""); |
| 99 | 103 | mongoTemplate.save(babyEyeCheck); |
| 104 | + | |
| 105 | + // 添加追访眼保检查 | |
| 106 | + Date nextCheckTime = babyEyeCheck.getNextCheckTime(); | |
| 107 | + if (null != nextCheckTime) { | |
| 108 | + babyAfterVisitService.addOrUpdateAfterVisitData(babyEyeCheck, TYPE_EYE_CHECK, STATUS_TYPE_NO); | |
| 109 | + } else { | |
| 110 | + babyAfterVisitService.addOrUpdateAfterVisitData(babyEyeCheck, TYPE_EYE_CHECK, STATUS_TYPE_UPDATE); | |
| 111 | + } | |
| 100 | 112 | |
| 101 | 113 | if(CollectionUtils.isNotEmpty(babyEyeCheck.getRiskFactorId())) { |
| 102 | 114 | String riskFactor = org.apache.commons.lang3.StringUtils.join(babyEyeCheck.getRiskFactorId().toArray(), ","); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyAfterVisitInfoModelWork.java
View file @
3a74ded
| 1 | 1 | package com.lyms.platform.operate.web.worker; |
| 2 | 2 | |
| 3 | -import com.lyms.platform.common.utils.DateUtil; | |
| 4 | 3 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 5 | -import com.lyms.platform.permission.dao.master.BabyPatientExtendEarScreenMapper; | |
| 6 | 4 | import com.lyms.platform.pojo.BabyAfterVisitInfoModel; |
| 7 | 5 | import com.lyms.platform.pojo.BabyEyeCheck; |
| 8 | 6 | import com.lyms.platform.pojo.BabyModel; |
| 9 | 7 | import org.springframework.beans.BeanUtils; |
| 10 | 8 | import org.springframework.data.domain.Sort; |
| 11 | 9 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 12 | -import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 13 | -import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
| 14 | -import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
| 15 | 10 | import org.springframework.data.mongodb.core.query.Criteria; |
| 16 | 11 | import org.springframework.data.mongodb.core.query.Query; |
| 17 | 12 | |
| ... | ... | @@ -75,9 +70,9 @@ |
| 75 | 70 | babyAfterVisitInfoModel.setPositiveProject(String.join(",", projectStrs)); |
| 76 | 71 | babyAfterVisitInfoModel.setCreateTime(new Date()); |
| 77 | 72 | babyAfterVisitInfoModel.setCheckDoctor(babyEyeCheck.getOperaterId()); |
| 78 | - BeanUtils.copyProperties(babyEyeCheck, babyAfterVisitInfoModel); | |
| 79 | - //babyAfterVisitInfoModel.setCheckMonthId(babyEyeCheck.getCheckMonthId()); | |
| 80 | - //babyAfterVisitInfoModel.setCheckTime(babyEyeCheck.getCheckTime()); | |
| 73 | + //BeanUtils.copyProperties(babyEyeCheck, babyAfterVisitInfoModel); | |
| 74 | + babyAfterVisitInfoModel.setCheckMonthId(babyEyeCheck.getCheckMonthId()); | |
| 75 | + babyAfterVisitInfoModel.setCheckTime(babyEyeCheck.getCheckTime()); | |
| 81 | 76 | } |
| 82 | 77 | } |
| 83 | 78 | /* List<AggregationOperation> operations = new ArrayList<>(); |