Commit 8e03af3e2421f29657c91fc82c4265103a573aab
1 parent
49c2bfd362
Exists in
master
and in
6 other branches
体重修改
Showing 5 changed files with 181 additions and 5 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java
View file @
8e03af3
| ... | ... | @@ -56,7 +56,9 @@ |
| 56 | 56 | XYTX(42,"血压测量提醒",21,"1"), |
| 57 | 57 | NOSERVICE(43,"无服务",18,"0,1,2,3,4"), |
| 58 | 58 | CHWJTX(44,"产后问卷提醒",4,"3"), |
| 59 | - ETJBTX(45,"儿保疾病提醒",14,"2"); | |
| 59 | + ETJBTX(45,"儿保疾病提醒",14,"2"), | |
| 60 | + PXTX(46,"贫血提醒",21,"1"), | |
| 61 | + TZCBTX(47,"体重超标提醒",21,"1"); | |
| 60 | 62 | |
| 61 | 63 | private SmsServiceEnums(int id,String name,int pid,String serviceObj){ |
| 62 | 64 | this.id = id; |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientWeight.java
View file @
8e03af3
| ... | ... | @@ -138,6 +138,17 @@ |
| 138 | 138 | private boolean printing; |
| 139 | 139 | |
| 140 | 140 | |
| 141 | + //是否超过上线值 | |
| 142 | + private String isNormal; | |
| 143 | + | |
| 144 | + public String getIsNormal() { | |
| 145 | + return isNormal; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void setIsNormal(String isNormal) { | |
| 149 | + this.isNormal = isNormal; | |
| 150 | + } | |
| 151 | + | |
| 141 | 152 | public boolean isPrinting() { |
| 142 | 153 | return printing; |
| 143 | 154 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
View file @
8e03af3
| ... | ... | @@ -37,6 +37,13 @@ |
| 37 | 37 | return patientWeightService.addOrUpdate(getUserId(request), patientWeight); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + | |
| 41 | + @ResponseBody | |
| 42 | + @RequestMapping(value = "/generateWeightMsg", method = RequestMethod.GET) | |
| 43 | + public void generateWeightMsg() { | |
| 44 | + patientWeightService.generateWeightMsg(); | |
| 45 | + } | |
| 46 | + | |
| 40 | 47 | /** |
| 41 | 48 | * @param key 姓名/证件号/联系方式 |
| 42 | 49 | * @param vcCardNo 就诊卡号 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
View file @
8e03af3
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
8e03af3
| ... | ... | @@ -23,16 +23,20 @@ |
| 23 | 23 | import com.lyms.platform.permission.service.UsersService; |
| 24 | 24 | import com.lyms.platform.pojo.*; |
| 25 | 25 | import com.lyms.platform.query.PatientsQuery; |
| 26 | +import com.lyms.platform.query.SmsConfigQuery; | |
| 27 | +import com.lyms.platform.query.SmsTemplateQuery; | |
| 26 | 28 | import net.sf.json.JSONArray; |
| 27 | 29 | import net.sf.json.JSONObject; |
| 28 | 30 | import org.apache.commons.collections.MapUtils; |
| 29 | 31 | import org.apache.commons.lang.StringUtils; |
| 30 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 31 | 34 | import org.springframework.data.domain.Sort; |
| 32 | 35 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 33 | 36 | import org.springframework.data.mongodb.core.query.Criteria; |
| 34 | 37 | import org.springframework.data.mongodb.core.query.Query; |
| 35 | 38 | import org.springframework.data.mongodb.core.query.Update; |
| 39 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 36 | 40 | import org.springframework.stereotype.Service; |
| 37 | 41 | |
| 38 | 42 | import java.math.BigDecimal; |
| ... | ... | @@ -43,6 +47,9 @@ |
| 43 | 47 | @Service |
| 44 | 48 | public class PatientWeightServiceImpl extends BaseServiceImpl implements PatientWeightService { |
| 45 | 49 | |
| 50 | + private static final String WEIGHT_MSG_CONTENT = "提示:您好,您在产检过程中监测体重增长幅度超标,为避免体重增长过快对您和您的宝宝带来不好的结局,请收到消息后尽快到产科门诊就诊。"; | |
| 51 | + private static final String QHDFY_WEIGHT_MSG_CONTENT = "提示:您好,您在产检过程中监测体重增长幅度超标,为避免体重增长过快对您和您的宝宝带来不好的结局,请收到消息后尽快到产科门诊106室就诊。"; | |
| 52 | + | |
| 46 | 53 | @Autowired |
| 47 | 54 | private MongoTemplate mongoTemplate; |
| 48 | 55 | |
| 49 | 56 | |
| ... | ... | @@ -54,8 +61,9 @@ |
| 54 | 61 | |
| 55 | 62 | @Autowired |
| 56 | 63 | private PatientWeightService2 patientWeightService2; |
| 57 | - | |
| 58 | 64 | @Autowired |
| 65 | + private SmsConfigService smsConfigService; | |
| 66 | + @Autowired | |
| 59 | 67 | private PatientsService patientsService; |
| 60 | 68 | |
| 61 | 69 | @Autowired |
| 62 | 70 | |
| ... | ... | @@ -86,10 +94,16 @@ |
| 86 | 94 | @Autowired |
| 87 | 95 | private UsersService usersService; |
| 88 | 96 | |
| 89 | - /*@Autowired | |
| 90 | - private PatientWeightService patientWeightService;*/ | |
| 91 | 97 | |
| 92 | 98 | @Autowired |
| 99 | + @Qualifier("commonThreadPool") | |
| 100 | + private ThreadPoolTaskExecutor commonThreadPool; | |
| 101 | + @Autowired | |
| 102 | + private SmsTemplateService smsTemplateService; | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + @Autowired | |
| 93 | 107 | private HealthChargeFacade healthChargeFacade; |
| 94 | 108 | |
| 95 | 109 | |
| ... | ... | @@ -156,6 +170,12 @@ |
| 156 | 170 | patientsService.addPatient(patients); |
| 157 | 171 | patientWeight.setPatientId(patients.getId()); |
| 158 | 172 | } |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 159 | 179 | Map<String, String> dayWeights = new LinkedHashMap<>(); |
| 160 | 180 | List<Map<String, Object>> dayWeights2 = new ArrayList<>(); |
| 161 | 181 | if (pw != null) { |
| ... | ... | @@ -166,6 +186,9 @@ |
| 166 | 186 | pw.setDayWeights(dayWeights); |
| 167 | 187 | pw.setNowWeight(patientWeight.getNowWeight()); |
| 168 | 188 | |
| 189 | + | |
| 190 | + String isNormal = getWeightRangeIsNormal(patients,pw); | |
| 191 | + | |
| 169 | 192 | String ymdDate = DateUtil.getyyyy_MM_dd(new Date()); |
| 170 | 193 | boolean flag = true; |
| 171 | 194 | if (CollectionUtils.isNotEmpty(pw.getDayWeights2())) { |
| ... | ... | @@ -193,6 +216,7 @@ |
| 193 | 216 | } |
| 194 | 217 | pw.setDayWeights2(dayWeights2); |
| 195 | 218 | pw.setModified(new Date()); |
| 219 | + pw.setIsNormal(isNormal); | |
| 196 | 220 | patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw); |
| 197 | 221 | return RespBuilder.buildSuccess(pw.getId()); |
| 198 | 222 | } |
| ... | ... | @@ -221,7 +245,7 @@ |
| 221 | 245 | /*m.put("doctorId", doctorId);*/ |
| 222 | 246 | dayWeights2.add(m); |
| 223 | 247 | patientWeight.setDayWeights2(dayWeights2); |
| 224 | - | |
| 248 | + pw.setIsNormal(getWeightRangeIsNormal(patients,patientWeight)); | |
| 225 | 249 | patientWeight.setModified(new Date()); |
| 226 | 250 | patientWeightService2.add(patientWeight); |
| 227 | 251 | |
| 228 | 252 | |
| ... | ... | @@ -245,7 +269,137 @@ |
| 245 | 269 | return RespBuilder.buildSuccess(patientWeight.getId()); |
| 246 | 270 | } |
| 247 | 271 | } |
| 272 | + /** | |
| 273 | + * 计算当前测量的体重是否超过上线值 | |
| 274 | + */ | |
| 275 | + private String getWeightRangeIsNormal(Patients patients,PatientWeight pw) { | |
| 248 | 276 | |
| 277 | + Map<String, Object> series = new LinkedHashMap<>(); | |
| 278 | + String isNormal = "true"; | |
| 279 | + if (pw != null) | |
| 280 | + { | |
| 281 | + | |
| 282 | + double bmiD = Double.parseDouble(pw.getBmi()); | |
| 283 | + String bmiStr = pw.getBmi(); | |
| 284 | + String bregmatic = pw.getBregmatic(); | |
| 285 | + //空和1表示单胎 | |
| 286 | + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) { | |
| 287 | + if (bmiD < 18.5) { | |
| 288 | + bmiStr = "BMI<18.5"; | |
| 289 | + } else if (bmiD >= 18.5 && bmiD <= 24.9) { | |
| 290 | + bmiStr = "BMI=18.5-24.9"; | |
| 291 | + } else if (bmiD > 24.9 && bmiD < 30) { | |
| 292 | + bmiStr = "BMI=25-29.9"; | |
| 293 | + } else if (bmiD >= 30) { | |
| 294 | + bmiStr = "BMI≥30"; | |
| 295 | + } | |
| 296 | + } else { | |
| 297 | + if (bmiD <= 24.9) { | |
| 298 | + bmiStr = "BMI≤24.9"; | |
| 299 | + } else if (bmiD >= 25 && bmiD <= 29.9) { | |
| 300 | + bmiStr = "BMI=25-29.9"; | |
| 301 | + } else if (bmiD >= 30) { | |
| 302 | + bmiStr = "BMI≥30"; | |
| 303 | + } | |
| 304 | + } | |
| 305 | + | |
| 306 | + getSeries(series, bmiStr, pw.getBregmatic()); | |
| 307 | + if (series.get("highDataMap") != null) | |
| 308 | + { | |
| 309 | + int week = DateUtil.getWeek(patients.getLastMenses(),new Date()); | |
| 310 | + Map<Integer, Double> map = (Map<Integer, Double>)series.get("highDataMap"); | |
| 311 | + Double d = map.get(week); | |
| 312 | + if (d != null && d < Double.parseDouble(pw.getNowWeight()) - Double.parseDouble(pw.getBeforeWeight())) | |
| 313 | + { | |
| 314 | + isNormal = "false"; | |
| 315 | + } | |
| 316 | + } | |
| 317 | + } | |
| 318 | + return isNormal; | |
| 319 | + } | |
| 320 | + | |
| 321 | + | |
| 322 | + /** | |
| 323 | + * 创建建档短信 | |
| 324 | + */ | |
| 325 | + public void generateWeightMsg() { | |
| 326 | + | |
| 327 | + SmsConfigQuery configQuery = new SmsConfigQuery(); | |
| 328 | + configQuery.setYn(YnEnums.YES.getId()); | |
| 329 | + configQuery.setPrefixTypes(new Integer[]{0, 1}); | |
| 330 | + //查询出对应医院配置 | |
| 331 | + List<SmsConfigModel> smsConfigModels = smsConfigService.querySmsConfig(configQuery); | |
| 332 | + if (CollectionUtils.isNotEmpty(smsConfigModels)) | |
| 333 | + { | |
| 334 | + for (SmsConfigModel configModel : smsConfigModels) | |
| 335 | + { | |
| 336 | + // 1 推送服务, 2 推送和短信服务 3短信服务, | |
| 337 | + int startType = smsConfigFacade.hospitalIsStart(configModel.getHospitalId(), configModel, SmsServiceEnums.TZCBTX.getId()); | |
| 338 | + if (startType == 0) { | |
| 339 | + return; | |
| 340 | + } | |
| 341 | + | |
| 342 | + Date date = DateUtil.addWeek(DateUtil.addDay(new Date(),-1),-4); | |
| 343 | + Date start = DateUtil.getDayFirstSecond(date); | |
| 344 | + Date end = DateUtil.getDayLastSecond(date); | |
| 345 | + List<PatientWeight> patientWeights = mongoTemplate.find(Query.query(Criteria.where("isNormal"). | |
| 346 | + is("false").and("lastMenses").gt(start).lte(end)), PatientWeight.class); | |
| 347 | + | |
| 348 | + Date date1 = DateUtil.addWeek(DateUtil.addDay(new Date(),-1),-8); | |
| 349 | + Date start1 = DateUtil.getDayFirstSecond(date1); | |
| 350 | + Date end1 = DateUtil.getDayLastSecond(date1); | |
| 351 | + patientWeights.addAll(mongoTemplate.find(Query.query(Criteria.where("isNormal"). | |
| 352 | + is("false").and("modified").gt(start1).lte(end1)), PatientWeight.class)); | |
| 353 | + | |
| 354 | + if (CollectionUtils.isNotEmpty(patientWeights)) | |
| 355 | + { | |
| 356 | + for (PatientWeight weight : patientWeights) | |
| 357 | + { | |
| 358 | + //短信前缀 | |
| 359 | + String messagePrefix = smsConfigFacade.getMsgPrefix(configModel, weight.getOperaterId(), ServiceObjEnums.YUNOBJ.getId()); | |
| 360 | + | |
| 361 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 362 | + MsgRequest mr = new MsgRequest(); | |
| 363 | + | |
| 364 | + String content = "【" + messagePrefix + "】" + ("216".equals(weight.getHospitalId()) ? QHDFY_WEIGHT_MSG_CONTENT : WEIGHT_MSG_CONTENT); | |
| 365 | + | |
| 366 | + mr.setFirst(content); | |
| 367 | + mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 368 | + Patients patients = patientsService.findOnePatientById(weight.getPatientId()); | |
| 369 | + mr.setPhone(patients.getPhone()); | |
| 370 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 371 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd(new Date())+" 16:00:00"); | |
| 372 | + mr.setSubTypeId(SmsServiceEnums.TZCBTX.getId()); | |
| 373 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 374 | + mr.setTimeType(SmsTimeTypeEnums.NO_ONTIME.getId()); | |
| 375 | + | |
| 376 | + mr.setHospitalId(weight.getHospitalId()); | |
| 377 | + mr.setTempId(weight.getId()); | |
| 378 | + mr.setPatientId(patients.getId()); | |
| 379 | + | |
| 380 | + mr.setKeyword1("产科医生"); | |
| 381 | + mr.setKeyword2(DateUtil.getyyyy_MM_dd(new Date())); | |
| 382 | + mr.setRemark(""); | |
| 383 | + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 384 | + mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 385 | + mr.setServiceType(startType); | |
| 386 | + | |
| 387 | + mr.setWxTempId(WxTempleteIdEnums.YUN_XUE_KE_CHEN_TX.getId()); | |
| 388 | + messages.add(mr); | |
| 389 | + ExceptionUtils.catchException("generateWeightMsg msg = " + mr); | |
| 390 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 391 | + smsConfigFacade.saveMsg(messages, weight.getHospitalId()); | |
| 392 | + } | |
| 393 | + | |
| 394 | + } | |
| 395 | + } | |
| 396 | + } | |
| 397 | + } | |
| 398 | + } | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 249 | 403 | @Override |
| 250 | 404 | public BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId) { |
| 251 | 405 | boolean flag = false; |
| ... | ... | @@ -1846,6 +2000,7 @@ |
| 1846 | 2000 | |
| 1847 | 2001 | series.put("lowData", CollectionUtils.getValList(lowMap)); |
| 1848 | 2002 | series.put("highData", CollectionUtils.getValList(highMap)); |
| 2003 | + series.put("highDataMap", highMap); | |
| 1849 | 2004 | series.put("normalData", CollectionUtils.getValList(normalMap)); |
| 1850 | 2005 | } |
| 1851 | 2006 |