Commit fa4793eace18bddbebfbc4ceb61487306284eb54
1 parent
6eb532c346
Exists in
master
and in
6 other branches
测量
Showing 4 changed files with 359 additions and 48 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-dal/src/main/java/com/lyms/platform/pojo/WeightConfigModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/MaternalDeliverResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
fa4793e
| ... | ... | @@ -790,7 +790,8 @@ |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | |
| 793 | - public static void weightMange(String fileName) | |
| 793 | + | |
| 794 | + public static void weightWeek(String fileName) | |
| 794 | 795 | { |
| 795 | 796 | |
| 796 | 797 | ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); |
| 797 | 798 | |
| ... | ... | @@ -802,13 +803,65 @@ |
| 802 | 803 | try { |
| 803 | 804 | wb = Workbook.getWorkbook(file); |
| 804 | 805 | Sheet s = wb.getSheet(0); |
| 806 | + System.out.println(s.getName() + " : "); | |
| 807 | + int rows = s.getRows(); | |
| 808 | + if(rows > 0){ | |
| 809 | + //遍历每行 | |
| 810 | + for(int i = 1 ;i < rows ; i++){ | |
| 811 | + | |
| 812 | + WeightConfigModel model = new WeightConfigModel(); | |
| 813 | + | |
| 814 | + Cell[] cells = s.getRow(i); | |
| 815 | + if(cells.length > 0){ | |
| 816 | + //遍历每行中的每列 | |
| 817 | + for (int j = 0 ; j < cells.length ; j ++) | |
| 818 | + { | |
| 819 | + String str = cells[j].getContents().trim(); | |
| 820 | + switch (j) | |
| 821 | + { | |
| 822 | + case 0: | |
| 823 | + model.setWeek(str); | |
| 824 | + continue; | |
| 825 | + case 1: | |
| 826 | + model.setWeekContent(str); | |
| 827 | + continue; | |
| 828 | + | |
| 829 | + } | |
| 830 | + } | |
| 831 | + | |
| 832 | + } | |
| 833 | + mongoTemplate.save(model); | |
| 834 | + } | |
| 835 | + } | |
| 836 | + } catch (IOException e) { | |
| 837 | + e.printStackTrace(); | |
| 838 | + } catch (BiffException e) { | |
| 839 | + e.printStackTrace(); | |
| 840 | + } | |
| 841 | + | |
| 842 | + } | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + public static void weightMange(String fileName) | |
| 847 | + { | |
| 848 | + | |
| 849 | + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml"); | |
| 850 | + MongoTemplate mongoTemplate | |
| 851 | + = (MongoTemplate) applicationContext.getBean("mongoTemplate"); | |
| 852 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
| 853 | + File file = new File(fileName); | |
| 854 | + Workbook wb = null; | |
| 855 | + try { | |
| 856 | + wb = Workbook.getWorkbook(file); | |
| 857 | + Sheet s = wb.getSheet(1); | |
| 805 | 858 | System.out.println(s.getName() + " : "); |
| 806 | 859 | int rows = s.getRows(); |
| 807 | 860 | if(rows > 0){ |
| 808 | 861 | //遍历每行 |
| 809 | 862 | for(int i = 1 ;i < rows ; i++){ |
| 810 | 863 | |
| 811 | - WeightManageConfigModel model = new WeightManageConfigModel(); | |
| 864 | + WeightConfigModel model = new WeightConfigModel(); | |
| 812 | 865 | |
| 813 | 866 | Cell[] cells = s.getRow(i); |
| 814 | 867 | if(cells.length > 0){ |
| 815 | 868 | |
| 816 | 869 | |
| 817 | 870 | |
| 818 | 871 | |
| 819 | 872 | |
| 820 | 873 | |
| 821 | 874 | |
| 822 | 875 | |
| 823 | 876 | |
| 824 | 877 | |
| 825 | 878 | |
| ... | ... | @@ -819,38 +872,45 @@ |
| 819 | 872 | switch (j) |
| 820 | 873 | { |
| 821 | 874 | case 0: |
| 822 | - model.setWeek(str); | |
| 875 | + model.setKcal(Double.parseDouble(str)); | |
| 876 | + continue; | |
| 823 | 877 | case 1: |
| 824 | - model.setExample(str); | |
| 878 | + String[] arr = str.split("-"); | |
| 879 | + model.setKcalStart(Double.parseDouble(arr[0])); | |
| 880 | + model.setKcalEnd(Double.parseDouble(arr[1])); | |
| 881 | + continue; | |
| 825 | 882 | case 2: |
| 826 | 883 | model.setBreakfast(str); |
| 884 | + continue; | |
| 827 | 885 | case 3: |
| 828 | 886 | model.setBreakfastAdd(str); |
| 887 | + continue; | |
| 829 | 888 | case 4: |
| 830 | 889 | model.setLunch(str); |
| 890 | + continue; | |
| 831 | 891 | case 5: |
| 832 | 892 | model.setLunchAdd(str); |
| 893 | + continue; | |
| 833 | 894 | case 6: |
| 834 | 895 | model.setDinner(str); |
| 896 | + continue; | |
| 835 | 897 | case 7: |
| 836 | 898 | model.setDinnerAdd(str); |
| 899 | + continue; | |
| 837 | 900 | case 8: |
| 838 | - model.setWeightType(str); | |
| 901 | + model.setNorthSouth(str); | |
| 902 | + continue; | |
| 839 | 903 | case 9: |
| 840 | 904 | List<String> list1 = Arrays.asList(str.split("\n")); |
| 841 | 905 | model.setSuggests(list1); |
| 906 | + continue; | |
| 842 | 907 | } |
| 843 | 908 | } |
| 844 | 909 | |
| 845 | 910 | } |
| 846 | - System.out.println("week=" + model.getWeek()+";type="+model.getWeightType()); | |
| 847 | 911 | mongoTemplate.save(model); |
| 848 | 912 | } |
| 849 | 913 | } |
| 850 | - | |
| 851 | - | |
| 852 | - | |
| 853 | - | |
| 854 | 914 | } catch (IOException e) { |
| 855 | 915 | e.printStackTrace(); |
| 856 | 916 | } catch (BiffException e) { |
| 857 | 917 | |
| ... | ... | @@ -871,12 +931,12 @@ |
| 871 | 931 | = (MongoTemplate) applicationContext.getBean("mongoTemplate"); |
| 872 | 932 | mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); |
| 873 | 933 | |
| 874 | - Sheet s1 = wb.getSheet(1); | |
| 934 | + Sheet s1 = wb.getSheet(2); | |
| 875 | 935 | int rows1 = s1.getRows(); |
| 876 | 936 | if(rows1 > 0){ |
| 877 | 937 | //遍历每行 |
| 878 | 938 | for(int i = 1 ;i < rows1 ; i++){ |
| 879 | - WeightManageConfigModel.Cookbook cookbook = new WeightManageConfigModel.Cookbook(); | |
| 939 | + WeightConfigModel.Cookbook cookbook = new WeightConfigModel.Cookbook(); | |
| 880 | 940 | Cell[] cells = s1.getRow(i); |
| 881 | 941 | if(cells.length > 0){ |
| 882 | 942 | //遍历每行中的每列 |
| 883 | 943 | |
| 884 | 944 | |
| 885 | 945 | |
| 886 | 946 | |
| 887 | 947 | |
| 888 | 948 | |
| 889 | 949 | |
| 890 | 950 | |
| 891 | 951 | |
| ... | ... | @@ -887,39 +947,45 @@ |
| 887 | 947 | switch (j) |
| 888 | 948 | { |
| 889 | 949 | case 0: |
| 890 | - cookbook.setWeek(str); | |
| 950 | + cookbook.setKcal(Double.parseDouble(str)); | |
| 951 | + continue; | |
| 891 | 952 | case 1: |
| 892 | - cookbook.setVegetable(str); | |
| 953 | + String[] arr = str.split("-"); | |
| 954 | + cookbook.setKcalStart(Double.parseDouble(arr[0])); | |
| 955 | + cookbook.setKcalEnd(Double.parseDouble(arr[1])); | |
| 956 | + continue; | |
| 893 | 957 | case 2: |
| 894 | - cookbook.setFoodMaterial(str); | |
| 958 | + cookbook.setVegetable(str); | |
| 959 | + continue; | |
| 895 | 960 | case 3: |
| 961 | + cookbook.setFoodMaterial(str); | |
| 962 | + continue; | |
| 963 | + case 4: | |
| 896 | 964 | List<String> list1 = Arrays.asList(str.split("\n")); |
| 897 | 965 | cookbook.setMakeMethod(list1); |
| 898 | - case 4: | |
| 899 | - cookbook.setWeightType(str); | |
| 900 | - | |
| 966 | + continue; | |
| 901 | 967 | } |
| 902 | 968 | |
| 903 | 969 | |
| 904 | 970 | } |
| 905 | 971 | |
| 906 | - WeightManageConfigModel weightManageConfigModel = | |
| 907 | - mongoTemplate.findOne(Query.query(Criteria.where("week").is(cookbook.getWeek()).and("weightType").is(cookbook.getWeightType())), | |
| 908 | - WeightManageConfigModel.class); | |
| 972 | + WeightConfigModel weightConfigModel = | |
| 973 | + mongoTemplate.findOne(Query.query(Criteria.where("kcal").is(cookbook.getKcal())), | |
| 974 | + WeightConfigModel.class); | |
| 909 | 975 | |
| 910 | - List<WeightManageConfigModel.Cookbook> cookbooks = weightManageConfigModel.getCookbooks(); | |
| 976 | + List<WeightConfigModel.Cookbook> cookbooks = weightConfigModel.getCookbooks(); | |
| 911 | 977 | if (cookbooks == null) |
| 912 | 978 | { |
| 913 | 979 | cookbooks = new ArrayList<>(); |
| 914 | 980 | } |
| 915 | 981 | cookbooks.add(cookbook); |
| 916 | - weightManageConfigModel.setCookbooks(cookbooks); | |
| 982 | + weightConfigModel.setCookbooks(cookbooks); | |
| 917 | 983 | |
| 918 | 984 | Update update = MongoConvertHelper |
| 919 | - .convertToNativeUpdate(ReflectionUtils.getUpdateField(weightManageConfigModel)); | |
| 985 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(weightConfigModel)); | |
| 920 | 986 | |
| 921 | - mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(weightManageConfigModel.getId())),update, | |
| 922 | - WeightManageConfigModel.class); | |
| 987 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(weightConfigModel.getId())),update, | |
| 988 | + WeightConfigModel.class); | |
| 923 | 989 | |
| 924 | 990 | } |
| 925 | 991 | } |
| ... | ... | @@ -935,8 +1001,9 @@ |
| 935 | 1001 | |
| 936 | 1002 | |
| 937 | 1003 | public static void main(String[] args) { |
| 938 | - weightMange("F:\\体重与营养管理\\体重营养配置模板.xls"); | |
| 939 | - weightFood("F:\\体重与营养管理\\体重营养配置模板.xls"); | |
| 1004 | + weightWeek("F:\\体重与营养管理\\第三版体重配置模板.xls"); | |
| 1005 | + weightMange("F:\\体重与营养管理\\第三版体重配置模板.xls"); | |
| 1006 | + weightFood("F:\\体重与营养管理\\第三版体重配置模板.xls"); | |
| 940 | 1007 | } |
| 941 | 1008 | |
| 942 | 1009 | public static void addBaby(ApplicationContext applicationContext) { |
platform-dal/src/main/java/com/lyms/platform/pojo/WeightConfigModel.java
View file @
fa4793e
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 4 | + | |
| 5 | +import java.io.Serializable; | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by Administrator on 2018-06-04. | |
| 10 | + */ | |
| 11 | +@Document(collection = "lyms_weight_config_test") | |
| 12 | +public class WeightConfigModel { | |
| 13 | + private String id; | |
| 14 | + private String week;//孕周 | |
| 15 | + private Double kcal; //整值卡路里 | |
| 16 | + private Double kcalStart; //整值卡路里区间值 | |
| 17 | + private Double kcalEnd; //整值卡路里区间值 | |
| 18 | + | |
| 19 | + private String weekContent;//当前孕周的营养指南 | |
| 20 | + | |
| 21 | + private String breakfast;//早餐 | |
| 22 | + private String breakfastAdd;//上午加餐 | |
| 23 | + private String lunch;//午餐 | |
| 24 | + private String lunchAdd;//下午加餐 | |
| 25 | + private String dinner;//晚餐 | |
| 26 | + private String dinnerAdd;//晚加餐 | |
| 27 | + | |
| 28 | + //菜谱 | |
| 29 | + private List<Cookbook> cookbooks; | |
| 30 | + | |
| 31 | + private String northSouth;//南北 | |
| 32 | + private List<String> suggests;//建议 | |
| 33 | + | |
| 34 | + public String getId() { | |
| 35 | + return id; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setId(String id) { | |
| 39 | + this.id = id; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public String getWeek() { | |
| 43 | + return week; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void setWeek(String week) { | |
| 47 | + this.week = week; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public Double getKcal() { | |
| 51 | + return kcal; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setKcal(Double kcal) { | |
| 55 | + this.kcal = kcal; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public Double getKcalStart() { | |
| 59 | + return kcalStart; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setKcalStart(Double kcalStart) { | |
| 63 | + this.kcalStart = kcalStart; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public Double getKcalEnd() { | |
| 67 | + return kcalEnd; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setKcalEnd(Double kcalEnd) { | |
| 71 | + this.kcalEnd = kcalEnd; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public String getWeekContent() { | |
| 75 | + return weekContent; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setWeekContent(String weekContent) { | |
| 79 | + this.weekContent = weekContent; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getBreakfast() { | |
| 83 | + return breakfast; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setBreakfast(String breakfast) { | |
| 87 | + this.breakfast = breakfast; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public String getBreakfastAdd() { | |
| 91 | + return breakfastAdd; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setBreakfastAdd(String breakfastAdd) { | |
| 95 | + this.breakfastAdd = breakfastAdd; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public String getLunch() { | |
| 99 | + return lunch; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setLunch(String lunch) { | |
| 103 | + this.lunch = lunch; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public String getLunchAdd() { | |
| 107 | + return lunchAdd; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public void setLunchAdd(String lunchAdd) { | |
| 111 | + this.lunchAdd = lunchAdd; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public String getDinner() { | |
| 115 | + return dinner; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public void setDinner(String dinner) { | |
| 119 | + this.dinner = dinner; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public String getDinnerAdd() { | |
| 123 | + return dinnerAdd; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public void setDinnerAdd(String dinnerAdd) { | |
| 127 | + this.dinnerAdd = dinnerAdd; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public List<Cookbook> getCookbooks() { | |
| 131 | + return cookbooks; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public void setCookbooks(List<Cookbook> cookbooks) { | |
| 135 | + this.cookbooks = cookbooks; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public String getNorthSouth() { | |
| 139 | + return northSouth; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public void setNorthSouth(String northSouth) { | |
| 143 | + this.northSouth = northSouth; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public List<String> getSuggests() { | |
| 147 | + return suggests; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public void setSuggests(List<String> suggests) { | |
| 151 | + this.suggests = suggests; | |
| 152 | + } | |
| 153 | + | |
| 154 | + @Override | |
| 155 | + public String toString() { | |
| 156 | + return "WeightManageConfigModel{" + | |
| 157 | + "id='" + id + '\'' + | |
| 158 | + ", week='" + week + '\'' + | |
| 159 | + ", kcal=" + kcal + | |
| 160 | + ", kcalStart=" + kcalStart + | |
| 161 | + ", kcalEnd=" + kcalEnd + | |
| 162 | + ", weekContent='" + weekContent + '\'' + | |
| 163 | + ", breakfast='" + breakfast + '\'' + | |
| 164 | + ", breakfastAdd='" + breakfastAdd + '\'' + | |
| 165 | + ", lunch='" + lunch + '\'' + | |
| 166 | + ", lunchAdd='" + lunchAdd + '\'' + | |
| 167 | + ", dinner='" + dinner + '\'' + | |
| 168 | + ", dinnerAdd='" + dinnerAdd + '\'' + | |
| 169 | + ", cookbooks=" + cookbooks + | |
| 170 | + ", northSouth='" + northSouth + '\'' + | |
| 171 | + ", suggests=" + suggests + | |
| 172 | + '}'; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public static class Cookbook implements Serializable { | |
| 176 | + private String vegetable;//菜名称 | |
| 177 | + private String foodMaterial; //食材 | |
| 178 | + private List<String> makeMethod;//制作方法 | |
| 179 | + private Double kcal; //整值卡路里 | |
| 180 | + private Double kcalStart; //整值卡路里区间值 | |
| 181 | + private Double kcalEnd; //整值卡路里区间值 | |
| 182 | + | |
| 183 | + public Double getKcal() { | |
| 184 | + return kcal; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setKcal(Double kcal) { | |
| 188 | + this.kcal = kcal; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public Double getKcalStart() { | |
| 192 | + return kcalStart; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setKcalStart(Double kcalStart) { | |
| 196 | + this.kcalStart = kcalStart; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public Double getKcalEnd() { | |
| 200 | + return kcalEnd; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public void setKcalEnd(Double kcalEnd) { | |
| 204 | + this.kcalEnd = kcalEnd; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public String getVegetable() { | |
| 208 | + return vegetable; | |
| 209 | + } | |
| 210 | + | |
| 211 | + public void setVegetable(String vegetable) { | |
| 212 | + this.vegetable = vegetable; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public String getFoodMaterial() { | |
| 216 | + return foodMaterial; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public void setFoodMaterial(String foodMaterial) { | |
| 220 | + this.foodMaterial = foodMaterial; | |
| 221 | + } | |
| 222 | + | |
| 223 | + public List<String> getMakeMethod() { | |
| 224 | + return makeMethod; | |
| 225 | + } | |
| 226 | + | |
| 227 | + public void setMakeMethod(List<String> makeMethod) { | |
| 228 | + this.makeMethod = makeMethod; | |
| 229 | + } | |
| 230 | + } | |
| 231 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/MaternalDeliverResult.java
View file @
fa4793e
| ... | ... | @@ -121,26 +121,26 @@ |
| 121 | 121 | setTireNumber(destModel.getTireNumber()); |
| 122 | 122 | setPlacenta(destModel.getPlacenta()); |
| 123 | 123 | setPlacentas(destModel.getPlacentas()); |
| 124 | - setDeliveryMode(JsonUtil.jkstr2Obj(destModel.getDeliveryMode(), Map.class)); | |
| 124 | + setDeliveryMode(destModel.getDeliveryMode() == null ? null : JsonUtil.jkstr2Obj(destModel.getDeliveryMode(), Map.class)); | |
| 125 | 125 | setOperationCause(destModel.getOperationCause()); |
| 126 | 126 | |
| 127 | 127 | setProdprocess(destModel.getProdprocess() == null ? null : JsonUtil.jkstr2Obj(destModel.getProdprocess(), Map.class)); |
| 128 | - setTotalprocess(JsonUtil.jkstr2Obj(destModel.getTotalprocess(), Map.class)); | |
| 128 | + setTotalprocess(destModel.getTotalprocess() == null ? null : JsonUtil.jkstr2Obj(destModel.getTotalprocess(), Map.class)); | |
| 129 | 129 | setPerinealCondition(destModel.getPerinealCondition()); |
| 130 | 130 | setSiLielevel(destModel.getSiLielevel()); |
| 131 | 131 | setNeedleNum(destModel.getNeedleNum()); |
| 132 | 132 | setMaternalInfo(destModel.getMaternalInfo()); |
| 133 | 133 | setDeathCause(destModel.getDeathCause()); |
| 134 | - setChBp(JsonUtil.str2Obj(destModel.getChBp(), Map.class)); | |
| 135 | - setCh2Bp(JsonUtil.str2Obj(destModel.getCh2Bp(), Map.class)); | |
| 134 | + setChBp(destModel.getChBp() == null ? null : JsonUtil.str2Obj(destModel.getChBp(), Map.class)); | |
| 135 | + setCh2Bp(destModel.getCh2Bp() == null ? null : JsonUtil.str2Obj(destModel.getCh2Bp(), Map.class)); | |
| 136 | 136 | setBreath(destModel.getBreath()); |
| 137 | 137 | setPulse(destModel.getPulse()); |
| 138 | 138 | setoHloseBloodL(destModel.getoHloseBloodL()); |
| 139 | 139 | settHloseBloodL(destModel.gettHloseBloodL()); |
| 140 | 140 | setrHloseBloodL(destModel.getrHloseBloodL()); |
| 141 | 141 | setsHloseBloodL(destModel.getsHloseBloodL()); |
| 142 | - setLoseBloodCause(JsonUtil.jkstr2Obj(destModel.getLoseBloodCause(), Map.class)); | |
| 143 | - setOcs(JsonUtil.str2Obj(destModel.getOcs(), Map.class)); | |
| 142 | + setLoseBloodCause(destModel.getLoseBloodCause() == null ? null : JsonUtil.jkstr2Obj(destModel.getLoseBloodCause(), Map.class)); | |
| 143 | + setOcs(destModel.getOcs() == null ? null : JsonUtil.str2Obj(destModel.getOcs(), Map.class)); | |
| 144 | 144 | setExtPlacentas(destModel.getExtPlacentas()); |
| 145 | 145 | |
| 146 | 146 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
fa4793e
| ... | ... | @@ -334,10 +334,8 @@ |
| 334 | 334 | return dayWeights; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - public static void main(String[] args) { | |
| 338 | - System.out.println("2017-12-16".compareTo("2017-12-18")); | |
| 339 | - } | |
| 340 | 337 | |
| 338 | + | |
| 341 | 339 | @Override |
| 342 | 340 | public BaseResponse edit(String id) { |
| 343 | 341 | PatientWeight patientWeight = mongoTemplate.findById(id, PatientWeight.class); |
| 344 | 342 | |
| 345 | 343 | |
| 346 | 344 | |
| 347 | 345 | |
| 348 | 346 | |
| ... | ... | @@ -1227,31 +1225,35 @@ |
| 1227 | 1225 | |
| 1228 | 1226 | /** |
| 1229 | 1227 | * 孕妇期所需卡里计算 |
| 1230 | - * @param beforeWeight | |
| 1231 | - * @param currentWeight | |
| 1228 | + * @param bWeight 孕前体重 | |
| 1229 | + * @param cWeight 当前体重 | |
| 1232 | 1230 | * @return |
| 1233 | 1231 | */ |
| 1234 | - private Map<String,Double> getComputeKul(double beforeWeight,double currentWeight,int week,double bmi) | |
| 1232 | + private Map<String,Double> getComputeKul(double bWeight,double cWeight,int week,double bmi) | |
| 1235 | 1233 | { |
| 1236 | 1234 | Map<String,Double> map = new HashMap<>(); |
| 1237 | 1235 | |
| 1238 | 1236 | double kulStart = 0; |
| 1239 | 1237 | double kulEnd = 0; |
| 1240 | - double add = currentWeight - beforeWeight; | |
| 1238 | + | |
| 1239 | + BigDecimal currentWeight = new BigDecimal(cWeight); | |
| 1240 | + BigDecimal beforeWeight = new BigDecimal(bWeight); | |
| 1241 | + | |
| 1242 | + double add = currentWeight.subtract(beforeWeight).doubleValue(); | |
| 1241 | 1243 | //孕早期 |
| 1242 | 1244 | if (week <= 12) |
| 1243 | 1245 | { |
| 1244 | 1246 | if (add < 1 && (1 - add >= 0.5)) |
| 1245 | 1247 | { |
| 1246 | - kulStart = currentWeight*25+500; | |
| 1248 | + kulStart = currentWeight.multiply(new BigDecimal(25)).doubleValue()+500; | |
| 1247 | 1249 | } |
| 1248 | 1250 | else if (add > 1.5 && (add - 1.5 >= 0.5)) |
| 1249 | 1251 | { |
| 1250 | - kulStart = currentWeight*25-500; | |
| 1252 | + kulStart = currentWeight.multiply(new BigDecimal(25)).doubleValue()-500; | |
| 1251 | 1253 | } |
| 1252 | 1254 | else |
| 1253 | 1255 | { |
| 1254 | - kulStart = currentWeight*25; | |
| 1256 | + kulStart = currentWeight.multiply(new BigDecimal(25)).doubleValue(); | |
| 1255 | 1257 | kulEnd = kulStart; |
| 1256 | 1258 | } |
| 1257 | 1259 | } |
| 1258 | 1260 | |
| 1259 | 1261 | |
| ... | ... | @@ -1279,12 +1281,15 @@ |
| 1279 | 1281 | avge = 0.22; |
| 1280 | 1282 | } |
| 1281 | 1283 | |
| 1282 | - double addWeightStart = 1 + (week - 12) * avge; | |
| 1283 | - double addWeightEnd = 1.5 + (week - 12) * avge; | |
| 1284 | + BigDecimal bigavage = new BigDecimal(avge); | |
| 1285 | + BigDecimal rangeweek = new BigDecimal(week - 12); | |
| 1284 | 1286 | |
| 1285 | - double kstart = (currentWeight + addWeightStart) * 25 + basekul; | |
| 1286 | - double kend = (currentWeight + addWeightEnd) * 25 + basekul; | |
| 1287 | + double addWeightStart = 1 + rangeweek.multiply(bigavage).doubleValue(); | |
| 1288 | + double addWeightEnd = 1.5 + rangeweek.multiply(bigavage).doubleValue(); | |
| 1287 | 1289 | |
| 1290 | + double kstart = (currentWeight.add(new BigDecimal(addWeightStart)).doubleValue()) * 25 + basekul; | |
| 1291 | + double kend = (currentWeight.add(new BigDecimal(addWeightEnd)).doubleValue()) * 25 + basekul; | |
| 1292 | + | |
| 1288 | 1293 | if (addWeightEnd > add && (addWeightEnd - add) > 0.5) |
| 1289 | 1294 | { |
| 1290 | 1295 | kstart -= 500; |
| ... | ... | @@ -1303,5 +1308,13 @@ |
| 1303 | 1308 | map.put("kulEnd",kulEnd); |
| 1304 | 1309 | return map; |
| 1305 | 1310 | } |
| 1311 | + | |
| 1312 | +// | |
| 1313 | +// public static void main(String[] args) { | |
| 1314 | +// PatientWeightServiceImpl patientWeightService = new PatientWeightServiceImpl(); | |
| 1315 | +// String bmi = patientWeightService.getBmi("55", "162"); | |
| 1316 | +// Map<String,Double> map = patientWeightService.getComputeKul(55, 62, 20, Double.parseDouble(bmi)); | |
| 1317 | +// System.out.println(map); | |
| 1318 | +// } | |
| 1306 | 1319 | } |