Hello,
I am working on a bit of code that should prompt a user to respond to a pop-up when they first create a visit with a set of patient parameters. I put the code in a text component for easier maintenance and to get the prompt to show before any forms do. This is what I have:
{
global by = sub(str(PATIENT.DATEOFBIRTH),7,4)
if (by >= 1945) AND (by <= 1965) AND (OBSANY("HEP C AB") == "") AND (OBSANY("HEPCTXSTATUS") == "") then
if useryesno("HEPATITIS C SCREENING: Click 'Yes' if the patient would like a screening. Otherwise click 'No'.") == "Yes" then
OBSNOW("HEPCTXSTATUS","Screening Ordered")
else
OBSNOW("HEPCTXSTATUS","Patient Declined Screening")
endif
else
""
endif
}
I'm assigning an obs term a value. My issue is that the obs term value is writing to the note text. I'm not sure how that is happening since I'm not using fmt() or cfmt() or just outputing a string -- I'm doing assignment. Anyone have any thoughts?
Thanks,
Brad
Yes it will output the last value that MEL code runs through. If the initial condition is true, the two paths of the next condition both end in an observation term, so that is the output. Just add empty double quote after each observation and it will stop it from translating, or one set of double quotes just before the closing bracket. Just make sure the last thing MEL evaluates is an empty string.
Thanks! I had forgotten about that.
I created a visibility in a custom VFE form to show only if patient was in this age bracket and did not have a HEP C AB value already in the flow sheet. I like this idea of the popup as an additional reminder. Thanks!
One other note to accompany gibson's very appropriate answer - be extremely careful using such a simple global variable name declaration. Being so simple, there is a high probability of data collision, perhaps even with the EMR's own global declarations. You may want to rename it to something more unique...
Thanks Lee. That is also a good point and I'll modify.