Commit 0425d46fdf91e2dac93777cfac8bada0c0c80e9e
1 parent
2d4405e1fb
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 15 additions and 15 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
0425d46
| ... | ... | @@ -1169,7 +1169,7 @@ |
| 1169 | 1169 | |
| 1170 | 1170 | double bmi = Double.parseDouble(patientWeight.getBmi()); |
| 1171 | 1171 | //根据高危获取不同的卡路里计算公式 |
| 1172 | - double kcal = getComputeKcal(week, bmi, patientWeight.getBeforeHeight()); | |
| 1172 | + int kcal = getComputeKcal(week, bmi, patientWeight.getBeforeHeight()); | |
| 1173 | 1173 | data.put("bmi", bmi); |
| 1174 | 1174 | data.put("kcal", kcal); |
| 1175 | 1175 | data.put("beforeWeight", patientWeight.getBeforeWeight()); |
| 1176 | 1176 | |
| 1177 | 1177 | |
| ... | ... | @@ -1217,20 +1217,11 @@ |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | |
| 1220 | - public WeightConfigModel getWeightConfigBykcal(double kcal, String northSouth, String risk) { | |
| 1220 | + public WeightConfigModel getWeightConfigBykcal(int kcal, String northSouth, String risk) { | |
| 1221 | 1221 | |
| 1222 | - int k1 = ((int) kcal / 100) * 100; | |
| 1223 | - double k2 = kcal - k1; | |
| 1224 | - if (k2 > 50) { | |
| 1225 | - k1 += 100; | |
| 1226 | - } | |
| 1227 | - if (k1 < 1500) { | |
| 1228 | - k1 = 1500; | |
| 1229 | - } else if (k1 > 2800) { | |
| 1230 | - k1 = 2800; | |
| 1231 | - } | |
| 1232 | 1222 | |
| 1233 | - Criteria criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(k1); | |
| 1223 | + | |
| 1224 | + Criteria criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(kcal); | |
| 1234 | 1225 | //如果传了高危因素id就按高危去查 |
| 1235 | 1226 | if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(risk)) { |
| 1236 | 1227 | criteria = criteria.and("riskId").in(risk).and("type").is("1"); |
| ... | ... | @@ -1260,7 +1251,7 @@ |
| 1260 | 1251 | * @return |
| 1261 | 1252 | */ |
| 1262 | 1253 | |
| 1263 | - public double getComputeKcal(int week, double bmi, String beforeHeight) { | |
| 1254 | + public int getComputeKcal(int week, double bmi, String beforeHeight) { | |
| 1264 | 1255 | |
| 1265 | 1256 | //系数 |
| 1266 | 1257 | int coefficient = 25; |
| ... | ... | @@ -1279,7 +1270,16 @@ |
| 1279 | 1270 | { |
| 1280 | 1271 | kcal = 2300; |
| 1281 | 1272 | } |
| 1282 | - return kcal; | |
| 1273 | + | |
| 1274 | + int k1 = ((int) kcal / 100) * 100; | |
| 1275 | + double k2 = kcal - k1; | |
| 1276 | + if (k2 > 50) { | |
| 1277 | + k1 += 100; | |
| 1278 | + } | |
| 1279 | + if (k1 < 1500) { | |
| 1280 | + k1 = 1500; | |
| 1281 | + } | |
| 1282 | + return k1; | |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 |