Has anyone used MEL_CHANGE_PROBLEM? How do you pull the PRID of the problem you want to change?
I want to create a function that searches the problem list and if the problem is there, change it, else a new. Has anyone accomplished this?
Thanks in advance!
We have a form that does this with Medications. The general outline is:
- Click a button that will pull individual medications from MEDS_AFTER into document variables. In our situation, each medication has different document variables to fill in: (1) name; (2) instructions; (3) MID.
- When we need to change a medication, we update the instructions the click a "change medication" button. This button calls MEL_CHANGE_MEDICATION, and specifically uses the MID from the document variable in Step 1.
- When we need to remove a medication, we click a "remove medication" button. This button calls MEL_REMOVE_MEDICATION, and specifically uses the MID from the document variable in Step 1.
The easy part for us is that we only do this for pain medications, and we determined that at most, a patient would be on 3 pain medications. In the case of Problems, a patient could have quite a few, so you might need to define an upper limit on Problems that can be adjusted this way. Or, you could build in variables that track these PRIDs behind the scenes...sounds like a fun project either way. Good luck!
When you say you want to search to see if the problem is in the current list of active problems, how do you want to accomplish that? I'm assuming you don't want the user to type in the PRID manually to search for it?
In general though, you can use the PROB_AFTER data symbol and create a delimited list to pull the PRID into a local or global variable, then pass that variable through the MEL_CHANGE_PROBLEM
Yes, thats what we want to do, but I don't know how to pick out that specific problem and PRID in the Prob_after delimited list to assign to that variable. I know how to create a delimited list, and find the PRID, but in a list of multiple problems, how do I select the one I want based on the ICD-9?
Thanks!
so if you would like for the PRID to be displayed based on the user inputting an ICD9, I would create the delimited list, do a looping array, and then use the match symbol. ie when using the prob_after data symbol, if match(document.icd9,subarray[3])>0 then result = subarray[7]. Does that make sense?
Sorry, I'm not an expert at MEL. What I want to do is create a button, that would look at the patients active problem list, and if the problem, based on the ICD-9 code I supply is on the list, then do MEL_Change_Prob using the PRID for that problem, else it will add the problem.
Our organization decided to take ICD10 a step further and want to reconcile all the ICD-9 problems to ICD-10 codes, with ICD-10 descriptions. So, that means alot of changing codes already there.
Here is the example of what I'm working with so far:
{fn fnProbAdd(strCode,strDesc)
{if (match(PROB_AFTER("delimited"),strCode)<=0) then
MEL_ADD_PROBLEM("DX OF", strDesc, strCode, str(._todaysdate), "", "", "", "") else
userok(strDesc + " " + strCode + " already exists on the patients problem list, please click 'Add/Change Problems' to change or remove problem")
endif}}
Here's what I'm looking for, but don't have the function to pull the PRID:
{fn fnProbAdd(strCode,strDesc,strICD9)
{if match(PROB_AFTER("delimited"),strICD9)>0) then MEL_CHAGNE_PROBLEM(PRID, strDesc, strCode, str(._todaysdate), "", "", "", "") else
MEL_ADD_PROBLEM("DX OF", strDesc, strCode, str(._todaysdate), "", "", "", "") endif}}
Thank you!!
It sounds like you are looking at the following set up:
- Document Variable where you can enter an ICD-9 code. Let's call this DOCUMENT.ICD
- Document Variable where you can enter a description. Let's call this DOCUMENT.DESC.
- Button to click. Action: If ICD-9 code in DOCUMENT.ICD exists, execute MEL_CHANGE_PROBLEM; Else, execute MEL_ADD_PROBLEM.
Unfortunately, I don't think there is a MEL function that can return the PRID field. You may be able to write a function using objects in the mldefs files, specifically C:\Program Files (x86)\Centricity Practice Solution\Client\mldefs2.txt. I haven't used these in a while, but the following function should get you close. One other (warning) thing to note, GE Support has told me in the past that these functions are not supported, as you are venturing outside of supported MEL functions...you can also accidentally find yourself in a never ending loop if you aren't careful.
With all that said, I would write the function as:
fn probAdd()
{
local icd = DOCUMENT.ICD
local desc = DOCUMENT.DESC
local probPRID = ""
local probDESC = ""
local probCODE = ""
local changeMade = "N"
if getRowCount("_MasterProb") == 0 then
MEL_ADD_PROBLEM("DX OF", desc, icd, str(._todaysdate), "", "", "", "")
else
for z = 0, z < getRowCount("_MasterProb"), z = z + 1 do
probPRID = getRow("_MasterProb", z, "PRID")
probDESC = getRow("_MasterProb", z, "Description")
probCODE = getRow("_MasterProb", z, "Code")
if code == probCODE then /*We have a match*/
MEL_CHANGE_PROBLEM(probPRID, desc, icd, str(._todaysdate), "", "", "", "")
changeMade = "Y"
z = getRowCount("_MasterProb") /*Break out of the loop*/
endif
endfor
if changeMade == "N" then /*We looped through and didn't find the Problem*/
MEL_ADD_PROBLEM("DX OF", desc, icd, str(._todaysdate), "", "", "", "")
endif
endif
}
Haven't tested this at all but I was thinking something like this:
document.icd is an edit field where the ICD9 code is put in
document.description is an edit field where the description is put in
{
ProbArray = getfield(prob_after("delimited"),"|","")
i=0
for i= 1, i<size(ProbArray),i=i + 1
do
ProbSubarray = getfield(ProbArray[i],"^","")
if match(ProbSubarray[3],document.ICD) == 0
then Mel_add_problem("Dx of",document.description,document.ICD,"","","","N","")
else Mel_change_problem(ProbSubarray[7],document.description,document.ICD,"","","","","")
endif
endfor
}
If you look at the help for PROB_NEW in the comment section, PRID is the last field returned in delimited. I believe it is the same for the other problem related functions when you pass the delimited parameter.
I'm trying to do something similar, except I am trying to remove a problem. I can add it just fine but when it comes to removing I just can't see to get rid of it.
Dx of^Pregnant State, incidental^ICD-V22.2^^09/20/2016^^^ICD10-Z33.1^1790009065378670.000000^09/20/2016^1790009065378670.000000|
{
!IF OBSNOW("PREGNANT") == "Yes"
THEN
local currentProblems=PROB_AFTER("list")
local nowProblems=PROB_NEW("list")
COND
CASE match(currentProblems,"Pregnant State, incidental")==0 and match(nowProblems,"Pregnant State, incidental")==0
MEL_ADD_PROBLEM("dx of", "Pregnant State, incidental", "ICD10-Z33.1", str(._TODAYSDATE), "", "")
ENDCOND
else IF OBSNOW("PREGNANT") == "No"
THEN
local currentProblems=PROB_AFTER("list")
local nowProblems=PROB_NEW("list")
COND
CASE match(currentProblems,"Pregnant State, incidental")>0 and match(nowProblems,"Pregnant State, incidental")>0
MEL_REMOVE_PROBLEM(1790009133379350.000000,str(._TODAYSDATE))
ENDCOND
else ""
endif endif
}
thoughts?
Scott, is your code returning an error value? Such as -1 through -7? My other thought is turning the PRID into a string.
no, its just not doing anything
turning the PRID into a string, just doing this? str(1790009133379350.000000)
ok, I figured it out, the PRID number doesn't stay the same... that's just swell...
Any way to get this to work without using the PRID?
Scott, you have to use the PRID otherwise the client doesn't know which problem to remove from the database. You will want to replace your last cond with an if. Pull the data from PROB_AFTER using delimited. Throw it into an array. Do a loop and match each problem record for the string and if it is > 0 then pull field 17 (I think) from the record. Put 17 in a variable and pass that as the PRID parameter in your MEL_REMOVE_PROBLEM.