Commit 690973e186f44fc5ceb9f226eb7e01fe5dd30f87

Authored by liquanyu
1 parent 9df6ad9719

肌萎缩

Showing 2 changed files with 32 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SmnController.java View file @ 690973e
... ... @@ -23,6 +23,20 @@
23 23 @Autowired
24 24 private SmnFacade smnFacade;
25 25  
  26 +
  27 + /**
  28 + * 是否存在申请记录
  29 + * @param param
  30 + * @param request
  31 + * @return
  32 + */
  33 + @RequestMapping(method = RequestMethod.POST, value = "/existSmnApply")
  34 + @ResponseBody
  35 + @TokenRequired
  36 + public BaseResponse existSmnApply(@RequestBody SmnRequest param, HttpServletRequest request) {
  37 + return smnFacade.existSmnApply(param, getUserId(request));
  38 + }
  39 +
26 40 /**
27 41 * 保存单个
28 42 *
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmnFacade.java View file @ 690973e
... ... @@ -53,6 +53,23 @@
53 53 @Autowired
54 54 private UsersService usersService;
55 55  
  56 +
  57 + public BaseResponse existSmnApply(SmnRequest param, Integer userId) {
  58 + BaseResponse baseResponse = new BaseResponse();
  59 + Patients patients = patientsService.findOnePatientById(param.getPatientId());
  60 + Query query = Query.query(Criteria.where("cardNo").is(patients.getCardNo()).and("status").in(Arrays.asList(2,3)));
  61 + List<SmnModel> smnModels = mongoTemplate.find(query, SmnModel.class);
  62 + if (CollectionUtils.isNotEmpty(smnModels))
  63 + {
  64 + baseResponse.setErrormsg("已经存在申请记录");
  65 + baseResponse.setErrorcode(1);
  66 + return baseResponse;
  67 + }
  68 + baseResponse.setErrormsg("无记录");
  69 + baseResponse.setErrorcode(0);
  70 + return baseResponse;
  71 + }
  72 +
56 73 public BaseResponse addSmn(SmnRequest param, Integer userId) {
57 74 String hospitalId = autoMatchFacade.getHospitalId(userId);
58 75  
... ... @@ -705,5 +722,6 @@
705 722 mongoTemplate.save(smnModel);
706 723 return new BaseResponse();
707 724 }
  725 +
708 726 }