Sure thing. The function below takes the BMI that is calculated when the patient has height and weight put in by the MA, and then runs through a conditional statement to find the correct ICD10 code for todays BMI.
It also has some code before the long conditional statement to remove the previous ICD code, since we do not want to have multiple ICD codes for BMI on the chart.
//A function to remove the last BMI from the problem list and update it to the current BMI using ICD-10 codes.
fn setBMICode(newBMI){
pArray = getfield(gproblistvs,"|","")
// a for loop to go through the problem codes and remove the BMI code that is being replaced.
for c = 1, c <= size(pArray), c = c+1 do
if match(pArray[c],"ICD10-Z68") >0 then
pArray[c] = getfield(pArray[c],"^","")
MEL_REMOVE_PROBLEM(pArray[c][9],str(._TODAYSDATE),"FALSE","Resolved")
endif
endfor
//Get the BMI down from a large Decimal point, and then calculate which ICD code is correct to add.
truncBMI = truncate(val(newBMI),0)
if(PATIENT_AGE()>=18) then
cond
case truncBMI <= 19 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 19 or less, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 19 or less, adult","ICD10-Z68.1",str(._TODAYSDATE),"","","","")
case truncBMI >= 20 AND truncBMI <=29
cond
case truncBMI == 20 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 20.0-20.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 20.0-20.9, adult","ICD10-Z68.20",str(._TODAYSDATE),"","","","")
case truncBMI == 21 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 21.0-21.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 21.0-21.9, adult","ICD10-Z68.21",str(._TODAYSDATE),"","","","")
case truncBMI == 22 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 22.0-22.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 22.0-22.9, adult","ICD10-Z68.22",str(._TODAYSDATE),"","","","")
case truncBMI == 23AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 23.0-23.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 23.0-23.9, adult","ICD10-Z68.23",str(._TODAYSDATE),"","","","")
case truncBMI == 24AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 24.0-24.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 24.0-24.9, adult","ICD10-Z68.24",str(._TODAYSDATE),"","","","")
case truncBMI == 25AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 25.0-25.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 25.0-25.9, adult","ICD10-Z68.25",str(._TODAYSDATE),"","","","")
case truncBMI == 26AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 26.0-26.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 26.0-26.9, adult","ICD10-Z68.26",str(._TODAYSDATE),"","","","")
case truncBMI == 27AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 27.0-27.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 27.0-27.9, adult","ICD10-Z68.27",str(._TODAYSDATE),"","","","")
case truncBMI == 28AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 28.0-28.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 28.0-28.9, adult","ICD10-Z68.28",str(._TODAYSDATE),"","","","")
case truncBMI == 29AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 29.0-29.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 29.0-29.9, adult","ICD10-Z68.29",str(._TODAYSDATE),"","","","")
endcond
case truncBMI >= 30 AND truncBMI <=39
cond
case truncBMI == 30 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 30.0-30.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 30.0-30.9, adult","ICD10-Z68.30",str(._TODAYSDATE),"","","","")
case truncBMI == 31 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 31.0-31.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 31.0-31.9, adult","ICD10-Z68.31",str(._TODAYSDATE),"","","","")
case truncBMI == 32 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 32.0-32.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 32.0-32.9, adult","ICD10-Z68.32",str(._TODAYSDATE),"","","","")
case truncBMI == 33 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 33.0-33.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 33.0-33.9, adult","ICD10-Z68.33",str(._TODAYSDATE),"","","","")
case truncBMI == 34 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 34.0-34.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 34.0-34.9, adult","ICD10-Z68.34",str(._TODAYSDATE),"","","","")
case truncBMI == 35 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 35.0-35.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 35.0-35.9, adult","ICD10-Z68.35",str(._TODAYSDATE),"","","","")
case truncBMI == 36 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 36.0-36.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 36.0-36.9, adult","ICD10-Z68.36",str(._TODAYSDATE),"","","","")
case truncBMI == 37 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 37.0-37.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 37.0-37.9, adult","ICD10-Z68.37",str(._TODAYSDATE),"","","","")
case truncBMI == 38 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 38.0-38.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 38.0-38.9, adult","ICD10-Z68.38",str(._TODAYSDATE),"","","","")
case truncBMI == 39 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 39.0-39.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 39.0-39.9, adult","ICD10-Z68.39",str(._TODAYSDATE),"","","","")
endcond
case truncBMI >= 40
cond
case truncBMI >=40 AND truncBMI <= 44.9 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 40.0-44.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 40.0-44.9, adult","ICD10-Z68.41",str(._TODAYSDATE),"","","","")
case truncBMI >= 45 AND truncBMI <= 49.9 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 45.0-49.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 45.0-49.9, adult","ICD10-Z68.42",str(._TODAYSDATE),"","","","")
case truncBMI >= 50 AND truncBMI <= 59.9 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 50.0-59.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 50.0-59.9, adult","ICD10-Z68.43",str(._TODAYSDATE),"","","","")
case truncBMI >= 60 AND truncBMI <= 69.9 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 60.0-69.9, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 60.0-69.9, adult","ICD10-Z68.44",str(._TODAYSDATE),"","","","")
case truncBMI >= 70 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) 70 or greater, adult")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) 70 or greater, adult","ICD10-Z68.45",str(._TODAYSDATE),"","","","")
endcond
endcond
else if (PATIENT_AGE()<18 AND PATIENT_AGE()>=2) then
cond
case OBSNOW("BMI%ILE") < 5 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) pediatric, less than 5th percentile for age")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) pediatric, less than 5th percentile for age","ICD10-Z68.51",str(._TODAYSDATE),"","","","")
case OBSNOW("BMI%ILE") >= 5 AND OBSNOW("BMI%ILE") < 85 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) pediatric, 5th percentile to less than 85th percentile for age")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) pediatric, 5th percentile to less than 85th percentile for age","ICD10-Z68.51",str(._TODAYSDATE),"","","","")
case OBSNOW("BMI%ILE") >= 85 AND OBSNOW("BMI%ILE") < 95 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) pediatric, 85th percentile to less than 95th percentile for age")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) pediatric, 85th percentile to less than 95th percentile for age","ICD10-Z68.51",str(._TODAYSDATE),"","","","")
case OBSNOW("BMI%ILE") >= 95 AND match(PROB_NEW("comma"),"Body Mass Index (BMI) pediatric, 95th percentile or greater for age")== 0
MEL_ADD_PROBLEM("DX OF","Body Mass Index (BMI) pediatric, 95th percentile or greater for age","ICD10-Z68.51",str(._TODAYSDATE),"","","","")
endcond
endif endif
}
Please let me know if you have any questions on using this, or how our form is working.
Thank you, and good luck! 🙂
-Daniel Carpenter