Commit 26a1ba3fc4d56c784e1ee0c2c8ddf11a790abb2b
1 parent
1293e31087
Exists in
master
and in
6 other branches
unpdate
Showing 2 changed files with 59 additions and 26 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
26a1ba3
| ... | ... | @@ -2668,7 +2668,7 @@ |
| 2668 | 2668 | List <MaternalDeliverModel> mlist = maternalDeliverModelList.subList(i, end); |
| 2669 | 2669 | Callable c = new MaterDeliverWorker(organizationService, usersService, |
| 2670 | 2670 | babyService,antExService, basicConfigService, childbirthManagerRequest.getInitQuery(), |
| 2671 | - mlist, patientsMap, postpartumRecordsService, recordsService, childbirthManagerRequest.getShowDetail()); | |
| 2671 | + mlist, patientsMap, postpartumRecordsService, recordsService, childbirthManagerRequest.getShowDetail(),mongoTemplate); | |
| 2672 | 2672 | Future f = commonThreadPool.submit(c); |
| 2673 | 2673 | if (f != null) { |
| 2674 | 2674 | futures.add(f); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/MaterDeliverWorker.java
View file @
26a1ba3
| ... | ... | @@ -15,9 +15,13 @@ |
| 15 | 15 | import com.lyms.platform.query.RecordsQuery; |
| 16 | 16 | import org.apache.commons.collections.CollectionUtils; |
| 17 | 17 | import org.apache.commons.collections.MapUtils; |
| 18 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 19 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 20 | +import org.springframework.data.mongodb.core.query.Query; | |
| 18 | 21 | |
| 19 | 22 | |
| 20 | 23 | import java.text.SimpleDateFormat; |
| 24 | +import java.util.ArrayList; | |
| 21 | 25 | import java.util.LinkedList; |
| 22 | 26 | import java.util.List; |
| 23 | 27 | import java.util.Map; |
| 24 | 28 | |
| ... | ... | @@ -43,11 +47,12 @@ |
| 43 | 47 | private PostpartumRecordsService postpartumRecordsService; |
| 44 | 48 | private RecordsService recordsService; |
| 45 | 49 | private int showDetail; |
| 50 | + private MongoTemplate mongoTemplate; | |
| 46 | 51 | |
| 47 | 52 | public MaterDeliverWorker(OrganizationService organizationService,UsersService usersService, |
| 48 | 53 | BabyService babyService,AntenatalExaminationService antExService,BasicConfigService basicConfigService,String initQuery, |
| 49 | 54 | List<MaternalDeliverModel> maternalDeliverModelList,Map<String, Patients> patientsMap, |
| 50 | - PostpartumRecordsService postpartumRecordsService,RecordsService recordsService,int showDetail) { | |
| 55 | + PostpartumRecordsService postpartumRecordsService,RecordsService recordsService,int showDetail,MongoTemplate mongoTemplate) { | |
| 51 | 56 | this.maternalDeliverModelList = maternalDeliverModelList; |
| 52 | 57 | this.patientsMap = patientsMap; |
| 53 | 58 | this.organizationService = organizationService; |
| ... | ... | @@ -59,6 +64,7 @@ |
| 59 | 64 | this.postpartumRecordsService = postpartumRecordsService; |
| 60 | 65 | this.recordsService = recordsService; |
| 61 | 66 | this.showDetail = showDetail; |
| 67 | + this.mongoTemplate = mongoTemplate; | |
| 62 | 68 | } |
| 63 | 69 | |
| 64 | 70 | @Override |
| 65 | 71 | |
| 66 | 72 | |
| ... | ... | @@ -81,34 +87,27 @@ |
| 81 | 87 | if(antExService != null && initQuery.contains("fmHospital") && initQuery.contains("buildWeek") |
| 82 | 88 | && initQuery.contains("czWeek") && initQuery.contains("hivkt") |
| 83 | 89 | && initQuery.contains("syjg") && initQuery.contains("ygbmky")){ |
| 90 | + | |
| 84 | 91 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
| 85 | 92 | antExChuQuery.setYn(YnEnums.YES.getId()); |
| 86 | 93 | antExChuQuery.setParentId(patients.getId()); |
| 87 | - List<AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery);//初诊记录 | |
| 94 | + List <AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery);//初诊记录 | |
| 88 | 95 | if(CollectionUtils.isNotEmpty(antExChuModels)){ |
| 89 | - AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 90 | - if (antExChuModel !=null) { | |
| 91 | - String czWeek = ""; | |
| 92 | - try { | |
| 93 | - if (antExChuModel.getCreated().getTime() - patients.getDueDate().getTime() > 0 && patients.getBuildType() == 2) { | |
| 94 | - czWeek = "已分娩"; | |
| 95 | - } else { | |
| 96 | - int days = DateUtil.daysBetween(patients.getLastMenses(), antExChuModel.getCreated()); | |
| 97 | - if (days > 7 * 42 - 1) { | |
| 98 | - czWeek = "已分娩"; | |
| 99 | - } else { | |
| 100 | - String week = (days / 7) + ""; | |
| 101 | - int day = (days % 7); | |
| 102 | - czWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); | |
| 103 | - } | |
| 104 | - } | |
| 105 | - } catch (Exception e) { | |
| 106 | - // 什么都不干 | |
| 107 | - } | |
| 108 | - childbirthManagerQueryModel.setCzWeek(czWeek);//初诊孕周 | |
| 109 | - childbirthManagerQueryModel.setHivkt(antExChuModel.getHivkt()); // 艾滋病检测结果 | |
| 110 | - childbirthManagerQueryModel.setSyjg(antExChuModel.getSyjg()); // 梅毒检测结果 | |
| 111 | - childbirthManagerQueryModel.setYgbmky(antExChuModel.getYgbmky()); // 乙肝检测结果 (乙肝表面抗原) | |
| 96 | + setCzInfo(patients, childbirthManagerQueryModel); | |
| 97 | + }else if(CollectionUtils.isEmpty(antExChuModels) && StringUtils.isNotEmpty(patients.getSource())) { | |
| 98 | + /* | |
| 99 | + 1 分娩医院档案id没有初诊信息 | |
| 100 | + 2 根据当前档案的数据来源id source字段,获取当前产程的所有档案 | |
| 101 | + */ | |
| 102 | + List <Patients> patientsList = new ArrayList <>(); | |
| 103 | + //获取主档案 | |
| 104 | + Patients patients1 = mongoTemplate.findOne(Query.query(Criteria.where("id").is(patients.getSource())), Patients.class); | |
| 105 | + patientsList.add(patients1); | |
| 106 | + //获取隐藏档案 | |
| 107 | + List<Patients> pats = mongoTemplate.find(Query.query(Criteria.where("source").is(patients.getSource()).and("enable").is("2")), Patients.class); | |
| 108 | + patientsList.addAll(pats); | |
| 109 | + for (Patients p: patientsList ) { | |
| 110 | + setCzInfo(p, childbirthManagerQueryModel); | |
| 112 | 111 | } |
| 113 | 112 | |
| 114 | 113 | } |
| ... | ... | @@ -663,6 +662,40 @@ |
| 663 | 662 | e.printStackTrace(); |
| 664 | 663 | } |
| 665 | 664 | return childbirthManagerQueryModelList; |
| 665 | + } | |
| 666 | + | |
| 667 | + private void setCzInfo(Patients patients, ChildbirthManagerQueryModel childbirthManagerQueryModel) { | |
| 668 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 669 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 670 | + antExChuQuery.setParentId(patients.getId()); | |
| 671 | + List <AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery);//初诊记录 | |
| 672 | + if(CollectionUtils.isNotEmpty(antExChuModels)){ | |
| 673 | + AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 674 | + if (antExChuModel !=null) { | |
| 675 | + String czWeek = ""; | |
| 676 | + try { | |
| 677 | + if (antExChuModel.getCreated().getTime() - patients.getDueDate().getTime() > 0 && patients.getBuildType() == 2) { | |
| 678 | + czWeek = "已分娩"; | |
| 679 | + } else { | |
| 680 | + int days = DateUtil.daysBetween(patients.getLastMenses(), antExChuModel.getCreated()); | |
| 681 | + if (days > 7 * 42 - 1) { | |
| 682 | + czWeek = "已分娩"; | |
| 683 | + } else { | |
| 684 | + String week = (days / 7) + ""; | |
| 685 | + int day = (days % 7); | |
| 686 | + czWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); | |
| 687 | + } | |
| 688 | + } | |
| 689 | + } catch (Exception e) { | |
| 690 | + // 什么都不干 | |
| 691 | + } | |
| 692 | + childbirthManagerQueryModel.setCzWeek(czWeek);//初诊孕周 | |
| 693 | + childbirthManagerQueryModel.setHivkt(antExChuModel.getHivkt()); // 艾滋病检测结果 | |
| 694 | + childbirthManagerQueryModel.setSyjg(antExChuModel.getSyjg()); // 梅毒检测结果 | |
| 695 | + childbirthManagerQueryModel.setYgbmky(antExChuModel.getYgbmky()); // 乙肝检测结果 (乙肝表面抗原) | |
| 696 | + } | |
| 697 | + | |
| 698 | + } | |
| 666 | 699 | } |
| 667 | 700 | } |