I would be grateful for some help troubleshooting a piece of MEL.
We are a state correctional department with 20+ facilities. We want to insert a ADD_FORM_COMP feature to an encounter that will load a specific form where the patient home location (facility) is any except our 3 reception facilities.
I have had success getting it to discriminate a single facilty with the following MEL string:
{if (PATIENT.HOMELOCATIONNAME)"Lorain Correctional Institution" then ADD_FORM_COMP("Enterprise\Fusion\Corrections\Mental Health","MH Human Trafficking Screening", "", "","") endif
When I try to insert "or" and "else if" to include another facility, the results are the form loads in all facilities or none.
I've found in my attempts to add an additional facility in the code, adding an exclamation point before the opening brace will cause it to work, but only for the first facility in the string.
I have successfully coded forms to include or exclude multiple OBS or document variables and have no difficulty getting them to work. Patient attributes don't seem behave in the same way for me.
Hello,
The one thing I noticed in your code block above is that it is missing a == . That might just be CHUG refomatting some text you pasted. But you could change the if portion to something like this:
if (PATIENT.HOMELOCATIONNAME == "Lorain Correctional Institution")
If you want to include the form for all locations except three you may also want to just exclude those. We do that but with a document location instead of the patient home location. The following are the contents of the text component we load in the document template:
{
if DOCUMENT.LOCOFCARENAME <> "Preferred Primary Care Physicians (36)" AND DOCUMENT.LOCOFCARENAME <> "Preferred Primary Care Physicians (37)" AND DOCUMENT.LOCOFCARENAME <> "Preferred Primary Care Physicians (38)" then
ADD_FORM_COMP("Enterprise\PPCP","HPI","8")
endif
""
}
Depending on the particulars of your workflow you might be able to do it this way as well.
Brad
Thanks for your quick reply Brad,
My original intent was to exclude the three receptions centers. Somehow I left the out of the sample code I included in my original post.
So, with your proposed document template solution, would is the MEL string inserted before any existing text and form components?
The way that we have it setup is the code above is in it's own text component. Then I added the text component to the document templates where we wanted to include the form instead of a reference to the form itself. That way when you open a new document everything loads as usual, but if one I am logged into (in my example) Office 36 the form doesn't load. If I am in another office than the form loads as if I referenced it directly.
I hope that answers you question. If not please let me know.
Brad
Good afternoon Brad
I tried using the text component solution you recommended and was not able to get that to work. The patient location attribute I’m using is not a document variable. I modified your MEL string and entered it is entered as a patient attribute, PATIENT.xxxxxx. Still not able to get that to work.
I started over from scratch coding for a single reception facility, thus:
{if (PATIENT.HOMELOCATIONNAME)"Lorain Correctional Institution" then ADD_FORM_COMP("Enterprise\Fusion\Corrections\Mental Health", "MH Human Trafficking Screening", "", "","") else “ ” endif }
That doesn’t work.
I had read in another CHUG thread that adding an exclamation point before the opening brace causes Centricity to evaluate that piece of MEL before loading the forms.
! {if (PATIENT.HOMELOCATIONNAME)"Lorain Correctional Institution" then ADD_FORM_COMP("Enterprise\Fusion\Corrections\Mental Health", "MH Human Trafficking Screening", "", "","") else “ ” endif }
This works for a single facility
When I add a second facility:
! {if (PATIENT.HOMELOCATIONNAME)"Lorain Correctional Institution" or (PATIENT.HOMELOCATIONNAME)"Corrections Reception Center" then ADD_FORM_COMP("Enterprise\Fusion\Corrections\Mental Health", "MH Human Trafficking Screening", "", "","") else “ ” endif }
It doesn’t work
Rethinking what I was looking for - Centricity to do nothing if the patient’s home location is one of the reception facilities - I decided to change from the does not equal perspective to the equals perspective. I ended up with is this:
!{if (PATIENT.HOMELOCATIONNAME)=="Lorain Correctional Institution" then "" else if (PATIENT.HOMELOCATIONNAME)=="Corrections Reception Center" then "" else if (PATIENT.HOMELOCATIONNAME)=="Ohio Reformatory for Women" then "" else ADD_FORM_COMP("Enterprise\Fusion\Corrections\Mental Health", "MH Human Trafficking Screening", "", "","") endif endif endif}
This works. Wish I knew why : )
Thanks for your input.