Commit cbcbaefdddc4c01ef5210769bbea8796c2cbc34d
1 parent
7ca22f31ec
Exists in
master
and in
6 other branches
孕妇追访历史数据处理完美
Showing 13 changed files with 403 additions and 18 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
- platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/TrackDownRecord.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/ChaseVisitHistory.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/GravidaVisitHistory.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/TrackDownHistory.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverService.java
View file @
cbcbaef
| ... | ... | @@ -23,11 +23,9 @@ |
| 23 | 23 | private IMatDeliverDao iMatDeliverDao; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * | |
| 27 | 26 | * 增加一条分娩记录 |
| 28 | 27 | * |
| 29 | 28 | * @param deliverModel 产妇分娩记录 |
| 30 | - * | |
| 31 | 29 | * @return |
| 32 | 30 | */ |
| 33 | 31 | public MaternalDeliverModel addMatDeliver(MaternalDeliverModel deliverModel) { |
| 34 | 32 | |
| 35 | 33 | |
| 36 | 34 | |
| 37 | 35 | |
| 38 | 36 | |
| ... | ... | @@ -37,27 +35,28 @@ |
| 37 | 35 | return iMatDeliverDao.addMatDeliver(deliverModel); |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | - public List<MaternalDeliverModel> query(MatDeliverQuery deliverQuery){ | |
| 38 | + public List<MaternalDeliverModel> query(MatDeliverQuery deliverQuery) { | |
| 41 | 39 | return iMatDeliverDao.queryWithList(deliverQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | - public List<MaternalDeliverModel> query(MatDeliverQuery deliverQuery,Sort.Direction sort,String field){ | |
| 42 | + public List<MaternalDeliverModel> query(MatDeliverQuery deliverQuery, Sort.Direction sort, String field) { | |
| 45 | 43 | return iMatDeliverDao.queryWithList(deliverQuery.convertToQuery().addOrder(sort, field)); |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | - public void deleteOne(String id){ | |
| 46 | + public void deleteOne(String id) { | |
| 49 | 47 | iMatDeliverDao.deleteOne(id); |
| 50 | 48 | } |
| 51 | 49 | |
| 52 | - public void updateOne(MaternalDeliverModel deliverModel,String id){ | |
| 50 | + public void updateOne(MaternalDeliverModel deliverModel, String id) { | |
| 53 | 51 | deliverModel.setModified(new Date()); |
| 54 | 52 | iMatDeliverDao.updateOneById(deliverModel, id); |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | - public int count(MatDeliverQuery matDeliverQuery){ | |
| 55 | + public int count(MatDeliverQuery matDeliverQuery) { | |
| 58 | 56 | return iMatDeliverDao.queryCount(matDeliverQuery.convertToQuery()); |
| 59 | 57 | } |
| 60 | - public MaternalDeliverModel getOneMatDeliver(String id){ | |
| 58 | + | |
| 59 | + public MaternalDeliverModel getOneMatDeliver(String id) { | |
| 61 | 60 | return iMatDeliverDao.getById(id); |
| 62 | 61 | } |
| 63 | 62 |
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
View file @
cbcbaef
| ... | ... | @@ -49,6 +49,7 @@ |
| 49 | 49 | // 月经停留开始天数 |
| 50 | 50 | private String mensStopEndDay; |
| 51 | 51 | |
| 52 | + private boolean isHistory; | |
| 52 | 53 | |
| 53 | 54 | // 初诊复诊发送推送消息时间 |
| 54 | 55 | private Date sendMsgTime; |
| ... | ... | @@ -310,6 +311,26 @@ |
| 310 | 311 | |
| 311 | 312 | //孕妇追访分娩方式冗余 |
| 312 | 313 | private String fmMode; |
| 314 | + | |
| 315 | + //是否分娩 | |
| 316 | + private String isDeliver; | |
| 317 | + | |
| 318 | + | |
| 319 | + public boolean isHistory() { | |
| 320 | + return isHistory; | |
| 321 | + } | |
| 322 | + | |
| 323 | + public void setHistory(boolean history) { | |
| 324 | + isHistory = history; | |
| 325 | + } | |
| 326 | + | |
| 327 | + public String getIsDeliver() { | |
| 328 | + return isDeliver; | |
| 329 | + } | |
| 330 | + | |
| 331 | + public void setIsDeliver(String isDeliver) { | |
| 332 | + this.isDeliver = isDeliver; | |
| 333 | + } | |
| 313 | 334 | |
| 314 | 335 | public String getFmMode() { |
| 315 | 336 | return fmMode; |
platform-dal/src/main/java/com/lyms/platform/pojo/ResidentsArchiveModel.java
View file @
cbcbaef
| ... | ... | @@ -132,6 +132,11 @@ |
| 132 | 132 | //是否终止流程 0 正常流程 1 终止流程 |
| 133 | 133 | private String stop; |
| 134 | 134 | |
| 135 | + | |
| 136 | + //历史数据是否同步 | |
| 137 | + private boolean isHistory; | |
| 138 | + | |
| 139 | + | |
| 135 | 140 | /***********荣成新增男性建档字段**********/ |
| 136 | 141 | private String isOrNotrdl;//是否进食肉、蛋类(0:否;1:是;默认为1) |
| 137 | 142 | private String isOrNotSc;//是否厌食蔬菜(0:否;1:是;默认为0) |
| ... | ... | @@ -186,6 +191,14 @@ |
| 186 | 191 | this.followupTime = followupTime; |
| 187 | 192 | } |
| 188 | 193 | |
| 194 | + | |
| 195 | + public boolean isHistory() { | |
| 196 | + return isHistory; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public void setHistory(boolean history) { | |
| 200 | + isHistory = history; | |
| 201 | + } | |
| 189 | 202 | |
| 190 | 203 | public String getCheckup() { |
| 191 | 204 | return checkup; |
platform-dal/src/main/java/com/lyms/platform/pojo/TrackDownRecord.java
View file @
cbcbaef
| ... | ... | @@ -78,7 +78,16 @@ |
| 78 | 78 | |
| 79 | 79 | //特殊 产筛追访日期 |
| 80 | 80 | private Date fmzyTrackDownDate; |
| 81 | + //历史数据是否处理 | |
| 82 | + private boolean isHistory; | |
| 81 | 83 | |
| 84 | + public boolean isHistory() { | |
| 85 | + return isHistory; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setHistory(boolean history) { | |
| 89 | + isHistory = history; | |
| 90 | + } | |
| 82 | 91 | |
| 83 | 92 | public Date getFmzyAppointmentDate() { |
| 84 | 93 | return fmzyAppointmentDate; |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
cbcbaef
| ... | ... | @@ -349,6 +349,17 @@ |
| 349 | 349 | //分娩方式 |
| 350 | 350 | private String fmMode; |
| 351 | 351 | |
| 352 | + //历史数据是否处理 | |
| 353 | + private boolean isHistory; | |
| 354 | + | |
| 355 | + public boolean isHistory() { | |
| 356 | + return isHistory; | |
| 357 | + } | |
| 358 | + | |
| 359 | + public void setHistory(boolean history) { | |
| 360 | + isHistory = history; | |
| 361 | + } | |
| 362 | + | |
| 352 | 363 | public String getFmMode() { |
| 353 | 364 | return fmMode; |
| 354 | 365 | } |
| 355 | 366 | |
| ... | ... | @@ -416,8 +427,11 @@ |
| 416 | 427 | if (null != serviceTypeIsExist) { |
| 417 | 428 | condition = condition.and("serviceType", serviceTypeIsExist, MongoOper.EXISTS); |
| 418 | 429 | } |
| 430 | + if (isHistory) { | |
| 431 | + condition = condition.and("isHistory", false, MongoOper.EXISTS); | |
| 432 | + } | |
| 419 | 433 | if (null != isDeliver) { |
| 420 | - condition = condition.and("fmDate", isDeliver, MongoOper.EXISTS); | |
| 434 | + condition = condition.and("isDeliver", isDeliver, MongoOper.IS); | |
| 421 | 435 | } |
| 422 | 436 | if (null != fmMode) { |
| 423 | 437 | condition = condition.and("fmMode", fmMode, MongoOper.IS); |
platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java
View file @
cbcbaef
| ... | ... | @@ -132,6 +132,17 @@ |
| 132 | 132 | //追访状态 0 正常 1. 待追访 2.已终止 |
| 133 | 133 | private Integer followupStatus; |
| 134 | 134 | |
| 135 | + //历史数据是否同步 | |
| 136 | + private boolean isHistory; | |
| 137 | + | |
| 138 | + public boolean isHistory() { | |
| 139 | + return isHistory; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public void setHistory(boolean history) { | |
| 143 | + isHistory = history; | |
| 144 | + } | |
| 145 | + | |
| 135 | 146 | public Date getCreatedStart() { |
| 136 | 147 | return createdStart; |
| 137 | 148 | } |
| ... | ... | @@ -190,6 +201,10 @@ |
| 190 | 201 | if (StringUtils.isNotEmpty(checkup)) { |
| 191 | 202 | condition = condition.and("checkup", checkup, MongoOper.IS); |
| 192 | 203 | } |
| 204 | + if (isHistory) { | |
| 205 | + condition = condition.and("isHistory", false, MongoOper.EXISTS); | |
| 206 | + } | |
| 207 | + | |
| 193 | 208 | if (StringUtils.isNotEmpty(pregnantBuild)) { |
| 194 | 209 | condition = condition.and("pregnantBuild", pregnantBuild, MongoOper.IS); |
| 195 | 210 | } |
platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java
View file @
cbcbaef
| ... | ... | @@ -44,6 +44,10 @@ |
| 44 | 44 | private Integer status; |
| 45 | 45 | private String cardNo; |
| 46 | 46 | private String phone; |
| 47 | + private Date startCreated; | |
| 48 | + private Date endCreated; | |
| 49 | + | |
| 50 | + | |
| 47 | 51 | /** |
| 48 | 52 | * 末次月经 |
| 49 | 53 | */ |
| ... | ... | @@ -87,6 +91,33 @@ |
| 87 | 91 | //查询TrackType; |
| 88 | 92 | private Integer queryTrackType; |
| 89 | 93 | |
| 94 | + // | |
| 95 | + private boolean isHistory; | |
| 96 | + | |
| 97 | + public boolean isHistory() { | |
| 98 | + return isHistory; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setHistory(boolean history) { | |
| 102 | + isHistory = history; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public Date getStartCreated() { | |
| 106 | + return startCreated; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setStartCreated(Date startCreated) { | |
| 110 | + this.startCreated = startCreated; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public Date getEndCreated() { | |
| 114 | + return endCreated; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setEndCreated(Date endCreated) { | |
| 118 | + this.endCreated = endCreated; | |
| 119 | + } | |
| 120 | + | |
| 90 | 121 | public Integer getQueryTrackType() { |
| 91 | 122 | return queryTrackType; |
| 92 | 123 | } |
| ... | ... | @@ -345,6 +376,10 @@ |
| 345 | 376 | condition = condition.and("cardNo", cardNo, MongoOper.IS); |
| 346 | 377 | } |
| 347 | 378 | |
| 379 | + if (isHistory) { | |
| 380 | + condition = condition.and("isHistory", false, MongoOper.EXISTS); | |
| 381 | + } | |
| 382 | + | |
| 348 | 383 | if (StringUtils.isNotEmpty(provinceId)) { |
| 349 | 384 | condition = condition.and("provinceRegisterId", provinceId, MongoOper.IS); |
| 350 | 385 | } |
| ... | ... | @@ -615,6 +650,24 @@ |
| 615 | 650 | } |
| 616 | 651 | } |
| 617 | 652 | } |
| 653 | + | |
| 654 | + | |
| 655 | + if (null != startCreated) { | |
| 656 | + if (null != c1) { | |
| 657 | + c1 = c1.and("created").gte(startCreated); | |
| 658 | + } else { | |
| 659 | + c1 = Criteria.where("created").gte(startCreated); | |
| 660 | + } | |
| 661 | + } | |
| 662 | + if (null != endCreated) { | |
| 663 | + if (c1 != null) { | |
| 664 | + c1 = c1.lte(endCreated); | |
| 665 | + } else { | |
| 666 | + c1 = Criteria.where("created").lte(endCreated); | |
| 667 | + } | |
| 668 | + } | |
| 669 | + | |
| 670 | + | |
| 618 | 671 | if (null != c1) { |
| 619 | 672 | condition = condition.andCondition(new MongoCondition(c1)); |
| 620 | 673 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java
View file @
cbcbaef
| ... | ... | @@ -146,6 +146,7 @@ |
| 146 | 146 | * 孕妇追访管理历史数据处理 |
| 147 | 147 | */ |
| 148 | 148 | @RequestMapping(value = "/historyData", method = RequestMethod.GET) |
| 149 | + @ResponseBody | |
| 149 | 150 | public void historyData(Date startTime, Date endTime, String hospitalId) { |
| 150 | 151 | downFacade.historyData(startTime, endTime, hospitalId); |
| 151 | 152 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
cbcbaef
| ... | ... | @@ -1447,6 +1447,8 @@ |
| 1447 | 1447 | public Patients getPatientsData(YunBookbuildingAddRequest yunRequest) { |
| 1448 | 1448 | Patients patient = new Patients(); |
| 1449 | 1449 | patient.setChildExtAddrs(yunRequest.getChildExtAddrs()); |
| 1450 | + //默认为未分娩 | |
| 1451 | + patient.setIsDeliver("0"); | |
| 1450 | 1452 | patient.setSendCareMan(yunRequest.getSendCareMan()); |
| 1451 | 1453 | patient.setReqHusband(yunRequest.getReqHusband()); |
| 1452 | 1454 | patient.setFuckLastMens(DateUtil.parseYMD(yunRequest.getFuckLastMens())); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java
View file @
cbcbaef
| ... | ... | @@ -14,8 +14,8 @@ |
| 14 | 14 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
| 15 | 15 | import com.lyms.platform.operate.web.utils.ResponseUtil; |
| 16 | 16 | import com.lyms.platform.operate.web.worker.ChaseVisitHistory; |
| 17 | -import com.lyms.platform.operate.web.worker.babyStatisticalProbabilityWorker; | |
| 18 | -import com.lyms.platform.permission.model.ServiceListQuery; | |
| 17 | +import com.lyms.platform.operate.web.worker.GravidaVisitHistory; | |
| 18 | +import com.lyms.platform.operate.web.worker.TrackDownHistory; | |
| 19 | 19 | import com.lyms.platform.pojo.*; |
| 20 | 20 | import com.lyms.platform.query.*; |
| 21 | 21 | import org.apache.commons.collections.CollectionUtils; |
| 22 | 22 | |
| ... | ... | @@ -31,9 +31,7 @@ |
| 31 | 31 | import org.springframework.stereotype.Component; |
| 32 | 32 | |
| 33 | 33 | import javax.annotation.PostConstruct; |
| 34 | -import javax.servlet.ServletOutputStream; | |
| 35 | 34 | import javax.servlet.http.HttpServletResponse; |
| 36 | -import java.text.SimpleDateFormat; | |
| 37 | 35 | import java.util.*; |
| 38 | 36 | import java.util.concurrent.Callable; |
| 39 | 37 | import java.util.concurrent.Future; |
| 40 | 38 | |
| 41 | 39 | |
| 42 | 40 | |
| ... | ... | @@ -1103,14 +1101,19 @@ |
| 1103 | 1101 | @Autowired |
| 1104 | 1102 | private PremaritalCheckupService premaritalCheckupService; |
| 1105 | 1103 | |
| 1104 | + @Autowired | |
| 1105 | + private AntenatalExaminationService antenatalExaminationService; | |
| 1106 | + | |
| 1107 | + | |
| 1106 | 1108 | public void historyData(Date startTime, Date endTime, String hospitalId) { |
| 1109 | + List<Map<String, Integer>> dataRequest = new ArrayList<>(); | |
| 1107 | 1110 | if (null != startTime && null != endTime && StringUtils.isNotEmpty(hospitalId)) { |
| 1108 | 1111 | //1.处理是否妇女是否有婚检 |
| 1109 | 1112 | ResidentsArchiveQuery query = new ResidentsArchiveQuery(); |
| 1110 | - List<Map<String, Integer>> dataRequest = new ArrayList<>(); | |
| 1111 | 1113 | query.setCreatedStart(startTime); |
| 1112 | 1114 | query.setCreatedEnd(endTime); |
| 1113 | 1115 | query.setHospitalId(hospitalId); |
| 1116 | + query.setHistory(true); | |
| 1114 | 1117 | List<ResidentsArchiveModel> archiveModels = residentsArchiveService.queryResident(query); |
| 1115 | 1118 | if (CollectionUtils.isNotEmpty(archiveModels)) { |
| 1116 | 1119 | int batchSize = 5; |
| ... | ... | @@ -1122,7 +1125,7 @@ |
| 1122 | 1125 | ends = archiveModels.size(); |
| 1123 | 1126 | } |
| 1124 | 1127 | List<ResidentsArchiveModel> mlist = archiveModels.subList(i, ends); |
| 1125 | - Callable c = new ChaseVisitHistory(mlist, residentsArchiveService,mongoTemplate); | |
| 1128 | + Callable c = new ChaseVisitHistory(mlist, residentsArchiveService, mongoTemplate); | |
| 1126 | 1129 | Future f = commonThreadPool.submit(c); |
| 1127 | 1130 | if (f != null) { |
| 1128 | 1131 | futures.add(f); |
| 1129 | 1132 | |
| 1130 | 1133 | |
| ... | ... | @@ -1138,9 +1141,80 @@ |
| 1138 | 1141 | } |
| 1139 | 1142 | } |
| 1140 | 1143 | } |
| 1144 | + //处理孕妇建档处历史数据 | |
| 1145 | + PatientsQuery patients = new PatientsQuery(); | |
| 1146 | + patients.setCreatedTimeStart(startTime); | |
| 1147 | + patients.setCreatedTimeEnd(endTime); | |
| 1148 | + patients.setHospitalId(hospitalId); | |
| 1149 | + patients.setHistory(true); | |
| 1150 | + List<Patients> patientsList = patientsService.queryPatient(patients); | |
| 1141 | 1151 | |
| 1142 | 1152 | |
| 1153 | + if (CollectionUtils.isNotEmpty(patientsList)) { | |
| 1154 | + int batchSize = 5; | |
| 1155 | + int ends = 0; | |
| 1156 | + List<Future> futures = new ArrayList<>(); | |
| 1157 | + for (int i = 0; i < patientsList.size(); i += batchSize) { | |
| 1158 | + ends = (ends + batchSize); | |
| 1159 | + if (ends > patientsList.size()) { | |
| 1160 | + ends = patientsList.size(); | |
| 1161 | + } | |
| 1162 | + List<Patients> mlist = patientsList.subList(i, ends); | |
| 1163 | + Callable c = new GravidaVisitHistory(mlist, matDeliverService, patientsService, antenatalExaminationService); | |
| 1164 | + Future f = commonThreadPool.submit(c); | |
| 1165 | + if (f != null) { | |
| 1166 | + futures.add(f); | |
| 1167 | + } | |
| 1168 | + } | |
| 1169 | + if (CollectionUtils.isNotEmpty(futures)) { | |
| 1170 | + for (Future f : futures) { | |
| 1171 | + try { | |
| 1172 | + dataRequest.add((Map<String, Integer>) f.get()); | |
| 1173 | + } catch (Exception e) { | |
| 1174 | + ExceptionUtils.catchException(e, "fm list error."); | |
| 1175 | + } | |
| 1176 | + } | |
| 1177 | + } | |
| 1178 | + } | |
| 1179 | + //追访详情历史数据处理 | |
| 1180 | + TrackDownRecordQuery trackDownRecordQuery = new TrackDownRecordQuery(); | |
| 1181 | + trackDownRecordQuery.setStartCreated(startTime); | |
| 1182 | + trackDownRecordQuery.setEndCreated(endTime); | |
| 1183 | + trackDownRecordQuery.setHospitalId(hospitalId); | |
| 1184 | + trackDownRecordQuery.setHistory(true); | |
| 1185 | + List<TrackDownRecord> trackDownRecords = trackDownRecordService.queryTrackDown(trackDownRecordQuery); | |
| 1186 | + if (CollectionUtils.isNotEmpty(trackDownRecords)) { | |
| 1187 | + int batchSize = 5; | |
| 1188 | + int ends = 0; | |
| 1189 | + List<Future> futures = new ArrayList<>(); | |
| 1190 | + for (int i = 0; i < trackDownRecords.size(); i += batchSize) { | |
| 1191 | + ends = (ends + batchSize); | |
| 1192 | + if (ends > trackDownRecords.size()) { | |
| 1193 | + ends = trackDownRecords.size(); | |
| 1194 | + } | |
| 1195 | + List<TrackDownRecord> mlist = trackDownRecords.subList(i, ends); | |
| 1196 | + Callable c = new TrackDownHistory(mlist, antenatalExaminationService, trackDownRecordService); | |
| 1197 | + Future f = commonThreadPool.submit(c); | |
| 1198 | + if (f != null) { | |
| 1199 | + futures.add(f); | |
| 1200 | + } | |
| 1201 | + } | |
| 1202 | + if (CollectionUtils.isNotEmpty(futures)) { | |
| 1203 | + for (Future f : futures) { | |
| 1204 | + try { | |
| 1205 | + dataRequest.add((Map<String, Integer>) f.get()); | |
| 1206 | + } catch (Exception e) { | |
| 1207 | + ExceptionUtils.catchException(e, "fm list error."); | |
| 1208 | + } | |
| 1209 | + } | |
| 1210 | + } | |
| 1211 | + } | |
| 1212 | + System.out.println("妇女处理历史数据 " + archiveModels.size()); | |
| 1213 | + System.out.println("孕妇处理历史数据 " + patientsList.size()); | |
| 1214 | + System.out.println("追访详情处理历史数据" + trackDownRecords.size()); | |
| 1215 | + System.out.println("处理范围 时间" + DateUtil.getyyyy_MM_dd(startTime) + "到" + DateUtil.getyyyy_MM_dd(endTime) + "医院id" + hospitalId); | |
| 1143 | 1216 | } |
| 1217 | + | |
| 1144 | 1218 | |
| 1145 | 1219 | } |
| 1146 | 1220 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/ChaseVisitHistory.java
View file @
cbcbaef
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import org.springframework.data.mongodb.core.query.Criteria; |
| 12 | 12 | import org.springframework.data.mongodb.core.query.Query; |
| 13 | 13 | |
| 14 | +import java.util.HashMap; | |
| 14 | 15 | import java.util.List; |
| 15 | 16 | import java.util.Map; |
| 16 | 17 | import java.util.concurrent.Callable; |
| ... | ... | @@ -32,6 +33,9 @@ |
| 32 | 33 | |
| 33 | 34 | @Override |
| 34 | 35 | public Map<String, Integer> call() throws Exception { |
| 36 | + //妇女建档历史数据处理 | |
| 37 | + int i = 0; | |
| 38 | + Map<String, Integer> data = new HashMap<>(); | |
| 35 | 39 | for (ResidentsArchiveModel archive : archiveModel) { |
| 36 | 40 | PremaritalCheckup checkup = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(archive.getId())), PremaritalCheckup.class); |
| 37 | 41 | if (null != checkup) { |
| 38 | 42 | |
| 39 | 43 | |
| ... | ... | @@ -47,11 +51,17 @@ |
| 47 | 51 | } |
| 48 | 52 | //默认正常 |
| 49 | 53 | archive.setStop("0"); |
| 50 | - | |
| 54 | + //数据已处理 | |
| 55 | + archive.setHistory(true); | |
| 56 | + //预约追访时间改成创建时间 | |
| 57 | + archive.setFollowupTime(archive.getCreated()); | |
| 51 | 58 | residentsArchiveService.updateResident(archive, archive.getId()); |
| 52 | - | |
| 59 | + i++; | |
| 60 | + System.out.println("处理妇女数据 " + archive.getId()); | |
| 53 | 61 | } |
| 54 | - return null; | |
| 62 | + System.out.println("妇女数据已处理=====》" + i); | |
| 63 | + data.put("woman", archiveModel.size()); | |
| 64 | + return data; | |
| 55 | 65 | } |
| 56 | 66 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/GravidaVisitHistory.java
View file @
cbcbaef
| 1 | +package com.lyms.platform.operate.web.worker; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
| 4 | +import com.lyms.platform.biz.service.MatDeliverService; | |
| 5 | +import com.lyms.platform.biz.service.PatientsService; | |
| 6 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 8 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 9 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 10 | +import com.lyms.platform.pojo.MaternalDeliverModel; | |
| 11 | +import com.lyms.platform.pojo.Patients; | |
| 12 | +import com.lyms.platform.query.AntExQuery; | |
| 13 | +import com.lyms.platform.query.MatDeliverQuery; | |
| 14 | + | |
| 15 | +import java.util.Date; | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | +import java.util.concurrent.Callable; | |
| 20 | + | |
| 21 | +public class GravidaVisitHistory implements Callable<Map<String, Integer>> { | |
| 22 | + private List<Patients> patients; | |
| 23 | + | |
| 24 | + private MatDeliverService matDeliverService; | |
| 25 | + | |
| 26 | + private PatientsService patientsService; | |
| 27 | + | |
| 28 | + private AntenatalExaminationService antenatalExaminationService; | |
| 29 | + | |
| 30 | + public GravidaVisitHistory(List<Patients> patients, MatDeliverService matDeliverService, PatientsService patientsService, | |
| 31 | + AntenatalExaminationService antenatalExaminationService) { | |
| 32 | + this.patients = patients; | |
| 33 | + this.matDeliverService = matDeliverService; | |
| 34 | + this.patientsService = patientsService; | |
| 35 | + this.antenatalExaminationService = antenatalExaminationService; | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public Map<String, Integer> call() throws Exception { | |
| 40 | + Map<String, Integer> data = new HashMap<>(); | |
| 41 | + int i = 0; | |
| 42 | + for (Patients p : patients) { | |
| 43 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 44 | + matDeliverQuery.setParentId(p.getId()); | |
| 45 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
| 46 | + List<MaternalDeliverModel> maternalDeliverModels = matDeliverService.query(matDeliverQuery); | |
| 47 | + if (CollectionUtils.isNotEmpty(maternalDeliverModels)) { | |
| 48 | + p.setIsDeliver("0"); | |
| 49 | + } else { | |
| 50 | + p.setIsDeliver("1"); | |
| 51 | + } | |
| 52 | + p.setStop("0"); | |
| 53 | + //查询复诊 | |
| 54 | + AntExQuery antExQuery = new AntExQuery(); | |
| 55 | + antExQuery.setParentId(p.getId()); | |
| 56 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 57 | + Map<String, Object> map = new HashMap<>(); | |
| 58 | + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
| 59 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 60 | + for (AntenatalExaminationModel examinationModel : list) { | |
| 61 | + if (null != examinationModel.getNextCheckTime()) { | |
| 62 | + //p.setFollowupTime(examinationModel.getNextCheckTime()); | |
| 63 | + map.put("time", examinationModel.getNextCheckTime()); | |
| 64 | + break; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + } else { | |
| 68 | + //查询初诊 | |
| 69 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExQuery.convertToQuery()); | |
| 70 | + if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 71 | + for (AntExChuModel antExChuModel : antExChuModels) { | |
| 72 | + if (antExChuModel.getNextCheckTime() != null) { | |
| 73 | + map.put("time", antExChuModel.getNextCheckTime()); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 77 | + } | |
| 78 | + if ((Date) map.get("time") != null) { | |
| 79 | + p.setFollowupTime((Date) map.get("time")); | |
| 80 | + } else { | |
| 81 | + p.setFollowupTime(p.getCreated()); | |
| 82 | + } | |
| 83 | + patientsService.updatePatientOne(p, p.getId()); | |
| 84 | + i++; | |
| 85 | + System.out.println("处理数据“孕妇ID" + p.getId()); | |
| 86 | + } | |
| 87 | + System.out.println("========>已处理孕妇数据" + i); | |
| 88 | + data.put("gravida", patients.size()); | |
| 89 | + return data; | |
| 90 | + } | |
| 91 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/TrackDownHistory.java
View file @
cbcbaef
| 1 | +package com.lyms.platform.operate.web.worker; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
| 4 | +import com.lyms.platform.biz.service.TrackDownRecordService; | |
| 5 | +import com.lyms.platform.common.enums.YnEnums; | |
| 6 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 7 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 8 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 9 | +import com.lyms.platform.pojo.TrackDownRecord; | |
| 10 | +import com.lyms.platform.query.AntExQuery; | |
| 11 | + | |
| 12 | +import java.util.Date; | |
| 13 | +import java.util.HashMap; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.Map; | |
| 16 | +import java.util.concurrent.Callable; | |
| 17 | + | |
| 18 | +public class TrackDownHistory implements Callable<Map<String, Integer>> { | |
| 19 | + | |
| 20 | + private List<TrackDownRecord> trackDownRecords; | |
| 21 | + | |
| 22 | + private AntenatalExaminationService antenatalExaminationService; | |
| 23 | + | |
| 24 | + private TrackDownRecordService trackDownRecordService; | |
| 25 | + | |
| 26 | + public TrackDownHistory(List<TrackDownRecord> trackDownRecords, AntenatalExaminationService antenatalExaminationService, TrackDownRecordService trackDownRecordService) { | |
| 27 | + this.trackDownRecords = trackDownRecords; | |
| 28 | + this.antenatalExaminationService = antenatalExaminationService; | |
| 29 | + this.trackDownRecordService = trackDownRecordService; | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public Map<String, Integer> call() throws Exception { | |
| 34 | + int i = 0; | |
| 35 | + Map<String, Integer> map = new HashMap<>(); | |
| 36 | + for (TrackDownRecord track : trackDownRecords) { | |
| 37 | + //先查询复诊 | |
| 38 | + AntExQuery antExQuery = new AntExQuery(); | |
| 39 | + Map<String, Date> data = new HashMap<>(); | |
| 40 | + antExQuery.setParentId(track.getParentId()); | |
| 41 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 42 | + antExQuery.setSort("checkDate"); | |
| 43 | + | |
| 44 | + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
| 45 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 46 | + for (AntenatalExaminationModel examinationModel : list) { | |
| 47 | + if (examinationModel.getNextCheckTime() != null) { | |
| 48 | + data.put("time", examinationModel.getNextCheckTime()); | |
| 49 | + break; | |
| 50 | + } | |
| 51 | + } | |
| 52 | + } else { | |
| 53 | + //初诊 | |
| 54 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExQuery.convertToQuery()); | |
| 55 | + if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 56 | + for (AntExChuModel antExChuModel : antExChuModels) { | |
| 57 | + if (antExChuModel.getNextCheckTime() != null) { | |
| 58 | + data.put("time", antExChuModel.getNextCheckTime()); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + } | |
| 62 | + } | |
| 63 | + track.setStop("0"); | |
| 64 | + | |
| 65 | + //表示已处理 | |
| 66 | + track.setHistory(true); | |
| 67 | + if (null != (Date) data.get("time")) { | |
| 68 | + track.setAppointmentDate((Date) data.get("time")); | |
| 69 | + track.setFmzyAppointmentDate((Date) data.get("time")); | |
| 70 | + track.setSieveAppointmentDate((Date) data.get("time")); | |
| 71 | + } else { | |
| 72 | + track.setAppointmentDate(track.getCreated()); | |
| 73 | + track.setFmzyAppointmentDate(track.getCreated()); | |
| 74 | + track.setSieveAppointmentDate(track.getCreated()); | |
| 75 | + } | |
| 76 | + trackDownRecordService.updateTrackDown(track, track.getId()); | |
| 77 | + i++; | |
| 78 | + } | |
| 79 | + System.out.println("追访详情已处理数据" + i); | |
| 80 | + map.put("trackDown", trackDownRecords.size()); | |
| 81 | + return map; | |
| 82 | + } | |
| 83 | +} |