Commit ccb038bea3b82d6743281b8a0517c48d4413d8fa
1 parent
df0ccbd05f
Exists in
master
and in
6 other branches
bmi保留两位小数,不进行四舍五入
Showing 1 changed file with 4 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
ccb038b
| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | import org.springframework.data.mongodb.core.query.Query; |
| 37 | 37 | import org.springframework.stereotype.Component; |
| 38 | 38 | |
| 39 | +import java.math.RoundingMode; | |
| 39 | 40 | import java.text.SimpleDateFormat; |
| 40 | 41 | import java.util.*; |
| 41 | 42 | |
| ... | ... | @@ -1412,6 +1413,7 @@ |
| 1412 | 1413 | |
| 1413 | 1414 | map.put("height", UnitUtils.unitSplice(data.getHeight(), UnitConstants.CM)); |
| 1414 | 1415 | map.put("weight", UnitUtils.unitSplice(data.getWeight(), UnitConstants.KG)); |
| 1416 | + //bmi指数 | |
| 1415 | 1417 | map.put("baricIndex", data.getBaricIndex()); |
| 1416 | 1418 | map.put("yqWeight", UnitUtils.unitSplice(data.getYqWeight(), UnitConstants.KG)); |
| 1417 | 1419 | // 血压 |
| 1418 | 1420 | |
| ... | ... | @@ -1779,8 +1781,9 @@ |
| 1779 | 1781 | try { |
| 1780 | 1782 | //体重指数计算规则:孕前体重/身高(单位米)的平方 |
| 1781 | 1783 | java.text.DecimalFormat df = new java.text.DecimalFormat("#.#"); |
| 1784 | + df.setRoundingMode(RoundingMode.FLOOR); | |
| 1782 | 1785 | double tzzs = Double.parseDouble(data.getYqWeight()) / Math.pow(Double.parseDouble(data.getHeight()) / 100, 2); |
| 1783 | - System.out.println("tzzs==================" + tzzs); | |
| 1786 | + System.out.println("tzzs==================" + tzzs+""); | |
| 1784 | 1787 | map.put("tzzs", df.format(tzzs)); |
| 1785 | 1788 | } catch (Exception e) { |
| 1786 | 1789 | ExceptionUtils.catchException(e, "体重指数计算错误"); |