Commit dd45a35798d6048f11a1b6057b85f20f6fd95ace

Authored by litao@lymsh.com
1 parent 5e09b11378

追访相关

Showing 3 changed files with 42 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java View file @ dd45a35
... ... @@ -23,6 +23,12 @@
23 23 private ITrackDownService trackDownService;
24 24  
25 25 @ResponseBody
  26 + @RequestMapping(value = "/mother/{parentId}", method = RequestMethod.GET)
  27 + public BaseResponse mother(@PathVariable String parentId, HttpServletRequest request) {
  28 + return trackDownService.mother(parentId, getUserId(request));
  29 + }
  30 +
  31 + @ResponseBody
26 32 @RequestMapping(value = "/init", method = RequestMethod.GET)
27 33 public BaseResponse init() {
28 34 return trackDownService.init();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITrackDownService.java View file @ dd45a35
... ... @@ -17,5 +17,6 @@
17 17  
18 18 BaseResponse init();
19 19  
  20 + BaseResponse mother(String parentId, Integer userId);
20 21 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java View file @ dd45a35
... ... @@ -371,6 +371,41 @@
371 371 return RespBuilder.buildSuccess("trackTypes", trackTypes, "dataTypes", dataTypes, "transfers", transfers);
372 372 }
373 373  
  374 + @Override
  375 + public BaseResponse mother(String parentId, Integer userId) {
  376 + Patients patients = mongoTemplate.findById(parentId, Patients.class);
  377 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  378 + Map<String, Object> map = new HashMap<>();
  379 + if(patients != null) {
  380 + map.put("username", patients.getUsername());
  381 + map.put("phone", patients.getPhone());
  382 + map.put("cardNo", patients.getCardNo());
  383 + map.put("age", DateUtil.getAge(patients.getBirth()));
  384 + map.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), new Date()));
  385 + map.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate())); /** 预产期 */
  386 + map.put("trackCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.F.getId()).and("yn").is(1)), TrackDown.class)); /** 访视次数 */
  387 + map.put("fcCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("trackDownDateType").is(TrackDownDateEnums.G.getId()).and("yn").is(1)), TrackDown.class)); /** 复查次数 */
  388 + map.put("checkCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId).and("hospitalId").is(hospitalId)), AntenatalExaminationModel.class) +
  389 + mongoTemplate.count(Query.query(Criteria.where("parentId").is(parentId)), AntExChuModel.class)); /** 本院产检次数 */
  390 + AntenatalExaminationModel examinationModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId)).with(new Sort(Sort.Direction.DESC, "created")), AntenatalExaminationModel.class);
  391 + if(examinationModel != null) {
  392 + map.put("checkTime", DateUtil.getyyyy_MM_dd(examinationModel.getCheckDate())); /** 产检日期 */
  393 + map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(examinationModel.getNextCheckTime())); /** 预约产检日期 */
  394 + } else {
  395 + AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId)).with(new Sort(Sort.Direction.DESC, "created")), AntExChuModel.class);
  396 + if(antExChuModel != null) {
  397 + map.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); /** 产检日期 */
  398 + map.put("nextCheckTime", DateUtil.getyyyy_MM_dd(antExChuModel.getNextCheckTime())); /** 预约产检日期 */
  399 + } else {
  400 + map.put("checkTime", "--"); /** 产检日期 */
  401 + map.put("nextCheckTime", "--"); /** 预约产检日期 */
  402 + }
  403 + }
  404 +
  405 + }
  406 + return RespBuilder.buildSuccess(map);
  407 + }
  408 +
374 409  
375 410 }