Commit 6a50bb4d87adf445c09585d5dc2367ac4a5ae3d5
1 parent
e42cae3e1b
Exists in
master
and in
6 other branches
update
Showing 2 changed files with 47 additions and 127 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyAfterVisitServiceImpl.java
View file @
6a50bb4
| 1 | 1 | package com.lyms.platform.operate.web.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.google.common.util.concurrent.ThreadFactoryBuilder; |
| 4 | -import com.lyms.platform.common.base.PageInfo; | |
| 4 | +import com.lyms.platform.biz.service.BabyBookbuildingService; | |
| 5 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 6 | 6 | import com.lyms.platform.common.enums.SexEnum; |
| 7 | 7 | import com.lyms.platform.common.enums.TrackDownTransferEnums; |
| ... | ... | @@ -28,10 +28,6 @@ |
| 28 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| 29 | 29 | import org.springframework.data.domain.Sort; |
| 30 | 30 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 31 | -import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 32 | -import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
| 33 | -import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
| 34 | -import org.springframework.data.mongodb.core.aggregation.MatchOperation; | |
| 35 | 31 | import org.springframework.data.mongodb.core.query.Criteria; |
| 36 | 32 | import org.springframework.data.mongodb.core.query.Query; |
| 37 | 33 | import org.springframework.data.mongodb.core.query.Update; |
| ... | ... | @@ -62,6 +58,9 @@ |
| 62 | 58 | @Autowired |
| 63 | 59 | private AutoMatchFacade autoMatchFacade; |
| 64 | 60 | |
| 61 | + @Autowired | |
| 62 | + private BabyBookbuildingService babyBookbuildingService; | |
| 63 | + | |
| 65 | 64 | /** |
| 66 | 65 | * 追访管理 - 追访列表 |
| 67 | 66 | * |
| 68 | 67 | |
| 69 | 68 | |
| 70 | 69 | |
| 71 | 70 | |
| 72 | 71 | |
| 73 | 72 | |
| 74 | 73 | |
| ... | ... | @@ -161,78 +160,25 @@ |
| 161 | 160 | Map<String, Integer> map = new HashMap<>(); |
| 162 | 161 | |
| 163 | 162 | // 访视概况 |
| 164 | - Integer statisticsModelsSize = getStatisticsModelsSize(babyId, afterVisitQuery, startDate, endDate, hospitalId); | |
| 163 | + Integer statisticsModelsSize = getStatisticsModelsSize(afterVisitQuery, startDate, endDate, hospitalId); | |
| 165 | 164 | map.put("statisticsModelsSize", statisticsModelsSize); |
| 166 | 165 | |
| 167 | - | |
| 168 | - | |
| 169 | 166 | // 档案转正 |
| 170 | 167 | List<BabyAfterVisitInfoModel> infoModels = new ArrayList<>(); |
| 171 | - setSyncAfterVisitInfoList(null, infoModels, afterVisitQuery, TYPE_BUILD, startDate, endDate, hospitalId); | |
| 168 | + setSyncAfterVisitInfoList( infoModels, afterVisitQuery, TYPE_BUILD, startDate, endDate, hospitalId); | |
| 172 | 169 | mongoTemplate.insert(infoModels, BabyAfterVisitInfoModel.class); |
| 173 | 170 | map.put("infoModels-build", infoModels.size()); |
| 174 | 171 | |
| 175 | - // 儿保检查 ( 已建档未做儿保检查) | |
| 172 | + // 儿保检查 | |
| 176 | 173 | List<String> ids = new ArrayList<>(); |
| 177 | 174 | List<BabyAfterVisitInfoModel> infoCheckModels = new ArrayList<>(); |
| 178 | - | |
| 179 | - /* Query query = new Query(); | |
| 180 | - query.addCriteria(Criteria.where("created").gte(startDate).lt(endDate)); | |
| 181 | - query.addCriteria(Criteria.where("yn").is(1)); | |
| 182 | - List<BabyModel> babyModels = mongoTemplate.find(query, BabyModel.class); | |
| 183 | - for (BabyModel model : babyModels) { | |
| 184 | - String modelId = model.getId(); | |
| 185 | - ids.add(modelId); | |
| 186 | - }*/ | |
| 187 | - | |
| 188 | - | |
| 189 | - setSyncAfterVisitInfoList(ids, infoCheckModels, afterVisitQuery, TYPE_CHECK, startDate, endDate, hospitalId); | |
| 175 | + setSyncAfterVisitInfoList(infoCheckModels, afterVisitQuery, TYPE_CHECK, startDate, endDate, hospitalId); | |
| 190 | 176 | mongoTemplate.insert(infoCheckModels, BabyAfterVisitInfoModel.class); |
| 191 | 177 | map.put("infoModels-check-size", infoCheckModels.size()); |
| 192 | 178 | |
| 193 | - | |
| 194 | - | |
| 195 | - | |
| 196 | 179 | // 眼保检查 |
| 197 | - List<String> babyIds = new ArrayList<>(); | |
| 198 | 180 | List<BabyAfterVisitInfoModel> infoEyeCheckModels = new ArrayList<>(); |
| 199 | - /* Query eyeQuery = new Query(); | |
| 200 | - eyeQuery.addCriteria(Criteria.where("created").gte(startDate).lt(endDate)); | |
| 201 | - eyeQuery.addCriteria(Criteria.where("yn").is(1)); | |
| 202 | - List<BabyModel> eyeBabyModels = mongoTemplate.find(eyeQuery, BabyModel.class); | |
| 203 | - for (BabyModel babyModel : eyeBabyModels) { | |
| 204 | - String babyModelId = babyModel.getId(); | |
| 205 | - boolean exists = mongoTemplate.exists(Query.query(Criteria.where(BABY_ID).is(babyModelId)), BabyEyeCheck.class); | |
| 206 | - if (!exists) { | |
| 207 | - babyIds.add(babyModel.getId()); | |
| 208 | - } | |
| 209 | - }*/ | |
| 210 | - // sysdate < 下次预约时间 已做眼保检查 and 下次预约时间 == null | |
| 211 | - /* MatchOperation eyeMatch = Aggregation.match(Criteria.where("created").gte(startDate).lt(endDate)); | |
| 212 | - AggregationOperation eyeGroup = Aggregation.group(BABY_ID).max("created").as("created").addToSet("id").as("babyEyeCheckIds"); | |
| 213 | - Aggregation eyeAggregation = Aggregation.newAggregation(eyeMatch, eyeGroup); | |
| 214 | - AggregationResults<Map> eyeAggregate = mongoTemplate.aggregate(eyeAggregation, BabyEyeCheck.class, Map.class); | |
| 215 | - List<Map> eyeMappedResults = eyeAggregate.getMappedResults(); | |
| 216 | - for (Map mappedResult : eyeMappedResults) { | |
| 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 | - } | |
| 227 | - } | |
| 228 | - }*/ | |
| 229 | - | |
| 230 | - /* List<BabyModel> modelsEye = mongoTemplate.find(Query.query(Criteria.where("_id").nin(babyIds).and("hospitalId").is(hospitalId).and("yn").is(1)), BabyModel.class); | |
| 231 | - if (models != null) { | |
| 232 | - babyIds.add(modelsEye.get(0).getId()); | |
| 233 | - }*/ | |
| 234 | - | |
| 235 | - setSyncAfterVisitInfoList(babyIds, infoEyeCheckModels, afterVisitQuery, TYPE_EYE_CHECK, startDate, endDate, hospitalId); | |
| 181 | + setSyncAfterVisitInfoList(infoEyeCheckModels, afterVisitQuery, TYPE_EYE_CHECK, startDate, endDate, hospitalId); | |
| 236 | 182 | mongoTemplate.insert(infoEyeCheckModels, BabyAfterVisitInfoModel.class); |
| 237 | 183 | map.put("infoModels-eyeCheck-size", infoEyeCheckModels.size()); |
| 238 | 184 | |
| ... | ... | @@ -245,7 +191,6 @@ |
| 245 | 191 | /** |
| 246 | 192 | * 获取已同步到访视概况的总数量 |
| 247 | 193 | * |
| 248 | - * @param babyId | |
| 249 | 194 | * @param afterVisitQuery |
| 250 | 195 | * @param startDate |
| 251 | 196 | * @param endDate |
| 252 | 197 | |
| 253 | 198 | |
| ... | ... | @@ -253,27 +198,12 @@ |
| 253 | 198 | * @throws InterruptedException |
| 254 | 199 | * @throws ExecutionException |
| 255 | 200 | */ |
| 256 | - private Integer getStatisticsModelsSize(String babyId, BabyAfterVisitRequest afterVisitQuery, Date startDate, Date endDate, String hospitalId) throws InterruptedException, ExecutionException { | |
| 201 | + private Integer getStatisticsModelsSize(BabyAfterVisitRequest afterVisitQuery, Date startDate, Date endDate, String hospitalId) throws InterruptedException, ExecutionException { | |
| 257 | 202 | List<BabyAfterVisitStatisticsModel> statisticsModels = new LinkedList<>(); |
| 258 | - if (StringUtils.isNotEmpty(babyId)) { | |
| 259 | - // 单条数据,方便测试 | |
| 260 | - Query query = Query.query(Criteria.where("_id").is(babyId).and("created").gte(startDate).lte(endDate)); | |
| 261 | - if (StringUtils.isNotEmpty(hospitalId)) { | |
| 262 | - query.addCriteria(Criteria.where("hospitalId").is(hospitalId)); | |
| 263 | - } | |
| 264 | - BabyModel babyModel = mongoTemplate.findOne(query, BabyModel.class); | |
| 265 | - if (babyModel != null) { | |
| 266 | - List<BabyModel> babyModelList = new ArrayList<>(); | |
| 267 | - babyModelList.add(babyModel); | |
| 268 | - ExecutorService service = Executors.newSingleThreadExecutor(); | |
| 269 | - Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(babyModelList, mongoTemplate, screenMapper)); | |
| 270 | - statisticsModels = listFuture.get(); | |
| 271 | - } | |
| 272 | - } else { | |
| 273 | 203 | |
| 274 | - // 递归获取要同步的数据集 | |
| 275 | - setSyncList(statisticsModels, afterVisitQuery, startDate, endDate, hospitalId); | |
| 276 | - } | |
| 204 | + // 递归获取要同步的数据集 | |
| 205 | + setSyncList(statisticsModels, afterVisitQuery, startDate, endDate, hospitalId); | |
| 206 | + | |
| 277 | 207 | // 批量保存 |
| 278 | 208 | mongoTemplate.insert(statisticsModels, BabyAfterVisitStatisticsModel.class); |
| 279 | 209 | |
| ... | ... | @@ -587,7 +517,6 @@ |
| 587 | 517 | /** |
| 588 | 518 | * 递归获取预约建档的儿童信息 |
| 589 | 519 | * |
| 590 | - * @param ids 建档ids - 针对儿保检查 | |
| 591 | 520 | * @param infoModels 接受的集合 |
| 592 | 521 | * @param afterVisitQuery query对象 |
| 593 | 522 | * @param type 类型 |
| 594 | 523 | |
| 595 | 524 | |
| ... | ... | @@ -596,14 +525,13 @@ |
| 596 | 525 | * @throws ExecutionException |
| 597 | 526 | * @throws InterruptedException |
| 598 | 527 | */ |
| 599 | - private void setSyncAfterVisitInfoList(List<String> ids, List<BabyAfterVisitInfoModel> infoModels, BabyAfterVisitRequest afterVisitQuery, Integer type, Date startDate, Date endDate, String hospitalId) | |
| 528 | + private void setSyncAfterVisitInfoList(List<BabyAfterVisitInfoModel> infoModels, BabyAfterVisitRequest afterVisitQuery, Integer type, Date startDate, Date endDate, String hospitalId) | |
| 600 | 529 | throws ExecutionException, InterruptedException { |
| 601 | 530 | Query query = new Query(); |
| 602 | - query.addCriteria(Criteria.where("created").gte(startDate).lte(endDate)); | |
| 531 | + query.addCriteria(Criteria.where("buildDate").gte(startDate).lte(endDate)); | |
| 603 | 532 | if (StringUtils.isNotEmpty(hospitalId)) { |
| 604 | 533 | query.addCriteria(Criteria.where("hospitalId").is(hospitalId)); |
| 605 | 534 | } |
| 606 | - long count = 0L; | |
| 607 | 535 | if (Objects.equals(TYPE_BUILD, type)) { |
| 608 | 536 | |
| 609 | 537 | // 档案转正 |
| 610 | 538 | |
| 611 | 539 | |
| 612 | 540 | |
| ... | ... | @@ -612,23 +540,17 @@ |
| 612 | 540 | |
| 613 | 541 | // 儿保检查 |
| 614 | 542 | query.addCriteria(Criteria.where("yn").is(1)); |
| 615 | - query.addCriteria(Criteria.where("dataStatus").ne(1)); | |
| 616 | 543 | query.addCriteria(new Criteria().orOperator(Criteria.where("buildType").is(3).and("enable").is("1"), Criteria.where("buildType").in(new ArrayList(){{add(1);add(2);}}))); |
| 617 | 544 | } else if (Objects.equals(TYPE_EYE_CHECK, type)) { |
| 618 | 545 | |
| 619 | 546 | // 眼保检查 |
| 620 | 547 | query.addCriteria(Criteria.where("yn").is(1)); |
| 621 | - query.addCriteria(Criteria.where("dataStatus").ne(1)); | |
| 622 | 548 | query.addCriteria(new Criteria().orOperator(Criteria.where("buildType").is(3).and("enable").is("1"), Criteria.where("buildType").in(new ArrayList(){{add(1);add(2);}}))); |
| 623 | 549 | |
| 624 | 550 | } else if (4 == type) { |
| 625 | 551 | // TODO 2019/7/2 14:36 dongqing 听力筛查 |
| 626 | 552 | } |
| 627 | - count = mongoTemplate.count(query, BabyModel.class); | |
| 628 | 553 | |
| 629 | - afterVisitQuery.mysqlBuild((int) count); | |
| 630 | - query.skip(afterVisitQuery.getOffset()).limit(afterVisitQuery.getLimit()); | |
| 631 | - query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "created"))); | |
| 632 | 554 | List models = mongoTemplate.find(query, BabyModel.class); |
| 633 | 555 | |
| 634 | 556 | |
| ... | ... | @@ -658,26 +580,6 @@ |
| 658 | 580 | System.out.println("当前查询数 - build ====>" + infoModels.size()); |
| 659 | 581 | } |
| 660 | 582 | } |
| 661 | - | |
| 662 | - PageInfo pageInfo = afterVisitQuery.getPageInfo(); | |
| 663 | - Integer lastPage = pageInfo.getLastPage(); | |
| 664 | - Integer currentPage = pageInfo.getPage(); | |
| 665 | - if (Objects.equals(lastPage, currentPage)) { | |
| 666 | - return; | |
| 667 | - } | |
| 668 | - for (int i = currentPage + 1; i <= lastPage; i++) { | |
| 669 | - afterVisitQuery.setPage(i); | |
| 670 | - if (TYPE_BUILD.equals(type)) { | |
| 671 | - setSyncAfterVisitInfoList(null, infoModels, afterVisitQuery, type, startDate, endDate, hospitalId); | |
| 672 | - } | |
| 673 | - if (TYPE_CHECK.equals(type)) { | |
| 674 | - setSyncAfterVisitInfoList(ids, infoModels, afterVisitQuery, type, startDate, endDate, hospitalId); | |
| 675 | - } | |
| 676 | - if (TYPE_EYE_CHECK.equals(type)) { | |
| 677 | - setSyncAfterVisitInfoList(ids, infoModels, afterVisitQuery, type, startDate, endDate, hospitalId); | |
| 678 | - } | |
| 679 | - | |
| 680 | - } | |
| 681 | 583 | } |
| 682 | 584 | |
| 683 | 585 | /** |
| 684 | 586 | |
| ... | ... | @@ -689,15 +591,23 @@ |
| 689 | 591 | private void setSyncList(List<BabyAfterVisitStatisticsModel> statisticsModels, BabyAfterVisitRequest afterVisitQuery, Date startDate, Date endDate, String hospitalId) throws ExecutionException, InterruptedException { |
| 690 | 592 | |
| 691 | 593 | Query query = new Query(); |
| 692 | - query.addCriteria(Criteria.where("created").gte(startDate).lte(endDate)); | |
| 594 | + query.addCriteria(Criteria.where("buildDate").gte(startDate).lte(endDate)); | |
| 693 | 595 | query.addCriteria(new Criteria().orOperator(Criteria.where("buildType").is(3).and("enable").is("1"), Criteria.where("buildType").in(new ArrayList(){{add(1);add(2);}}))); |
| 694 | 596 | if (StringUtils.isNotEmpty(hospitalId)) { |
| 695 | 597 | query.addCriteria(Criteria.where("hospitalId").is(hospitalId)); |
| 696 | 598 | } |
| 697 | - long count = mongoTemplate.count(query, BabyModel.class); | |
| 698 | - afterVisitQuery.mysqlBuild((int) count); | |
| 699 | - query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "created"))); | |
| 700 | - query.skip(afterVisitQuery.getOffset()).limit(afterVisitQuery.getLimit()); | |
| 599 | + | |
| 600 | + /*BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 601 | + babyModelQuery.setDataStatus(true); | |
| 602 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 603 | + babyModelQuery.setBuildDateStart(startDate); | |
| 604 | + babyModelQuery.setBuildDateEnd(endDate); | |
| 605 | + babyModelQuery.setHospitalId(hospitalId); | |
| 606 | + babyModelQuery.setBuildTypeList(new ArrayList<Integer>(){{add(1);add(2);}}); | |
| 607 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery, "created", Sort.Direction.DESC); | |
| 608 | + | |
| 609 | + | |
| 610 | + Query query1 = babyModelQuery.convertToQuery().convertToMongoQuery();*/ | |
| 701 | 611 | List<BabyModel> babyModels = mongoTemplate.find(query, BabyModel.class); |
| 702 | 612 | |
| 703 | 613 | ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("sync-pool-%d").build(); |
| 704 | 614 | |
| 705 | 615 | |
| ... | ... | @@ -719,15 +629,14 @@ |
| 719 | 629 | if (end > size) { |
| 720 | 630 | end = size; |
| 721 | 631 | } |
| 722 | - Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(babyModels.subList(i, end), mongoTemplate, screenMapper)); | |
| 632 | + Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(babyModels.subList(i, end), mongoTemplate, screenMapper, true)); | |
| 723 | 633 | List<BabyAfterVisitStatisticsModel> visitStatisticsModels = listFuture.get(); |
| 724 | 634 | if (CollectionUtils.isNotEmpty(visitStatisticsModels)) { |
| 725 | 635 | statisticsModels.addAll(visitStatisticsModels); |
| 726 | - System.out.println("当前查询数====>" + statisticsModels.size()); | |
| 727 | 636 | } |
| 728 | 637 | } |
| 729 | 638 | |
| 730 | - PageInfo pageInfo = afterVisitQuery.getPageInfo(); | |
| 639 | + /* PageInfo pageInfo = afterVisitQuery.getPageInfo(); | |
| 731 | 640 | Integer lastPage = pageInfo.getLastPage(); |
| 732 | 641 | Integer currentPage = pageInfo.getPage(); |
| 733 | 642 | if (Objects.equals(lastPage, currentPage)) { |
| ... | ... | @@ -736,7 +645,7 @@ |
| 736 | 645 | for (int i = currentPage + 1; i <= lastPage; i++) { |
| 737 | 646 | afterVisitQuery.setPage(i); |
| 738 | 647 | setSyncList(statisticsModels, afterVisitQuery, startDate, endDate, hospitalId); |
| 739 | - } | |
| 648 | + }*/ | |
| 740 | 649 | } |
| 741 | 650 | |
| 742 | 651 | |
| ... | ... | @@ -781,7 +690,7 @@ |
| 781 | 690 | mongoTemplate.updateFirst(query, Update.update("highRiskType", STATUS_TYPE_BUILD), BabyAfterVisitStatisticsModel.class); |
| 782 | 691 | } else { |
| 783 | 692 | // 新增数据 |
| 784 | - Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(models, mongoTemplate, screenMapper)); | |
| 693 | + Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(models, mongoTemplate, screenMapper, false)); | |
| 785 | 694 | List<BabyAfterVisitStatisticsModel> statisticsModels = listFuture.get(); |
| 786 | 695 | mongoTemplate.insert(statisticsModels, BabyAfterVisitStatisticsModel.class); |
| 787 | 696 | } |
| ... | ... | @@ -789,7 +698,7 @@ |
| 789 | 698 | // 预建档/临时建档 |
| 790 | 699 | if (Objects.equals(STATUS_TYPE_TEMPORARY_DOCUMENT, statusType)) { |
| 791 | 700 | // 新增数据 |
| 792 | - Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(models, mongoTemplate, screenMapper)); | |
| 701 | + Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(models, mongoTemplate, screenMapper, false)); | |
| 793 | 702 | List<BabyAfterVisitStatisticsModel> statisticsModels = listFuture.get(); |
| 794 | 703 | mongoTemplate.insert(statisticsModels, BabyAfterVisitStatisticsModel.class); |
| 795 | 704 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyAfterVisitStatisticsModelWork.java
View file @
6a50bb4
| ... | ... | @@ -27,12 +27,14 @@ |
| 27 | 27 | private MongoTemplate mongoTemplate; |
| 28 | 28 | private BabyPatientExtendEarScreenMapper screenMapper; |
| 29 | 29 | private List<BabyModel> babyModels; |
| 30 | + private boolean syncData; | |
| 30 | 31 | public BabyAfterVisitStatisticsModelWork(final List<BabyModel> babyModels, |
| 31 | 32 | final MongoTemplate mongoTemplate, |
| 32 | - final BabyPatientExtendEarScreenMapper screenMapper) { | |
| 33 | + final BabyPatientExtendEarScreenMapper screenMapper, final boolean syncData) { | |
| 33 | 34 | this.babyModels = babyModels; |
| 34 | 35 | this.mongoTemplate = mongoTemplate; |
| 35 | 36 | this.screenMapper = screenMapper; |
| 37 | + this.syncData = syncData; | |
| 36 | 38 | |
| 37 | 39 | } |
| 38 | 40 | |
| ... | ... | @@ -53,7 +55,7 @@ |
| 53 | 55 | boolean exists = mongoTemplate.exists(babyQuery, BabyAfterVisitStatisticsModel.class); |
| 54 | 56 | if (!exists) { |
| 55 | 57 | BabyAfterVisitStatisticsModel babyAfterVisitStatisticsModel = new BabyAfterVisitStatisticsModel(); |
| 56 | - statisticsModelList.add(babyAfterVisitStatisticsModel); | |
| 58 | + | |
| 57 | 59 | BeanUtils.copyProperties(babyModel, babyAfterVisitStatisticsModel); |
| 58 | 60 | babyAfterVisitStatisticsModel.setYn(1); |
| 59 | 61 | babyAfterVisitStatisticsModel.setId(null); |
| ... | ... | @@ -66,7 +68,14 @@ |
| 66 | 68 | babyAfterVisitStatisticsModel.setHighRiskType(4); |
| 67 | 69 | } else { |
| 68 | 70 | // 正式建档 |
| 69 | - babyAfterVisitStatisticsModel.setHighRiskType(1); | |
| 71 | + if (syncData) { | |
| 72 | + if (yn != 1) { | |
| 73 | + continue; | |
| 74 | + } | |
| 75 | + babyAfterVisitStatisticsModel.setHighRiskType(1); | |
| 76 | + } else { | |
| 77 | + babyAfterVisitStatisticsModel.setHighRiskType(1); | |
| 78 | + } | |
| 70 | 79 | } |
| 71 | 80 | // 儿保检查数 |
| 72 | 81 | long checkCount = mongoTemplate.count(buildQuery, BabyCheckModel.class); |
| ... | ... | @@ -80,6 +89,8 @@ |
| 80 | 89 | int screenCount = screenMapper.queryEarScreenListCount(screenQuery); |
| 81 | 90 | babyAfterVisitStatisticsModel.setHearCheckSize(screenCount); |
| 82 | 91 | babyAfterVisitStatisticsModel.setAfterVisitWorkflowStatus("1"); |
| 92 | + | |
| 93 | + statisticsModelList.add(babyAfterVisitStatisticsModel); | |
| 83 | 94 | } |
| 84 | 95 | } |
| 85 | 96 | return statisticsModelList; |