Commit 967014a40c45ce3249def336549699784590b097
1 parent
34af745845
Exists in
master
and in
6 other branches
1
Showing 1 changed file with 78 additions and 16 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownJobFacade.java
View file @
967014a
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | -import com.lyms.platform.biz.service.PatientsService; | |
4 | -import com.lyms.platform.biz.service.PremaritalCheckupService; | |
5 | -import com.lyms.platform.biz.service.ResidentsArchiveService; | |
6 | -import com.lyms.platform.biz.service.TrackDownRecordService; | |
3 | +import com.lyms.platform.biz.service.*; | |
7 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | 5 | import com.lyms.platform.common.enums.TrackDownDateEnums; |
9 | 6 | import com.lyms.platform.common.enums.YnEnums; |
10 | 7 | import com.lyms.platform.common.result.BaseResponse; |
11 | 8 | import com.lyms.platform.common.utils.DateUtil; |
12 | 9 | import com.lyms.platform.common.utils.StringUtils; |
13 | -import com.lyms.platform.pojo.Patients; | |
14 | -import com.lyms.platform.pojo.PremaritalCheckup; | |
15 | -import com.lyms.platform.pojo.ResidentsArchiveModel; | |
16 | -import com.lyms.platform.pojo.TrackDownRecord; | |
17 | -import com.lyms.platform.query.PatientsQuery; | |
18 | -import com.lyms.platform.query.PremaritalCheckupQuery; | |
19 | -import com.lyms.platform.query.ResidentsArchiveQuery; | |
20 | -import com.lyms.platform.query.TrackDownRecordQuery; | |
10 | +import com.lyms.platform.pojo.*; | |
11 | +import com.lyms.platform.query.*; | |
21 | 12 | import org.apache.commons.collections.CollectionUtils; |
22 | 13 | import org.slf4j.Logger; |
23 | 14 | import org.slf4j.LoggerFactory; |
... | ... | @@ -306,7 +297,7 @@ |
306 | 297 | premaritalCheckupQuery.setNeed("1"); |
307 | 298 | premaritalCheckupQuery.setPage(page); |
308 | 299 | premaritalCheckupQuery.setLimit(limit); |
309 | - data= premaritalCheckupService.queryPremaritalCheckup(premaritalCheckupQuery); | |
300 | + data = premaritalCheckupService.queryPremaritalCheckup(premaritalCheckupQuery); | |
310 | 301 | |
311 | 302 | //查询妇女建档 |
312 | 303 | // data = residentsArchiveService.queryResident(archiveQuery); |
... | ... | @@ -328,8 +319,8 @@ |
328 | 319 | Integer count = patientsService.queryPatientCount(patientsQuery1); |
329 | 320 | if (null != count && count == 0) { |
330 | 321 | logger.info("HYTrackDownDataLoader addTrackDown by id :" + model.getId()); |
331 | - TrackDownRecord down= build(model); | |
332 | - if(null!=down){ | |
322 | + TrackDownRecord down = build(model); | |
323 | + if (null != down) { | |
333 | 324 | downRecordService.addTrackDown(down); |
334 | 325 | } |
335 | 326 | } |
... | ... | @@ -337,7 +328,7 @@ |
337 | 328 | |
338 | 329 | @Override |
339 | 330 | public TrackDownRecord build(PremaritalCheckup model) { |
340 | - if(StringUtils.isEmpty(model.getParentId())){ | |
331 | + if (StringUtils.isEmpty(model.getParentId())) { | |
341 | 332 | return null; |
342 | 333 | } |
343 | 334 | TrackDownRecord record = new TrackDownRecord(); |
... | ... | @@ -437,5 +428,76 @@ |
437 | 428 | return record; |
438 | 429 | } |
439 | 430 | } |
431 | + | |
432 | + /** | |
433 | + * 产后访视数据加载 | |
434 | + */ | |
435 | + class CHFSTrackDownDataLoader implements TrackDownDataLoader<MaternalDeliverModel> { | |
436 | + | |
437 | + @Override | |
438 | + public void execute() { | |
439 | + int page = 1; | |
440 | + List<MaternalDeliverModel> data = null; | |
441 | + do { | |
442 | + MatDeliverQuery deliverQuery = new MatDeliverQuery(); | |
443 | + deliverQuery.setYn(YnEnums.YES.getId()); | |
444 | + deliverQuery.setSort("created asc"); | |
445 | + deliverQuery.setNeed("1"); | |
446 | + deliverQuery.setPage(page); | |
447 | + deliverQuery.setLimit(limit); | |
448 | + | |
449 | + //查询妇女建档 | |
450 | + data = matDeliverService.query(deliverQuery); | |
451 | + if (CollectionUtils.isNotEmpty(data)) { | |
452 | + for (MaternalDeliverModel model : data) { | |
453 | + //单条数据处理 | |
454 | + handOneByOne(model); | |
455 | + } | |
456 | + } | |
457 | + page++; | |
458 | + } while (CollectionUtils.isNotEmpty(data) && data.size() == limit); | |
459 | + } | |
460 | + | |
461 | + @Override | |
462 | + public void handOneByOne(MaternalDeliverModel model) { | |
463 | + if (null != model && StringUtils.isNotEmpty(model.getId())) { | |
464 | + PremaritalCheckupQuery premaritalCheckupQuery = new PremaritalCheckupQuery(); | |
465 | + premaritalCheckupQuery.setYn(YnEnums.YES.getId()); | |
466 | + premaritalCheckupQuery.setParentId(model.getId()); | |
467 | + premaritalCheckupQuery.setSexType(1); | |
468 | + List<PremaritalCheckup> DATA = premaritalCheckupService.queryPremaritalCheckup(premaritalCheckupQuery); | |
469 | + | |
470 | + if (CollectionUtils.isEmpty(DATA)) { | |
471 | + logger.info("HJTrackDownDataLoader addTrackDown by id :" + model.getId()); | |
472 | + downRecordService.addTrackDown(build(model)); | |
473 | + } else { | |
474 | + //TODO 如果有婚检还存在的情况 | |
475 | + } | |
476 | + } | |
477 | + } | |
478 | + | |
479 | + @Override | |
480 | + public TrackDownRecord build(MaternalDeliverModel model) { | |
481 | + TrackDownRecord record = new TrackDownRecord(); | |
482 | + record.setParentId(model.getId()); | |
483 | + | |
484 | + Patients patients =patientsService.findOnePatientById(model.getParentId()); | |
485 | + record.setAddressRegister(patients.getAddressRegister()); | |
486 | + record.setAreaRegisterId(patients.getAreaRegisterId()); | |
487 | + record.setBirth(patients.getBirth()); | |
488 | + record.setCityRegisterId(patients.getCityRegisterId()); | |
489 | + record.setUsername(patients.getUsername()); | |
490 | + record.setStreetRegisterId(patients.getStreetRegisterId()); | |
491 | + record.setPhone(patients.getPhone()); | |
492 | + record.setHospitalId(model.getHospitalId()); | |
493 | + record.setStatus(1); | |
494 | + record.setCardNo(patients.getCardNo()); | |
495 | + record.setTrackType(TrackDownDateEnums.F.getId()); | |
496 | + return record; | |
497 | + } | |
498 | + } | |
499 | + | |
500 | + @Autowired | |
501 | + private MatDeliverService matDeliverService; | |
440 | 502 | } |