here is what I used for BMI, the idea is pretty similar. For PATIENT._AGEINMONTHS you will need to use parenthesis around the values and CPS tweaks out on infant patients.
{
if PATIENT_AGE() >= 21 and OBSNOW("weight") <> "" then
local currentProblems=PROB_AFTER("list")
COND
CASE VAL(DOCUMENT.BODY_MASS_IN) > 0 and VAL(DOCUMENT.BODY_MASS_IN) <=19 and match(currentProblems,"BMI equal to or less than 19,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI equal to or less than 19,adult", "ICD10-Z68.1", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 20.0 and VAL(DOCUMENT.BODY_MASS_IN) < 21 and match(currentProblems,"BMI 20.0-20.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 20.0-20.9,adult", "ICD10-Z68.20", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 21.0 and VAL(DOCUMENT.BODY_MASS_IN) < 22 and match(currentProblems,"BMI 21.0-21.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 21.0-21.9,adult", "ICD10-Z68.21", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 22.0 and VAL(DOCUMENT.BODY_MASS_IN) < 23 and match(currentProblems,"BMI 22.0-22.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 22.0-22.9,adult", "ICD10-Z68.22", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 23.0 and VAL(DOCUMENT.BODY_MASS_IN) < 24 and match(currentProblems,"BMI 23.0-23.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 23.0-23.9,adult", "ICD10-Z68.23", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 24.0 and VAL(DOCUMENT.BODY_MASS_IN) < 25 and match(currentProblems,"BMI 24.0-24.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 24.0-24.9,adult", "ICD10-Z68.24", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 25.0 and VAL(DOCUMENT.BODY_MASS_IN) < 26 and match(currentProblems,"BMI 25.0-25.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 25.0-25.9,adult", "ICD10-Z68.25", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 26.0 and VAL(DOCUMENT.BODY_MASS_IN) < 27 and match(currentProblems,"BMI 26.0-26.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 26.0-26.9,adult", "ICD10-Z68.26", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 27.0 and VAL(DOCUMENT.BODY_MASS_IN) < 28 and match(currentProblems,"BMI 27.0-27.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 27.0-27.9,adult", "ICD10-Z68.27", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 28.0 and VAL(DOCUMENT.BODY_MASS_IN) < 29 and match(currentProblems,"BMI 28.0-28.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 28.0-28.9,adult", "ICD10-Z68.28", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 29.0 and VAL(DOCUMENT.BODY_MASS_IN) < 30 and match(currentProblems,"BMI 29.0-29.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 29.0-29.9,adult", "ICD10-Z68.29", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 30.0 and VAL(DOCUMENT.BODY_MASS_IN) < 31 and match(currentProblems,"BMI 30.0-30.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 30.0-30.9,adult", "ICD10-Z68.30", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 31.0 and VAL(DOCUMENT.BODY_MASS_IN) < 32 and match(currentProblems,"BMI 31.0-31.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 31.0-31.9,adult", "ICD10-Z68.31", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 32.0 and VAL(DOCUMENT.BODY_MASS_IN) < 33 and match(currentProblems,"BMI 32.0-32.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 32.0-32.9,adult", "ICD10-Z68.32", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 33.0 and VAL(DOCUMENT.BODY_MASS_IN) < 34 and match(currentProblems,"BMI 33.0-33.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 33.0-33.9,adult", "ICD10-Z68.33", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 34.0 and VAL(DOCUMENT.BODY_MASS_IN) < 35 and match(currentProblems,"BMI 34.0-34.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 34.0-34.9,adult", "ICD10-Z68.34", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 35.0 and VAL(DOCUMENT.BODY_MASS_IN) < 36 and match(currentProblems,"BMI 35.0-35.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 35.0-35.9,adult", "ICD10-Z68.35", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 36.0 and VAL(DOCUMENT.BODY_MASS_IN) < 37 and match(currentProblems,"BMI 36.0-36.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 36.0-36.9,adult", "ICD10-Z68.36", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 37.0 and VAL(DOCUMENT.BODY_MASS_IN) < 38 and match(currentProblems,"BMI 37.0-37.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 37.0-37.9,adult", "ICD10-Z68.37", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 38.0 and VAL(DOCUMENT.BODY_MASS_IN) < 39 and match(currentProblems,"BMI 38.0-38.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 38.0-38.9,adult", "ICD10-Z68.38", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 39.0 and VAL(DOCUMENT.BODY_MASS_IN) < 40 and match(currentProblems,"BMI 39.0-39.9,adult")==0 MEL_ADD_PROBLEM("dx of", "BMI 39.0-39.9,adult", "ICD10-Z68.39", str(._TODAYSDATE), "", "") CASE VAL(DOCUMENT.BODY_MASS_IN) >= 40.0 and match(currentProblems,"BMI 40.0 and over,adult")==0
MEL_ADD_PROBLEM("dx of", "BMI 40.0 and over,adult", "ICD10-Z68.4", str(._TODAYSDATE), "", "")
ENDCOND
else ""
endif
}