ccc_add_assess() just calls ccc_extract_assess(), so you can just manipulate that function to get what you need out of it. If you want to keep the functionality of ccc_extract_assess(), you'll need to name your modified version something else. Here is the code for you to modify:
fn ccc_extract_assess(aa,bb,cc)
{
/*
aa is Dx label; bb is comma delimited string of Dx codes to assess; cc is # of days or a date to set date range, or "L" for last value;
if bb is empty, then all problems will be assessed;
if cc is empty, then all dates will be assessed;
if bb and cc empty, then return assessments for all problems and all dates;
returns a "\r\n" delimited string of assessments.
*/
local a,b,c,d,e,f,g="",h,i,j,k,l,m,n,p,q,r,s,t,u
a = getfield(prob_after("delimited"),"|","")
n = size(a)
if n=0 then return "" else "" endif
k = getfield(bb,",","")
l = size(k)
/* set date range */
h = str(cc)
cond
case h="" or h="L" or h="l" ""
case size(h) < 10 h = str(subtractdates(str(._todaysdate),"0","0",h))
else ""
endcond
for c=1, c<=n, c=c+1 do
if a[c]="" then "" else
b = getfield(a[c],"^","")
/* j is dx code from Prob List */
j = b[3]
/* 12-22-05: moved m to here-jt */
m = ""
/* determine if selected problem is found in dx code string */
if bb="" then "" else
for f=1, f<=l, f=f+1 do
if match(j,k[f]) > 0 then m = 1 break else "" endif
endfor
endif
/* if bb has a value but does not match w/ selected problem, then do nothing */
if bb<>"" and m = "" then "" else
/* get delimited list of assessments for selected problem */
if g_use_ccc_list_assess = true then
d = ccc_list_assessments_delim(b[1],b[2],j)
else
d = list_assessments(b[1],b[2],j,"delimited")
endif
if d="" then "" else
e = getfield(d,"|","")
if h="L" or h="l" then q = 1 else q = size(e) endif
/* 12-13-06:
added this code since the date of the assessment does not always follow the date of entry;
since e[] is sorted by date of entry and not date of assessment, this had to be added to get the 'last value';
for args other than "L", the date of assessment is already being compared prior to accepting it as a value.
*/
if size(e)<2 then "" else
if h="L" or h="l" then
u=copy(e[1])
r = getfield(u,"^","")
while size(r)<6 do r[size(r)+1]="" endwhile
t=str(r[5])
for f=2, f<=size(e), f=f+1 do
s = getfield(e[f],"^","")
while size(s)<6 do s[size(s)+1]="" endwhile
if durationdays(t,str(s[5]))>0 then t=str(s[5]) u=copy(e[f]) endif
endfor
/* reset e[1] to values with most recent date for "L" arg; since q is set to 1, then e[1] will be only value evaluated below */
e[1]=copy(u)
endif endif
for f=1, f<=q, f=f+1 do
if e[f]="" then "" else
i = getfield(e[f],"^","")
// Mods DAFN 13dec2005
while size(i)<6 do i[size(i)+1]="" endwhile
/* 12-22-05: jt added; make sure a true date before proceeding */
if durationdays("01/01/1920",str(i[5]))==0 then "" else
/* make sure date is within range */
if durationdays(str(i[5]),h) > 0 then break else
/* formatting */
if size(g) < 4 then p="\r\n" else
if sub(g,size(g)-3)=="\r\n\r\n" then p="" else p="\r\n"
endif endif
g = g +
if i[1]="" then "" else p + "Problem: \t" + ccc_capLETTER(i[1]) + "\r\n" +
if i[5]="" then "" else "Assessed: \t" + i[5] + "\r\n" endif +
if i[6]="" then "" else i[6] + "\r\n" endif
endif
endif endif endif
endfor
endif endif endif
endfor
return g
}
Posted : August 18, 2014 2:22 am