Commit 2cc081bb9a44d6830109163863a36b0f343c99fa

Authored by jiangjiazhi
1 parent 0a9d234138

1

Showing 2 changed files with 81 additions and 29 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java View file @ 2cc081b
... ... @@ -28,9 +28,10 @@
28 28  
29 29 @ResponseBody
30 30 @TokenRequired
31   - @RequestMapping(value = "/mother/{parentId}", method = RequestMethod.GET)
32   - public BaseResponse mother(@PathVariable String parentId, HttpServletRequest request) {
33   - return trackDownService.mother(parentId, getUserId(request));
  31 + @RequestMapping(value = "/mother/{parentId}/{trackType}", method = RequestMethod.GET)
  32 + public BaseResponse mother(@PathVariable String parentId, HttpServletRequest request, @PathVariable Integer trackType) {
  33 +// return trackDownService.mother(parentId, getUserId(request));
  34 + return downFacade.mother(parentId,trackType,getUserId(request));
34 35 }
35 36  
36 37 @ResponseBody
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java View file @ 2cc081b
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3   -import com.lyms.platform.biz.service.BasicConfigService;
4   -import com.lyms.platform.biz.service.TrackDownRecordService;
5   -import com.lyms.platform.biz.service.TrackDownService;
  3 +import com.lyms.platform.biz.service.*;
6 4 import com.lyms.platform.common.constants.ErrorCodeConstants;
7 5 import com.lyms.platform.common.enums.TrackDownDateEnums;
8 6 import com.lyms.platform.common.enums.TrackDownTransferEnums;
... ... @@ -14,8 +12,7 @@
14 12 import com.lyms.platform.common.utils.StringUtils;
15 13 import com.lyms.platform.operate.web.request.TrackDownQueryRequest;
16 14 import com.lyms.platform.operate.web.utils.CommonsHelper;
17   -import com.lyms.platform.pojo.TrackDown;
18   -import com.lyms.platform.pojo.TrackDownRecord;
  15 +import com.lyms.platform.pojo.*;
19 16 import com.lyms.platform.query.TrackDownRecordQuery;
20 17 import org.apache.commons.collections.CollectionUtils;
21 18 import org.slf4j.Logger;
... ... @@ -65,6 +62,14 @@
65 62 @Autowired
66 63 private AutoMatchFacade autoMatchFacade;
67 64  
  65 + /**
  66 + * 妇女建档
  67 + */
  68 + @Autowired
  69 + private ResidentsArchiveService residentsArchiveService;
  70 + @Autowired
  71 + private PatientsService patientsService;
  72 +
68 73 @PostConstruct
69 74 private void init() {
70 75 trackDownTypeHandlerMap = new HashMap<>();
... ... @@ -93,6 +98,58 @@
93 98 return downRecordQuery;
94 99 }
95 100  
  101 + /**
  102 + * 追访基本信息
  103 + *
  104 + * @param parentId
  105 + * @param trackType 业务类型
  106 + * @return
  107 + */
  108 + public BaseObjectResponse mother(String parentId,Integer trackType,Integer userId){
  109 + String hospitalId= autoMatchFacade.getHospitalId(userId);
  110 + Map<String, Object> map = new HashMap<>();
  111 + if(TrackDownDateEnums.C.getId()>trackType){
  112 + ResidentsArchiveModel resid = residentsArchiveService.getResident(parentId);
  113 + map.put("username", resid.getUsername());
  114 + map.put("phone", resid.getPhone());
  115 + map.put("cardNo", resid.getCertificateNum());
  116 + map.put("age", DateUtil.getAge(resid.getBirthday()));
  117 + }else{
  118 + Patients patients =patientsService.findOnePatientById(parentId);
  119 + map.put("username", patients.getUsername());
  120 + map.put("phone", patients.getPhone());
  121 + map.put("cardNo", patients.getCardNo());
  122 + map.put("age", DateUtil.getAge(patients.getBirth()));
  123 + map.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), new Date()));
  124 + map.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); /** 预产期 */
  125 + map.put("trackCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.F.getId()).and("yn").is(1)), TrackDown.class)); /** 访视次数 */
  126 + map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate()));
  127 + }
  128 +
  129 + TrackDown tc = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.E.getId()).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
  130 + if (tc != null) {
  131 + map.put("reservatDate", DateUtil.getyyyy_MM_dd(tc.getReservatDate())); /** 预约住院日期 */
  132 + }
  133 + map.put("fcCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.G.getId()).and("yn").is(1)), TrackDown.class)); /** 复查次数 */
  134 + map.put("checkCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("hospitalId").is(hospitalId)), AntenatalExaminationModel.class) +
  135 + mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId)), AntExChuModel.class)); /** 本院产检次数 */
  136 + AntenatalExaminationModel examinationModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId)).with(new Sort(Sort.Direction.DESC, "created")), AntenatalExaminationModel.class);
  137 + if (examinationModel != null) {
  138 + map.put("checkTime", DateUtil.getyyyy_MM_dd(examinationModel.getCheckDate())); /** 产检日期 */
  139 + map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(examinationModel.getNextCheckTime())); /** 预约产检日期 */
  140 + } else {
  141 + AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId)).with(new Sort(Sort.Direction.DESC, "created")), AntExChuModel.class);
  142 + if (antExChuModel != null) {
  143 + map.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); /** 产检日期 */
  144 + map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(antExChuModel.getNextCheckTime())); /** 预约产检日期 */
  145 + } else {
  146 + map.put("checkTime", "--"); /** 产检日期 */
  147 + map.put("nextCheckTime", "--"); /** 预约产检日期 */
  148 + }
  149 + }
  150 + return RespBuilder.buildSuccess(map);
  151 + }
  152 +
96 153 public BaseObjectResponse list(TrackDownQueryRequest downQueryRequest, Integer userId) {
97 154 //转换为本地的查询条件
98 155 TrackDownRecordQuery downRecordQuery = convertNaviteQuery(downQueryRequest, userId);
... ... @@ -112,7 +169,6 @@
112 169 pageResult.setLimit(downRecordQuery.getPageInfo().getLimit());
113 170 pageResult.setGrid(data);
114 171 return RespBuilder.buildSuccess(pageResult);
115   -// return new BaseListResponse().setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(downRecordQuery.getPageInfo());
116 172 }
117 173  
118 174 /**
119 175  
120 176  
121 177  
122 178  
... ... @@ -130,34 +186,29 @@
130 186 Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate);
131 187 }
132 188  
133   -
  189 + /**
  190 + * 怀孕建档返回的字段
  191 + */
134 192 class HYTrackDownTypeHandler implements TrackDownTypeHandler {
135 193  
136 194 @Override
137 195 public Map build(TrackDownRecord downRecord, MongoTemplate mongoTemplate) {
138 196 Map<String, Object> temp = new HashMap<>();
  197 + temp.put("id", downRecord.getId());
  198 + temp.put("pid", downRecord.getPid());
  199 + temp.put("parentId", downRecord.getParentId());
139 200 temp.put("username", downRecord.getUsername());
140   - temp.put("age", DateUtil.getAge(downRecord.getBirth()));
141   - temp.put("cardNo", StringUtils.encryCardNo(downRecord.getCardNo()));
142   - temp.put("residenceAddress",CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
  201 + temp.put("cardNo", downRecord.getCardNo());
  202 + temp.put("residenceAddress", CommonsHelper.getFullAddress(downRecord.getProvinceRegisterId(), downRecord.getCityRegisterId(), downRecord.getAreaRegisterId(), downRecord.getAddressRegister(), basicConfigService)); /** 居住地 */
143 203 temp.put("phone", StringUtils.encryPhone(downRecord.getPhone()));
144   - temp.put("id", downRecord.getId());
145   -// temp.put("dueDate", DateUtil.getyyyy_MM_dd(DateUtil.addDay(downRecord.getLastMenses(),281)));
146   -// temp.put("week", DateUtil.getWeekDesc(downRecord.getLastMenses(), new Date())); /** 孕周 */
147   - temp.put("cjDate", ""); /** 产检日期 */
148   - temp.put("yycjDate", ""); /** 预约产检日期 */
149   - temp.put("cjzfDate", ""); /** 产检追访时间 */
150 204 TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(downRecord.getParentId()).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
151   - if (trackDown != null) {
152   - temp.put("result", StringUtils.isEmpty(trackDown.getResult()) ? "--" : trackDown.getResult()); // 婚检追访结果
153   -// temp.put("result", getResultByType(trackType, patient.getId(), new Sort(Sort.Direction.DESC, "created"))); // 婚检追访结果
154   - temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate())); // 追访时间
155   - temp.put("yyTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate())); // 预约时间
156   - } else {
157   - temp.put("result", "--"); // 婚检追访结果
158   - temp.put("trackDownTime", "--"); // 追访时间
159   - temp.put("yyTime", "--"); // 预约时间
160   - }
  205 + temp.put("age", DateUtil.getAge(downRecord.getBirth()));
  206 + // 婚检追访结果
  207 + temp.put("result", trackDown == null ? "--" : TrackDownTransferEnums.getName(trackDown.getTrackDownType()));
  208 + // 婚检追访时间
  209 + temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate()));
  210 + // 预约时间
  211 + temp.put("yyTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate()));
161 212 return temp;
162 213 }
163 214 }