Here's an expanded example of the above logic. This is used at visit check in to prep the visit. We'll plan to improve this using a visual form editor component rather than all the text and quicktexts (so that the text translation doesn't stay in the note, it's more organized and the quicktexts are replaced by buttons):
{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","SYSTOLIC", "contains", "any") == "" then "" else "Patient needs a BP reading documented. " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","MAMMOGRAM", "contains", "any") == "" then "" else "Needs a mammogram, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","COLON", "contains", "any") == "" then "" else "Needs a colonoscopy referral, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","PAP", "contains", "any") == "" then "" else "Needs a pap, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","FOOT", "contains", "any") == "" then "" else "Have the patient remove shoes and socks for a monofilament exam. " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","LDL", "contains", "any") == "" then "" else MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "LIPID PANEL", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0"))+MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "LFT's (AST & ALT)", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0"))+ "LIPIDs/ALT/AST ordered, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","Hct", "contains", "any") == "" then "" else MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "CBC W/Auto Diff", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) + "CBC ordered, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","POTASSIUM", "contains", "any") == "" then (if LISTSUBSET(LISTPROTOCOLDUE(),"comma","GLUCOSE", "contains", "any") == "" then (if LISTSUBSET(LISTPROTOCOLDUE(),"comma","CREATININE", "contains", "any") == "" then "" else "BMP ordered, " + MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "BMP", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) endif) else "BMP ordered, " + MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "BMP", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) endif) else "BMP ordered, " + MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "BMP", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","HGBA1C", "contains", "any") == "" then "" else MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "HBA1C", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) + "HgbA1c ordered, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","TSH", "contains", "any") == "" then "" else MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "TSH", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) + "TSH ordered, " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","MICROAL", "contains", "any") == "" then "" else (MEL_ADD_ORDER("T", "Labs SFM (Test orders)", "MICROALBUMIN", "", "", "", "", "", "", "", ADDDATES(str(._TODAYSDATE), "0", "0", "0")) + "microalbumin ordered, please obtain a urine sample, ") endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","cult", "contains", "any") == "" then "" else "
The patient needs a urine culture. Please arrange this. " endif}
{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","flu", "contains", "any") == "" then "" else "
Recommend a flu shot. .flu " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","pneumo", "contains", "any") == "" then "" else "
Recommend a pnuemonia vaccine. .pneumo " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","tdap", "contains", "any") == "" then "" else "
Recommend a Tdap. .tdap " endif}
Extra vaccine code (.extrainj )
Any vaccines, verify no allergy (.addallergies )
{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","PARTNER", "contains", "any") == "" then "" else "
If the patient would like testing for sexually transmitted infections please orders this with .stdorder " endif}{if LISTSUBSET(LISTPROTOCOLDUE(),"comma","PSA",
"contains", "any") == "" then "" else "
PSA test or defer per this last discussion regarding PSA testing (may be blank): " + fmt(LASTOBSVALUEDATE("PSARECACT"), "I") + "
If no previous discussion or last discussion over 2 years ago, use PSA informational handout to solicit patient preference and document their response, draw per their preference.
" endif}
(.blooddraw )