BSDX41M ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
;
SURV ; ******************** SURVEILLANCE - HARD CODE *******
Q:'$D(^APCHSCTL(APCHSTYP,5,0))
S APCHSDOB=$P(^DPT(APCHSPAT,0),U,3)
S X1=DT,X2=APCHSDOB D ^%DTC S APCHSAGE=$$AGE^AUPNPAT(APCHSPAT)
S APCHSEX=$P(^DPT(APCHSPAT,0),U,2)
;
S (APCHSANY,APCHSITM)=0
K APCHSTEX
;
S APCHSURX="K APCHSTEX,APCHOVR,APCHICAR,APCHLAST,APCHSRTP,APCHNEXT,APCHSBWR,X,C,%,T,Y,APCHNUMD,S,R,APCHTAXN,APCHSINT,APCHT,APCHREF,APCHSCRI,APCHTEST,APCHLSIG,APCHLCOL,APCHLBE,APCHPBEG,N,APCHPNEU,APCHMMR,APCHY,APCHX,APCHLSIC,APCHLCOI,APCHLBEI"
;
F APCHSLP=0:0 S APCHSITM=$O(^APCHSCTL(APCHSTYP,5,APCHSITM)) Q:'APCHSITM!($D(APCHSQIT)) D
.S APCHSITI=$P(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2)
.I $P(^APCHSURV($P(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2),0),U,7)'="R" Q ;REMINDERS ONLY
.I $D(^APCHSURV($P(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2),0)) S APCHSDO=$P(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2) I APCHSDO]"" D @($P(APCHSDO,";")_U_$P(APCHSDO,";",2))
;
D EOJ
Q
;
URINE ;
Q:APCHSAGE'<13
K APCHSLDT
S APCHSLAB="URINALYSIS" D LABDFN D:APCHSLBD MULTLAB
S APCHSLAB="URINE GLUCOSE" D LABDFN D:APCHSLBD MULTLAB
Q:'APCHSLBD
S APCHSDIS="URINALYSIS"
S APCHSIVD=$O(APCHSLDT(""))
I 'APCHSIVD,APCHSAGE>5 S APCHSDUE="MAY BE DUE NOW",APCHSDAT="" D DISPLAY Q
I 'APCHSIVD S X1=APCHSDOB,X2=365*5 D C^%DTC S Y=X X APCHSCVD S APCHSDUE=Y,APCHSDAT="" D DISPLAY Q
D GETDATE S APCHSLST=APCHSDAT
D PASTAGE
I APCHSAGE<5,APCHSOLD'>3 S APCHSIVD=9999999-(APCHSDOB+50000) D GETDATE S APCHSDUE=APCHSDAT,APCHSDAT=APCHSLST D DISPLAY Q
D PASTAGE I APCHSOLD'>3 S APCHSDUE="MAY BE DUE NOW",APCHSDAT=APCHSLST D DISPLAY Q
Q
;
MULTLAB ;ENTRY POINT
;GET LAST VISIT DATE FROM AMONG TWO LAB TESTS
K APCHSDT
S APCHSDT=$O(^AUPNVLAB("AA",APCHSPAT,APCHSLBD,""))
I APCHSDT S APCHSLDT(APCHSDT)=""
Q
;
REGEXAM ;ENTRY POINT
;PELVIC, RECTAL, BREAST
D EXAMDFN Q:'APCHSEXD
S APCHSIVD=$O(^AUPNVXAM("AA",APCHSPAT,APCHSEXD,""))
I 'APCHSIVD S APCHSDUE="MAY BE DUE NOW",APCHSDAT="" D REFEXAM,DISPLAY Q
D GETDATE
I '$D(APCHSTEX) D COMPARE,REFEXAM,DISPLAY I 1
E D DISPLAY
Q
;
;
REGLAB ;ENTRY POINT
D LABDFN
Q:'APCHSLBD
S APCHSIVD=$O(^AUPNVLAB("AA",APCHSPAT,APCHSLBD,""))
I 'APCHSIVD S APCHSDUE="MAY BE DUE NOW",APCHSDAT="",APCHSEXD=$O(^LAB(60,"B",APCHSLAB,0)),APCHSDF1=60 D REFDF,DISPLAY G A
D GETDATE
S APCHSEXD=$O(^LAB(60,"B",APCHSLAB,0)),APCHSDF1=60
I '$D(APCHSTEX) D COMPARE D REFDF,DISPLAY I 1
E D REFDF,DISPLAY
A Q
;
DFSURV ;ENTRY POINT (SURVEILLANCES found by the Data Fetcher)
;DM FOOT, DM EYE, DM DENTAL, DM CHOLESTEROL, DM CREATININE
;DM TRIGLYCERIDES, PHYSICAL EXAMS
I 'APCHSIVD S APCHSDUE="MAY BE DUE NOW",APCHSDAT="" D REFDF,DISPLAY G DFSURVX
D GETDATE
I '$D(APCHSTEX) D COMPARE,REFDF,DISPLAY I 1
E D DISPLAY
DFSURVX ;
Q
;
;
COMPARE ;ENTRY POINT
S X1=9999999-$P(APCHSIVD,"."),X2=APCHSINT D C^%DTC S Y=X X APCHSCVD S (APCHSDUE,APCHSWD)=Y
S X2=9999999-$P(APCHSIVD,"."),X1=DT D ^%DTC I X>APCHSINT S APCHSDUE=$S('$D(APCHSDD):"MAY BE DUE NOW (WAS DUE "_APCHSWD_")",1:"MAY BE DUE NOW")
Q
;
GETDATE ;ENTRY POINT
S Y=-$P(APCHSIVD,".")+9999999 X APCHSCVD S APCHSDAT=Y
Q
;
PASTAGE ;ENTRY POINT;GETS AGE AT TIME OF LAST PROCEDURE OR EXAM, ETC
S X1=9999999-$P(APCHSIVD,"."),X2=APCHSDOB D ^%DTC S APCHSOLD=$J(X/365.25,1,2)
Q
;
EXAMDFN ;ENTRY POINT
S APCHSEXD=$O(^AUTTEXAM("C",APCHSEXN,""))
Q
;
LABDFN ;ENTRY POINT
S APCHSLBD=$O(^LAB(60,"B",APCHSLAB,""))
Q
;
DISPLAY ;ENTRY POINT
I 'APCHSANY D FIRST Q:$D(APCHSQIT) S APCHSANY=1
X APCHSCKP Q:$D(APCHSQIT)
I APCHSNPG D
.S BSDXTMP=$$FILL^BSDX41(24)_"LAST"
.S BSDXTMP=BSDXTMP_$$FILL^BSDX41(37-$L(BSDXTMP))_"NEXT"
.S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=BSDXTMP_$C(30)
.S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=$C(30)
.S BXDXTMP=""
.S APCHSCT=0
S BSDXTMP=APCHSDIS_$$FILL^BSDX41(22-$L(APCHSDIS))_APCHSDAT
I $D(APCHSTEX) D
.S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=BSDXTMP_$$FILL^BSDX41(35-$L(BSDXTMP))_APCHSTEX(1)_$C(30)
.F APCHSL=2:1 Q:'$D(APCHSTEX(APCHSL)) S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=$$FILL^BSDX41(35)_APCHSTEX(APCHSL)_$C(30)
E S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=BSDXTMP_$$FILL^BSDX41(35-$L(BSDXTMP))_APCHSDUE_$C(30)
S BSDXTMP=""
S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=$C(30)
S APCHSCT=APCHSCT+1
I '(APCHSCT#4) D
.;X APCHSCKP Q:$D(APCHSQIT)
.S:'APCHSNPG BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=$C(30)
K APCHSTEX Q
;
FIRST ;EP
;X APCHSCKP Q:$D(APCHSQIT) X:'APCHSNPG APCHSBRK
S BSDXTMP=$$FILL^BSDX41(24)_"LAST"
S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=BSDXTMP_$$FILL^BSDX41(37-$L(BSDXTMP))_"NEXT"_$C(30)
S BSDXI=BSDXI+1 S ^BSDXTMP($J,BSDXI)=$C(30)
S BSDXTMP=""
S APCHSCT=0
Q
;
REFDF ;EP dm item refused?
I '$G(APCHSDF1) Q
I $G(APCHSDUE)'["DUE" Q
I $G(APCHSTAX)]"" D REFDFM Q
I '$G(APCHSEXD) Q
NEW X S X=$O(^AUPNPREF("AA",APCHSPAT,APCHSDF1,APCHSEXD,0))
I 'X Q ;none of this exam was refused
N APCHS1,APCHS2 S (APCHS1,APCHS2)=0 F S APCHS1=$O(APCHSTEX(APCHS1)) Q:APCHS1'=+APCHS1 S APCHS2=APCHS1
I $D(APCHSTEX) S APCHS2=APCHS2+1,APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS,APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X)) Q
I '$D(APCHSTEX) S APCHS2=APCHS2+1,APCHSTEX(APCHS2)=APCHSDUE,APCHS2=APCHS2+1,APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS,APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
Q
REFDFM ;taxonomy check for dm item
NEW G
S G=0,APCHSEXD=0 F S APCHSEXD=$O(^ATXLAB(APCHSTAX,21,"B",APCHSEXD)) Q:APCHSEXD'=+APCHSEXD!(G) D
.NEW X S X=$O(^AUPNPREF("AA",APCHSPAT,APCHSDF1,APCHSEXD,0))
.I 'X Q ;none of this exam was refused
.S G=1 N APCHS1,APCHS2 S (APCHS1,APCHS2)=0 F S APCHS1=$O(APCHSTEX(APCHS1)) Q:APCHS1'=+APCHS1 S APCHS2=APCHS1
.I $D(APCHSTEX) S APCHS2=APCHS2+1,APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS,APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X)) Q
.I '$D(APCHSTEX) S APCHS2=APCHS2+1,APCHSTEX(APCHS2)=APCHSDUE,APCHS2=APCHS2+1,APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS,APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
Q
REFEXAM ; did this patient refuse this exam
I '$G(APCHSEXD) Q
Q:$G(APCHSDUE)'["MAY BE DUE"
NEW X S X=$O(^AUPNPREF("AA",APCHSPAT,9999999.15,APCHSEXD,0))
I 'X Q ;none of this exam was refused
K APCHSTEX S APCHSTEX(1)=APCHSDUE,APCHSTEX(2)="**NOTE** Patient refused a "_APCHSDIS,APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
Q
EOJ ;
K APCHSEXM,APCHSEXD,APCHSIVD,APCHSDUE,APCHSNTE,APCHSDOB,APCHSAGE,APCHSINT,APCHSWD,APCHSPRC,APCHSTP,APCHSDF
K APCHSCT,APCHSBP,APCHSITM,APCHSDO,APCHSDA,APCHSER,APCHSINM,APCHSLP
K X1,X2,APCHSLAB,APCHSYRY,APCHSL
K APCHSOLD,APCHSIVB,APCHSIVA,APCHSLST,APCHSANY,APCHSDAT,APCHSDIS,APCHSEX,APCHSEXN,APCHSLBD,APCHSKDT,APCHSKN,APCHSKND,APCHSLDT,APCHSDT
K APCHSIM,APCHSIMD,APCHSKD,APCHSMSC,APCHSMSD,APCHSURD,APCHSLAB
K APCHSMDT,APCHSMAM,APCHSDD,X,Y
K APCHS,APCHDMPT,APCHSCAT,APCHSONE,APCHSHFD
Q
;
BSDX41M ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
+1 ;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
+2 ;
SURV ; ******************** SURVEILLANCE - HARD CODE *******
+1 IF '$DATA(^APCHSCTL(APCHSTYP,5,0))
QUIT
+2 SET APCHSDOB=$PIECE(^DPT(APCHSPAT,0),U,3)
+3 SET X1=DT
SET X2=APCHSDOB
DO ^%DTC
SET APCHSAGE=$$AGE^AUPNPAT(APCHSPAT)
+4 SET APCHSEX=$PIECE(^DPT(APCHSPAT,0),U,2)
+5 ;
+6 SET (APCHSANY,APCHSITM)=0
+7 KILL APCHSTEX
+8 ;
+9 SET APCHSURX="K APCHSTEX,APCHOVR,APCHICAR,APCHLAST,APCHSRTP,APCHNEXT,APCHSBWR,X,C,%,T,Y,APCHNUMD,S,R,APCHTAXN,APCHSINT,APCHT,APCHREF,APCHSCRI,APCHTEST,APCHLSIG,APCHLCOL,APCHLBE,APCHPBEG,N,APCHPNEU,APCHMMR,APCHY,APCHX,APCHLSIC,APCHLCOI,APCHLBEI"
+10 ;
+11 FOR APCHSLP=0:0
SET APCHSITM=$ORDER(^APCHSCTL(APCHSTYP,5,APCHSITM))
IF 'APCHSITM!($DATA(APCHSQIT))
QUIT
Begin DoDot:1
+12 SET APCHSITI=$PIECE(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2)
+13 ;REMINDERS ONLY
IF $PIECE(^APCHSURV($PIECE(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2),0),U,7)'="R"
QUIT
+14 IF $DATA(^APCHSURV($PIECE(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2),0))
SET APCHSDO=$PIECE(^APCHSCTL(APCHSTYP,5,APCHSITM,0),U,2)
IF APCHSDO]""
DO @($PIECE(APCHSDO,";")_U_$PIECE(APCHSDO,";",2))
End DoDot:1
+15 ;
+16 DO EOJ
+17 QUIT
+18 ;
URINE ;
+1 IF APCHSAGE'<13
QUIT
+2 KILL APCHSLDT
+3 SET APCHSLAB="URINALYSIS"
DO LABDFN
IF APCHSLBD
DO MULTLAB
+4 SET APCHSLAB="URINE GLUCOSE"
DO LABDFN
IF APCHSLBD
DO MULTLAB
+5 IF 'APCHSLBD
QUIT
+6 SET APCHSDIS="URINALYSIS"
+7 SET APCHSIVD=$ORDER(APCHSLDT(""))
+8 IF 'APCHSIVD
IF APCHSAGE>5
SET APCHSDUE="MAY BE DUE NOW"
SET APCHSDAT=""
DO DISPLAY
QUIT
+9 IF 'APCHSIVD
SET X1=APCHSDOB
SET X2=365*5
DO C^%DTC
SET Y=X
XECUTE APCHSCVD
SET APCHSDUE=Y
SET APCHSDAT=""
DO DISPLAY
QUIT
+10 DO GETDATE
SET APCHSLST=APCHSDAT
+11 DO PASTAGE
+12 IF APCHSAGE<5
IF APCHSOLD'>3
SET APCHSIVD=9999999-(APCHSDOB+50000)
DO GETDATE
SET APCHSDUE=APCHSDAT
SET APCHSDAT=APCHSLST
DO DISPLAY
QUIT
+13 DO PASTAGE
IF APCHSOLD'>3
SET APCHSDUE="MAY BE DUE NOW"
SET APCHSDAT=APCHSLST
DO DISPLAY
QUIT
+14 QUIT
+15 ;
MULTLAB ;ENTRY POINT
+1 ;GET LAST VISIT DATE FROM AMONG TWO LAB TESTS
+2 KILL APCHSDT
+3 SET APCHSDT=$ORDER(^AUPNVLAB("AA",APCHSPAT,APCHSLBD,""))
+4 IF APCHSDT
SET APCHSLDT(APCHSDT)=""
+5 QUIT
+6 ;
REGEXAM ;ENTRY POINT
+1 ;PELVIC, RECTAL, BREAST
+2 DO EXAMDFN
IF 'APCHSEXD
QUIT
+3 SET APCHSIVD=$ORDER(^AUPNVXAM("AA",APCHSPAT,APCHSEXD,""))
+4 IF 'APCHSIVD
SET APCHSDUE="MAY BE DUE NOW"
SET APCHSDAT=""
DO REFEXAM
DO DISPLAY
QUIT
+5 DO GETDATE
+6 IF '$DATA(APCHSTEX)
DO COMPARE
DO REFEXAM
DO DISPLAY
IF 1
+7 IF '$TEST
DO DISPLAY
+8 QUIT
+9 ;
+10 ;
REGLAB ;ENTRY POINT
+1 DO LABDFN
+2 IF 'APCHSLBD
QUIT
+3 SET APCHSIVD=$ORDER(^AUPNVLAB("AA",APCHSPAT,APCHSLBD,""))
+4 IF 'APCHSIVD
SET APCHSDUE="MAY BE DUE NOW"
SET APCHSDAT=""
SET APCHSEXD=$ORDER(^LAB(60,"B",APCHSLAB,0))
SET APCHSDF1=60
DO REFDF
DO DISPLAY
GOTO A
+5 DO GETDATE
+6 SET APCHSEXD=$ORDER(^LAB(60,"B",APCHSLAB,0))
SET APCHSDF1=60
+7 IF '$DATA(APCHSTEX)
DO COMPARE
DO REFDF
DO DISPLAY
IF 1
+8 IF '$TEST
DO REFDF
DO DISPLAY
A QUIT
+1 ;
DFSURV ;ENTRY POINT (SURVEILLANCES found by the Data Fetcher)
+1 ;DM FOOT, DM EYE, DM DENTAL, DM CHOLESTEROL, DM CREATININE
+2 ;DM TRIGLYCERIDES, PHYSICAL EXAMS
+3 IF 'APCHSIVD
SET APCHSDUE="MAY BE DUE NOW"
SET APCHSDAT=""
DO REFDF
DO DISPLAY
GOTO DFSURVX
+4 DO GETDATE
+5 IF '$DATA(APCHSTEX)
DO COMPARE
DO REFDF
DO DISPLAY
IF 1
+6 IF '$TEST
DO DISPLAY
DFSURVX ;
+1 QUIT
+2 ;
+3 ;
COMPARE ;ENTRY POINT
+1 SET X1=9999999-$PIECE(APCHSIVD,".")
SET X2=APCHSINT
DO C^%DTC
SET Y=X
XECUTE APCHSCVD
SET (APCHSDUE,APCHSWD)=Y
+2 SET X2=9999999-$PIECE(APCHSIVD,".")
SET X1=DT
DO ^%DTC
IF X>APCHSINT
SET APCHSDUE=$SELECT('$DATA(APCHSDD):"MAY BE DUE NOW (WAS DUE "_APCHSWD_")",1:"MAY BE DUE NOW")
+3 QUIT
+4 ;
GETDATE ;ENTRY POINT
+1 SET Y=-$PIECE(APCHSIVD,".")+9999999
XECUTE APCHSCVD
SET APCHSDAT=Y
+2 QUIT
+3 ;
PASTAGE ;ENTRY POINT;GETS AGE AT TIME OF LAST PROCEDURE OR EXAM, ETC
+1 SET X1=9999999-$PIECE(APCHSIVD,".")
SET X2=APCHSDOB
DO ^%DTC
SET APCHSOLD=$JUSTIFY(X/365.25,1,2)
+2 QUIT
+3 ;
EXAMDFN ;ENTRY POINT
+1 SET APCHSEXD=$ORDER(^AUTTEXAM("C",APCHSEXN,""))
+2 QUIT
+3 ;
LABDFN ;ENTRY POINT
+1 SET APCHSLBD=$ORDER(^LAB(60,"B",APCHSLAB,""))
+2 QUIT
+3 ;
DISPLAY ;ENTRY POINT
+1 IF 'APCHSANY
DO FIRST
IF $DATA(APCHSQIT)
QUIT
SET APCHSANY=1
+2 XECUTE APCHSCKP
IF $DATA(APCHSQIT)
QUIT
+3 IF APCHSNPG
Begin DoDot:1
+4 SET BSDXTMP=$$FILL^BSDX41(24)_"LAST"
+5 SET BSDXTMP=BSDXTMP_$$FILL^BSDX41(37-$LENGTH(BSDXTMP))_"NEXT"
+6 SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=BSDXTMP_$CHAR(30)
+7 SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=$CHAR(30)
+8 SET BXDXTMP=""
+9 SET APCHSCT=0
End DoDot:1
+10 SET BSDXTMP=APCHSDIS_$$FILL^BSDX41(22-$LENGTH(APCHSDIS))_APCHSDAT
+11 IF $DATA(APCHSTEX)
Begin DoDot:1
+12 SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=BSDXTMP_$$FILL^BSDX41(35-$LENGTH(BSDXTMP))_APCHSTEX(1)_$CHAR(30)
+13 FOR APCHSL=2:1
IF '$DATA(APCHSTEX(APCHSL))
QUIT
SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=$$FILL^BSDX41(35)_APCHSTEX(APCHSL)_$CHAR(30)
End DoDot:1
+14 IF '$TEST
SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=BSDXTMP_$$FILL^BSDX41(35-$LENGTH(BSDXTMP))_APCHSDUE_$CHAR(30)
+15 SET BSDXTMP=""
+16 SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=$CHAR(30)
+17 SET APCHSCT=APCHSCT+1
+18 IF '(APCHSCT#4)
Begin DoDot:1
+19 ;X APCHSCKP Q:$D(APCHSQIT)
+20 IF 'APCHSNPG
SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=$CHAR(30)
End DoDot:1
+21 KILL APCHSTEX
QUIT
+22 ;
FIRST ;EP
+1 ;X APCHSCKP Q:$D(APCHSQIT) X:'APCHSNPG APCHSBRK
+2 SET BSDXTMP=$$FILL^BSDX41(24)_"LAST"
+3 SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=BSDXTMP_$$FILL^BSDX41(37-$LENGTH(BSDXTMP))_"NEXT"_$CHAR(30)
+4 SET BSDXI=BSDXI+1
SET ^BSDXTMP($JOB,BSDXI)=$CHAR(30)
+5 SET BSDXTMP=""
+6 SET APCHSCT=0
+7 QUIT
+8 ;
REFDF ;EP dm item refused?
+1 IF '$GET(APCHSDF1)
QUIT
+2 IF $GET(APCHSDUE)'["DUE"
QUIT
+3 IF $GET(APCHSTAX)]""
DO REFDFM
QUIT
+4 IF '$GET(APCHSEXD)
QUIT
+5 NEW X
SET X=$ORDER(^AUPNPREF("AA",APCHSPAT,APCHSDF1,APCHSEXD,0))
+6 ;none of this exam was refused
IF 'X
QUIT
+7 NEW APCHS1,APCHS2
SET (APCHS1,APCHS2)=0
FOR
SET APCHS1=$ORDER(APCHSTEX(APCHS1))
IF APCHS1'=+APCHS1
QUIT
SET APCHS2=APCHS1
+8 IF $DATA(APCHSTEX)
SET APCHS2=APCHS2+1
SET APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS
SET APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
QUIT
+9 IF '$DATA(APCHSTEX)
SET APCHS2=APCHS2+1
SET APCHSTEX(APCHS2)=APCHSDUE
SET APCHS2=APCHS2+1
SET APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS
SET APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
+10 QUIT
REFDFM ;taxonomy check for dm item
+1 NEW G
+2 SET G=0
SET APCHSEXD=0
FOR
SET APCHSEXD=$ORDER(^ATXLAB(APCHSTAX,21,"B",APCHSEXD))
IF APCHSEXD'=+APCHSEXD!(G)
QUIT
Begin DoDot:1
+3 NEW X
SET X=$ORDER(^AUPNPREF("AA",APCHSPAT,APCHSDF1,APCHSEXD,0))
+4 ;none of this exam was refused
IF 'X
QUIT
+5 SET G=1
NEW APCHS1,APCHS2
SET (APCHS1,APCHS2)=0
FOR
SET APCHS1=$ORDER(APCHSTEX(APCHS1))
IF APCHS1'=+APCHS1
QUIT
SET APCHS2=APCHS1
+6 IF $DATA(APCHSTEX)
SET APCHS2=APCHS2+1
SET APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS
SET APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
QUIT
+7 IF '$DATA(APCHSTEX)
SET APCHS2=APCHS2+1
SET APCHSTEX(APCHS2)=APCHSDUE
SET APCHS2=APCHS2+1
SET APCHSTEX(APCHS2)="**NOTE** Patient refused a "_APCHSDIS
SET APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
End DoDot:1
+8 QUIT
REFEXAM ; did this patient refuse this exam
+1 IF '$GET(APCHSEXD)
QUIT
+2 IF $GET(APCHSDUE)'["MAY BE DUE"
QUIT
+3 NEW X
SET X=$ORDER(^AUPNPREF("AA",APCHSPAT,9999999.15,APCHSEXD,0))
+4 ;none of this exam was refused
IF 'X
QUIT
+5 KILL APCHSTEX
SET APCHSTEX(1)=APCHSDUE
SET APCHSTEX(2)="**NOTE** Patient refused a "_APCHSDIS
SET APCHSTEX(3)=" on "_$$FMTE^XLFDT((9999999-X))
+6 QUIT
EOJ ;
+1 KILL APCHSEXM,APCHSEXD,APCHSIVD,APCHSDUE,APCHSNTE,APCHSDOB,APCHSAGE,APCHSINT,APCHSWD,APCHSPRC,APCHSTP,APCHSDF
+2 KILL APCHSCT,APCHSBP,APCHSITM,APCHSDO,APCHSDA,APCHSER,APCHSINM,APCHSLP
+3 KILL X1,X2,APCHSLAB,APCHSYRY,APCHSL
+4 KILL APCHSOLD,APCHSIVB,APCHSIVA,APCHSLST,APCHSANY,APCHSDAT,APCHSDIS,APCHSEX,APCHSEXN,APCHSLBD,APCHSKDT,APCHSKN,APCHSKND,APCHSLDT,APCHSDT
+5 KILL APCHSIM,APCHSIMD,APCHSKD,APCHSMSC,APCHSMSD,APCHSURD,APCHSLAB
+6 KILL APCHSMDT,APCHSMAM,APCHSDD,X,Y
+7 KILL APCHS,APCHDMPT,APCHSCAT,APCHSONE,APCHSHFD
+8 QUIT
+9 ;