Commit 05f4c066fdec17c043a89b92982b69e725c61ca1

Authored by jiangjiazhi
1 parent b49f358e88

增加是否通知

Showing 3 changed files with 104 additions and 4 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java View file @ 05f4c06
... ... @@ -12,10 +12,7 @@
12 12 import com.lyms.platform.operate.web.facade.BasicConfigFacade;
13 13 import com.lyms.platform.operate.web.facade.PatientFacade;
14 14 import com.lyms.platform.operate.web.facade.PuerperaManagerFacade;
15   -import com.lyms.platform.operate.web.request.PatientQueryRequest;
16   -import com.lyms.platform.operate.web.request.PuerperaManagerQueryRequest;
17   -import com.lyms.platform.operate.web.request.PuerperaMatcherCommunityRequest;
18   -import com.lyms.platform.operate.web.request.RiskPatientsQueryRequest;
  15 +import com.lyms.platform.operate.web.request.*;
19 16 import org.springframework.beans.factory.annotation.Autowired;
20 17 import org.springframework.stereotype.Controller;
21 18 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -146,6 +143,16 @@
146 143 @ResponseBody
147 144 public BaseResponse getPatent(@Valid PatientQueryRequest request){
148 145 return patientFacade.findPatient(request);
  146 + }
  147 + /**
  148 + * 发送孕妇指导短信
  149 + *
  150 + * @return 返回结果
  151 + */
  152 + @RequestMapping(value = "/sendPGuildSms", method = RequestMethod.GET)
  153 + @ResponseBody
  154 + public BaseResponse patientGuildSms(@Valid PatientGuideSmsRequest patientGuideSmsRequest){
  155 + return patientFacade.patientGuildSms(patientGuideSmsRequest);
149 156 }
150 157 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 05f4c06
... ... @@ -2,6 +2,8 @@
2 2  
3 3 import com.lyms.platform.biz.service.*;
4 4 import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.enums.ServiceObjEnums;
  6 +import com.lyms.platform.common.enums.SmsServiceEnums;
5 7 import com.lyms.platform.common.enums.YnEnums;
6 8 import com.lyms.platform.common.result.BaseListResponse;
7 9 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -322,6 +324,50 @@
322 324 data.add(riskPatientsResult);
323 325 }
324 326 return data;
  327 + }
  328 +
  329 + public BaseResponse patientGuildSms(PatientGuideSmsRequest patientGuideSmsRequest){
  330 + MessageListRequest smsList = new MessageListRequest();
  331 + List<MessageRequest> messages = new ArrayList<>();
  332 + List<Patients> sendModels = new ArrayList<>();
  333 + if (CollectionUtils.isNotEmpty(patientGuideSmsRequest.getIds()))
  334 + {
  335 + for(String patientId:patientGuideSmsRequest.getIds()){
  336 + Patients patients= patientsService.findOnePatientById(patientId);
  337 + if(null!=patients){
  338 + sendModels.add(patients);
  339 + }
  340 + }
  341 + if (CollectionUtils.isNotEmpty(sendModels))
  342 + {
  343 + for (Patients model : sendModels)
  344 + {
  345 + if (model != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(model.getPhone()))
  346 + {
  347 + MessageRequest mr = new MessageRequest();
  348 + mr.setContent(patientGuideSmsRequest.getSmsContent());
  349 + mr.setObjType(Integer.valueOf(patientGuideSmsRequest.getType()));
  350 + mr.setPhone(model.getPhone());
  351 + //短信商
  352 + mr.setServiceType(1);//待定
  353 + mr.setTypeId(1); //待定
  354 + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  355 + mr.setSubTypeId(SmsServiceEnums.YSGXHZD.getId());
  356 +
  357 + mr.setExt1(String.valueOf(model.getHospitalId()));
  358 + messages.add(mr);
  359 + }
  360 + }
  361 + }
  362 +
  363 + if (CollectionUtils.isNotEmpty(messages))
  364 + {
  365 + smsList.setTypeId(1);
  366 + smsList.setMessages(messages);
  367 + //调用发送接口 TODO
  368 + }
  369 + }
  370 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
325 371 }
326 372 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PatientGuideSmsRequest.java View file @ 05f4c06
  1 +package com.lyms.platform.operate.web.request;
  2 +
  3 +import com.lyms.platform.common.core.annotation.form.FormParam;
  4 +import org.hibernate.validator.constraints.NotEmpty;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 产妇个性指导短信
  10 + *
  11 + * Created by Administrator on 2016/7/12 0012.
  12 + */
  13 +public class PatientGuideSmsRequest {
  14 + //短信内容
  15 + @FormParam
  16 + @NotEmpty(message = "短信内容不能为空")
  17 + private String smsContent;
  18 +
  19 + //儿童IDs
  20 + private List<String> ids;
  21 + //1 孕妇 3产妇
  22 + private String type;
  23 +
  24 + public String getType() {
  25 + return type;
  26 + }
  27 +
  28 + public void setType(String type) {
  29 + this.type = type;
  30 + }
  31 +
  32 + public List<String> getIds() {
  33 + return ids;
  34 + }
  35 +
  36 + public void setIds(List<String> ids) {
  37 + this.ids = ids;
  38 + }
  39 +
  40 + public String getSmsContent() {
  41 + return smsContent;
  42 + }
  43 +
  44 + public void setSmsContent(String smsContent) {
  45 + this.smsContent = smsContent;
  46 + }
  47 +}