I am working on a drop down that adds a Dx code based of the selections you choose. If I click left, shoulder, first encounter, it adds the correct Dx code. But once I've done that, if I decide it's not the first encounter, but instead the second, if I change my selection it adds the Dx but I need it to remove the one entered incorrectly. Can someone tell me how to do that?
Here's the code I have so far:
{if (DOCUMENT.LOCATION = "unspecified") AND (DOCUMENT.SITE = "unspecified site") AND (DOCUMENT.ENCOUNTER = "Initial encounter for fracture") then
MEL_ADD_PROBLEM("dx of", "Initial encounter for unspecified fracture", "ICD10-M80.00XA", str(._TODAYSDATE), "", "")
else
if (DOCUMENT.LOCATION = "unspecified") AND (DOCUMENT.SITE = "unspecified site") AND (DOCUMENT.ENCOUNTER = "Subsequent encounter for fracture with routine healing") then
MEL_ADD_PROBLEM("dx of", "Subsequent encounter for unspecified fracture with routine healing", "ICD10-M80.00XD", str(._TODAYSDATE), "", "")
else
endif
endif}
Have you looked at using MEL_CHANGE_PROBLEM(...) when the problem exists already ?
You would need to check if the problem description and code are the same AND that they were added during this encounter, to identify if this is a change and not a new problem.
Here is a function that I use to remove one or several ICD10 code(s) entered in error. For example in entering the smoking status on a patient.
OBSNOW("SMOK STATUS") set to Former smoker Problem added to chart
MEL_ADD_PROBLEM("dx of", "history of tobacco use", "ICD10-Z87.891", "", "", "")
Then patient states that they are a current every day smoker, so the new smoking status problem is added to chart and check made and deletion of the inactive smoking problem(s) of Never smoked (ICD10-Z78.9) and history of tobacco use (ICD10-Z87.891) if found active on the problem list.
MEL_ADD_PROBLEM("dx of", "tobacco user", "ICD10-Z72.0", "", "", "")
NAAC_REMOVE_PROB("ICD10-Z87.891,ICD10-Z78.9")
{fn NAAC_REMOVE_PROB(sICD10){
local aProbLst, aICD10, chkICD10, sPRID
local i,j,k
if OK(sICD10)=FALSE then return "" else "" endif
while match(sICD10,", ")>0 do sICD10=remove(sICD10,match(sICD10,", ")+1,1) endwhile
aProbLst=getfield(PROB_AFTER("delimited"),"|","")
for i=1, i<=size(aProbLst), i = i+1 do
aProbLst[i]=getfield(aProbLst[i],"^","")
endfor
aICD10=getfield(sICD10,",","")
for j=1, j<=size(aICD10), j = j+1 do
chkICD10=aICD10[j]
for k=1, k<=size(aProbLst), k = k+1 do
if aProbLst[k][8]=chkICD10 then
sPRID=aProbLst[k][9]
if sPRID<>"" then
MEL_REMOVE_PROBLEM(sPRID, str(DOCUMENT.CLINICALDATE), true, "Resolved")
BREAK
else "" endif
else "" endif
endfor
endfor
return ""
} }
Hope this example helps.
Jaisan
Thank you both. I'll give both of these a try. I'll update with my results 🙂