Commit 64a48804f209d1b08176d08e9a134298424218ac
1 parent
6b03436d4f
Exists in
master
and in
6 other branches
产检过期提醒和儿童身高曲线图接口恢复
Showing 4 changed files with 439 additions and 484 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/SendTimeEnums.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
platform-common/src/main/java/com/lyms/platform/common/enums/SendTimeEnums.java
View file @
64a4880
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
64a4880
| ... | ... | @@ -509,6 +509,7 @@ |
| 509 | 509 | |
| 510 | 510 | private Date fmDateStart; |
| 511 | 511 | private Date fmDateEnd; |
| 512 | + private Date nextCheckTime; | |
| 512 | 513 | private Date nextCheckTimeStart; |
| 513 | 514 | private Date nextCheckTimeEnd; |
| 514 | 515 | |
| 515 | 516 | |
| ... | ... | @@ -555,8 +556,16 @@ |
| 555 | 556 | private String pcerteTypeId; |
| 556 | 557 | |
| 557 | 558 | |
| 558 | - private String blNum; | |
| 559 | + private String blNum; | |
| 559 | 560 | |
| 561 | + public Date getNextCheckTime() { | |
| 562 | + return nextCheckTime; | |
| 563 | + } | |
| 564 | + | |
| 565 | + public void setNextCheckTime(Date nextCheckTime) { | |
| 566 | + this.nextCheckTime = nextCheckTime; | |
| 567 | + } | |
| 568 | + | |
| 560 | 569 | public String getBlNum() { |
| 561 | 570 | return blNum; |
| 562 | 571 | } |
| ... | ... | @@ -1272,7 +1281,7 @@ |
| 1272 | 1281 | MongoCondition con3 = MongoCondition.newInstance("cardNo", pvc, MongoOper.IS); |
| 1273 | 1282 | MongoCondition con5 = MongoCondition.newInstance("vcCardNo", pvc, MongoOper.IS); |
| 1274 | 1283 | if (c1 != null) { |
| 1275 | - c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con3, con5}).getCriteria()); | |
| 1284 | + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con3, con5}).getCriteria()); | |
| 1276 | 1285 | } else { |
| 1277 | 1286 | c1 = c.orCondition(new MongoCondition[]{con1, con3, con5}).getCriteria(); |
| 1278 | 1287 | } |
| ... | ... | @@ -1351,9 +1360,7 @@ |
| 1351 | 1360 | } else { |
| 1352 | 1361 | c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd); |
| 1353 | 1362 | } |
| 1354 | - } | |
| 1355 | - else if (fmDateStart != null) | |
| 1356 | - { | |
| 1363 | + } else if (fmDateStart != null) { | |
| 1357 | 1364 | if (null != c1) { |
| 1358 | 1365 | c1 = c1.and("fmDate").gte(fmDateStart); |
| 1359 | 1366 | } else { |
| ... | ... | @@ -1406,7 +1413,7 @@ |
| 1406 | 1413 | condition = condition.and("riskFactorId", rFactorList, MongoOper.IN); |
| 1407 | 1414 | } |
| 1408 | 1415 | |
| 1409 | - if(isNullrFactor){ | |
| 1416 | + if (isNullrFactor) { | |
| 1410 | 1417 | condition = condition.and("riskFactorId", new ArrayList<String>(), MongoOper.IS); |
| 1411 | 1418 | } |
| 1412 | 1419 | |
| ... | ... | @@ -1492,6 +1499,7 @@ |
| 1492 | 1499 | } |
| 1493 | 1500 | } |
| 1494 | 1501 | |
| 1502 | + | |
| 1495 | 1503 | if (null != nextCheckTimeEnd) { |
| 1496 | 1504 | if (null != c1) { |
| 1497 | 1505 | c1 = c1.lte(nextCheckTimeEnd); |
| ... | ... | @@ -1645,6 +1653,10 @@ |
| 1645 | 1653 | } else { |
| 1646 | 1654 | c1 = Criteria.where("fmWeek").lte(fmWeekEnd); |
| 1647 | 1655 | } |
| 1656 | + } | |
| 1657 | + | |
| 1658 | + if (null != nextCheckTime) { | |
| 1659 | + condition = condition.and("nextCheckTime", nextCheckTime, MongoOper.NE); | |
| 1648 | 1660 | } |
| 1649 | 1661 | |
| 1650 | 1662 | if (StringUtils.isNotEmpty(fmHospital)) { |
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
64a4880
Diff suppressed. Click to show
| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | import com.lyms.platform.beans.MsgRequest; |
| 5 | 5 | import com.lyms.platform.biz.service.*; |
| 6 | 6 | import com.lyms.platform.common.enums.*; |
| 7 | -import com.lyms.platform.common.utils.DateUtil; | |
| 8 | 7 | import com.lyms.platform.common.utils.StringUtils; |
| 9 | 8 | import com.lyms.platform.msg.service.IBaseService; |
| 10 | 9 | import com.lyms.platform.msg.utils.DateUtils; |
| 11 | 10 | |
| ... | ... | @@ -14,11 +13,12 @@ |
| 14 | 13 | import com.lyms.platform.permission.service.BabyPatientExtendEarHearingDiagnoseService; |
| 15 | 14 | import com.lyms.platform.permission.service.BabyPatientExtendEarScreenService; |
| 16 | 15 | import com.lyms.platform.pojo.*; |
| 17 | -import com.lyms.platform.query.*; | |
| 16 | +import com.lyms.platform.query.BabyModelQuery; | |
| 17 | +import com.lyms.platform.query.PatientsQuery; | |
| 18 | +import com.lyms.platform.query.SmsTemplateQuery; | |
| 18 | 19 | import org.apache.commons.collections.CollectionUtils; |
| 19 | 20 | import org.slf4j.Logger; |
| 20 | 21 | import org.slf4j.LoggerFactory; |
| 21 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 22 | 22 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 23 | 23 | import org.springframework.data.mongodb.core.query.Criteria; |
| 24 | 24 | import org.springframework.data.mongodb.core.query.Query; |
| ... | ... | @@ -64,8 +64,7 @@ |
| 64 | 64 | MongoTemplate mongoTemplate, |
| 65 | 65 | BabyPatientExtendEarScreenService babyPatientExtendEarScreenService, |
| 66 | 66 | BabyPatientExtendEarHearingDiagnoseService hearingDiagnoseService, |
| 67 | - BabyPatientExtendEarFollowUpService babyPatientExtendEarFollowUpService) | |
| 68 | - { | |
| 67 | + BabyPatientExtendEarFollowUpService babyPatientExtendEarFollowUpService) { | |
| 69 | 68 | this.configs = configs; |
| 70 | 69 | this.baseService = baseService; |
| 71 | 70 | this.yunBookbuildingService = yunBookbuildingService; |
| 72 | 71 | |
| 73 | 72 | |
| 74 | 73 | |
| ... | ... | @@ -81,25 +80,22 @@ |
| 81 | 80 | @Override |
| 82 | 81 | public void run() { |
| 83 | 82 | |
| 84 | - if (CollectionUtils.isNotEmpty(configs)) | |
| 85 | - { | |
| 83 | + if (CollectionUtils.isNotEmpty(configs)) { | |
| 86 | 84 | //查询短信模板 |
| 87 | 85 | SmsTemplateQuery tempQuery = new SmsTemplateQuery(); |
| 88 | 86 | tempQuery.setYn(YnEnums.YES.getId()); |
| 89 | 87 | //启用状态 0未启用 1启用 |
| 90 | 88 | tempQuery.setStatus(1); |
| 91 | 89 | |
| 92 | - for(final SmsConfigModel config : configs) { | |
| 90 | + for (final SmsConfigModel config : configs) { | |
| 93 | 91 | String hospitalId = config.getHospitalId(); |
| 94 | - logger.info("genernate tempplate hospital id = "+hospitalId); | |
| 95 | - if (StringUtils.isEmpty(hospitalId)) | |
| 96 | - { | |
| 92 | + logger.info("genernate tempplate hospital id = " + hospitalId); | |
| 93 | + if (StringUtils.isEmpty(hospitalId)) { | |
| 97 | 94 | continue; |
| 98 | 95 | } |
| 99 | 96 | |
| 100 | 97 | //判断医院是否运行 |
| 101 | - if (!baseService.isRunning(hospitalId)) | |
| 102 | - { | |
| 98 | + if (!baseService.isRunning(hospitalId)) { | |
| 103 | 99 | continue; |
| 104 | 100 | } |
| 105 | 101 | |
| ... | ... | @@ -107,8 +103,7 @@ |
| 107 | 103 | tempQuery.setHospitalId(hospitalId); |
| 108 | 104 | List<SmsTemplateModel> templates = smsTemplateService.querySmsTemplates(tempQuery); |
| 109 | 105 | |
| 110 | - if (CollectionUtils.isEmpty(templates)) | |
| 111 | - { | |
| 106 | + if (CollectionUtils.isEmpty(templates)) { | |
| 112 | 107 | continue; |
| 113 | 108 | } |
| 114 | 109 | try { |
| 115 | 110 | |
| 116 | 111 | |
| ... | ... | @@ -120,19 +115,17 @@ |
| 120 | 115 | if (end > templates.size()) { |
| 121 | 116 | end = templates.size(); |
| 122 | 117 | } |
| 123 | - final List<SmsTemplateModel> items = templates.subList(i, end); | |
| 118 | + final List<SmsTemplateModel> items = templates.subList(i, end); | |
| 124 | 119 | pool.execute(new Runnable() { |
| 125 | 120 | @Override |
| 126 | 121 | public void run() { |
| 127 | 122 | |
| 128 | - if (CollectionUtils.isEmpty(items)) | |
| 129 | - { | |
| 123 | + if (CollectionUtils.isEmpty(items)) { | |
| 130 | 124 | return; |
| 131 | 125 | } |
| 132 | 126 | |
| 133 | 127 | //循环每一个模板,根据模板条件查询到用户 发送短信 |
| 134 | - for (SmsTemplateModel template : items) | |
| 135 | - { | |
| 128 | + for (SmsTemplateModel template : items) { | |
| 136 | 129 | try { |
| 137 | 130 | //模板属于的医院id |
| 138 | 131 | String tempHid = template.getHospitalId(); |
| 139 | 132 | |
| 140 | 133 | |
| 141 | 134 | |
| 142 | 135 | |
| ... | ... | @@ -154,32 +147,26 @@ |
| 154 | 147 | } |
| 155 | 148 | |
| 156 | 149 | //判断模板是否发送 |
| 157 | - boolean isSendTemplate = baseService.isSendTemplate(template.getTemplateType(),service); | |
| 158 | - if (!isSendTemplate) | |
| 159 | - { | |
| 150 | + boolean isSendTemplate = baseService.isSendTemplate(template.getTemplateType(), service); | |
| 151 | + if (!isSendTemplate) { | |
| 160 | 152 | continue; |
| 161 | 153 | } |
| 162 | 154 | |
| 163 | 155 | service = (template.getTemplateType() == null || template.getTemplateType() == 0) ? 1 : 3; |
| 164 | 156 | |
| 165 | 157 | //孕妇 |
| 166 | - if (serviceObj == ServiceObjEnums.YUNOBJ.getId()) | |
| 167 | - { | |
| 168 | - generateYunTempMsg(template,config,service); | |
| 158 | + if (serviceObj == ServiceObjEnums.YUNOBJ.getId()) { | |
| 159 | + generateYunTempMsg(template, config, service); | |
| 169 | 160 | } |
| 170 | 161 | //儿童 |
| 171 | - else if (serviceObj == ServiceObjEnums.BABYOBJ.getId()) | |
| 172 | - { | |
| 173 | - generateChildTempMsg(template, config,service); | |
| 162 | + else if (serviceObj == ServiceObjEnums.BABYOBJ.getId()) { | |
| 163 | + generateChildTempMsg(template, config, service); | |
| 174 | 164 | } |
| 175 | 165 | //产妇 |
| 176 | - else if (serviceObj == ServiceObjEnums.CHANOBJ.getId()) | |
| 177 | - { | |
| 178 | - generateChanTempMsg(template, config,service); | |
| 166 | + else if (serviceObj == ServiceObjEnums.CHANOBJ.getId()) { | |
| 167 | + generateChanTempMsg(template, config, service); | |
| 179 | 168 | } |
| 180 | - } | |
| 181 | - catch (Exception e) | |
| 182 | - { | |
| 169 | + } catch (Exception e) { | |
| 183 | 170 | logger.error("genernate templete error. [" + template.toString() + "]", e); |
| 184 | 171 | continue; |
| 185 | 172 | } |
| ... | ... | @@ -187,10 +174,8 @@ |
| 187 | 174 | } |
| 188 | 175 | }); |
| 189 | 176 | } |
| 190 | - } | |
| 191 | - catch (Exception e) | |
| 192 | - { | |
| 193 | - logger.error("genernate config error.["+config.toString()+"]",e); | |
| 177 | + } catch (Exception e) { | |
| 178 | + logger.error("genernate config error.[" + config.toString() + "]", e); | |
| 194 | 179 | continue; |
| 195 | 180 | } |
| 196 | 181 | } |
| 197 | 182 | |
| ... | ... | @@ -199,11 +184,11 @@ |
| 199 | 184 | |
| 200 | 185 | /** |
| 201 | 186 | * 生成儿童模板消息 |
| 187 | + * | |
| 202 | 188 | * @param template |
| 203 | 189 | * @param config |
| 204 | 190 | */ |
| 205 | - private void generateChildTempMsg(SmsTemplateModel template, SmsConfigModel config,Integer service) | |
| 206 | - { | |
| 191 | + private void generateChildTempMsg(SmsTemplateModel template, SmsConfigModel config, Integer service) { | |
| 207 | 192 | |
| 208 | 193 | //模板属于的医院id |
| 209 | 194 | String tempHid = template.getHospitalId(); |
| ... | ... | @@ -219,7 +204,7 @@ |
| 219 | 204 | Integer sendTimeType = template.getSendTimeType(); |
| 220 | 205 | |
| 221 | 206 | |
| 222 | - logger.info("generateChildTempMsg info : serviceType = "+serviceType +";templateId="+template.getId()+";smsType="+smsType); | |
| 207 | + logger.info("generateChildTempMsg info : serviceType = " + serviceType + ";templateId=" + template.getId() + ";smsType=" + smsType); | |
| 223 | 208 | |
| 224 | 209 | BabyModelQuery babyModelQuery = new BabyModelQuery(); |
| 225 | 210 | babyModelQuery.setYn(YnEnums.YES.getId()); |
| 226 | 211 | |
| 227 | 212 | |
| ... | ... | @@ -231,19 +216,16 @@ |
| 231 | 216 | babyModelQuery = HelperUtils.getServiceBabyQuery(serviceType, serviceStatus, babyModelQuery); |
| 232 | 217 | |
| 233 | 218 | //儿保预约提醒 |
| 234 | - if (smsType == SmsServiceEnums.EBYYTX.getId()) | |
| 235 | - { | |
| 219 | + if (smsType == SmsServiceEnums.EBYYTX.getId()) { | |
| 236 | 220 | //发送短信集合 |
| 237 | 221 | MsgListRequest list = new MsgListRequest(); |
| 238 | 222 | List<MsgRequest> messages = new ArrayList<>(); |
| 239 | 223 | |
| 240 | 224 | Date yuYueDate = DateUtils.addDay(new Date(), sendTimeType); |
| 241 | - yuYueDate = DateUtils.formatDate(yuYueDate,DateUtils.Y_M_D); | |
| 225 | + yuYueDate = DateUtils.formatDate(yuYueDate, DateUtils.Y_M_D); | |
| 242 | 226 | List<BabyCheckModel> checkModels = babyBookbuildingService.queryBabyYuYueRecord(yuYueDate, tempHid); |
| 243 | - if (CollectionUtils.isNotEmpty(checkModels)) | |
| 244 | - { | |
| 245 | - for(BabyCheckModel checkModel : checkModels) | |
| 246 | - { | |
| 227 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 228 | + for (BabyCheckModel checkModel : checkModels) { | |
| 247 | 229 | |
| 248 | 230 | BabyModelQuery query = new BabyModelQuery(); |
| 249 | 231 | query.setYn(YnEnums.YES.getId()); |
| 250 | 232 | |
| 251 | 233 | |
| 252 | 234 | |
| ... | ... | @@ -251,22 +233,20 @@ |
| 251 | 233 | |
| 252 | 234 | //查询符合条件儿童 |
| 253 | 235 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); |
| 254 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 255 | - { | |
| 256 | - for (BabyModel model : babyModels) | |
| 257 | - { | |
| 236 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 237 | + for (BabyModel model : babyModels) { | |
| 258 | 238 | //短信前缀 |
| 259 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 260 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 261 | - messageContent = HelperUtils.replaceEL(model.getName(), yuYueDate, messageContent); | |
| 239 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 240 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 241 | + messageContent = HelperUtils.replaceEL(model.getName(), yuYueDate, messageContent); | |
| 262 | 242 | |
| 263 | - String itemName = "儿童保健"; | |
| 264 | - String nextCheckTime = DateUtils.getDateStr(yuYueDate,DateUtils.Y_M_D); | |
| 243 | + String itemName = "儿童保健"; | |
| 244 | + String nextCheckTime = DateUtils.getDateStr(yuYueDate, DateUtils.Y_M_D); | |
| 265 | 245 | |
| 266 | 246 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 267 | 247 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 268 | 248 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 269 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 249 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 270 | 250 | |
| 271 | 251 | messages.add(request); |
| 272 | 252 | } |
| 273 | 253 | |
| 274 | 254 | |
| 275 | 255 | |
| ... | ... | @@ -278,26 +258,22 @@ |
| 278 | 258 | HelperUtils.sendMsg(list); |
| 279 | 259 | } |
| 280 | 260 | //儿保程序提醒 |
| 281 | - else if (smsType == SmsServiceEnums.EBCXTX.getId()) | |
| 282 | - { | |
| 261 | + else if (smsType == SmsServiceEnums.EBCXTX.getId()) { | |
| 283 | 262 | |
| 284 | 263 | //发送频次 |
| 285 | 264 | Integer sendFreq = template.getSendFrequency(); |
| 286 | 265 | |
| 287 | - if (sendFreq == SendFrequencyEnums.ONCE.getId()) | |
| 288 | - { | |
| 266 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) { | |
| 289 | 267 | |
| 290 | 268 | //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); |
| 291 | 269 | Integer sendDateType = template.getSendDateType(); |
| 292 | - if (sendDateType == SendDateEnums.SLRQ.getId()) | |
| 293 | - { | |
| 270 | + if (sendDateType == SendDateEnums.SLRQ.getId()) { | |
| 294 | 271 | |
| 295 | 272 | //时间类型 |
| 296 | 273 | Integer specialDateType = template.getSpecialDateType(); |
| 297 | 274 | |
| 298 | 275 | //儿童天数 |
| 299 | - if (specialDateType == SpecialDateEnums.ETTS.getId()) | |
| 300 | - { | |
| 276 | + if (specialDateType == SpecialDateEnums.ETTS.getId()) { | |
| 301 | 277 | |
| 302 | 278 | //发送短信集合 |
| 303 | 279 | MsgListRequest list = new MsgListRequest(); |
| 304 | 280 | |
| 305 | 281 | |
| 306 | 282 | |
| 307 | 283 | |
| 308 | 284 | |
| 309 | 285 | |
| 310 | 286 | |
| ... | ... | @@ -306,48 +282,42 @@ |
| 306 | 282 | Integer start = template.getStart(); |
| 307 | 283 | Integer end = template.getEnd(); |
| 308 | 284 | |
| 309 | - if (start != null && end != null) | |
| 310 | - { | |
| 311 | - Date startDate = DateUtils.getNewDate(new Date(),-end, "天", sendTimeType); | |
| 312 | - Date endDate = DateUtils.getNewDate(new Date(),-start,"天",sendTimeType); | |
| 285 | + if (start != null && end != null) { | |
| 286 | + Date startDate = DateUtils.getNewDate(new Date(), -end, "天", sendTimeType); | |
| 287 | + Date endDate = DateUtils.getNewDate(new Date(), -start, "天", sendTimeType); | |
| 313 | 288 | startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); |
| 314 | - endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 289 | + endDate = DateUtils.formatDate(endDate, DateUtils.Y_M_D); | |
| 315 | 290 | babyModelQuery.setBirthStart(startDate); |
| 316 | 291 | babyModelQuery.setBirthEnd(endDate); |
| 317 | 292 | |
| 318 | - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 319 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 320 | - { | |
| 321 | - for (BabyModel model : babyModels) | |
| 322 | - { | |
| 323 | - if (model.getBirth() == null) | |
| 324 | - { | |
| 293 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 294 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 295 | + for (BabyModel model : babyModels) { | |
| 296 | + if (model.getBirth() == null) { | |
| 325 | 297 | continue; |
| 326 | 298 | } |
| 327 | - if (HelperUtils.isExistMsg(model.getId(), template.getId())) | |
| 328 | - { | |
| 299 | + if (HelperUtils.isExistMsg(model.getId(), template.getId())) { | |
| 329 | 300 | continue; |
| 330 | 301 | } |
| 331 | 302 | |
| 332 | 303 | //如果有有效的预约短信就不发送 儿保检查提醒 |
| 333 | - if (queryBabyOrder(model.getBirth(), start, tempHid, sendTimeType, model.getId(), "天")) | |
| 334 | - { | |
| 304 | + if (queryBabyOrder(model.getBirth(), start, tempHid, sendTimeType, model.getId(), "天")) { | |
| 335 | 305 | continue; |
| 336 | 306 | } |
| 337 | 307 | |
| 338 | 308 | |
| 339 | 309 | //短信前缀 |
| 340 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 341 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 342 | - messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 310 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 311 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 312 | + messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 343 | 313 | |
| 344 | - String itemName = "儿童保健"; | |
| 345 | - String nextCheckTime = HelperUtils.getKeyword(start, end, "天"); | |
| 314 | + String itemName = "儿童保健"; | |
| 315 | + String nextCheckTime = HelperUtils.getKeyword(start, end, "天"); | |
| 346 | 316 | |
| 347 | 317 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 348 | 318 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 349 | 319 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 350 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 320 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 351 | 321 | |
| 352 | 322 | messages.add(request); |
| 353 | 323 | |
| ... | ... | @@ -359,8 +329,7 @@ |
| 359 | 329 | HelperUtils.sendMsg(list); |
| 360 | 330 | } |
| 361 | 331 | //儿童月龄 |
| 362 | - else if (specialDateType == SpecialDateEnums.ETYL.getId()) | |
| 363 | - { | |
| 332 | + else if (specialDateType == SpecialDateEnums.ETYL.getId()) { | |
| 364 | 333 | |
| 365 | 334 | //发送短信集合 |
| 366 | 335 | MsgListRequest list = new MsgListRequest(); |
| 367 | 336 | |
| 368 | 337 | |
| 369 | 338 | |
| 370 | 339 | |
| 371 | 340 | |
| 372 | 341 | |
| ... | ... | @@ -369,47 +338,41 @@ |
| 369 | 338 | Integer start = template.getStart(); |
| 370 | 339 | Integer end = template.getEnd(); |
| 371 | 340 | |
| 372 | - if (start != null && end != null) | |
| 373 | - { | |
| 374 | - Date startDate = DateUtils.getNewDate(new Date(),-end-1, "月", sendTimeType); | |
| 375 | - Date endDate = DateUtils.getNewDate(new Date(),-start,"月",sendTimeType); | |
| 341 | + if (start != null && end != null) { | |
| 342 | + Date startDate = DateUtils.getNewDate(new Date(), -end - 1, "月", sendTimeType); | |
| 343 | + Date endDate = DateUtils.getNewDate(new Date(), -start, "月", sendTimeType); | |
| 376 | 344 | startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); |
| 377 | - endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 345 | + endDate = DateUtils.formatDate(endDate, DateUtils.Y_M_D); | |
| 378 | 346 | babyModelQuery.setBirthStart(startDate); |
| 379 | 347 | babyModelQuery.setBirthEnd(endDate); |
| 380 | 348 | |
| 381 | - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 382 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 383 | - { | |
| 384 | - for (BabyModel model : babyModels) | |
| 385 | - { | |
| 386 | - if (model.getBirth() == null) | |
| 387 | - { | |
| 349 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 350 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 351 | + for (BabyModel model : babyModels) { | |
| 352 | + if (model.getBirth() == null) { | |
| 388 | 353 | continue; |
| 389 | 354 | } |
| 390 | 355 | |
| 391 | - if (HelperUtils.isExistMsg(model.getId(),template.getId())) | |
| 392 | - { | |
| 356 | + if (HelperUtils.isExistMsg(model.getId(), template.getId())) { | |
| 393 | 357 | continue; |
| 394 | 358 | } |
| 395 | 359 | |
| 396 | 360 | //如果有有效的预约短信就不发送 儿保检查提醒 |
| 397 | - if (queryBabyOrder(model.getBirth(), start, tempHid, sendTimeType, model.getId(), "月")) | |
| 398 | - { | |
| 361 | + if (queryBabyOrder(model.getBirth(), start, tempHid, sendTimeType, model.getId(), "月")) { | |
| 399 | 362 | continue; |
| 400 | 363 | } |
| 401 | 364 | |
| 402 | 365 | //短信前缀 |
| 403 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 404 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 405 | - messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 406 | - String itemName = "儿童保健"; | |
| 407 | - String nextCheckTime = HelperUtils.getKeyword(start, end, "月龄"); | |
| 366 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 367 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 368 | + messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 369 | + String itemName = "儿童保健"; | |
| 370 | + String nextCheckTime = HelperUtils.getKeyword(start, end, "月龄"); | |
| 408 | 371 | |
| 409 | 372 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 410 | 373 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 411 | 374 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 412 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 375 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 413 | 376 | messages.add(request); |
| 414 | 377 | |
| 415 | 378 | } |
| 416 | 379 | |
| 417 | 380 | |
| 418 | 381 | |
| ... | ... | @@ -423,25 +386,21 @@ |
| 423 | 386 | } |
| 424 | 387 | } |
| 425 | 388 | //疫苗接种提醒 |
| 426 | - else if (smsType == SmsServiceEnums.EBYMTX.getId()) | |
| 427 | - { | |
| 389 | + else if (smsType == SmsServiceEnums.EBYMTX.getId()) { | |
| 428 | 390 | //发送频次 |
| 429 | 391 | Integer sendFreq = template.getSendFrequency(); |
| 430 | 392 | |
| 431 | - if (sendFreq == SendFrequencyEnums.ONCE.getId()) | |
| 432 | - { | |
| 393 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) { | |
| 433 | 394 | |
| 434 | 395 | //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); |
| 435 | 396 | Integer sendDateType = template.getSendDateType(); |
| 436 | - if (sendDateType == SendDateEnums.SLRQ.getId()) | |
| 437 | - { | |
| 397 | + if (sendDateType == SendDateEnums.SLRQ.getId()) { | |
| 438 | 398 | |
| 439 | 399 | //时间类型 |
| 440 | 400 | Integer specialDateType = template.getSpecialDateType(); |
| 441 | 401 | |
| 442 | 402 | //儿童天数 |
| 443 | - if (specialDateType == SpecialDateEnums.ETTS.getId()) | |
| 444 | - { | |
| 403 | + if (specialDateType == SpecialDateEnums.ETTS.getId()) { | |
| 445 | 404 | |
| 446 | 405 | //发送短信集合 |
| 447 | 406 | MsgListRequest list = new MsgListRequest(); |
| 448 | 407 | |
| 449 | 408 | |
| 450 | 409 | |
| 451 | 410 | |
| 452 | 411 | |
| ... | ... | @@ -450,36 +409,31 @@ |
| 450 | 409 | Integer start = template.getStart(); |
| 451 | 410 | Integer end = template.getEnd(); |
| 452 | 411 | |
| 453 | - if (start != null && end != null) | |
| 454 | - { | |
| 455 | - Date startDate = DateUtils.getNewDate(new Date(),-end, "天", sendTimeType); | |
| 456 | - Date endDate = DateUtils.getNewDate(new Date(),-start,"天",sendTimeType); | |
| 412 | + if (start != null && end != null) { | |
| 413 | + Date startDate = DateUtils.getNewDate(new Date(), -end, "天", sendTimeType); | |
| 414 | + Date endDate = DateUtils.getNewDate(new Date(), -start, "天", sendTimeType); | |
| 457 | 415 | startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); |
| 458 | - endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 416 | + endDate = DateUtils.formatDate(endDate, DateUtils.Y_M_D); | |
| 459 | 417 | babyModelQuery.setBirthStart(startDate); |
| 460 | 418 | babyModelQuery.setBirthEnd(endDate); |
| 461 | 419 | |
| 462 | - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 463 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 464 | - { | |
| 465 | - for (BabyModel model : babyModels) | |
| 466 | - { | |
| 467 | - if (model.getBirth() == null) | |
| 468 | - { | |
| 420 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 421 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 422 | + for (BabyModel model : babyModels) { | |
| 423 | + if (model.getBirth() == null) { | |
| 469 | 424 | continue; |
| 470 | 425 | } |
| 471 | - if (HelperUtils.isExistMsg(model.getId(), template.getId())) | |
| 472 | - { | |
| 426 | + if (HelperUtils.isExistMsg(model.getId(), template.getId())) { | |
| 473 | 427 | continue; |
| 474 | 428 | } |
| 475 | 429 | |
| 476 | 430 | //短信前缀 |
| 477 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 478 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 479 | - messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 431 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 432 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 433 | + messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 480 | 434 | |
| 481 | 435 | //接种时间 |
| 482 | - String vaccineTime = start+"天"; | |
| 436 | + String vaccineTime = start + "天"; | |
| 483 | 437 | //疫苗名称 |
| 484 | 438 | String vaccineName = HelperUtils.getVaccineName(template.getContent()); |
| 485 | 439 | //疫苗接种人 |
| ... | ... | @@ -488,7 +442,7 @@ |
| 488 | 442 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 489 | 443 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 490 | 444 | model.getHospitalId(), template.getId(), model.getId(), vaccineName, vaccinePerson, vaccineTime, |
| 491 | - WxTempleteIdEnums.ER_TONG_YI_MIAO_TIXING.getId(),service); | |
| 445 | + WxTempleteIdEnums.ER_TONG_YI_MIAO_TIXING.getId(), service); | |
| 492 | 446 | |
| 493 | 447 | messages.add(request); |
| 494 | 448 | |
| ... | ... | @@ -500,8 +454,7 @@ |
| 500 | 454 | HelperUtils.sendMsg(list); |
| 501 | 455 | } |
| 502 | 456 | //儿童月龄 |
| 503 | - else if (specialDateType == SpecialDateEnums.ETYL.getId()) | |
| 504 | - { | |
| 457 | + else if (specialDateType == SpecialDateEnums.ETYL.getId()) { | |
| 505 | 458 | |
| 506 | 459 | //发送短信集合 |
| 507 | 460 | MsgListRequest list = new MsgListRequest(); |
| 508 | 461 | |
| 509 | 462 | |
| 510 | 463 | |
| 511 | 464 | |
| 512 | 465 | |
| 513 | 466 | |
| ... | ... | @@ -510,48 +463,43 @@ |
| 510 | 463 | Integer start = template.getStart(); |
| 511 | 464 | Integer end = template.getEnd(); |
| 512 | 465 | |
| 513 | - if (start != null && end != null) | |
| 514 | - { | |
| 515 | - Date startDate = DateUtils.getNewDate(new Date(),-end-1, "月", sendTimeType); | |
| 516 | - Date endDate = DateUtils.getNewDate(new Date(),-start,"月",sendTimeType+1); | |
| 466 | + if (start != null && end != null) { | |
| 467 | + Date startDate = DateUtils.getNewDate(new Date(), -end - 1, "月", sendTimeType); | |
| 468 | + Date endDate = DateUtils.getNewDate(new Date(), -start, "月", sendTimeType + 1); | |
| 517 | 469 | startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); |
| 518 | - endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 470 | + endDate = DateUtils.formatDate(endDate, DateUtils.Y_M_D); | |
| 519 | 471 | babyModelQuery.setBirthStart(startDate); |
| 520 | 472 | babyModelQuery.setBirthEnd(endDate); |
| 521 | 473 | System.out.println(DateUtils.getDateStr(startDate, DateUtils.Y_M_D)); |
| 522 | - System.out.println(DateUtils.getDateStr(endDate,DateUtils.Y_M_D)); | |
| 523 | - List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 524 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 525 | - { | |
| 526 | - for (BabyModel model : babyModels) | |
| 527 | - { | |
| 528 | - if (model.getBirth() == null) | |
| 529 | - { | |
| 474 | + System.out.println(DateUtils.getDateStr(endDate, DateUtils.Y_M_D)); | |
| 475 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 476 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 477 | + for (BabyModel model : babyModels) { | |
| 478 | + if (model.getBirth() == null) { | |
| 530 | 479 | continue; |
| 531 | 480 | } |
| 532 | 481 | |
| 533 | - if (HelperUtils.isExistMsg(model.getId(),template.getId())) | |
| 534 | - { | |
| 482 | + if (HelperUtils.isExistMsg(model.getId(), template.getId())) { | |
| 535 | 483 | continue; |
| 536 | 484 | } |
| 537 | 485 | |
| 538 | 486 | //短信前缀 |
| 539 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 540 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 541 | - messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 487 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 488 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 489 | + messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 542 | 490 | |
| 543 | 491 | //疫苗名称 |
| 544 | 492 | String vaccineName = HelperUtils.getVaccineName(template.getContent()); |
| 545 | 493 | //疫苗接种人 |
| 546 | 494 | String vaccinePerson = model.getName(); |
| 547 | 495 | //接种时间 |
| 548 | - String vaccineTime = start+ "月龄"; | |
| 496 | + String vaccineTime = start + "月龄"; | |
| 549 | 497 | |
| 550 | 498 | |
| 551 | 499 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 552 | 500 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 553 | 501 | model.getHospitalId(), template.getId(), model.getId(), vaccineName, vaccinePerson, vaccineTime, |
| 554 | - WxTempleteIdEnums.ER_TONG_YI_MIAO_TIXING.getId(),service); | |
| 502 | + WxTempleteIdEnums.ER_TONG_YI_MIAO_TIXING.getId(), service); | |
| 555 | 503 | messages.add(request); |
| 556 | 504 | |
| 557 | 505 | } |
| 558 | 506 | |
| 559 | 507 | |
| 560 | 508 | |
| ... | ... | @@ -565,21 +513,18 @@ |
| 565 | 513 | } |
| 566 | 514 | } |
| 567 | 515 | //儿童眼保键预约提醒 |
| 568 | - else if (smsType == SmsServiceEnums.YBYYTX.getId()) | |
| 569 | - { | |
| 516 | + else if (smsType == SmsServiceEnums.YBYYTX.getId()) { | |
| 570 | 517 | //发送短信集合 |
| 571 | 518 | MsgListRequest list = new MsgListRequest(); |
| 572 | 519 | List<MsgRequest> messages = new ArrayList<>(); |
| 573 | 520 | |
| 574 | 521 | Date orderDate = DateUtils.addDay(new Date(), sendTimeType); |
| 575 | - orderDate = DateUtils.formatDate(orderDate,DateUtils.Y_M_D); | |
| 522 | + orderDate = DateUtils.formatDate(orderDate, DateUtils.Y_M_D); | |
| 576 | 523 | |
| 577 | - List<BabyEyeCheck> checkModels = mongoTemplate.find(Query.query(Criteria.where("nextCheckTime").gte(orderDate).lt(DateUtils.addDay(orderDate, 1)) | |
| 524 | + List<BabyEyeCheck> checkModels = mongoTemplate.find(Query.query(Criteria.where("nextCheckTime").gte(orderDate).lt(DateUtils.addDay(orderDate, 1)) | |
| 578 | 525 | .and("yn").is("1").and("hospitalId").is(tempHid)), BabyEyeCheck.class); |
| 579 | - if (CollectionUtils.isNotEmpty(checkModels)) | |
| 580 | - { | |
| 581 | - for(BabyEyeCheck eyecheck : checkModels) | |
| 582 | - { | |
| 526 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
| 527 | + for (BabyEyeCheck eyecheck : checkModels) { | |
| 583 | 528 | |
| 584 | 529 | BabyModelQuery query = new BabyModelQuery(); |
| 585 | 530 | query.setYn(YnEnums.YES.getId()); |
| 586 | 531 | |
| 587 | 532 | |
| 588 | 533 | |
| ... | ... | @@ -587,22 +532,20 @@ |
| 587 | 532 | |
| 588 | 533 | //查询符合条件儿童 |
| 589 | 534 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); |
| 590 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 591 | - { | |
| 592 | - for (BabyModel model : babyModels) | |
| 593 | - { | |
| 535 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 536 | + for (BabyModel model : babyModels) { | |
| 594 | 537 | //短信前缀 |
| 595 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 596 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 597 | - messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 538 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 539 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 540 | + messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 598 | 541 | |
| 599 | - String itemName = "儿童保健"; | |
| 600 | - String nextCheckTime = DateUtils.getDateStr(orderDate,DateUtils.Y_M_D); | |
| 542 | + String itemName = "儿童保健"; | |
| 543 | + String nextCheckTime = DateUtils.getDateStr(orderDate, DateUtils.Y_M_D); | |
| 601 | 544 | |
| 602 | 545 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 603 | 546 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 604 | 547 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 605 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 548 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 606 | 549 | |
| 607 | 550 | messages.add(request); |
| 608 | 551 | } |
| 609 | 552 | |
| ... | ... | @@ -614,14 +557,13 @@ |
| 614 | 557 | HelperUtils.sendMsg(list); |
| 615 | 558 | } |
| 616 | 559 | //儿童听力筛查预约提醒 |
| 617 | - else if (smsType == SmsServiceEnums.TSYYTX.getId()) | |
| 618 | - { | |
| 560 | + else if (smsType == SmsServiceEnums.TSYYTX.getId()) { | |
| 619 | 561 | //发送短信集合 |
| 620 | 562 | MsgListRequest list = new MsgListRequest(); |
| 621 | 563 | List<MsgRequest> messages = new ArrayList<>(); |
| 622 | 564 | |
| 623 | 565 | Date orderDate = DateUtils.addDay(new Date(), sendTimeType); |
| 624 | - orderDate = DateUtils.formatDate(orderDate,DateUtils.Y_M_D); | |
| 566 | + orderDate = DateUtils.formatDate(orderDate, DateUtils.Y_M_D); | |
| 625 | 567 | |
| 626 | 568 | |
| 627 | 569 | BabyPatientExtendEarScreenQuery screenQuery = new BabyPatientExtendEarScreenQuery(); |
| ... | ... | @@ -631,10 +573,8 @@ |
| 631 | 573 | screenQuery.setStatus(0); |
| 632 | 574 | |
| 633 | 575 | List<BabyPatientExtendEarScreen> babyPatientExtendEarScreens = babyPatientExtendEarScreenService.queryEarScreenList(screenQuery); |
| 634 | - if (CollectionUtils.isNotEmpty(babyPatientExtendEarScreens)) | |
| 635 | - { | |
| 636 | - for(BabyPatientExtendEarScreen ear : babyPatientExtendEarScreens) | |
| 637 | - { | |
| 576 | + if (CollectionUtils.isNotEmpty(babyPatientExtendEarScreens)) { | |
| 577 | + for (BabyPatientExtendEarScreen ear : babyPatientExtendEarScreens) { | |
| 638 | 578 | |
| 639 | 579 | BabyModelQuery query = new BabyModelQuery(); |
| 640 | 580 | query.setYn(YnEnums.YES.getId()); |
| 641 | 581 | |
| 642 | 582 | |
| 643 | 583 | |
| ... | ... | @@ -642,22 +582,20 @@ |
| 642 | 582 | |
| 643 | 583 | //查询符合条件儿童 |
| 644 | 584 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); |
| 645 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 646 | - { | |
| 647 | - for (BabyModel model : babyModels) | |
| 648 | - { | |
| 585 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 586 | + for (BabyModel model : babyModels) { | |
| 649 | 587 | //短信前缀 |
| 650 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 651 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 652 | - messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 588 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 589 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 590 | + messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 653 | 591 | |
| 654 | - String itemName = "儿童保健"; | |
| 655 | - String nextCheckTime = DateUtils.getDateStr(orderDate,DateUtils.Y_M_D); | |
| 592 | + String itemName = "儿童保健"; | |
| 593 | + String nextCheckTime = DateUtils.getDateStr(orderDate, DateUtils.Y_M_D); | |
| 656 | 594 | |
| 657 | 595 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 658 | 596 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 659 | 597 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 660 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 598 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 661 | 599 | |
| 662 | 600 | messages.add(request); |
| 663 | 601 | } |
| 664 | 602 | |
| ... | ... | @@ -669,14 +607,13 @@ |
| 669 | 607 | HelperUtils.sendMsg(list); |
| 670 | 608 | } |
| 671 | 609 | //儿童听力诊断预约提醒 |
| 672 | - else if (smsType == SmsServiceEnums.TYZDYYTX.getId()) | |
| 673 | - { | |
| 610 | + else if (smsType == SmsServiceEnums.TYZDYYTX.getId()) { | |
| 674 | 611 | //发送短信集合 |
| 675 | 612 | MsgListRequest list = new MsgListRequest(); |
| 676 | 613 | List<MsgRequest> messages = new ArrayList<>(); |
| 677 | 614 | |
| 678 | 615 | Date orderDate = DateUtils.addDay(new Date(), sendTimeType); |
| 679 | - orderDate = DateUtils.formatDate(orderDate,DateUtils.Y_M_D); | |
| 616 | + orderDate = DateUtils.formatDate(orderDate, DateUtils.Y_M_D); | |
| 680 | 617 | |
| 681 | 618 | BabyPatientExtendEarHearingDiagnoseQuery diagnoseQuery = new BabyPatientExtendEarHearingDiagnoseQuery(); |
| 682 | 619 | // diagnoseQuery.setIfdel(0); |
| ... | ... | @@ -686,10 +623,8 @@ |
| 686 | 623 | |
| 687 | 624 | //已经诊断的数据 |
| 688 | 625 | List<BabyPatientExtendEarHearingDiagnose> hearingDiagnoseList = hearingDiagnoseService.getHdAndScreen(diagnoseQuery); |
| 689 | - if (CollectionUtils.isNotEmpty(hearingDiagnoseList)) | |
| 690 | - { | |
| 691 | - for(BabyPatientExtendEarHearingDiagnose diagnose : hearingDiagnoseList) | |
| 692 | - { | |
| 626 | + if (CollectionUtils.isNotEmpty(hearingDiagnoseList)) { | |
| 627 | + for (BabyPatientExtendEarHearingDiagnose diagnose : hearingDiagnoseList) { | |
| 693 | 628 | |
| 694 | 629 | BabyModelQuery query = new BabyModelQuery(); |
| 695 | 630 | query.setYn(YnEnums.YES.getId()); |
| 696 | 631 | |
| 697 | 632 | |
| 698 | 633 | |
| ... | ... | @@ -697,22 +632,20 @@ |
| 697 | 632 | |
| 698 | 633 | //查询符合条件儿童 |
| 699 | 634 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); |
| 700 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 701 | - { | |
| 702 | - for (BabyModel model : babyModels) | |
| 703 | - { | |
| 635 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 636 | + for (BabyModel model : babyModels) { | |
| 704 | 637 | //短信前缀 |
| 705 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 706 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 707 | - messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 638 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 639 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 640 | + messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 708 | 641 | |
| 709 | - String itemName = "儿童保健"; | |
| 710 | - String nextCheckTime = DateUtils.getDateStr(orderDate,DateUtils.Y_M_D); | |
| 642 | + String itemName = "儿童保健"; | |
| 643 | + String nextCheckTime = DateUtils.getDateStr(orderDate, DateUtils.Y_M_D); | |
| 711 | 644 | |
| 712 | 645 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 713 | 646 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 714 | 647 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 715 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 648 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 716 | 649 | |
| 717 | 650 | messages.add(request); |
| 718 | 651 | } |
| 719 | 652 | |
| 720 | 653 | |
| 721 | 654 | |
| ... | ... | @@ -724,28 +657,25 @@ |
| 724 | 657 | HelperUtils.sendMsg(list); |
| 725 | 658 | } |
| 726 | 659 | //儿童听力随访预约提醒 |
| 727 | - else if (smsType == SmsServiceEnums.TLZDYYTX.getId()) | |
| 728 | - { | |
| 660 | + else if (smsType == SmsServiceEnums.TLZDYYTX.getId()) { | |
| 729 | 661 | //发送短信集合 |
| 730 | 662 | MsgListRequest list = new MsgListRequest(); |
| 731 | 663 | List<MsgRequest> messages = new ArrayList<>(); |
| 732 | 664 | |
| 733 | 665 | Date orderDate = DateUtils.addDay(new Date(), sendTimeType); |
| 734 | - orderDate = DateUtils.formatDate(orderDate,DateUtils.Y_M_D); | |
| 666 | + orderDate = DateUtils.formatDate(orderDate, DateUtils.Y_M_D); | |
| 735 | 667 | |
| 736 | 668 | |
| 737 | 669 | //查询条件 |
| 738 | 670 | BabyPatientExtendEarFollowUpQuery followUpQuery = new BabyPatientExtendEarFollowUpQuery(); |
| 739 | 671 | followUpQuery.setIfdel(0); |
| 740 | - followUpQuery.setNextStartTime(DateUtils.getDateStr(orderDate,DateUtils.Y_M_D)); | |
| 741 | - followUpQuery.setNextEndTime(DateUtils.getDateStr(orderDate,DateUtils.Y_M_D)); | |
| 672 | + followUpQuery.setNextStartTime(DateUtils.getDateStr(orderDate, DateUtils.Y_M_D)); | |
| 673 | + followUpQuery.setNextEndTime(DateUtils.getDateStr(orderDate, DateUtils.Y_M_D)); | |
| 742 | 674 | followUpQuery.setHospitalId(tempHid); |
| 743 | 675 | |
| 744 | 676 | List<BabyPatientExtendEarFollowUp> BabyPatientExtendEarFollowUpList = babyPatientExtendEarFollowUpService.queryBabyPatientExtendEarFollowUp(followUpQuery); |
| 745 | - if (CollectionUtils.isNotEmpty(BabyPatientExtendEarFollowUpList)) | |
| 746 | - { | |
| 747 | - for(BabyPatientExtendEarFollowUp follow : BabyPatientExtendEarFollowUpList) | |
| 748 | - { | |
| 677 | + if (CollectionUtils.isNotEmpty(BabyPatientExtendEarFollowUpList)) { | |
| 678 | + for (BabyPatientExtendEarFollowUp follow : BabyPatientExtendEarFollowUpList) { | |
| 749 | 679 | |
| 750 | 680 | BabyModelQuery query = new BabyModelQuery(); |
| 751 | 681 | query.setYn(YnEnums.YES.getId()); |
| 752 | 682 | |
| 753 | 683 | |
| 754 | 684 | |
| ... | ... | @@ -753,22 +683,20 @@ |
| 753 | 683 | |
| 754 | 684 | //查询符合条件儿童 |
| 755 | 685 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); |
| 756 | - if (CollectionUtils.isNotEmpty(babyModels)) | |
| 757 | - { | |
| 758 | - for (BabyModel model : babyModels) | |
| 759 | - { | |
| 686 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 687 | + for (BabyModel model : babyModels) { | |
| 760 | 688 | //短信前缀 |
| 761 | - String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 762 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 763 | - messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 689 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); | |
| 690 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 691 | + messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); | |
| 764 | 692 | |
| 765 | - String itemName = "儿童保健"; | |
| 766 | - String nextCheckTime = DateUtils.getDateStr(orderDate,DateUtils.Y_M_D); | |
| 693 | + String itemName = "儿童保健"; | |
| 694 | + String nextCheckTime = DateUtils.getDateStr(orderDate, DateUtils.Y_M_D); | |
| 767 | 695 | |
| 768 | 696 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), |
| 769 | 697 | ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), |
| 770 | 698 | model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", |
| 771 | - WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 699 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(), service); | |
| 772 | 700 | |
| 773 | 701 | messages.add(request); |
| 774 | 702 | } |
| ... | ... | @@ -784,6 +712,7 @@ |
| 784 | 712 | |
| 785 | 713 | /** |
| 786 | 714 | * 查询儿童有效的下次预约时间 |
| 715 | + * | |
| 787 | 716 | * @param birth |
| 788 | 717 | * @param start |
| 789 | 718 | * @param tempHid |
| 790 | 719 | |
| 791 | 720 | |
| 792 | 721 | |
| ... | ... | @@ -792,19 +721,16 @@ |
| 792 | 721 | * @param type |
| 793 | 722 | * @return |
| 794 | 723 | */ |
| 795 | - private boolean queryBabyOrder(Date birth, Integer start, String tempHid, Integer sendTimeType, String pid,String type) { | |
| 724 | + private boolean queryBabyOrder(Date birth, Integer start, String tempHid, Integer sendTimeType, String pid, String type) { | |
| 796 | 725 | Set<String> idset = new HashSet<>(); |
| 797 | 726 | Date startDate = DateUtils.getNewDate(birth, start, type, -sendTimeType); |
| 798 | - if (startDate != null) | |
| 799 | - { | |
| 727 | + if (startDate != null) { | |
| 800 | 728 | //把时间格式化成 yyyy_MM_dd 的日期 |
| 801 | - startDate = DateUtils.formatDate(startDate,DateUtils.Y_M_D); | |
| 729 | + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); | |
| 802 | 730 | } |
| 803 | 731 | List<BabyCheckModel> models = babyBookbuildingService.queryBabyOrder(startDate, tempHid, pid); |
| 804 | - if (CollectionUtils.isNotEmpty(models)) | |
| 805 | - { | |
| 806 | - for (BabyCheckModel model : models) | |
| 807 | - { | |
| 732 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 733 | + for (BabyCheckModel model : models) { | |
| 808 | 734 | idset.add(model.getId()); |
| 809 | 735 | } |
| 810 | 736 | } |
| 811 | 737 | |
| ... | ... | @@ -813,10 +739,10 @@ |
| 813 | 739 | |
| 814 | 740 | /** |
| 815 | 741 | * 生成孕妇推送模板消息 |
| 742 | + * | |
| 816 | 743 | * @param template 模板信息 |
| 817 | 744 | */ |
| 818 | - private void generateYunTempMsg(SmsTemplateModel template,SmsConfigModel config,Integer service) | |
| 819 | - { | |
| 745 | + private void generateYunTempMsg(SmsTemplateModel template, SmsConfigModel config, Integer service) { | |
| 820 | 746 | |
| 821 | 747 | //模板属于的医院id |
| 822 | 748 | String tempHid = template.getHospitalId(); |
| 823 | 749 | |
| ... | ... | @@ -827,11 +753,11 @@ |
| 827 | 753 | Integer serviceStatus = template.getServiceStatus(); |
| 828 | 754 | //消息类型 |
| 829 | 755 | Integer smsType = template.getSmsType(); |
| 830 | - | |
| 831 | - //发送时间 SendTimeEnums DT(0,"当天"),QYT(1,"前一天"),QLT(2,"前两天"),QST(3,"前三天"); | |
| 756 | + //发送时间 SendTimeEnums DT(0,"当天"),QYT(1,"前一天"),QLT(2,"前两天"),QST(3,"前三天"), | |
| 757 | + // HYT(-1,"后一天"),HLT(-2,"后二天"),HST(-3,"后三天")/; | |
| 832 | 758 | Integer sendTimeType = template.getSendTimeType(); |
| 833 | 759 | |
| 834 | - logger.info("generateYunTempMsg info : serviceType = "+serviceType +";templateId="+template.getId()+";smsType="+smsType); | |
| 760 | + logger.info("generateYunTempMsg info : serviceType = " + serviceType + ";templateId=" + template.getId() + ";smsType=" + smsType); | |
| 835 | 761 | |
| 836 | 762 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 837 | 763 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 838 | 764 | |
| 839 | 765 | |
| 840 | 766 | |
| 841 | 767 | |
| 842 | 768 | |
| 843 | 769 | |
| 844 | 770 | |
| ... | ... | @@ -849,38 +775,34 @@ |
| 849 | 775 | |
| 850 | 776 | HelperUtils.getServicePatientQuery(serviceType, serviceStatus, patientsQuery); |
| 851 | 777 | |
| 852 | - //孕妇预约短信 | |
| 853 | - if (smsType == SmsServiceEnums.CJYYTX.getId()) | |
| 854 | - { | |
| 855 | - //发送短信集合 | |
| 856 | - MsgListRequest list = new MsgListRequest(); | |
| 857 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 778 | + //发送短信集合 | |
| 779 | + MsgListRequest list = new MsgListRequest(); | |
| 780 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 858 | 781 | |
| 859 | - Date yuYueDate = DateUtils.addDay(new Date(),sendTimeType); | |
| 782 | + //孕妇预约短信 | |
| 783 | + if (smsType == SmsServiceEnums.CJYYTX.getId()) { | |
| 784 | + Date yuYueDate = DateUtils.addDay(new Date(), sendTimeType); | |
| 860 | 785 | //得到孕妇的id |
| 861 | - Set<String> idset = baseService.getYuYuePatient(sendTimeType, tempHid); | |
| 786 | + Set<String> idset = baseService.getYuYuePatient(sendTimeType, tempHid); | |
| 862 | 787 | |
| 863 | - for (String id : idset) | |
| 864 | - { | |
| 788 | + for (String id : idset) { | |
| 865 | 789 | //查询符合条件的孕妇 |
| 866 | 790 | patientsQuery.setId(id); |
| 867 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 868 | - if (CollectionUtils.isNotEmpty(patients)) | |
| 869 | - { | |
| 870 | - for (Patients pat : patients) | |
| 871 | - { | |
| 791 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 792 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 793 | + for (Patients pat : patients) { | |
| 872 | 794 | //短信前缀 |
| 873 | - String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(),ServiceObjEnums.YUNOBJ.getId()); | |
| 874 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 875 | - messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); | |
| 795 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 796 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 797 | + messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); | |
| 876 | 798 | |
| 877 | - String checkTimeStr = DateUtils.getDateStr(yuYueDate,DateUtils.Y_M_D); | |
| 799 | + String checkTimeStr = DateUtils.getDateStr(yuYueDate, DateUtils.Y_M_D); | |
| 878 | 800 | String checkName = "产前检查"; |
| 879 | 801 | |
| 880 | 802 | MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), |
| 881 | 803 | ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), |
| 882 | 804 | pat.getHospitalId(), template.getId(), pat.getId(), checkName, checkTimeStr, "", |
| 883 | - WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId(),service); | |
| 805 | + WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId(), service); | |
| 884 | 806 | |
| 885 | 807 | messages.add(request); |
| 886 | 808 | } |
| 887 | 809 | |
| 888 | 810 | |
| 889 | 811 | |
| 890 | 812 | |
| 891 | 813 | |
| 892 | 814 | |
| 893 | 815 | |
| 894 | 816 | |
| 895 | 817 | |
| 896 | 818 | |
| 897 | 819 | |
| ... | ... | @@ -891,68 +813,55 @@ |
| 891 | 813 | HelperUtils.sendMsg(list); |
| 892 | 814 | } |
| 893 | 815 | //产检程序提醒 |
| 894 | - else if (smsType == SmsServiceEnums.CJCXTX.getId()) | |
| 895 | - { | |
| 896 | - //发送短信集合 | |
| 897 | - MsgListRequest list = new MsgListRequest(); | |
| 898 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 899 | - | |
| 816 | + else if (smsType == SmsServiceEnums.CJCXTX.getId()) { | |
| 900 | 817 | //发送频次 |
| 901 | 818 | Integer sendFreq = template.getSendFrequency(); |
| 902 | 819 | |
| 903 | - if (sendFreq == SendFrequencyEnums.ONCE.getId()) | |
| 904 | - { | |
| 820 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) { | |
| 905 | 821 | //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); |
| 906 | 822 | Integer sendDateType = template.getSendDateType(); |
| 907 | - if (sendDateType == SendDateEnums.SLRQ.getId()) | |
| 908 | - { | |
| 823 | + if (sendDateType == SendDateEnums.SLRQ.getId()) { | |
| 909 | 824 | //孕妇为孕周 |
| 910 | 825 | Integer specialDateType = template.getSpecialDateType(); |
| 911 | 826 | |
| 912 | - if (specialDateType == SpecialDateEnums.YZ.getId()) | |
| 913 | - { | |
| 827 | + if (specialDateType == SpecialDateEnums.YZ.getId()) { | |
| 914 | 828 | Integer start = template.getStart(); |
| 915 | 829 | Integer end = template.getEnd(); |
| 916 | 830 | |
| 917 | - if (start != null && end != null) | |
| 918 | - { | |
| 919 | - Date startDate = DateUtils.getNewDate(new Date(),-end-1,"周",sendTimeType+1); | |
| 920 | - Date endDate = DateUtils.getNewDate(new Date(),-start,"周",sendTimeType); | |
| 921 | - startDate = DateUtils.formatDate(startDate,DateUtils.Y_M_D); | |
| 922 | - endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 831 | + if (start != null && end != null) { | |
| 832 | + Date startDate = DateUtils.getNewDate(new Date(), -end - 1, "周", sendTimeType + 1); | |
| 833 | + Date endDate = DateUtils.getNewDate(new Date(), -start, "周", sendTimeType); | |
| 834 | + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); | |
| 835 | + endDate = DateUtils.formatDate(endDate, DateUtils.Y_M_D); | |
| 923 | 836 | patientsQuery.setLastMensesStart(startDate); |
| 924 | 837 | patientsQuery.setLastMensesEnd(endDate); |
| 925 | 838 | //查询符合条件的孕妇 |
| 926 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 927 | - if (CollectionUtils.isNotEmpty(patients)) | |
| 928 | - { | |
| 929 | - for (Patients pat : patients) | |
| 930 | - { | |
| 931 | - if (HelperUtils.isExistMsg(pat.getId(),template.getId())) | |
| 932 | - { | |
| 839 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 840 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 841 | + for (Patients pat : patients) { | |
| 842 | + if (HelperUtils.isExistMsg(pat.getId(), template.getId())) { | |
| 933 | 843 | continue; |
| 934 | 844 | } |
| 935 | 845 | |
| 936 | 846 | //如果有有效的预约短信就不发送产检程序提醒 |
| 937 | 847 | boolean isOrder = baseService.queryYunIsOrder(sendTimeType, tempHid, pat.getId(), pat.getLastMenses(), start); |
| 938 | - if (isOrder) | |
| 939 | - { | |
| 848 | + if (isOrder) { | |
| 940 | 849 | continue; |
| 941 | 850 | } |
| 942 | 851 | |
| 943 | 852 | //短信前缀 |
| 944 | - String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 945 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 853 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 854 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 946 | 855 | |
| 947 | - String checkWeekName = HelperUtils.getCheckTimeStr(start,end); | |
| 856 | + String checkWeekName = HelperUtils.getCheckTimeStr(start, end); | |
| 948 | 857 | String checkName = "产前检查"; |
| 949 | 858 | |
| 950 | - messageContent = HelperUtils.replaceName(pat.getUsername(), messageContent); | |
| 859 | + messageContent = HelperUtils.replaceName(pat.getUsername(), messageContent); | |
| 951 | 860 | |
| 952 | - MsgRequest request = HelperUtils.getMessageRequest( messageContent,pat.getPhone(), | |
| 861 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 953 | 862 | ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), |
| 954 | - pat.getHospitalId(),template.getId(),pat.getId(),checkName,checkWeekName,"", | |
| 955 | - WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId(),service); | |
| 863 | + pat.getHospitalId(), template.getId(), pat.getId(), checkName, checkWeekName, "", | |
| 864 | + WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId(), service); | |
| 956 | 865 | messages.add(request); |
| 957 | 866 | } |
| 958 | 867 | } |
| 959 | 868 | |
| 960 | 869 | |
| 961 | 870 | |
| 962 | 871 | |
| 963 | 872 | |
| 964 | 873 | |
| 965 | 874 | |
| 966 | 875 | |
| 967 | 876 | |
| 968 | 877 | |
| 969 | 878 | |
| 970 | 879 | |
| 971 | 880 | |
| 972 | 881 | |
| 973 | 882 | |
| 974 | 883 | |
| 975 | 884 | |
| 976 | 885 | |
| 977 | 886 | |
| 978 | 887 | |
| 979 | 888 | |
| 980 | 889 | |
| 981 | 890 | |
| 982 | 891 | |
| 983 | 892 | |
| 984 | 893 | |
| 985 | 894 | |
| 986 | 895 | |
| 987 | 896 | |
| 988 | 897 | |
| 989 | 898 | |
| 990 | 899 | |
| 991 | 900 | |
| 992 | 901 | |
| 993 | 902 | |
| ... | ... | @@ -962,196 +871,215 @@ |
| 962 | 871 | } |
| 963 | 872 | list.setMessages(messages); |
| 964 | 873 | HelperUtils.sendMsg(list); |
| 874 | + } else if (smsType == SmsServiceEnums.CJGQTX.getId()) {//产检过期提醒 | |
| 875 | + //去产检冗余表,根据产检时间进行降序排列,取第一条的下次产检时间 | |
| 876 | + //查询产检冗余表的产检时间为昨天或前天,再根据patientId集合,查询产检冗余表,然后如果产检时间在规定范围内存在,则已经产检, | |
| 877 | + //如果范围内没有记录则发送推送或者短信 | |
| 878 | +//发送短信集合 | |
| 879 | + //该提醒的预约产检时间 | |
| 880 | + Date yuYueDate = DateUtils.addDay(new Date(), sendTimeType); | |
| 881 | + PatientsQuery patientQuery = new PatientsQuery(); | |
| 882 | + patientQuery.setNextCheckTimeStart(yuYueDate); | |
| 883 | + //查指定预约下次产检时间 | |
| 884 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientQuery); | |
| 885 | + | |
| 886 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 887 | + for (Patients pat : patients) { | |
| 888 | + //短信前缀 | |
| 889 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 890 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 891 | + messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); | |
| 892 | + | |
| 893 | + String checkTimeStr = DateUtils.getDateStr(yuYueDate, DateUtils.Y_M_D); | |
| 894 | + String checkName = "产检日期过期提醒"; | |
| 895 | + | |
| 896 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 897 | + ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), | |
| 898 | + pat.getHospitalId(), template.getId(), pat.getId(), checkName, checkTimeStr, "", | |
| 899 | + WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId(), service); | |
| 900 | + | |
| 901 | + messages.add(request); | |
| 902 | + } | |
| 903 | + list.setMessages(messages); | |
| 904 | + HelperUtils.sendMsg(list); | |
| 905 | + } | |
| 965 | 906 | } |
| 966 | 907 | } |
| 967 | 908 | |
| 968 | 909 | |
| 969 | - /** | |
| 970 | - * 产妇模板消息生成 | |
| 971 | - * @param template | |
| 972 | - * @param config | |
| 973 | - */ | |
| 974 | - private void generateChanTempMsg(SmsTemplateModel template, SmsConfigModel config,Integer service) { | |
| 910 | + /** | |
| 911 | + * 产妇模板消息生成 | |
| 912 | + * | |
| 913 | + * @param template | |
| 914 | + * @param config | |
| 915 | + */ | |
| 916 | + private void generateChanTempMsg (SmsTemplateModel template, SmsConfigModel config, Integer service){ | |
| 975 | 917 | |
| 976 | - //模板属于的医院id | |
| 977 | - String tempHid = template.getHospitalId(); | |
| 918 | + //模板属于的医院id | |
| 919 | + String tempHid = template.getHospitalId(); | |
| 978 | 920 | |
| 979 | - //服务类型 | |
| 980 | - Integer serviceType = template.getServiceType(); | |
| 981 | - //服务状态 | |
| 982 | - Integer serviceStatus = template.getServiceStatus(); | |
| 983 | - //消息类型 | |
| 984 | - Integer smsType = template.getSmsType(); | |
| 921 | + //服务类型 | |
| 922 | + Integer serviceType = template.getServiceType(); | |
| 923 | + //服务状态 | |
| 924 | + Integer serviceStatus = template.getServiceStatus(); | |
| 925 | + //消息类型 | |
| 926 | + Integer smsType = template.getSmsType(); | |
| 985 | 927 | |
| 986 | - //发送时间 SendTimeEnums DT(0,"当天"),QYT(1,"前一天"),QLT(2,"前两天"),QST(3,"前三天"); | |
| 987 | - Integer sendTimeType = template.getSendTimeType(); | |
| 928 | + //发送时间 SendTimeEnums DT(0,"当天"),QYT(1,"前一天"),QLT(2,"前两天"),QST(3,"前三天"); | |
| 929 | + Integer sendTimeType = template.getSendTimeType(); | |
| 988 | 930 | |
| 989 | - logger.info("generateYunTempMsg info : serviceType = "+serviceType +";templateId="+template.getId()+";smsType="+smsType); | |
| 931 | + logger.info("generateYunTempMsg info : serviceType = " + serviceType + ";templateId=" + template.getId() + ";smsType=" + smsType); | |
| 990 | 932 | |
| 991 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 992 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 993 | - patientsQuery.setHospitalId(tempHid); | |
| 933 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 934 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 935 | + patientsQuery.setHospitalId(tempHid); | |
| 994 | 936 | |
| 995 | - List buildType = new ArrayList(); | |
| 996 | - buildType.add(0); | |
| 997 | - buildType.add(2); | |
| 998 | - patientsQuery.setSmsBuildTypeList(buildType); | |
| 999 | - //1孕妇 3产妇 | |
| 1000 | - patientsQuery.setType(3); | |
| 1001 | - //0未终止妊娠的产妇 | |
| 1002 | - patientsQuery.setDueStatus(0); | |
| 937 | + List buildType = new ArrayList(); | |
| 938 | + buildType.add(0); | |
| 939 | + buildType.add(2); | |
| 940 | + patientsQuery.setSmsBuildTypeList(buildType); | |
| 941 | + //1孕妇 3产妇 | |
| 942 | + patientsQuery.setType(3); | |
| 943 | + //0未终止妊娠的产妇 | |
| 944 | + patientsQuery.setDueStatus(0); | |
| 1003 | 945 | |
| 1004 | - HelperUtils.getServicePatientQuery(serviceType, serviceStatus, patientsQuery); | |
| 946 | + HelperUtils.getServicePatientQuery(serviceType, serviceStatus, patientsQuery); | |
| 1005 | 947 | |
| 1006 | - //产妇预约短信 | |
| 1007 | - if (smsType == SmsServiceEnums.CHFCYUTX.getId()) | |
| 1008 | - { | |
| 1009 | - //发送短信集合 | |
| 1010 | - MsgListRequest list = new MsgListRequest(); | |
| 1011 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 948 | + //产妇预约短信 | |
| 949 | + if (smsType == SmsServiceEnums.CHFCYUTX.getId()) { | |
| 950 | + //发送短信集合 | |
| 951 | + MsgListRequest list = new MsgListRequest(); | |
| 952 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 1012 | 953 | |
| 1013 | - //把时间格式成yyyy_MM_dd | |
| 1014 | - Date actualSendDate = DateUtils.formatDate(DateUtils.addDay(new Date(), sendTimeType), DateUtils.Y_M_D); | |
| 954 | + //把时间格式成yyyy_MM_dd | |
| 955 | + Date actualSendDate = DateUtils.formatDate(DateUtils.addDay(new Date(), sendTimeType), DateUtils.Y_M_D); | |
| 1015 | 956 | |
| 1016 | - //查询出产妇预约 | |
| 1017 | - List<PostReviewModel> orderModels = postReviewService.queryPostOrder(actualSendDate, tempHid); | |
| 957 | + //查询出产妇预约 | |
| 958 | + List<PostReviewModel> orderModels = postReviewService.queryPostOrder(actualSendDate, tempHid); | |
| 1018 | 959 | |
| 1019 | - if(CollectionUtils.isNotEmpty(orderModels)) | |
| 1020 | - { | |
| 1021 | - for(PostReviewModel orderModel : orderModels) | |
| 1022 | - { | |
| 1023 | - PatientsQuery query = new PatientsQuery(); | |
| 1024 | - query.setYn(YnEnums.YES.getId()); | |
| 1025 | - query.setId(orderModel.getId()); //id就是parentId | |
| 960 | + if (CollectionUtils.isNotEmpty(orderModels)) { | |
| 961 | + for (PostReviewModel orderModel : orderModels) { | |
| 962 | + PatientsQuery query = new PatientsQuery(); | |
| 963 | + query.setYn(YnEnums.YES.getId()); | |
| 964 | + query.setId(orderModel.getId()); //id就是parentId | |
| 1026 | 965 | |
| 1027 | - //查询符合条件的产妇 | |
| 1028 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(query); | |
| 1029 | - if (CollectionUtils.isNotEmpty(patients)) | |
| 1030 | - { | |
| 1031 | - for (Patients pat : patients) | |
| 1032 | - { | |
| 1033 | - //短信前缀 | |
| 1034 | - String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(),ServiceObjEnums.CHANOBJ.getId()); | |
| 1035 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 1036 | - String title = "产后复查"; | |
| 1037 | - messageContent = HelperUtils.replaceEL(pat.getUsername(), actualSendDate, messageContent); | |
| 1038 | - MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 1039 | - ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), | |
| 1040 | - pat.getHospitalId(), template.getId(), pat.getId(), title, DateUtils.getDateStr(actualSendDate,DateUtils.Y_M_D), "", | |
| 1041 | - WxTempleteIdEnums.CHAN_HOU_FU_CHA.getId(),service); | |
| 966 | + //查询符合条件的产妇 | |
| 967 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(query); | |
| 968 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 969 | + for (Patients pat : patients) { | |
| 970 | + //短信前缀 | |
| 971 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.CHANOBJ.getId()); | |
| 972 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 973 | + String title = "产后复查"; | |
| 974 | + messageContent = HelperUtils.replaceEL(pat.getUsername(), actualSendDate, messageContent); | |
| 975 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 976 | + ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), | |
| 977 | + pat.getHospitalId(), template.getId(), pat.getId(), title, DateUtils.getDateStr(actualSendDate, DateUtils.Y_M_D), "", | |
| 978 | + WxTempleteIdEnums.CHAN_HOU_FU_CHA.getId(), service); | |
| 1042 | 979 | |
| 1043 | - messages.add(request); | |
| 980 | + messages.add(request); | |
| 981 | + } | |
| 1044 | 982 | } |
| 1045 | 983 | } |
| 1046 | 984 | } |
| 985 | + | |
| 986 | + list.setMessages(messages); | |
| 987 | + HelperUtils.sendMsg(list); | |
| 1047 | 988 | } |
| 989 | + //产后复查程序提醒 | |
| 990 | + else if (smsType == SmsServiceEnums.CHFCCXTX.getId()) { | |
| 1048 | 991 | |
| 1049 | - list.setMessages(messages); | |
| 1050 | - HelperUtils.sendMsg(list); | |
| 1051 | - } | |
| 1052 | - //产后复查程序提醒 | |
| 1053 | - else if (smsType == SmsServiceEnums.CHFCCXTX.getId()) | |
| 1054 | - { | |
| 992 | + //发送短信集合 | |
| 993 | + MsgListRequest list = new MsgListRequest(); | |
| 994 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 1055 | 995 | |
| 1056 | - //发送短信集合 | |
| 1057 | - MsgListRequest list = new MsgListRequest(); | |
| 1058 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 996 | + //发送频次 | |
| 997 | + Integer sendFreq = template.getSendFrequency(); | |
| 1059 | 998 | |
| 1060 | - //发送频次 | |
| 1061 | - Integer sendFreq = template.getSendFrequency(); | |
| 999 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) { | |
| 1062 | 1000 | |
| 1063 | - if (sendFreq == SendFrequencyEnums.ONCE.getId()) { | |
| 1001 | + //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); | |
| 1002 | + Integer sendDateType = template.getSendDateType(); | |
| 1003 | + if (sendDateType == SendDateEnums.SLRQ.getId()) { | |
| 1004 | + // | |
| 1005 | + Integer specialDateType = template.getSpecialDateType(); | |
| 1064 | 1006 | |
| 1065 | - //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); | |
| 1066 | - Integer sendDateType = template.getSendDateType(); | |
| 1067 | - if (sendDateType == SendDateEnums.SLRQ.getId()) { | |
| 1068 | - // | |
| 1069 | - Integer specialDateType = template.getSpecialDateType(); | |
| 1007 | + //产后天数 | |
| 1008 | + if (specialDateType == SpecialDateEnums.CHTS.getId()) { | |
| 1009 | + Integer start = template.getStart(); | |
| 1010 | + Integer end = template.getEnd(); | |
| 1070 | 1011 | |
| 1071 | - //产后天数 | |
| 1072 | - if (specialDateType == SpecialDateEnums.CHTS.getId()) { | |
| 1073 | - Integer start = template.getStart(); | |
| 1074 | - Integer end = template.getEnd(); | |
| 1012 | + if (start != null && end != null) { | |
| 1013 | + Date startDate = DateUtils.getNewDate(new Date(), -end, "天", sendTimeType); | |
| 1014 | + Date endDate = DateUtils.getNewDate(new Date(), -start, "天", sendTimeType); | |
| 1015 | + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); | |
| 1016 | + endDate = DateUtils.formatDate(endDate, DateUtils.Y_M_D); | |
| 1017 | + patientsQuery.setFmDateStart(startDate); | |
| 1018 | + patientsQuery.setFmDateEnd(endDate); | |
| 1019 | + List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 1020 | + for (Patients pat : patientses) { | |
| 1021 | + if (pat.getDueDate() == null) { | |
| 1022 | + continue; | |
| 1023 | + } | |
| 1075 | 1024 | |
| 1076 | - if (start != null && end != null) { | |
| 1077 | - Date startDate = DateUtils.getNewDate(new Date(),-end, "天", sendTimeType); | |
| 1078 | - Date endDate = DateUtils.getNewDate(new Date(),-start, "天", sendTimeType); | |
| 1079 | - startDate = DateUtils.formatDate(startDate,DateUtils.Y_M_D); | |
| 1080 | - endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 1081 | - patientsQuery.setFmDateStart(startDate); | |
| 1082 | - patientsQuery.setFmDateEnd(endDate); | |
| 1083 | - List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 1084 | - for(Patients pat : patientses) | |
| 1085 | - { | |
| 1086 | - if (pat.getDueDate() == null) | |
| 1087 | - { | |
| 1088 | - continue; | |
| 1089 | - } | |
| 1025 | + if (HelperUtils.isExistMsg(pat.getId(), template.getId())) { | |
| 1026 | + continue; | |
| 1027 | + } | |
| 1090 | 1028 | |
| 1091 | - if (HelperUtils.isExistMsg(pat.getId(),template.getId())) | |
| 1092 | - { | |
| 1093 | - continue; | |
| 1094 | - } | |
| 1029 | + if (queryPostOrder(pat.getDueDate(), start, tempHid, sendTimeType, pat.getId())) { | |
| 1030 | + continue; | |
| 1031 | + } | |
| 1032 | + //短信前缀 | |
| 1033 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.CHANOBJ.getId()); | |
| 1034 | + String messageContent = "【" + messagePrefix + "】" + template.getContent(); | |
| 1035 | + messageContent = HelperUtils.replaceName(pat.getUsername(), messageContent); | |
| 1095 | 1036 | |
| 1096 | - if (queryPostOrder(pat.getDueDate(),start,tempHid,sendTimeType,pat.getId())) | |
| 1097 | - { | |
| 1098 | - continue; | |
| 1099 | - } | |
| 1100 | - //短信前缀 | |
| 1101 | - String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(),ServiceObjEnums.CHANOBJ.getId()); | |
| 1102 | - String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 1103 | - messageContent = HelperUtils.replaceName(pat.getUsername(), messageContent); | |
| 1037 | + String days = "产后" + HelperUtils.getKeyword(start, end, "天"); | |
| 1104 | 1038 | |
| 1105 | - String days = "产后"+HelperUtils.getKeyword(start,end,"天"); | |
| 1106 | - | |
| 1107 | - String title = "产后复查"; | |
| 1108 | - MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 1109 | - ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), | |
| 1110 | - pat.getHospitalId(), template.getId(), pat.getId(), title, days, "", | |
| 1111 | - WxTempleteIdEnums.CHAN_HOU_FU_CHA.getId(),service); | |
| 1112 | - messages.add(request); | |
| 1039 | + String title = "产后复查"; | |
| 1040 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 1041 | + ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), | |
| 1042 | + pat.getHospitalId(), template.getId(), pat.getId(), title, days, "", | |
| 1043 | + WxTempleteIdEnums.CHAN_HOU_FU_CHA.getId(), service); | |
| 1044 | + messages.add(request); | |
| 1045 | + } | |
| 1113 | 1046 | } |
| 1114 | 1047 | } |
| 1115 | - } | |
| 1116 | - //产妇服务结束 | |
| 1117 | - else if (specialDateType == SpecialDateEnums.FWJS.getId()) | |
| 1118 | - { | |
| 1048 | + //产妇服务结束 | |
| 1049 | + else if (specialDateType == SpecialDateEnums.FWJS.getId()) { | |
| 1119 | 1050 | |
| 1051 | + } | |
| 1120 | 1052 | } |
| 1121 | 1053 | } |
| 1054 | + | |
| 1055 | + list.setMessages(messages); | |
| 1056 | + HelperUtils.sendMsg(list); | |
| 1122 | 1057 | } |
| 1123 | 1058 | |
| 1124 | - list.setMessages(messages); | |
| 1125 | - HelperUtils.sendMsg(list); | |
| 1126 | 1059 | } |
| 1127 | 1060 | |
| 1128 | - } | |
| 1129 | 1061 | |
| 1130 | - | |
| 1131 | - /** | |
| 1132 | - * 查询出产妇有效的下次预约时间 | |
| 1133 | - * @param tempHid | |
| 1134 | - * @return | |
| 1135 | - */ | |
| 1136 | - private boolean queryPostOrder(Date dueDate,Integer start,String tempHid,Integer sendTimeType,String pid) | |
| 1137 | - { | |
| 1138 | - Set<String> idset = new HashSet<>(); | |
| 1139 | - Date startDate = DateUtils.getNewDate(dueDate, start, "周", -sendTimeType); | |
| 1140 | - if (startDate != null) | |
| 1141 | - { | |
| 1142 | - //把时间格式化成 yyyy_MM_dd 的日期 | |
| 1143 | - startDate = DateUtils.formatDate(startDate,DateUtils.Y_M_D); | |
| 1144 | - } | |
| 1145 | - List<PostReviewModel> models = postReviewService.queryPostOrder(startDate, tempHid, pid); | |
| 1146 | - if (CollectionUtils.isNotEmpty(models)) | |
| 1147 | - { | |
| 1148 | - for (PostReviewModel model : models) | |
| 1149 | - { | |
| 1150 | - idset.add(model.getId()); //这里的id就是parentid | |
| 1062 | + /** | |
| 1063 | + * 查询出产妇有效的下次预约时间 | |
| 1064 | + * | |
| 1065 | + * @param tempHid | |
| 1066 | + * @return | |
| 1067 | + */ | |
| 1068 | + private boolean queryPostOrder (Date dueDate, Integer start, String tempHid, Integer sendTimeType, String pid){ | |
| 1069 | + Set<String> idset = new HashSet<>(); | |
| 1070 | + Date startDate = DateUtils.getNewDate(dueDate, start, "周", -sendTimeType); | |
| 1071 | + if (startDate != null) { | |
| 1072 | + //把时间格式化成 yyyy_MM_dd 的日期 | |
| 1073 | + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); | |
| 1151 | 1074 | } |
| 1152 | - } | |
| 1075 | + List<PostReviewModel> models = postReviewService.queryPostOrder(startDate, tempHid, pid); | |
| 1076 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 1077 | + for (PostReviewModel model : models) { | |
| 1078 | + idset.add(model.getId()); //这里的id就是parentid | |
| 1079 | + } | |
| 1080 | + } | |
| 1153 | 1081 | |
| 1154 | - return idset.size() > 0; | |
| 1082 | + return idset.size() > 0; | |
| 1083 | + } | |
| 1155 | 1084 | } |
| 1156 | -} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
64a4880
| ... | ... | @@ -1678,19 +1678,22 @@ |
| 1678 | 1678 | |
| 1679 | 1679 | Map<String,Object> map = new HashMap<>(); |
| 1680 | 1680 | |
| 1681 | - List<String> weightTitles = new LinkedList<>(); | |
| 1681 | + List<Integer> weightTitles = new LinkedList<>(); | |
| 1682 | 1682 | List<String> weightValues = new LinkedList<>(); |
| 1683 | 1683 | |
| 1684 | - List<String> heightTitles = new LinkedList<>(); | |
| 1684 | + List<Integer> heightTitles = new LinkedList<>(); | |
| 1685 | 1685 | List<String> heightValues = new LinkedList<>(); |
| 1686 | 1686 | |
| 1687 | - List<Map<String,String>> tables = new LinkedList<>(); | |
| 1687 | + List<Map<String,Object>> tables = new LinkedList<>(); | |
| 1688 | 1688 | |
| 1689 | + BabyModel babyModel = babyService.getOneBabyById(babyId); | |
| 1690 | + | |
| 1689 | 1691 | BabyCheckModelQuery query = new BabyCheckModelQuery(); |
| 1690 | 1692 | query.setYn(YnEnums.YES.getId()); |
| 1691 | 1693 | query.setBuildId(babyId); |
| 1692 | 1694 | //查询儿童的检查记录 |
| 1693 | 1695 | List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate,created", Sort.Direction.ASC); |
| 1696 | + | |
| 1694 | 1697 | if (CollectionUtils.isNotEmpty(checkModels)) |
| 1695 | 1698 | { |
| 1696 | 1699 | for (BabyCheckModel checkModel : checkModels) |
| 1697 | 1700 | |
| 1698 | 1701 | |
| ... | ... | @@ -1699,15 +1702,21 @@ |
| 1699 | 1702 | { |
| 1700 | 1703 | if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight()) || org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight())) |
| 1701 | 1704 | { |
| 1702 | - Map<String,String> heightMap = new HashMap<>(); | |
| 1705 | + int month = DateUtil.getBabyAgeMonth(babyModel.getBirth(),checkModel.getCheckDate()); | |
| 1706 | + Map<String,Object> heightMap = new HashMap<>(); | |
| 1707 | + heightMap.put("time",month); | |
| 1703 | 1708 | if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight())) |
| 1704 | 1709 | { |
| 1705 | 1710 | if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getHeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getHeight()).matches()) |
| 1706 | 1711 | { |
| 1707 | - heightTitles.add(DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())); | |
| 1708 | - heightValues.add(checkModel.getHeight()); | |
| 1712 | + if(heightTitles.contains(month)){ | |
| 1713 | + int index = heightTitles.indexOf(month); | |
| 1714 | + heightValues.set(index,checkModel.getHeight()); | |
| 1715 | + }else { | |
| 1716 | + heightTitles.add(month); | |
| 1717 | + heightValues.add(checkModel.getHeight()); | |
| 1718 | + } | |
| 1709 | 1719 | } |
| 1710 | - heightMap.put("time",DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())); | |
| 1711 | 1720 | heightMap.put("height", checkModel.getHeight()); |
| 1712 | 1721 | } |
| 1713 | 1722 | else |
| 1714 | 1723 | |
| 1715 | 1724 | |
| ... | ... | @@ -1719,17 +1728,21 @@ |
| 1719 | 1728 | { |
| 1720 | 1729 | if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getWeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getWeight()).matches()) |
| 1721 | 1730 | { |
| 1722 | - weightTitles.add(DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())); | |
| 1723 | - weightValues.add(checkModel.getWeight()); | |
| 1731 | + | |
| 1732 | + if(weightTitles.contains(month)){//如果存在月的数据则更新对应索引的值 | |
| 1733 | + int index = weightTitles.indexOf(month); | |
| 1734 | + weightValues.set(index,checkModel.getWeight()); | |
| 1735 | + }else { | |
| 1736 | + weightTitles.add(month); | |
| 1737 | + weightValues.add(checkModel.getWeight()); | |
| 1738 | + } | |
| 1724 | 1739 | } |
| 1725 | - heightMap.put("time", DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())); | |
| 1726 | 1740 | heightMap.put("weight",checkModel.getWeight()); |
| 1727 | 1741 | } |
| 1728 | 1742 | else |
| 1729 | 1743 | { |
| 1730 | 1744 | heightMap.put("weight", "--"); |
| 1731 | 1745 | } |
| 1732 | - | |
| 1733 | 1746 | tables.add(heightMap); |
| 1734 | 1747 | } |
| 1735 | 1748 | } |
| ... | ... | @@ -1742,7 +1755,9 @@ |
| 1742 | 1755 | map.put("heightValues",heightValues); |
| 1743 | 1756 | |
| 1744 | 1757 | map.put("tables",tables); |
| 1745 | - | |
| 1758 | + if(babyModel!=null){ | |
| 1759 | + map.put("sex",babyModel.getSex()); | |
| 1760 | + } | |
| 1746 | 1761 | return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 1747 | 1762 | } |
| 1748 | 1763 | } |