Commit 2cbb347890d75310d37f03501f27b4525b0c790a
1 parent
8bef8e67ef
Exists in
master
and in
6 other branches
血糖
Showing 4 changed files with 92 additions and 37 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
View file @
2cbb347
... | ... | @@ -987,7 +987,7 @@ |
987 | 987 | beforeWeight = weight.getBeforeWeight() == null ? "" : weight.getBeforeWeight(); |
988 | 988 | beforeHeight = weight.getBeforeHeight() == null ? "" : weight.getBeforeHeight(); |
989 | 989 | lastWeight = weight.getNowWeight() == null ? "" : weight.getNowWeight(); |
990 | - tireNumber = weight.getBregmatic() == null ? "" : (Integer.valueOf(weight.getBregmatic()) < 3 ? weight.getBregmatic() : weight.getBregmaticOther()); | |
990 | + tireNumber = !StringUtils.isNotEmpty(weight.getBregmatic()) ? "1" : (Integer.valueOf(weight.getBregmatic()) < 3 ? weight.getBregmatic() : weight.getBregmaticOther()); | |
991 | 991 | } |
992 | 992 | else |
993 | 993 | { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java
View file @
2cbb347
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
View file @
2cbb347
... | ... | @@ -61,12 +61,13 @@ |
61 | 61 | @Autowired |
62 | 62 | private PatientsService patientService; |
63 | 63 | |
64 | - private static Map<String,String> typeGuideMap =new HashMap<>(); | |
64 | + private static Map<String, String> typeGuideMap = new HashMap<>(); | |
65 | + | |
65 | 66 | static { |
66 | - typeGuideMap.put("00","在这周你的血压值和血压波动均在正常范围之内,但是也需要注意饮食和运动。高油高盐饮食以及体重过重都会增加患妊娠期高血压的风险。此外保持心理平衡也是减少患妊高症的关键因素之一。"); | |
67 | - typeGuideMap.put("11","在这周你的血压值在正常范围之内,但血压波动情况异常,在饮食、运动等方面都需要注意。由于血压的不稳定,在心理上你也承受着一定的压力,在这份报告中将根据你的血压值和血压波动情况建议你下一周的饮食和运动方式以及心理疏导。"); | |
68 | - typeGuideMap.put("01","在这周你的血压值在异常范围但血压的波动情况良好没有较大的起伏。因此在饮食、运动等方面都需要注意。由于血压值的异常,在心理上你也承受着一定的压力,在这份报告中将根据你的血压值和血压波动情况建议你下一周的饮食和运动方式以及心理疏导。"); | |
69 | - typeGuideMap.put("10","在这周你的血压值正常,但是血压波动幅度较大。在降压的同时也要保持血压波动的平稳。血压波动异常可由多种原因导致,你需要合理饮食、适当运动、保持心理平衡等以保持血压的平稳。"); | |
67 | + typeGuideMap.put("00", "在这周你的血压值和血压波动均在正常范围之内,但是也需要注意饮食和运动。高油高盐饮食以及体重过重都会增加患妊娠期高血压的风险。此外保持心理平衡也是减少患妊高症的关键因素之一。"); | |
68 | + typeGuideMap.put("11", "在这周你的血压值在正常范围之内,但血压波动情况异常,在饮食、运动等方面都需要注意。由于血压的不稳定,在心理上你也承受着一定的压力,在这份报告中将根据你的血压值和血压波动情况建议你下一周的饮食和运动方式以及心理疏导。"); | |
69 | + typeGuideMap.put("01", "在这周你的血压值在异常范围但血压的波动情况良好没有较大的起伏。因此在饮食、运动等方面都需要注意。由于血压值的异常,在心理上你也承受着一定的压力,在这份报告中将根据你的血压值和血压波动情况建议你下一周的饮食和运动方式以及心理疏导。"); | |
70 | + typeGuideMap.put("10", "在这周你的血压值正常,但是血压波动幅度较大。在降压的同时也要保持血压波动的平稳。血压波动异常可由多种原因导致,你需要合理饮食、适当运动、保持心理平衡等以保持血压的平稳。"); | |
70 | 71 | } |
71 | 72 | |
72 | 73 | /** |
... | ... | @@ -114,7 +115,7 @@ |
114 | 115 | List<String> keys = new ArrayList<>(bp.getInfos().keySet()); |
115 | 116 | int count = 0, bpcount = 0, |
116 | 117 | index = 0; |
117 | - String countType="0",bpCountType="0"; | |
118 | + String countType = "0", bpCountType = "0"; | |
118 | 119 | if (!set.isEmpty()) { |
119 | 120 | for (Map.Entry<String, Map<String, Object>> entry : set) { |
120 | 121 | Map<String, Object> entryMap = entry.getValue(); |
... | ... | @@ -126,7 +127,7 @@ |
126 | 127 | ++count; |
127 | 128 | } |
128 | 129 | |
129 | - if (keys.size() - 1 >=++index ) { | |
130 | + if (keys.size() - 1 >= ++index) { | |
130 | 131 | //计算血压波动异常次数 |
131 | 132 | String mapKey = keys.get(index); |
132 | 133 | |
133 | 134 | |
134 | 135 | |
... | ... | @@ -140,19 +141,19 @@ |
140 | 141 | } |
141 | 142 | } |
142 | 143 | } |
143 | - if(bpcount>=3){ | |
144 | - bpCountType="1"; | |
144 | + if (bpcount >= 3) { | |
145 | + bpCountType = "1"; | |
145 | 146 | } |
146 | 147 | |
147 | - if(count>=3){ | |
148 | - countType="1"; | |
148 | + if (count >= 3) { | |
149 | + countType = "1"; | |
149 | 150 | } |
150 | 151 | } |
151 | 152 | } |
152 | 153 | |
153 | 154 | report.setStatus(0); |
154 | - report.setType(bpCountType+countType); | |
155 | - report.setGuide(bp.getInfos().size()>=5?typeGuideMap.get(report.getType()):"在这周你的血压测量次数没有达到可以出报告的标准,但是根据你的孕周这份报告可以给你提供相应的膳食指导。"); | |
155 | + report.setType(bpCountType + countType); | |
156 | + report.setGuide(bp.getInfos().size() >= 5 ? typeGuideMap.get(report.getType()) : "在这周你的血压测量次数没有达到可以出报告的标准,但是根据你的孕周这份报告可以给你提供相应的膳食指导。"); | |
156 | 157 | report.setBpWaveCount(String.valueOf(bpcount)); |
157 | 158 | report.setBpValExp(String.valueOf(count)); |
158 | 159 | report.setYn(YnEnums.YES.getId()); |
159 | 160 | |
160 | 161 | |
... | ... | @@ -309,14 +310,17 @@ |
309 | 310 | } |
310 | 311 | |
311 | 312 | @Override |
312 | - public List<Map<String, Object>> getAppInfo(String parentId) { | |
313 | + public Map<String,Object> getAppInfo(String parentId) { | |
313 | 314 | List<BloodPressure> bloodPressure = mongoTemplate.find(Query.query(Criteria.where("pid").is(parentId)), BloodPressure.class); |
314 | 315 | List<Map<String, Object>> restList = new ArrayList<>(); |
316 | + int count = 0; | |
315 | 317 | if (CollectionUtils.isNotEmpty(bloodPressure)) { |
316 | 318 | for (BloodPressure b : bloodPressure) { |
317 | 319 | Map<String, Map<String, Object>> infos = b.getInfos(); |
318 | 320 | Object[] keys = infos.keySet().toArray(); |
319 | 321 | CollectionUtils.reverseArray(keys); |
322 | + Object[] items = getKeys(keys); | |
323 | + count = getExceptionCount(items, infos); | |
320 | 324 | for (Object key : keys) { |
321 | 325 | Map<String, Object> temp = new HashMap<>(); |
322 | 326 | Map<String, Object> info = infos.get(key); |
323 | 327 | |
324 | 328 | |
325 | 329 | |
326 | 330 | |
... | ... | @@ -329,14 +333,47 @@ |
329 | 333 | } |
330 | 334 | } |
331 | 335 | CollectionUtils.sortListByMapKeyWithDate(restList, "createTime"); |
332 | - return restList; | |
336 | + Map<String,Object> map = new HashMap<>(); | |
337 | + map.put("restList",restList); | |
338 | + map.put("excetionCount",count); | |
339 | + return map; | |
333 | 340 | } |
334 | 341 | |
335 | - private int bloodPressureExceptionCount() | |
342 | + private int getExceptionCount(Object[] items, Map<String, Map<String, Object>> infos) | |
336 | 343 | { |
337 | - | |
338 | 344 | int count = 0; |
345 | + for (Object key : items) { | |
346 | + Map<String, Object> info = infos.get(key); | |
347 | + if (info == null) | |
348 | + { | |
349 | + continue; | |
350 | + } | |
351 | + Object szy = info.get("szy"); | |
352 | + Object ssy = info.get("ssy"); | |
353 | + int result = getPressureStatus(String.valueOf(ssy),String.valueOf(szy)); | |
354 | + if (result != 0) | |
355 | + { | |
356 | + count++; | |
357 | + } | |
358 | + } | |
339 | 359 | return count; |
360 | + } | |
361 | + | |
362 | + | |
363 | + | |
364 | + private Object[] getKeys(Object[] keys) | |
365 | + { | |
366 | + Object[] items = new Object[keys.length]; | |
367 | + Object obj = keys[0]; | |
368 | + for (int i = 0; i < keys.length; i++) { | |
369 | + String date = DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.parseYMD(String.valueOf(obj)), -i)); | |
370 | + if (!date.equals(keys[i])) | |
371 | + { | |
372 | + break; | |
373 | + } | |
374 | + items[i] = keys[i]; | |
375 | + } | |
376 | + return items; | |
340 | 377 | } |
341 | 378 | |
342 | 379 | @Override |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
2cbb347
... | ... | @@ -509,36 +509,54 @@ |
509 | 509 | bss.add(bloodSugar); |
510 | 510 | maps.put(bloodSugar.getCreatYmdDate(),bss); |
511 | 511 | } |
512 | - } | |
513 | 512 | |
514 | - maps = sortMapByKey(maps); | |
515 | - if (maps.size() > 0) | |
516 | - { | |
517 | - for (String key : maps.keySet()) | |
513 | + maps = sortMapByKey(maps); | |
514 | + maps = doHandle(maps,bloodSugars.get(0).getCreatYmdDate()); | |
515 | + if (maps.size() > 0 && maps.size() >= 3) | |
518 | 516 | { |
519 | - boolean isBreak = false; | |
520 | - List<BloodSugar> bss = maps.get(key); | |
521 | - if (CollectionUtils.isNotEmpty(bss)) | |
517 | + for (String key : maps.keySet()) | |
522 | 518 | { |
523 | - for (BloodSugar bs : bss) | |
519 | + boolean isBreak = false; | |
520 | + List<BloodSugar> bss = maps.get(key); | |
521 | + if (CollectionUtils.isNotEmpty(bss)) | |
524 | 522 | { |
525 | - int status = getBloodSugarStatus(bs.getBloodSugarType(),Float.parseFloat(bs.getBloodSugar())); | |
526 | - if (status != 0) | |
523 | + for (BloodSugar bs : bss) | |
527 | 524 | { |
528 | - isBreak = true; | |
529 | - count++; | |
530 | - break; | |
525 | + int status = getBloodSugarStatus(bs.getBloodSugarType(),Float.parseFloat(bs.getBloodSugar())); | |
526 | + if (status != 0) | |
527 | + { | |
528 | + isBreak = true; | |
529 | + count++; | |
530 | + break; | |
531 | + } | |
531 | 532 | } |
532 | 533 | } |
534 | + if (!isBreak || count >=5) | |
535 | + { | |
536 | + break; | |
537 | + } | |
533 | 538 | } |
534 | - if (!isBreak || count >=5) | |
539 | + } | |
540 | + } | |
541 | + return count; | |
542 | + } | |
543 | + | |
544 | + private Map<String, List<BloodSugar>> doHandle(Map<String, List<BloodSugar>> maps,String lastDate) | |
545 | + { | |
546 | + Map<String, List<BloodSugar>> result = new HashMap<>(); | |
547 | + if (maps.size() > 0 && maps.size() >= 3) { | |
548 | + int index = 0; | |
549 | + for (String key : maps.keySet()) { | |
550 | + String date = DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.parseYMD(lastDate), index)); | |
551 | + if (!date.equals(key)) | |
535 | 552 | { |
536 | - break; | |
553 | + break; | |
537 | 554 | } |
555 | + result.put(key,maps.get(key)); | |
556 | + index--; | |
538 | 557 | } |
539 | 558 | } |
540 | - | |
541 | - return count; | |
559 | + return result; | |
542 | 560 | } |
543 | 561 | |
544 | 562 |