getObesityLevel static method

ObesityLevel getObesityLevel(
  1. double weight,
  2. int sex,
  3. double height
)

肥胖等级 Obesity level @param: weight(kg) @param: sex(1: male; Others: Female) @param: height(cm) @result: ObesityLevel

Implementation

static ObesityLevel getObesityLevel(double weight, int sex, double height) {
  final standardWeight = getStandardWeightDouble(sex, height);
  final result = (weight - standardWeight) / standardWeight;
  if (result < -0.2) {
    return ObesityLevel.underweight;
  } else if (result < -0.1) {
    return ObesityLevel.thin;
  } else if (result <= 0.1) {
    return ObesityLevel.standard;
  } else if (result <= 0.2) {
    return ObesityLevel.biased;
  } else {
    return ObesityLevel.overweight;
  }
}