Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BSDX41M

BSDX41M.m

Go to the documentation of this file.
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
 ;