BUD1RPL2 ; IHS/CMI/LAB - UDS print lists ;
;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
;
T52 ;EP
S BUDP=0,BUD1L=35
I '$D(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L)) D T52H W !!,"No Uncategorized Provider visits to report." Q
D T52H
S BUD1L=35,BUD1L2=0,BUDY=$O(^BUDLTFIV("B",BUD1L,0)),BUDY=$P(^BUDLTFIV(BUDY,0),U,2)
W !!,"Line ",BUD1L," ",BUDY
S BUDCOM="" F S BUDCOM=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM)) Q:BUDCOM=""!(BUDQUIT) D
.S BUDAGE="" F S BUDAGE=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE)) Q:BUDAGE=""!(BUDQUIT) D
..S BUDSEX="" F S BUDSEX=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE,BUDSEX)) Q:BUDSEX=""!(BUDQUIT) D
...S DFN=0 F S DFN=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE,BUDSEX,DFN)) Q:DFN'=+DFN!(BUDQUIT) D T5W
...Q
..Q
.Q
W !
Q
T5W ;
W !,$E($P(^DPT(DFN,0),U,1),1,22),?24,$S($$HRN^AUPNPAT(DFN,BUDSITE)]"":$$HRN^AUPNPAT(DFN,BUDSITE,2),1:$$HRN^AUPNPAT(DFN,DUZ(2),2)),?36,$E(BUDCOM,1,12)
W ?51,$P(^DPT(DFN,0),U,2),?55,$$AGE^AUPNPAT(DFN,BUDCAD),?60,$E($P($$RACE^BUD1RPTC(DFN),U,4),1,15)," (",$P($$RACE^BUD1RPTC(DFN),U,3),")"
K BUDVLST S BUDV=0 F S BUDV=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE,BUDSEX,DFN,BUDV)) Q:BUDV'=+BUDV!(BUDQUIT) D
.S BUDVLST($P(^AUPNVSIT(BUDV,0),U),BUDV)=""
S BUDDD=0 F S BUDDD=$O(BUDVLST(BUDDD)) Q:BUDDD=""!(BUDQUIT) D
.S BUDV=0 F S BUDV=$O(BUDVLST(BUDDD,BUDV)) Q:BUDV'=+BUDV!(BUDQUIT) D
..I $Y>(IOSL-3) D T52H Q:BUDQUIT W !!,"Line ",BUD1L," ",BUDY
..W !?5,$$FMTE^XLFDT($P($P(^AUPNVSIT(BUDV,0),U),".")),?25,$E($$PRIMPROV^APCLV(BUDV,"E"),1,14),?42,$$PRIMPROV^APCLV(BUDV,"D"),?50,$P(^AUPNVSIT(BUDV,0),U,7),?55,$E($$CLINIC^APCLV(BUDV,"E"),1,14),?70,$E($$LOCENC^APCLV(BUDV,"E"),1,9)
..Q
Q
T52H ;
G:'BUDGPG T5H2
K DIR I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BUDQUIT=1 Q
T5H2 ;
W:$D(IOF) @IOF S BUDGPG=BUDGPG+1
W !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BUDGPG,!
W !,$$CTR("*** BPHC Uniform Data System (UDS) ***",80)
W !,$$CTR("Patient List for Table 5 Columns B & C, Uncategorized Provider Visits",80),!
W $$CTR($P(^DIC(4,BUDSITE,0),U),80),!
S X="Reporting Period: "_$$FMTE^XLFDT(BUDBD)_" to "_$$FMTE^XLFDT(BUDED) W $$CTR(X,80),!
W $TR($J("",80)," ","-")
I BUDP=0 W !,"List of all patients, for uncategorized provider visits. Displays",!,"community, gender, age and visit data, including Provider codes." D
.W !,"* (R) - denotes the value was obtained from the Race field"
.W !," (C) - denotes the value was obtained from the Classification/Beneficiary field"
.W !
W !,"PATIENT NAME",?24,"HRN",?36,"COMMUNITY",?50,"SEX",?55,"AGE",?60,"RACE*"
W !?5,"VISIT DATE",?25,"PROV TYPE",?41,"PROV CD",?50,"SRV",?55,"CLINIC",?70,"LOCATION"
W !,$TR($J("",80)," ","-")
S BUDP=1
Q
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
USR() ;EP - Return name of current user from ^VA(200.
Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
;----------
T51 ;EP
S BUDNEWR=1
S BUD1L="" F S BUD1L=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L)) Q:BUD1L=""!(BUDQUIT) D
.S BUD1L2="" F S BUD1L2=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L,BUD1L2)) Q:BUD1L2=""!(BUDQUIT) D
..S BUD1LL=BUD1L_$S(BUD1L2=0:"",1:BUD1L2)
..S BUDY=$O(^BUDLTFIV("B",BUD1LL,0)),BUDY=$P(^BUDLTFIV(BUDY,0),U,2)_" "_$P(^BUDLTFIV(BUDY,0),U,3)_" "_$P(^BUDLTFIV(BUDY,0),U,4)
..S BUDSUBT="Line "_BUD1LL_" "_BUDY
..I $Y>(IOSL-3)!$G(BUDNEWR) D T51H Q:BUDQUIT K BUDNEWR
..W !!,"Line ",BUD1LL," ",BUDY
..S BUDPROV="" F S BUDPROV=$O(^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L,BUD1L2,BUDPROV)) Q:BUDPROV=""!(BUDQUIT) D
...I $Y>(IOSL-3) D T51H Q:BUDQUIT W !!,"Line ",BUD1LL," ",BUDY
...W !,BUDPROV,?35,^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L,BUD1L2,BUDPROV)
.Q
W !
Q
T51H ;
G:'BUDGPG T51H1
K DIR I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BUDQUIT=1 Q
T51H1 ;
W:$D(IOF) @IOF S BUDGPG=BUDGPG+1
W !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BUDGPG,!
W !,$$CTR("*** BPHC Uniform Data System (UDS) ***",80)
W !,$$CTR("Personnel List for Table 5 Column A, By Service Category",80),!
W $$CTR($P(^DIC(4,BUDSITE,0),U),80),!
S X="Reporting Period: "_$$FMTE^XLFDT(BUDBD)_" to "_$$FMTE^XLFDT(BUDED) W $$CTR(X,80),!
S X="Population: "_$S($G(BUDBEN)=1:"Indian/Alaskan Native (Classification 01)",$G(BUDBEN)=2:"Not Indian Alaskan/Native (Not Classification 01)",$G(BUDBEN)=3:"All (both Indian/Alaskan Natives and Non 01)",1:"") W $$CTR(X,80),!
W $TR($J("",80)," ","-")
W !,"List of all Active Provider Personnel sorted by Major Service Category.",!
W !,"PROVIDER NAME",?35,"PROVIDER CODE",?70,"FTE"
W !,$TR($J("",80)," ","-")
Q
BUD1RPL2 ; IHS/CMI/LAB - UDS print lists ;
+1 ;;10.0;IHS/RPMS UNIFORM DATA SYSTEM;;FEB 04, 2016;Build 50
+2 ;
T52 ;EP
+1 SET BUDP=0
SET BUD1L=35
+2 IF '$DATA(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L))
DO T52H
WRITE !!,"No Uncategorized Provider visits to report."
QUIT
+3 DO T52H
+4 SET BUD1L=35
SET BUD1L2=0
SET BUDY=$ORDER(^BUDLTFIV("B",BUD1L,0))
SET BUDY=$PIECE(^BUDLTFIV(BUDY,0),U,2)
+5 WRITE !!,"Line ",BUD1L," ",BUDY
+6 SET BUDCOM=""
FOR
SET BUDCOM=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM))
IF BUDCOM=""!(BUDQUIT)
QUIT
Begin DoDot:1
+7 SET BUDAGE=""
FOR
SET BUDAGE=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE))
IF BUDAGE=""!(BUDQUIT)
QUIT
Begin DoDot:2
+8 SET BUDSEX=""
FOR
SET BUDSEX=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE,BUDSEX))
IF BUDSEX=""!(BUDQUIT)
QUIT
Begin DoDot:3
+9 SET DFN=0
FOR
SET DFN=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE,BUDSEX,DFN))
IF DFN'=+DFN!(BUDQUIT)
QUIT
DO T5W
+10 QUIT
End DoDot:3
+11 QUIT
End DoDot:2
+12 QUIT
End DoDot:1
+13 WRITE !
+14 QUIT
T5W ;
+1 WRITE !,$EXTRACT($PIECE(^DPT(DFN,0),U,1),1,22),?24,$SELECT($$HRN^AUPNPAT(DFN,BUDSITE)]"":$$HRN^AUPNPAT(DFN,BUDSITE,2),1:$$HRN^AUPNPAT(DFN,DUZ(2),2)),?36,$EXTRACT(BUDCOM,1,12)
+2 WRITE ?51,$PIECE(^DPT(DFN,0),U,2),?55,$$AGE^AUPNPAT(DFN,BUDCAD),?60,$EXTRACT($PIECE($$RACE^BUD1RPTC(DFN),U,4),1,15)," (",$PIECE($$RACE^BUD1RPTC(DFN),U,3),")"
+3 KILL BUDVLST
SET BUDV=0
FOR
SET BUDV=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T5",BUD1L,BUD1L2,BUDCOM,BUDAGE,BUDSEX,DFN,BUDV))
IF BUDV'=+BUDV!(BUDQUIT)
QUIT
Begin DoDot:1
+4 SET BUDVLST($PIECE(^AUPNVSIT(BUDV,0),U),BUDV)=""
End DoDot:1
+5 SET BUDDD=0
FOR
SET BUDDD=$ORDER(BUDVLST(BUDDD))
IF BUDDD=""!(BUDQUIT)
QUIT
Begin DoDot:1
+6 SET BUDV=0
FOR
SET BUDV=$ORDER(BUDVLST(BUDDD,BUDV))
IF BUDV'=+BUDV!(BUDQUIT)
QUIT
Begin DoDot:2
+7 IF $Y>(IOSL-3)
DO T52H
IF BUDQUIT
QUIT
WRITE !!,"Line ",BUD1L," ",BUDY
+8 WRITE !?5,$$FMTE^XLFDT($PIECE($PIECE(^AUPNVSIT(BUDV,0),U),".")),?25,$EXTRACT($$PRIMPROV^APCLV(BUDV,"E"),1,14),?42,$$PRIMPROV^APCLV(BUDV,"D"),?50,$PIECE(^AUPNVSIT(BUDV,0),U,7),?55,$EXTRACT($$CLINIC^APCLV(BUDV,"E"),1,14),?70,...
... $EXTRACT($$LOCENC^APCLV(BUDV,"E"),1,9)
+9 QUIT
End DoDot:2
End DoDot:1
+10 QUIT
T52H ;
+1 IF 'BUDGPG
GOTO T5H2
+2 KILL DIR
IF $EXTRACT(IOST)="C"
IF IO=IO(0)
IF '$DATA(ZTQUEUED)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET BUDQUIT=1
QUIT
T5H2 ;
+1 IF $DATA(IOF)
WRITE @IOF
SET BUDGPG=BUDGPG+1
+2 WRITE !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
+3 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BUDGPG,!
+4 WRITE !,$$CTR("*** BPHC Uniform Data System (UDS) ***",80)
+5 WRITE !,$$CTR("Patient List for Table 5 Columns B & C, Uncategorized Provider Visits",80),!
+6 WRITE $$CTR($PIECE(^DIC(4,BUDSITE,0),U),80),!
+7 SET X="Reporting Period: "_$$FMTE^XLFDT(BUDBD)_" to "_$$FMTE^XLFDT(BUDED)
WRITE $$CTR(X,80),!
+8 WRITE $TRANSLATE($JUSTIFY("",80)," ","-")
+9 IF BUDP=0
WRITE !,"List of all patients, for uncategorized provider visits. Displays",!,"community, gender, age and visit data, including Provider codes."
Begin DoDot:1
+10 WRITE !,"* (R) - denotes the value was obtained from the Race field"
+11 WRITE !," (C) - denotes the value was obtained from the Classification/Beneficiary field"
+12 WRITE !
End DoDot:1
+13 WRITE !,"PATIENT NAME",?24,"HRN",?36,"COMMUNITY",?50,"SEX",?55,"AGE",?60,"RACE*"
+14 WRITE !?5,"VISIT DATE",?25,"PROV TYPE",?41,"PROV CD",?50,"SRV",?55,"CLINIC",?70,"LOCATION"
+15 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+16 SET BUDP=1
+17 QUIT
CTR(X,Y) ;EP - Center X in a field Y wide.
+1 QUIT $JUSTIFY("",$SELECT($DATA(Y):Y,1:IOM)-$LENGTH(X)\2)_X
+2 ;----------
USR() ;EP - Return name of current user from ^VA(200.
+1 QUIT $SELECT($GET(DUZ):$SELECT($DATA(^VA(200,DUZ,0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
+2 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
+1 QUIT $SELECT($GET(DUZ(2)):$SELECT($DATA(^DIC(4,DUZ(2),0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
+2 ;----------
T51 ;EP
+1 SET BUDNEWR=1
+2 SET BUD1L=""
FOR
SET BUD1L=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L))
IF BUD1L=""!(BUDQUIT)
QUIT
Begin DoDot:1
+3 SET BUD1L2=""
FOR
SET BUD1L2=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L,BUD1L2))
IF BUD1L2=""!(BUDQUIT)
QUIT
Begin DoDot:2
+4 SET BUD1LL=BUD1L_$SELECT(BUD1L2=0:"",1:BUD1L2)
+5 SET BUDY=$ORDER(^BUDLTFIV("B",BUD1LL,0))
SET BUDY=$PIECE(^BUDLTFIV(BUDY,0),U,2)_" "_$PIECE(^BUDLTFIV(BUDY,0),U,3)_" "_$PIECE(^BUDLTFIV(BUDY,0),U,4)
+6 SET BUDSUBT="Line "_BUD1LL_" "_BUDY
+7 IF $Y>(IOSL-3)!$GET(BUDNEWR)
DO T51H
IF BUDQUIT
QUIT
KILL BUDNEWR
+8 WRITE !!,"Line ",BUD1LL," ",BUDY
+9 SET BUDPROV=""
FOR
SET BUDPROV=$ORDER(^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L,BUD1L2,BUDPROV))
IF BUDPROV=""!(BUDQUIT)
QUIT
Begin DoDot:3
+10 IF $Y>(IOSL-3)
DO T51H
IF BUDQUIT
QUIT
WRITE !!,"Line ",BUD1LL," ",BUDY
+11 WRITE !,BUDPROV,?35,^XTMP("BUD1RPT1",BUDJ,BUDH,"T51",BUD1L,BUD1L2,BUDPROV)
End DoDot:3
End DoDot:2
+12 QUIT
End DoDot:1
+13 WRITE !
+14 QUIT
T51H ;
+1 IF 'BUDGPG
GOTO T51H1
+2 KILL DIR
IF $EXTRACT(IOST)="C"
IF IO=IO(0)
IF '$DATA(ZTQUEUED)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET BUDQUIT=1
QUIT
T51H1 ;
+1 IF $DATA(IOF)
WRITE @IOF
SET BUDGPG=BUDGPG+1
+2 WRITE !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
+3 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BUDGPG,!
+4 WRITE !,$$CTR("*** BPHC Uniform Data System (UDS) ***",80)
+5 WRITE !,$$CTR("Personnel List for Table 5 Column A, By Service Category",80),!
+6 WRITE $$CTR($PIECE(^DIC(4,BUDSITE,0),U),80),!
+7 SET X="Reporting Period: "_$$FMTE^XLFDT(BUDBD)_" to "_$$FMTE^XLFDT(BUDED)
WRITE $$CTR(X,80),!
+8 SET X="Population: "_$SELECT($GET(BUDBEN)=1:"Indian/Alaskan Native (Classification 01)",$GET(BUDBEN)=2:"Not Indian Alaskan/Native (Not Classification 01)",$GET(BUDBEN)=3:"All (both Indian/Alaskan Natives and Non 01)",1:"")
WRITE $$CTR(X,80),!
+9 WRITE $TRANSLATE($JUSTIFY("",80)," ","-")
+10 WRITE !,"List of all Active Provider Personnel sorted by Major Service Category.",!
+11 WRITE !,"PROVIDER NAME",?35,"PROVIDER CODE",?70,"FTE"
+12 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+13 QUIT