Commit 94db403ea5c55964893ef952e26dc667336efcae
1 parent
b428519279
Exists in
master
and in
6 other branches
体重管理相关代码
Showing 2 changed files with 34 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
94db403
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 9 | 9 | import com.lyms.platform.operate.web.service.PatientWeightService; |
| 10 | 10 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
| 11 | +import com.lyms.platform.operate.web.utils.MathUtil; | |
| 11 | 12 | import com.lyms.platform.operate.web.utils.MongoUtil; |
| 12 | 13 | import com.lyms.platform.pojo.PatientWeight; |
| 13 | 14 | import com.lyms.platform.pojo.Patients; |
| ... | ... | @@ -668,9 +669,9 @@ |
| 668 | 669 | |
| 669 | 670 | Map<String, Object> reportModel = new HashMap<>(); |
| 670 | 671 | Map<String, Object> series = new HashMap<>(); |
| 671 | - series.put("lowData", CollectionUtils.getValList(lowMap)); | |
| 672 | - series.put("highData", CollectionUtils.getValList(highMap)); | |
| 673 | - series.put("normalData", CollectionUtils.getValList(normalMap)); | |
| 672 | + series.put("lowData", MathUtil.doubleFormat2(CollectionUtils.getValList(lowMap))); | |
| 673 | + series.put("highData", MathUtil.doubleFormat2(CollectionUtils.getValList(highMap))); | |
| 674 | + series.put("normalData", MathUtil.doubleFormat2(CollectionUtils.getValList(normalMap))); | |
| 674 | 675 | |
| 675 | 676 | series.put("dayWeights", restList); |
| 676 | 677 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MathUtil.java
View file @
94db403
| ... | ... | @@ -4,6 +4,8 @@ |
| 4 | 4 | |
| 5 | 5 | import java.math.BigDecimal; |
| 6 | 6 | import java.text.DecimalFormat; |
| 7 | +import java.util.ArrayList; | |
| 8 | +import java.util.List; | |
| 7 | 9 | |
| 8 | 10 | /** |
| 9 | 11 | * @Author: litao |
| ... | ... | @@ -36,6 +38,34 @@ |
| 36 | 38 | public static String doubleFormat(Double d) { |
| 37 | 39 | DecimalFormat df = new DecimalFormat("######0.00"); |
| 38 | 40 | return df.format(d); |
| 41 | + } | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 格式化dubbo类型数据 保留1位 | |
| 45 | + * @param d | |
| 46 | + * @return | |
| 47 | + */ | |
| 48 | + public static Double doubleFormat2(Double d) { | |
| 49 | + DecimalFormat df = new DecimalFormat("######0.0"); | |
| 50 | + return Double.parseDouble(df.format(d)); | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 格式化dubbo类型数据 保留1位 | |
| 55 | + */ | |
| 56 | + public static List<Double> doubleFormat2(List<Double> list) { | |
| 57 | + List<Double> restList = new ArrayList<>(); | |
| 58 | + if(CollectionUtils.isNotEmpty(list)) { | |
| 59 | + for (Double d : restList) { | |
| 60 | + restList.add(d); | |
| 61 | + } | |
| 62 | + } | |
| 63 | + return restList; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public static void main(String[] args) { | |
| 67 | + Double d = 0.0533; | |
| 68 | + System.out.println(doubleFormat2(d)); | |
| 39 | 69 | } |
| 40 | 70 | |
| 41 | 71 | /** |