Commit 2972300784382d0260f9f70b7ce0e0a8471c5d7b

Authored by [wangbo]
1 parent dbcac89caf

追访搜索功能修改完成

Showing 6 changed files with 161 additions and 74 deletions

platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 2972300
... ... @@ -29,7 +29,9 @@
29 29  
30 30 private String husbandPhone;
31 31  
32   - //居住类别
  32 + //居住类别、
  33 +
  34 +
33 35 private String liveType;
34 36 /**
35 37 * 关键字
... ... @@ -335,7 +337,6 @@
335 337 private Date startAge;
336 338 private Date endAge;
337 339  
338   -
339 340 /**
340 341 * 孕妇追访字段冗余
341 342 * 0 代表正常 1 待追访 2.已终止
... ... @@ -344,6 +345,7 @@
344 345  
345 346 //是否分娩
346 347 private Boolean isDeliver;
  348 +
347 349  
348 350 public Boolean isDeliver() {
349 351 return isDeliver;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java View file @ 2972300
... ... @@ -87,7 +87,7 @@
87 87 @RequestMapping(value = "/all", method = RequestMethod.GET)
88 88 public BaseResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer type,
89 89 @RequestParam Integer page, @RequestParam Integer limit, HttpServletRequest request,
90   - Integer check, String checkup, String pregnantBuild, Integer followupStatus, boolean isDeliver) {
  90 + Integer check, String checkup, String pregnantBuild, Integer followupStatus, Boolean isDeliver) {
91 91 return trackDownService.all(buildStart, buildEnd, checkStart, checkEnd, fmStart, fmEnd, key,
92 92 page, limit, getUserId(request), type, check, checkup, pregnantBuild, followupStatus, isDeliver);
93 93 }
... ... @@ -130,6 +130,15 @@
130 130 @RequestMapping(method = RequestMethod.GET)
131 131 public BaseResponse list(TrackDownQueryRequest downQueryRequest, HttpServletRequest request) {
132 132 return downFacade.list(downQueryRequest, getUserId(request));
  133 + }
  134 +
  135 + /**
  136 + * 孕妇追访管理历史数据处理
  137 + */
  138 +
  139 + @RequestMapping(value = "/historyData", method = RequestMethod.GET)
  140 + public void historyData(Date startTime, Date endTime) {
  141 + downFacade.historyData(startTime, endTime);
133 142 }
134 143  
135 144 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java View file @ 2972300
... ... @@ -29,6 +29,7 @@
29 29 import org.springframework.stereotype.Component;
30 30  
31 31 import javax.annotation.PostConstruct;
  32 +import javax.servlet.ServletOutputStream;
32 33 import javax.servlet.http.HttpServletResponse;
33 34 import java.util.*;
34 35  
... ... @@ -72,7 +73,7 @@
72 73  
73 74 //查询的追访类型
74 75 trackDownRecord.setTrackType(downQueryRequest.getTrackType());
75   - Map map = downTypeHandler.build(trackDownRecord, mongoTemplate);
  76 + Map map = downTypeHandler.build(trackDownRecord, mongoTemplate, downQueryRequest.getEncryption());
76 77 if (downQueryRequest.getTrackType() == TrackDownDateEnums.D.getId()) {
77 78 if (trackType == TrackDownDateEnums.C.getId()) {
78 79 trackType = TrackDownDateEnums.D.getId();
... ... @@ -201,7 +202,7 @@
201 202 * @param mongoTemplate 数据库连接
202 203 * @return 返回的内容
203 204 */
204   - Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate);
  205 + Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption);
205 206 }
206 207  
207 208 @Autowired
... ... @@ -312,6 +313,42 @@
312 313 isPatient = true;
313 314 }
314 315  
  316 + /**2019-07 需求搜索条件添加*/
  317 + if (downQueryRequest.getFmType() != null) {//分泌方式
  318 + patientsQuery.setFmType(downQueryRequest.getFmType());
  319 + isPatient = true;
  320 + }
  321 +
  322 + if (null != downQueryRequest.getPostpartumDays()) {//产后天数
  323 + Calendar instance = Calendar.getInstance();
  324 + instance.setTime(new Date());
  325 + instance.add(Calendar.DATE, -downQueryRequest.getBeOverdueDays());
  326 + instance.set(Calendar.HOUR_OF_DAY, 23);
  327 + instance.set(Calendar.MINUTE, 59);
  328 + instance.set(Calendar.SECOND, 59);
  329 + instance.set(Calendar.MILLISECOND, 999);
  330 + Date end = instance.getTime();
  331 + patientsQuery.setFmDateEnd(end);
  332 +
  333 + instance.setTime(new Date());
  334 + instance.add(Calendar.DATE, -downQueryRequest.getBeOverdueDays());
  335 + instance.set(Calendar.HOUR_OF_DAY, 00);
  336 + instance.set(Calendar.MINUTE, 00);
  337 + instance.set(Calendar.SECOND, 00);
  338 + instance.set(Calendar.MILLISECOND, 000);
  339 + Date start = instance.getTime();
  340 + patientsQuery.setFmDateStart(start);
  341 + isPatient = true;
  342 + }
  343 +
  344 + if (downQueryRequest.getStartWeek() != null && downQueryRequest.getEndWeek() != null) {//孕周
  345 + Date start = DateUtil.getWeekStart(downQueryRequest.getStartWeek());
  346 + patientsQuery.setLastMensesStart(start);
  347 + Date end = DateUtil.getWeekEnd(downQueryRequest.getEndWeek());
  348 + patientsQuery.setLastMensesEnd(end);
  349 + isPatient = true;
  350 + }
  351 +
315 352 if (downQueryRequest.getIsHightRisk() != null) {//是否高危:是:排除健康,否:等于健康
316 353 if (downQueryRequest.getIsHightRisk() == 1) {//是
317 354 // patientsQuery.setNotoRiskFactor("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
... ... @@ -602,7 +639,7 @@
602 639  
603 640 //查询的追访类型
604 641 trackDownRecord.setTrackType(downQueryRequest.getTrackType());
605   - Map map = downTypeHandler.build(trackDownRecord, mongoTemplate);
  642 + Map map = downTypeHandler.build(trackDownRecord, mongoTemplate, downQueryRequest.getEncryption());
606 643 if (downQueryRequest.getTrackType() == TrackDownDateEnums.D.getId()) {
607 644 if (trackType == TrackDownDateEnums.C.getId()) {
608 645 trackType = TrackDownDateEnums.D.getId();
609 646  
610 647  
... ... @@ -631,16 +668,16 @@
631 668 class CHFCTrackDownTypeHandler implements TrackDownTypeHandler {
632 669  
633 670 @Override
634   - public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) {
  671 + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption) {
635 672 Map<String, Object> temp = new HashMap<>();
636 673 temp.put("id", downRecord.getId());
637 674 temp.put("pid", downRecord.getPid());
638 675 temp.put("parentId", downRecord.getParentId());
639 676 temp.put("username", downRecord.getUsername());
640   - temp.put("cardNo", StringUtils.encryCardNo(downRecord.getCardNo()));
  677 + temp.put("cardNo", encryption == 0 ? StringUtils.encryCardNo(downRecord.getCardNo()) : downRecord.getCardNo());
641 678 temp.put("trackDownDateType", downRecord.getTrackType());
642 679 temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
643   - temp.put("phone", StringUtils.encryPhone(downRecord.getPhone()));
  680 + temp.put("phone", encryption == 0 ? StringUtils.encryPhone(downRecord.getPhone()) : downRecord.getPhone());
644 681 TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(downRecord.getParentId()).and("yn").is(1).and("trackDownDateType").in(7, 10)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
645 682 temp.put("age", DateUtil.getAge(downRecord.getBirth()));
646 683 // 追访结果
647 684  
648 685  
... ... @@ -712,16 +749,16 @@
712 749 */
713 750 class CHTrackDownTypeHandler implements TrackDownTypeHandler {
714 751 @Override
715   - public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) {
  752 + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption) {
716 753 Map<String, Object> temp = new HashMap<>();
717 754 temp.put("id", downRecord.getId());
718 755 temp.put("pid", downRecord.getPid());
719 756 temp.put("parentId", downRecord.getParentId());
720 757 temp.put("username", downRecord.getUsername());
721   - temp.put("cardNo", StringUtils.encryCardNo(downRecord.getCardNo()));
  758 + temp.put("cardNo", encryption == 0 ? StringUtils.encryCardNo(downRecord.getCardNo()) : downRecord.getCardNo());
722 759 temp.put("trackDownDateType", downRecord.getTrackType());
723 760 temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
724   - temp.put("phone", StringUtils.encryPhone(downRecord.getPhone()));
  761 + temp.put("phone", encryption == 0 ? StringUtils.encryPhone(downRecord.getPhone()) : downRecord.getPhone());
725 762  
726 763 temp.put("fmDate", "--");
727 764 temp.put("result", "--");
728 765  
729 766  
730 767  
... ... @@ -755,18 +792,17 @@
755 792 * 怀孕建档返回的字段
756 793 */
757 794 class HYTrackDownTypeHandler implements TrackDownTypeHandler {
758   -
759 795 @Override
760   - public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) {
  796 + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption) {
761 797 Map<String, Object> temp = new HashMap<>();
762 798 temp.put("id", downRecord.getId());
763 799 temp.put("pid", downRecord.getPid());
764 800 temp.put("parentId", downRecord.getParentId());
765 801 temp.put("trackDownDateType", downRecord.getTrackType());
766 802 temp.put("username", downRecord.getUsername());
767   - temp.put("cardNo", StringUtils.encryCardNo(downRecord.getCardNo()));
  803 + temp.put("cardNo", encryption == 0 ? StringUtils.encryCardNo(downRecord.getCardNo()) : downRecord.getCardNo());
768 804 temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
769   - temp.put("phone", StringUtils.encryPhone(downRecord.getPhone()));
  805 + temp.put("phone", encryption == 0 ? StringUtils.encryPhone(downRecord.getPhone()) : downRecord.getPhone());
770 806 TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(downRecord.getParentId()).and("yn").is(1).and("trackDownDateType").is(downRecord.getTrackType())).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
771 807 temp.put("age", DateUtil.getAge(downRecord.getBirth()));
772 808 // 婚检追访结果
773 809  
774 810  
... ... @@ -787,17 +823,17 @@
787 823 class FQTrackDownTypeHandler implements TrackDownTypeHandler {
788 824  
789 825 @Override
790   - public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) {
  826 + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption) {
791 827 Map<String, Object> temp = new HashMap<>();
792 828 temp.put("id", downRecord.getId());
793 829 temp.put("pid", downRecord.getPid());
794 830 temp.put("parentId", downRecord.getResidentsArchiveId());
795 831 temp.put("username", downRecord.getUsername());
796   - temp.put("cardNo", StringUtils.encryCardNo(downRecord.getCardNo()));
  832 + temp.put("cardNo", encryption == 0 ? StringUtils.encryCardNo(downRecord.getCardNo()) : downRecord.getCardNo());
797 833 temp.put("trackDownDateType", downRecord.getTrackType());
798 834  
799 835 temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
800   - temp.put("phone", StringUtils.encryPhone(downRecord.getPhone()));
  836 + temp.put("phone", encryption == 0 ? StringUtils.encryPhone(downRecord.getPhone()) : downRecord.getPhone());
801 837 List<TrackDown> trackDown = mongoTemplate.find(Query.query(Criteria.where("parentId").is(downRecord.getResidentsArchiveId()).and("yn").is(1).and("trackDownDateType").is(downRecord.getTrackType())).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
802 838 temp.put("age", DateUtil.getAge(downRecord.getBirth()));
803 839 // 婚检追访结果
... ... @@ -820,7 +856,7 @@
820 856 class CJTrackDownTypeHandler implements TrackDownTypeHandler {
821 857  
822 858 @Override
823   - public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) {
  859 + public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate, Integer encryption) {
824 860  
825 861 String parentId = downRecord.getParentId();
826 862 String hospitalId = downRecord.getHospitalId();
827 863  
... ... @@ -837,10 +873,10 @@
837 873 handHightRisk(patients, temp);
838 874 temp.put("username", downRecord.getUsername());
839 875 temp.put("age", DateUtil.getAge(downRecord.getBirth()));
840   - temp.put("cardNo", StringUtils.encryCardNo(downRecord.getCardNo()));
  876 + temp.put("cardNo", encryption == 0 ? StringUtils.encryCardNo(downRecord.getCardNo()) : downRecord.getCardNo());
841 877 temp.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); /** 预产期 */
842 878 temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
843   - temp.put("phone", StringUtils.encryPhone(downRecord.getPhone()));
  879 + temp.put("phone", encryption == 0 ? StringUtils.encryPhone(downRecord.getPhone()) : downRecord.getPhone());
844 880 temp.put("id", downRecord.getId());
845 881 temp.put("parentId", downRecord.getParentId());
846 882 if (patients != null) {
... ... @@ -963,5 +999,41 @@
963 999 map.put("rLevel", HighScoreResult.filter(level));
964 1000 }
965 1001 }
  1002 +
  1003 + /**
  1004 + * 孕妇追访历史数据处理
  1005 + */
  1006 +
  1007 + private long start;
  1008 +
  1009 + public void historyData(Date startTime, Date endTime) {
  1010 + //1.处理妇女表中的预约字段
  1011 + List<TrackDownRecord> trackDownRecord = mongoTemplate.find(Query.query(Criteria.where("created").gte(startTime).lte(endTime)), TrackDownRecord.class);
  1012 + System.out.println(trackDownRecord.size());
  1013 + TrackDownRecord trackDown = new TrackDownRecord();
  1014 + ResidentsArchiveModel residentsArchiveModel = new ResidentsArchiveModel();
  1015 + Patients patients = new Patients();
  1016 +
  1017 + System.out.println(System.currentTimeMillis());
  1018 + start = System.currentTimeMillis();
  1019 + for (TrackDownRecord track : trackDownRecord) {
  1020 +
  1021 + System.out.println("id:" + track.getId());
  1022 + trackDown.setAppointmentDate(track.getCreated());
  1023 + trackDown.setStop("0");
  1024 + residentsArchiveModel.setStop("0");
  1025 + residentsArchiveModel.setFollowupTime(track.getCreated());
  1026 + patients.setStop("0");
  1027 + patients.setFollowupTime(track.getCreated());
  1028 + patientsService.updatePatientOne(patients, track.getParentId());
  1029 + residentsArchiveService.updateResident(residentsArchiveModel, track.getResidentsArchiveId());
  1030 + trackDownRecordService.updateTrackDown(trackDown, track.getId());
  1031 + }
  1032 + System.out.println("结束时间:" + (System.currentTimeMillis() - start));
  1033 +
  1034 +
  1035 + }
  1036 +
  1037 +
966 1038 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/TrackDownQueryRequest.java View file @ 2972300
... ... @@ -49,16 +49,6 @@
49 49 /**
50 50 * 新加查询条件
51 51 */
52   - //追访日期
53   - private Date startChaseVisit;
54   - private Date endChaseVisit;
55   -
56   - //逾期天数
57   - private Integer startBeOverdue;
58   - private Integer endBeOverdue;
59   - //流程状态
60   - private Integer processState;
61   -
62 52 //妇女建档开始日期
63 53 private Date foundDateStart;
64 54 //结束日期
65 55  
... ... @@ -82,7 +72,61 @@
82 72 //结束追访日期
83 73 private Date trackDownDateEnd;
84 74  
  75 + //是否加密 0 你加密 1加密
  76 + private Integer encryption;
85 77  
  78 + //分娩方式
  79 + private String fmType;
  80 +
  81 + //产后天数
  82 + private Integer postpartumDays;
  83 +
  84 + //起始孕周
  85 + private Integer startWeek;
  86 +
  87 + //结束孕周
  88 + private Integer endWeek;
  89 +
  90 + public Integer getStartWeek() {
  91 + return startWeek;
  92 + }
  93 +
  94 + public void setStartWeek(Integer startWeek) {
  95 + this.startWeek = startWeek;
  96 + }
  97 +
  98 + public Integer getEndWeek() {
  99 + return endWeek;
  100 + }
  101 +
  102 + public void setEndWeek(Integer endWeek) {
  103 + this.endWeek = endWeek;
  104 + }
  105 +
  106 + public Integer getPostpartumDays() {
  107 + return postpartumDays;
  108 + }
  109 +
  110 + public void setPostpartumDays(Integer postpartumDays) {
  111 + this.postpartumDays = postpartumDays;
  112 + }
  113 +
  114 + public String getFmType() {
  115 + return fmType;
  116 + }
  117 +
  118 + public void setFmType(String fmType) {
  119 + this.fmType = fmType;
  120 + }
  121 +
  122 + public Integer getEncryption() {
  123 + return encryption;
  124 + }
  125 +
  126 + public void setEncryption(Integer encryption) {
  127 + this.encryption = encryption;
  128 + }
  129 +
86 130 public Date getTrackDownDateStart() {
87 131 return trackDownDateStart;
88 132 }
... ... @@ -145,46 +189,6 @@
145 189  
146 190 public void setFoundDateEnd(Date foundDateEnd) {
147 191 this.foundDateEnd = foundDateEnd;
148   - }
149   -
150   - public Date getStartChaseVisit() {
151   - return startChaseVisit;
152   - }
153   -
154   - public void setStartChaseVisit(Date startChaseVisit) {
155   - this.startChaseVisit = startChaseVisit;
156   - }
157   -
158   - public Date getEndChaseVisit() {
159   - return endChaseVisit;
160   - }
161   -
162   - public void setEndChaseVisit(Date endChaseVisit) {
163   - this.endChaseVisit = endChaseVisit;
164   - }
165   -
166   - public Integer getStartBeOverdue() {
167   - return startBeOverdue;
168   - }
169   -
170   - public void setStartBeOverdue(Integer startBeOverdue) {
171   - this.startBeOverdue = startBeOverdue;
172   - }
173   -
174   - public Integer getEndBeOverdue() {
175   - return endBeOverdue;
176   - }
177   -
178   - public void setEndBeOverdue(Integer endBeOverdue) {
179   - this.endBeOverdue = endBeOverdue;
180   - }
181   -
182   - public Integer getProcessState() {
183   - return processState;
184   - }
185   -
186   - public void setProcessState(Integer processState) {
187   - this.processState = processState;
188 192 }
189 193  
190 194  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITrackDownService.java View file @ 2972300
... ... @@ -17,7 +17,7 @@
17 17 BaseObjectResponse list(String provinceId, String cityId, String areaId, String streetId, String key, Integer trackType, Integer page, Integer limit, Integer userId);
18 18  
19 19 BaseObjectResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart,
20   - Date fmEnd, String key, Integer page, Integer limit, Integer userId, Integer type, Integer check, String checkup, String pregnantBuild, Integer followupStatus, boolean isDeliver);
  20 + Date fmEnd, String key, Integer page, Integer limit, Integer userId, Integer type, Integer check, String checkup, String pregnantBuild, Integer followupStatus, Boolean isDeliver);
21 21  
22 22 BaseObjectResponse info(String patientId, Integer trackType, Integer buildType);
23 23  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java View file @ 2972300
... ... @@ -72,7 +72,7 @@
72 72 */
73 73 @Override
74 74 public BaseObjectResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key,
75   - Integer page, Integer limit, Integer userId, Integer type, Integer check, String checkup, String pregnantBuild, Integer followupStatus, boolean isDeliver) {
  75 + Integer page, Integer limit, Integer userId, Integer type, Integer check, String checkup, String pregnantBuild, Integer followupStatus, Boolean isDeliver) {
76 76 String hospitalId = autoMatchFacade.getHospitalId(userId);
77 77 List<Map<String, Object>> restList = new ArrayList<>();
78 78 Integer archiveModelCount = 0;