I'm completely new to MEL and VFE, and while some of it has come quickly, certain aspects are just a huge struggle.
Here's what I'm trying to accomplish: I have a vital signs form that automatically calculates BMI based on height and weight. If the BMI is considered unhealthy, a problem is automatically posted to the Problem list. If the provider has to change the BMI during the appointment or the patient is still unhealthy on the next visit, a new BMI problem is posted to the list, rather than simply updating the old one.
I want the new BMI problem to essentially overwrite the old one. I've been struggling with this on and off for a week now, and I have it 90% working. I'm just having a hard time getting the PRID out, and documentation has been no help at all (aside: Why make the PRID so important to use, then not provide any indication of how to get it or even write a function to grab it for us?).
Here's my code (some of it might be familiar to readers of other MEL_REMOVE_PROBLEM or PRID threads... previously shared examples either don't work, don't make sense to me, or both):
fn changeOldProblem() {
local ProbArray = ""
local ProbSubArray = ""
ProbArray = getfield(PROB_AFTER("delimited"),"|","") /*
i=0
for i = 1, i <= size(ProbArray),i = i + 1
do
/*ProbSubArray[5] should access the ICD10*/
ProbSubArray = getfield(ProbArray[i],"^","")
if match(ProbSubArray[5], "ICD10-E66.3") == 0
/*I'm guessing that ProbSubArray[5] is the ICD10 number. I'm also guessing that I can do a match like this, rather than matching ProbSubArray to a document variable or something.*/
then
/* ProbSubArray[9] should access the PRID!*/
MEL_REMOVE_PROBLEM(ProbSubArray[9],"", "", "")
MEL_ADD_PROBLEM(ProbSubArray[1],ProbSubArray[2],ProbSubArray[3],"03/03/1990","",str(OBSNOW("BMI")),"","")
else
MEL_ADD_PROBLEM("","TEST","","04/04/2000","",str(OBSNOW("BMI")),"","")
endif
endfor
}
Can anyone give me some guidance?
Finally, does anyone know how to display variables in Data Fields? I've been using Data Fields to show information I'm trying to get, like the status of certain document variables. But, for example, if I want to display the PRID or ICD10 on the actual form, is there a way I can make a Data Field show that? Does that question make sense? For testing purposes, I want to be able to see that I'm even getting the number I think I'm getting.
Posted : October 24, 2016 9:44 am