Commit 46cd9d8e708be30f8a007317ac589605e6459030
1 parent
9ed9a9ff2e
Exists in
master
and in
6 other branches
体重报告
Showing 1 changed file with 144 additions and 31 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
46cd9d8
... | ... | @@ -545,6 +545,7 @@ |
545 | 545 | String yunqi = "孕" + String.valueOf(week) + "期"; |
546 | 546 | map.put("yunqi", yunqi); |
547 | 547 | } |
548 | + map.put("week",week); | |
548 | 549 | map.put("height", patientWeight.getBeforeHeight() == null ? "" : MathUtil.doubleFormat(Double.parseDouble(patientWeight.getBeforeHeight()) / 100) + " 米"); |
549 | 550 | map.put("beforeWeight", patientWeight.getBeforeWeight() == null ? "" : patientWeight.getBeforeWeight() + " 公斤"); |
550 | 551 | map.put("bmi", patientWeight.getBmi()); |
... | ... | @@ -560,8 +561,18 @@ |
560 | 561 | if (week > 5 && week < 41) { |
561 | 562 | double bmi = Double.parseDouble(patientWeight.getBmi()); |
562 | 563 | //根据高危获取不同的卡路里计算公式 |
563 | - Map<String, String> kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), | |
564 | - Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight()); | |
564 | + | |
565 | + Map<String, String> kmap = null; | |
566 | + //威海市妇幼热量单独计算 | |
567 | + if ("2100001635".equals(hospitalId)) | |
568 | + { | |
569 | + kmap = getWhComputeKul(week,Double.parseDouble(patientWeight.getNowWeight()), Double.parseDouble(patientWeight.getBeforeWeight()), patientWeight.getBregmatic(), bmi); | |
570 | + } | |
571 | + else | |
572 | + { | |
573 | + kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), | |
574 | + Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight()); | |
575 | + } | |
565 | 576 | if (map == null || map.size() == 0) { |
566 | 577 | return null; |
567 | 578 | } |
... | ... | @@ -578,6 +589,7 @@ |
578 | 589 | setYSYZ(map,ComputeKulServiceManager.getPatientGuideMap().get(rid+nsArea)); |
579 | 590 | //设置饮食原则 |
580 | 591 | setYYZN(map,ComputeKulServiceManager.getPatientGuideMap().get(rid+nsArea)); |
592 | + | |
581 | 593 | } |
582 | 594 | } |
583 | 595 | } |
... | ... | @@ -597,6 +609,7 @@ |
597 | 609 | return RespBuilder.buildSuccess(); |
598 | 610 | } |
599 | 611 | |
612 | + | |
600 | 613 | @Override |
601 | 614 | public BaseResponse wxReport(String pid) { |
602 | 615 | PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), PatientWeight.class); |
... | ... | @@ -898,7 +911,6 @@ |
898 | 911 | map.put("ysyz", patientGuide.getYsyz()); |
899 | 912 | map.put("cookbookTitle", "饮食原则"); |
900 | 913 | } |
901 | - | |
902 | 914 | private void setYYZN(Map<String, Object> map, ComputeKulServiceManager.PatientGuide patientGuide) { |
903 | 915 | if(null==patientGuide){ |
904 | 916 | return; |
... | ... | @@ -1099,8 +1111,7 @@ |
1099 | 1111 | } |
1100 | 1112 | String title = ""; |
1101 | 1113 | String color = ""; |
1102 | - double low = 1; | |
1103 | - double high = 1.5D; | |
1114 | + | |
1104 | 1115 | String bmiStr = ""; |
1105 | 1116 | |
1106 | 1117 | //空和1表示单胎 |
1107 | 1118 | |
1108 | 1119 | |
1109 | 1120 | |
... | ... | @@ -1138,12 +1149,47 @@ |
1138 | 1149 | } |
1139 | 1150 | } |
1140 | 1151 | |
1152 | + List<Integer> xAxis = new ArrayList<>(); | |
1141 | 1153 | |
1154 | + Map<String, Object> reportModel = new LinkedHashMap<>(); | |
1155 | + Map<String, Object> series = new LinkedHashMap<>(); | |
1156 | + getSeries(series, bmiStr, bregmatic); | |
1157 | + | |
1158 | + series.put("dayWeights", restList); | |
1159 | + | |
1160 | + reportModel.put("series", series); | |
1161 | + | |
1162 | + reportModel.put("title", title); | |
1163 | + reportModel.put("color", color); | |
1164 | + | |
1165 | + for (int i = 1; i <= 40; i++) { | |
1166 | + xAxis.add(i); | |
1167 | + } | |
1168 | + reportModel.put("xAxis", xAxis); | |
1169 | + | |
1170 | + List<Object> list = new ArrayList<>(); | |
1171 | + if (MapUtils.isNotEmpty(weights)) { | |
1172 | + Iterator<Map.Entry<Integer, String>> iterator = weights.entrySet().iterator(); | |
1173 | + while (iterator.hasNext()) { | |
1174 | + Map.Entry<Integer, String> next = iterator.next(); | |
1175 | + list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); | |
1176 | + } | |
1177 | + } | |
1178 | + series.put("portData", list); | |
1179 | + restMap.put("reportModel", reportModel); | |
1180 | + } | |
1181 | + | |
1182 | + | |
1183 | + public void getSeries(Map<String, Object> series,String bmiStr,String bregmatic) | |
1184 | + { | |
1185 | + | |
1142 | 1186 | Map<Integer, Double> highMap = new LinkedHashMap<>(); |
1143 | 1187 | Map<Integer, Double> normalMap = new LinkedHashMap<>(); |
1144 | 1188 | Map<Integer, Double> lowMap = new LinkedHashMap<>(); |
1145 | - List<Integer> xAxis = new ArrayList<>(); | |
1146 | 1189 | |
1190 | + double low = 1; | |
1191 | + double high = 1.5D; | |
1192 | + | |
1147 | 1193 | double avg = Double.valueOf(String.format("%.2f", low / 12)); |
1148 | 1194 | for (int i = 1; i <= 12; i++) { |
1149 | 1195 | lowMap.put(i, Double.valueOf(String.format("%.2f", i * avg))); |
1150 | 1196 | |
... | ... | @@ -1175,34 +1221,9 @@ |
1175 | 1221 | normalMap.put(i, Double.valueOf(String.format("%.2f", (highMap.get(i) + lowMap.get(i)) / 2))); |
1176 | 1222 | } |
1177 | 1223 | |
1178 | - Map<String, Object> reportModel = new LinkedHashMap<>(); | |
1179 | - Map<String, Object> series = new LinkedHashMap<>(); | |
1180 | 1224 | series.put("lowData", CollectionUtils.getValList(lowMap)); |
1181 | 1225 | series.put("highData", CollectionUtils.getValList(highMap)); |
1182 | 1226 | series.put("normalData", CollectionUtils.getValList(normalMap)); |
1183 | - | |
1184 | - series.put("dayWeights", restList); | |
1185 | - | |
1186 | - reportModel.put("series", series); | |
1187 | - | |
1188 | - reportModel.put("title", title); | |
1189 | - reportModel.put("color", color); | |
1190 | - | |
1191 | - for (int i = 1; i <= 40; i++) { | |
1192 | - xAxis.add(i); | |
1193 | - } | |
1194 | - reportModel.put("xAxis", xAxis); | |
1195 | - | |
1196 | - List<Object> list = new ArrayList<>(); | |
1197 | - if (MapUtils.isNotEmpty(weights)) { | |
1198 | - Iterator<Map.Entry<Integer, String>> iterator = weights.entrySet().iterator(); | |
1199 | - while (iterator.hasNext()) { | |
1200 | - Map.Entry<Integer, String> next = iterator.next(); | |
1201 | - list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); | |
1202 | - } | |
1203 | - } | |
1204 | - series.put("portData", list); | |
1205 | - restMap.put("reportModel", reportModel); | |
1206 | 1227 | } |
1207 | 1228 | |
1208 | 1229 | /** |
... | ... | @@ -1367,6 +1388,98 @@ |
1367 | 1388 | map.put("status", status); |
1368 | 1389 | return map; |
1369 | 1390 | } |
1391 | + | |
1392 | + | |
1393 | + | |
1394 | + public Map<String, String> getWhComputeKul(int week, double currentWeight,double beforeWeight,String bregmatic, double bmiD) { | |
1395 | + | |
1396 | + String bmiStr = null; | |
1397 | + //空和1表示单胎 | |
1398 | + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) { | |
1399 | + if (bmiD < 18.5) { | |
1400 | + bmiStr = "BMI<18.5"; | |
1401 | + } else if (bmiD >= 18.5 && bmiD <= 24.9) { | |
1402 | + bmiStr = "BMI=18.5-24.9"; | |
1403 | + } else if (bmiD > 24.9 && bmiD < 30) { | |
1404 | + bmiStr = "BMI=25-29.9"; | |
1405 | + } else if (bmiD >= 30) { | |
1406 | + bmiStr = "BMI≥30"; | |
1407 | + } | |
1408 | + } else { | |
1409 | + if (bmiD <= 24.9) { | |
1410 | + bmiStr = "BMI≤24.9"; | |
1411 | + } else if (bmiD >= 25 && bmiD <= 29.9) { | |
1412 | + bmiStr = "BMI=25-29.9"; | |
1413 | + } else if (bmiD >= 30) { | |
1414 | + bmiStr = "BMI≥30"; | |
1415 | + } | |
1416 | + } | |
1417 | + | |
1418 | + Map<String, Object> series = new LinkedHashMap<>(); | |
1419 | + getSeries(series, bmiStr, bregmatic); | |
1420 | + | |
1421 | + | |
1422 | + List<Double> highMap = (List<Double>)series.get("highMap"); | |
1423 | + List<Double> lowMap = (List<Double>)series.get("lowMap"); | |
1424 | + | |
1425 | + Map<String, String> map = new HashMap<>(); | |
1426 | + | |
1427 | + double kulStart = 0; | |
1428 | + double kulEnd = 0; | |
1429 | + String status = ""; | |
1430 | + | |
1431 | + double add = Double.valueOf(String.format("%.2f", currentWeight - beforeWeight)); | |
1432 | + | |
1433 | + double hvalue = highMap.get(week-1); | |
1434 | + double lvalue = lowMap.get(week - 1); | |
1435 | + | |
1436 | + //孕早期 | |
1437 | + if (week <= 12) { | |
1438 | + if (add < lvalue) { | |
1439 | + status = "低于"; | |
1440 | + kulStart = currentWeight * 30 ; | |
1441 | + } else if (add >= lvalue && add <= hvalue) { | |
1442 | + status = "处于"; | |
1443 | + kulStart = currentWeight * 25; | |
1444 | + } else { | |
1445 | + status = "高于"; | |
1446 | + kulStart = currentWeight * 20; | |
1447 | + } | |
1448 | + | |
1449 | + } | |
1450 | + //孕中期 | |
1451 | + else if (week < 28) { | |
1452 | + if (add < lvalue) { | |
1453 | + status = "低于"; | |
1454 | + kulStart = currentWeight * 30 +340; | |
1455 | + } else if (add >= lvalue && add <= hvalue) { | |
1456 | + status = "处于"; | |
1457 | + kulStart = currentWeight * 25 + 340; | |
1458 | + } else { | |
1459 | + status = "高于"; | |
1460 | + kulStart = currentWeight * 20 + 340; | |
1461 | + } | |
1462 | + } | |
1463 | + else | |
1464 | + { | |
1465 | + if (add < lvalue) { | |
1466 | + status = "低于"; | |
1467 | + kulStart = currentWeight * 30 + 450; | |
1468 | + } else if (add >= lvalue && add <= hvalue) { | |
1469 | + status = "处于"; | |
1470 | + kulStart = currentWeight * 25 + 450; | |
1471 | + } else { | |
1472 | + status = "高于"; | |
1473 | + kulStart = currentWeight * 20 + 450; | |
1474 | + } | |
1475 | + } | |
1476 | + kulEnd = kulStart; | |
1477 | + map.put("kulStart", String.valueOf(kulStart)); | |
1478 | + map.put("kulEnd", String.valueOf(kulEnd)); | |
1479 | + map.put("status", status); | |
1480 | + return map; | |
1481 | + } | |
1482 | + | |
1370 | 1483 | |
1371 | 1484 | /** |
1372 | 1485 | * 获取高危的饮食原则 |