APCLAPIR ; IHS/CMI/LAB - visit data ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;
;Documentation for each API:
; Input:
; APCLPDFN - Patient DFN
; APCLBD - beginning date to begin search for value - if blank, default is DOB
; APCLED - ending date of search - if blank, default is DT
;
; Output:
;returns the string:
; 1 or 0^date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
; piece 1: 1 if item found, 0 if no item found in the date range
; 2: date of last item
; 3: text of item found
; 4: value - result
; 5: visit ien on which item found
; 6: file item found in (usually a V File #)
; 7: ien of V File entry found
;
REMDEPS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last depression screening exam
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTDEPS^APCLAPI(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMALCS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last alcohol screening exam
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTALC^APCLAPI(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMAOF(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last assessment of function
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTAOF^APCLAPI4(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMBP(P,APCLBD,APCLED) ;PEP - called from reminders to get last BP
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"BP","MEASUREMENT",APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMBRST(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last breast exam
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTBRST^APCLAPI3(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMCHOL(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last cholesterol
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTCHOL^APCLAPI3(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMDENT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last dental exam
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTDENT^APCLAPI2(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMGLUC(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last glucose test
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTGLUC^APCLAPI3(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMIPVS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on IPV
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTIPVS^APCLAPI(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMEPSDT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last EPSDT
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTEPS^APCLAPI3(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMFRA(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last FALL RISK ASSESSMENT exam
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTFRA^APCLAPI2(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMHC(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last HEAD CIRCUMFERENCE
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"HC","MEASUREMENT",APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMHEAR(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last HEARING exam
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTHEAR^APCLAPI3(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMHT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last HEIGHT
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"HT","MEASUREMENT",APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMFLU(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last FLU SHOT
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTFLU^APCLAPI4(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMMAMM(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last MAMMOGRAM
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTMAM^APCLAPI1(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMOSTEO(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last OSTEOPOROSIS SCREENING
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTOST^APCLAPI4(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMPAP(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PAP SMEAR
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTPAP^APCLAPI1(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMPELV(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PELVIC EXAM
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTPELV^APCLAPI2(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMPHYS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PHYSICAL EXAM
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTPHYS^APCLAPI2(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMPNEU(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PNEUMOVAX
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTPNEU^APCLAPI4(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMRECT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last RECTAL EXAM
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTRECT^APCLAPI2(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMRUBEL(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last RUBELLA
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTRUB^APCLAPI3(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMTD(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last TD
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTTD^APCLAPI4(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMTOBS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last TOBACCO SCREENING
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTTOBS^APCLAPI1(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMTON(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last TONOMETRY
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTTON^APCLAPI1(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMVAE(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last VISUAL ACUTIY EXAM
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTVAE^APCLAPI1(P,APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
REMWT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last WEIGHT
;
I '$G(P) Q 0
I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(P)
I $G(APCLED)="" S APCLED=DT
NEW APCLR
S APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"WT","MEASUREMENT",APCLBD,APCLED,"A")
I APCLR]"" Q 1_"^"_APCLR
Q 0
;
APCLAPIR ; IHS/CMI/LAB - visit data ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;
+3 ;Documentation for each API:
+4 ; Input:
+5 ; APCLPDFN - Patient DFN
+6 ; APCLBD - beginning date to begin search for value - if blank, default is DOB
+7 ; APCLED - ending date of search - if blank, default is DT
+8 ;
+9 ; Output:
+10 ;returns the string:
+11 ; 1 or 0^date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
+12 ; piece 1: 1 if item found, 0 if no item found in the date range
+13 ; 2: date of last item
+14 ; 3: text of item found
+15 ; 4: value - result
+16 ; 5: visit ien on which item found
+17 ; 6: file item found in (usually a V File #)
+18 ; 7: ien of V File entry found
+19 ;
REMDEPS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last depression screening exam
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTDEPS^APCLAPI(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMALCS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last alcohol screening exam
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTALC^APCLAPI(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMAOF(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last assessment of function
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTAOF^APCLAPI4(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMBP(P,APCLBD,APCLED) ;PEP - called from reminders to get last BP
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"BP","MEASUREMENT",APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMBRST(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last breast exam
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTBRST^APCLAPI3(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMCHOL(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last cholesterol
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTCHOL^APCLAPI3(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMDENT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last dental exam
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTDENT^APCLAPI2(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMGLUC(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last glucose test
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTGLUC^APCLAPI3(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMIPVS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on IPV
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTIPVS^APCLAPI(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMEPSDT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last EPSDT
+1 IF '$GET(P)
QUIT 0
+2 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+3 IF $GET(APCLED)=""
SET APCLED=DT
+4 NEW APCLR
+5 SET APCLR=$$LASTEPS^APCLAPI3(P,APCLBD,APCLED,"A")
+6 IF APCLR]""
QUIT 1_"^"_APCLR
+7 QUIT 0
+8 ;
REMFRA(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last FALL RISK ASSESSMENT exam
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTFRA^APCLAPI2(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMHC(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last HEAD CIRCUMFERENCE
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"HC","MEASUREMENT",APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMHEAR(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last HEARING exam
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTHEAR^APCLAPI3(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMHT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last HEIGHT
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"HT","MEASUREMENT",APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMFLU(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last FLU SHOT
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTFLU^APCLAPI4(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMMAMM(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last MAMMOGRAM
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTMAM^APCLAPI1(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMOSTEO(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last OSTEOPOROSIS SCREENING
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTOST^APCLAPI4(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMPAP(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PAP SMEAR
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTPAP^APCLAPI1(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMPELV(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PELVIC EXAM
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTPELV^APCLAPI2(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMPHYS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PHYSICAL EXAM
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTPHYS^APCLAPI2(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMPNEU(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last PNEUMOVAX
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTPNEU^APCLAPI4(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMRECT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last RECTAL EXAM
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTRECT^APCLAPI2(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMRUBEL(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last RUBELLA
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTRUB^APCLAPI3(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMTD(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last TD
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTTD^APCLAPI4(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMTOBS(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last TOBACCO SCREENING
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTTOBS^APCLAPI1(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMTON(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last TONOMETRY
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTTON^APCLAPI1(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMVAE(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last VISUAL ACUTIY EXAM
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTVAE^APCLAPI1(P,APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;
REMWT(P,APCLBD,APCLED) ;PEP - called from reminders to get data on last WEIGHT
+1 ;
+2 IF '$GET(P)
QUIT 0
+3 IF $GET(APCLBD)=""
SET APCLBD=$$DOB^AUPNPAT(P)
+4 IF $GET(APCLED)=""
SET APCLED=DT
+5 NEW APCLR
+6 SET APCLR=$$LASTITEM^APCLAPIU(APCLPDFN,"WT","MEASUREMENT",APCLBD,APCLED,"A")
+7 IF APCLR]""
QUIT 1_"^"_APCLR
+8 QUIT 0
+9 ;