Commit 345a0f1941c18a71b5f0219b7979ec6a97b59ab9
1 parent
5adba5d09e
Exists in
master
and in
1 other branch
update code
Showing 4 changed files with 107 additions and 3 deletions
- platform-dal/src/main/java/com/lyms/platform/query/SmsTemplateQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
platform-dal/src/main/java/com/lyms/platform/query/SmsTemplateQuery.java
View file @
345a0f1
| ... | ... | @@ -92,6 +92,12 @@ |
| 92 | 92 | condition = condition.and("serviceObj", serviceObj, MongoOper.IS); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | + | |
| 96 | + if (null != specialDateType) { | |
| 97 | + condition = condition.and("specialDateType", specialDateType, MongoOper.IS); | |
| 98 | + } | |
| 99 | + | |
| 100 | + | |
| 95 | 101 | if (null != status) { |
| 96 | 102 | condition = condition.and("status", status, MongoOper.IS); |
| 97 | 103 | } |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
345a0f1
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
345a0f1
| ... | ... | @@ -51,11 +51,15 @@ |
| 51 | 51 | |
| 52 | 52 | @Autowired |
| 53 | 53 | private AntenatalExaminationFacade antenatalExaminationFacade; |
| 54 | + | |
| 54 | 55 | @Autowired |
| 55 | 56 | private BabyCheckFacade babyCheckFacade; |
| 57 | + | |
| 56 | 58 | @Autowired |
| 57 | 59 | private PersonService personService; |
| 58 | 60 | |
| 61 | + @Autowired | |
| 62 | + private SmsTemplateService smsTemplateService; | |
| 59 | 63 | |
| 60 | 64 | public BaseResponse getBabyBase(String babyId){ |
| 61 | 65 | //查询儿童的基本信息 |
| 62 | 66 | |
| ... | ... | @@ -234,11 +238,56 @@ |
| 234 | 238 | br.setErrormsg("失败"); |
| 235 | 239 | |
| 236 | 240 | } |
| 241 | + //创建建档短信 | |
| 242 | + createBuildSms(model); | |
| 243 | + | |
| 237 | 244 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 238 | 245 | br.setErrormsg("成功"); |
| 239 | 246 | br.setData(model.getId()); |
| 240 | 247 | |
| 241 | 248 | return br; |
| 249 | + } | |
| 250 | + | |
| 251 | + | |
| 252 | + /** | |
| 253 | + * 创建建档短信 | |
| 254 | + */ | |
| 255 | + private void createBuildSms(BabyModel babyModel) | |
| 256 | + { | |
| 257 | + | |
| 258 | + SmsTemplateQuery query = new SmsTemplateQuery(); | |
| 259 | + query.setYn(YnEnums.YES.getId()); | |
| 260 | + query.setHospitalId(babyModel.getHospitalId()); | |
| 261 | + query.setServiceObj(ServiceObjEnums.BABYOBJ.getId()); | |
| 262 | + query.setSpecialDateType(SpecialDateEnums.JD.getId()); | |
| 263 | + | |
| 264 | + List<SmsTemplateModel> temps = smsTemplateService.querySmsTemplates(query); | |
| 265 | + if (CollectionUtils.isNotEmpty(temps)) | |
| 266 | + { | |
| 267 | + SmsTemplateModel templateModel = temps.get(0); | |
| 268 | + MessageListRequest smsList = new MessageListRequest(); | |
| 269 | + List<MessageRequest> messages = new ArrayList<>(); | |
| 270 | + MessageRequest mr = new MessageRequest(); | |
| 271 | + mr.setContent(templateModel.getContent()); | |
| 272 | + mr.setObjType(ServiceObjEnums.BABYOBJ.getId()); | |
| 273 | + mr.setPhone(babyModel.getMphone()); | |
| 274 | + //短信商 | |
| 275 | + mr.setServiceType(1);//待定 | |
| 276 | + mr.setTypeId(1); //待定 | |
| 277 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 278 | + mr.setSubTypeId(SmsServiceEnums.YSGXHZD.getId()); | |
| 279 | + | |
| 280 | + mr.setExt1(babyModel.getHospitalId()); | |
| 281 | + mr.setExt2(templateModel.getId()); | |
| 282 | + mr.setExt3(babyModel.getId()); | |
| 283 | + messages.add(mr); | |
| 284 | + | |
| 285 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 286 | + smsList.setTypeId(1); | |
| 287 | + smsList.setMessages(messages); | |
| 288 | + //调用发送接口 TODO | |
| 289 | + } | |
| 290 | + } | |
| 242 | 291 | } |
| 243 | 292 | |
| 244 | 293 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
345a0f1
| ... | ... | @@ -3,12 +3,15 @@ |
| 3 | 3 | import com.lyms.platform.biz.dal.IPersonDao; |
| 4 | 4 | import com.lyms.platform.biz.service.BasicConfigService; |
| 5 | 5 | import com.lyms.platform.biz.service.PersonService; |
| 6 | +import com.lyms.platform.biz.service.SmsTemplateService; | |
| 6 | 7 | import com.lyms.platform.common.enums.*; |
| 7 | 8 | import com.lyms.platform.common.result.BaseListResponse; |
| 8 | 9 | import com.lyms.platform.common.utils.JsonUtil; |
| 9 | 10 | import com.lyms.platform.common.utils.StringUtils; |
| 10 | 11 | import com.lyms.platform.common.utils.SystemConfig; |
| 11 | 12 | import com.lyms.platform.operate.web.request.BookbuildingQueryRequest; |
| 13 | +import com.lyms.platform.operate.web.request.MessageListRequest; | |
| 14 | +import com.lyms.platform.operate.web.request.MessageRequest; | |
| 12 | 15 | import com.lyms.platform.operate.web.result.BasicConfigResult; |
| 13 | 16 | import com.lyms.platform.operate.web.result.BookbuildingRecordResult; |
| 14 | 17 | import com.lyms.platform.operate.web.result.PregnantInfoResult; |
| 15 | 18 | |
| ... | ... | @@ -16,8 +19,10 @@ |
| 16 | 19 | import com.lyms.platform.permission.service.OrganizationService; |
| 17 | 20 | import com.lyms.platform.pojo.BasicConfig; |
| 18 | 21 | import com.lyms.platform.pojo.PersonModel; |
| 22 | +import com.lyms.platform.pojo.SmsTemplateModel; | |
| 19 | 23 | import com.lyms.platform.query.BasicConfigQuery; |
| 20 | 24 | import com.lyms.platform.query.PatientsQuery; |
| 25 | +import com.lyms.platform.query.SmsTemplateQuery; | |
| 21 | 26 | import org.apache.commons.collections.CollectionUtils; |
| 22 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | 28 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -50,6 +55,9 @@ |
| 50 | 55 | @Autowired |
| 51 | 56 | private PersonService personService; |
| 52 | 57 | |
| 58 | + @Autowired | |
| 59 | + private SmsTemplateService smsTemplateService; | |
| 60 | + | |
| 53 | 61 | /** |
| 54 | 62 | * 添加孕妇建档 |
| 55 | 63 | * @param yunRequest |
| 56 | 64 | |
| ... | ... | @@ -108,11 +116,55 @@ |
| 108 | 116 | return br; |
| 109 | 117 | |
| 110 | 118 | } |
| 119 | + | |
| 120 | + //生成建档短信 | |
| 121 | + createBuildSms(p); | |
| 111 | 122 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 112 | 123 | br.setErrormsg("成功"); |
| 113 | 124 | br.setData(p.getId()); |
| 114 | 125 | return br; |
| 115 | 126 | |
| 127 | + } | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * 创建建档短信 | |
| 131 | + */ | |
| 132 | + private void createBuildSms(Patients patient) | |
| 133 | + { | |
| 134 | + | |
| 135 | + SmsTemplateQuery query = new SmsTemplateQuery(); | |
| 136 | + query.setYn(YnEnums.YES.getId()); | |
| 137 | + query.setHospitalId(patient.getHospitalId()); | |
| 138 | + query.setServiceObj(ServiceObjEnums.YUNOBJ.getId()); | |
| 139 | + query.setSpecialDateType(SpecialDateEnums.JD.getId()); | |
| 140 | + | |
| 141 | + List<SmsTemplateModel> temps = smsTemplateService.querySmsTemplates(query); | |
| 142 | + if (CollectionUtils.isNotEmpty(temps)) | |
| 143 | + { | |
| 144 | + SmsTemplateModel templateModel = temps.get(0); | |
| 145 | + MessageListRequest smsList = new MessageListRequest(); | |
| 146 | + List<MessageRequest> messages = new ArrayList<>(); | |
| 147 | + MessageRequest mr = new MessageRequest(); | |
| 148 | + mr.setContent(templateModel.getContent()); | |
| 149 | + mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 150 | + mr.setPhone(patient.getPhone()); | |
| 151 | + //短信商 | |
| 152 | + mr.setServiceType(1);//待定 | |
| 153 | + mr.setTypeId(1); //待定 | |
| 154 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 155 | + mr.setSubTypeId(SmsServiceEnums.YSGXHZD.getId()); | |
| 156 | + | |
| 157 | + mr.setExt1(patient.getHospitalId()); | |
| 158 | + mr.setExt2(templateModel.getId()); | |
| 159 | + mr.setExt3(patient.getId()); | |
| 160 | + messages.add(mr); | |
| 161 | + | |
| 162 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 163 | + smsList.setTypeId(1); | |
| 164 | + smsList.setMessages(messages); | |
| 165 | + //调用发送接口 TODO | |
| 166 | + } | |
| 167 | + } | |
| 116 | 168 | } |
| 117 | 169 | |
| 118 | 170 | /** |