diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java index 712a9d4..a07888a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java @@ -1169,7 +1169,7 @@ public class BloodSugarServiceImpl extends BaseServiceImpl implements IBloodSuga double bmi = Double.parseDouble(patientWeight.getBmi()); //根据高危获取不同的卡路里计算公式 - double kcal = getComputeKcal(week, bmi, patientWeight.getBeforeHeight()); + int kcal = getComputeKcal(week, bmi, patientWeight.getBeforeHeight()); data.put("bmi", bmi); data.put("kcal", kcal); data.put("beforeWeight", patientWeight.getBeforeWeight()); @@ -1217,20 +1217,11 @@ public class BloodSugarServiceImpl extends BaseServiceImpl implements IBloodSuga } - public WeightConfigModel getWeightConfigBykcal(double kcal, String northSouth, String risk) { + public WeightConfigModel getWeightConfigBykcal(int kcal, String northSouth, String risk) { - int k1 = ((int) kcal / 100) * 100; - double k2 = kcal - k1; - if (k2 > 50) { - k1 += 100; - } - if (k1 < 1500) { - k1 = 1500; - } else if (k1 > 2800) { - k1 = 2800; - } - Criteria criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(k1); + + Criteria criteria = Criteria.where("northSouth").is(northSouth).and("kcal").is(kcal); //如果传了高危因素id就按高危去查 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(risk)) { criteria = criteria.and("riskId").in(risk).and("type").is("1"); @@ -1260,7 +1251,7 @@ public class BloodSugarServiceImpl extends BaseServiceImpl implements IBloodSuga * @return */ - public double getComputeKcal(int week, double bmi, String beforeHeight) { + public int getComputeKcal(int week, double bmi, String beforeHeight) { //系数 int coefficient = 25; @@ -1279,7 +1270,16 @@ public class BloodSugarServiceImpl extends BaseServiceImpl implements IBloodSuga { kcal = 2300; } - return kcal; + + int k1 = ((int) kcal / 100) * 100; + double k2 = kcal - k1; + if (k2 > 50) { + k1 += 100; + } + if (k1 < 1500) { + k1 = 1500; + } + return k1; }