Commit 856c2aad18b4dfb7cba64c0b4402d2d08270e931

Authored by jiangjiazhi
1 parent 32c071c424

增加退出登录接口

Showing 2 changed files with 43 additions and 9 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 856c2aa
... ... @@ -50,23 +50,43 @@
50 50 * @return
51 51 */
52 52 public BaseResponse matchCommunity(PuerperaMatcherCommunityRequest puerperaMatcherCommunityRequest) {
53   - Patients puerperaModel = patientsService.findOnePatientById(puerperaMatcherCommunityRequest.getParentId());
54 53  
55   - Assert.notNull(puerperaModel, "产妇信息不存在");
  54 + if(0==puerperaMatcherCommunityRequest.getT()){
  55 + Patients puerperaModel = patientsService.findOnePatientById(puerperaMatcherCommunityRequest.getParentId());
56 56  
57   - puerperaModel.setCommunityId(puerperaMatcherCommunityRequest.getCommunityId());
58   - patientsService.updatePatient(puerperaModel);
  57 + Assert.notNull(puerperaModel, "产妇信息不存在");
59 58  
  59 + puerperaModel.setCommunityId(puerperaMatcherCommunityRequest.getCommunityId());
  60 + patientsService.updatePatient(puerperaModel);
  61 + //修改新生儿的社区信息
  62 + updateBabyCommunity(puerperaModel.getId(),puerperaModel.getPhone(),puerperaMatcherCommunityRequest.getCommunityId(),Boolean.FALSE);
  63 +
  64 + }else{
  65 + updateBabyCommunity(puerperaMatcherCommunityRequest.getParentId(), null, puerperaMatcherCommunityRequest.getCommunityId(), Boolean.TRUE);
  66 + }
  67 +
  68 + //TODO 产妇分配了社区,需要给对应的社区提示消息
  69 + return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
  70 + }
  71 +
  72 + /**
  73 + * 修改新生儿的社区信息
  74 + */
  75 + private void updateBabyCommunity(String parentId,String phone,String communityId,boolean isBaby){
60 76 BabyModelQuery babyModelQuery = new BabyModelQuery();
61   - babyModelQuery.setParentId(puerperaModel.getId());
62 77 babyModelQuery.setYn(YnEnums.YES.getId());
  78 + if(isBaby){
  79 + babyModelQuery.setId(parentId);
  80 + }else{
  81 + babyModelQuery.setParentId(parentId);
  82 + }
63 83  
64 84 BabyModel babyModel = new BabyModel();
65   - babyModel.setCommunityId(puerperaMatcherCommunityRequest.getCommunityId());
66   - babyModel.setMphone(puerperaModel.getPhone());
  85 + babyModel.setCommunityId(communityId);
  86 + if(StringUtils.isNotEmpty(phone)){
  87 + babyModel.setMphone(phone);
  88 + }
67 89 babyService.findAndModify(babyModelQuery.convertToQuery(),babyModel);
68   - //TODO 产妇分配了社区,需要给对应的社区提示消息
69   - return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
70 90 }
71 91  
72 92 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PuerperaMatcherCommunityRequest.java View file @ 856c2aa
... ... @@ -18,6 +18,12 @@
18 18 @NotEmpty(message = "communityId不能为空")
19 19 private String communityId;
20 20  
  21 + /**
  22 + * t表示type 0 为产妇 1为新生儿
  23 + */
  24 + @FormParam
  25 + private int t=0;
  26 +
21 27 public String getCommunityId() {
22 28 return communityId;
23 29 }
... ... @@ -32,6 +38,14 @@
32 38  
33 39 public void setParentId(String parentId) {
34 40 this.parentId = parentId;
  41 + }
  42 +
  43 + public int getT() {
  44 + return t;
  45 + }
  46 +
  47 + public void setT(int t) {
  48 + this.t = t;
35 49 }
36 50 }