BGP9DPEP ; IHS/CMI/LAB - IHS gpra print 01 Jul 2008 7:54 PM ;
;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
;
;
PRINT ;
S BGPRTYPE=6,BGP9RPTH=""
K ^TMP($J)
K BGPDELIM
I BGPROT="D" G DEL
S BGPIOSL=$S($G(BGPGUI):55,1:$G(IOSL))
D ^BGP9DH
I BGPQHDR D KITM Q
S BGPGPG=0
S BGPQUIT=""
D PRINT1
K ^TMP($J)
I BGPROT="P" D KITM Q
;
DEL ;create delimited output file
I '$D(BGPGUI) D ^%ZISC ;close printer device
K ^TMP($J)
D DEL^BGP9DPED
K ^XTMP("BGP9PE",BGPJ,BGPH)
K ^TMP($J)
Q
;
PRINT1 ;EP
K ^TMP($J)
S BGPIC=0 F S BGPIC=$O(BGPIND(BGPIC)) Q:BGPIC=""!(BGPQUIT) D
.D HEADER
.I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
.W !!,$P(^BGPPEIN(BGPIC,0),U,2)
.I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
.W !!,"Denominator(s):"
.S BGPX=0 F S BGPX=$O(^BGPPEIN(BGPIC,61,"B",BGPX)) Q:BGPX'=+BGPX!(BGPQUIT) D
..S BGPY=0 F S BGPY=$O(^BGPPEIN(BGPIC,61,"B",BGPX,BGPY)) Q:BGPY'=+BGPY!(BGPQUIT) D
...S BGPZ=0 F S BGPZ=$O(^BGPPEIN(BGPIC,61,BGPY,11,BGPZ)) Q:BGPZ'=+BGPZ!(BGPQUIT) D
....I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
....W !,^BGPPEIN(BGPIC,61,BGPY,11,BGPZ,0)
....Q
...Q
..Q
.I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
.W !!,"Numerator(s):"
.S BGPX=0 F S BGPX=$O(^BGPPEIN(BGPIC,62,"B",BGPX)) Q:BGPX'=+BGPX!(BGPQUIT) D
..S BGPY=0 F S BGPY=$O(^BGPPEIN(BGPIC,62,"B",BGPX,BGPY)) Q:BGPY'=+BGPY!(BGPQUIT) D
...S BGPZ=0 F S BGPZ=$O(^BGPPEIN(BGPIC,62,BGPY,11,BGPZ)) Q:BGPZ'=+BGPZ!(BGPQUIT) D
....I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
....W !,^BGPPEIN(BGPIC,62,BGPY,11,BGPZ,0)
....Q
...;W !
...Q
..Q
.S BGPNODE=11
.W ! S BGPX=0 F S BGPX=$O(^BGPPEIN(BGPIC,BGPNODE,BGPX)) Q:BGPX'=+BGPX D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
..W !,^BGPPEIN(BGPIC,BGPNODE,BGPX,0)
.D @BGPIC
.Q:BGPQUIT
;
D ^BGP9DPEL
D EXIT
Q
1 ;
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2)
D H1^BGP9DPH
S BGPCYD=$$V(1,BGPRPT,11,1)
S BGPPRD=$$V(2,BGPRPT,11,1)
S BGPBLD=$$V(3,BGPRPT,11,1)
W !!,"User Pop"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
S N=11,P=2 D SETN
W !,"# w/ patient ed"
D H2^BGP9DPH
Q
2 ;
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2)
D H1^BGP9DPH
S BGPCYD=$$V(1,BGPRPT,11,7)
S BGPPRD=$$V(2,BGPRPT,11,7)
S BGPBLD=$$V(3,BGPRPT,11,7)
W !!,"Total Time Spent",!,"Providing Education",!,"(mins)"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
K BGPPROVS
S N=12 D SETNM
K BGPX
S X="",C=0 F S X=$O(BGPPROVS(X)) Q:X="" S Y="" F S Y=$O(BGPPROVS(X,Y)) Q:Y="" S C=C+1 S BGPX((9999999-$P(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
S BGP1=0 F S BGP1=$O(BGPX(BGP1)) Q:BGP1'=+BGP1!(BGPQUIT) D
.S BGP2=0 F S BGP2=$O(BGPX(BGP1,BGP2)) Q:BGP2'=+BGP2!(BGPQUIT) D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
..W !,$E($P(BGPX(BGP1,BGP2),U,2),1,20)
..S BGPCYN=$P(BGPX(BGP1,BGP2),U,3)
..S BGPPRN=$P(BGPX(BGP1,BGP2),U,4)
..S BGPBLN=$P(BGPX(BGP1,BGP2),U,5)
..S BGPCYP=$P(BGPX(BGP1,BGP2),U,6)
..S BGPPRP=$P(BGPX(BGP1,BGP2),U,7)
..S BGPBLP=$P(BGPX(BGP1,BGP2),U,8)
..D H2^BGP9DPH
I '$G(BGPAREAA) D
.S BGPAA=$$V(1,BGPRPT,11,7)
.S BGPAB=$$V(2,BGPRPT,11,7)
.S BGPAC=$$V(3,BGPRPT,11,7)
.S BGPCYN=$$V(1,BGPRPT,11,6)
.S BGPPRN=$$V(2,BGPRPT,11,6)
.S BGPBLN=$$V(3,BGPRPT,11,6)
.S BGPCYD=$$V(1,BGPRPT,11,3)
.S BGPPRD=$$V(2,BGPRPT,11,3)
.S BGPBLD=$$V(3,BGPRPT,11,3)
I $G(BGPAREAA) D
.S BGPAA=$$V(1,BGPRPT,11,7)
.S BGPAB=$$V(2,BGPRPT,11,7)
.S BGPAC=$$V(3,BGPRPT,11,7)
.S BGPCYN=$$V(1,BGPRPT,11,6)
.S BGPPRN=$$V(2,BGPRPT,11,6)
.S BGPBLN=$$V(3,BGPRPT,11,6)
.S BGPCYD=$S(BGPAA:BGPAA/BGPCYN,1:0)
.S BGPPRD=$S(BGPAB:BGPAB/BGPPRN,1:0)
.S BGPBLD=$S(BGPAC:BGPAC/BGPBLN,1:0)
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
W !!,"Total # of Minutes recorded",!,"for All Providers"
W ?20,$$C(BGPAA,0,8),?35,$$C(BGPAB,0,8),?58,$$C(BGPAC,0,8),!
W !,"Total # of Pt Ed Codes with Provider",!,"and minutes recorded"
W ?20,$$C(BGPCYN,0,8),?35,$$C(BGPPRN,0,8),?58,$$C(BGPBLN,0,8)
W !!,"Average Time Spent",!,"All Providers",!,"(minutes)"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
I $G(BGPAREAA) D
.S BGPCYD=999999999,BGPBLD=999999999,BGPPRD=999999999
.S X=0 F S X=$O(BGPSUL(X)) Q:X'=+X D
..I $P($G(^BGPPEDCN(X,11)),U,4)]"",$P($G(^BGPPEDCN(X,11)),U,4)<BGPCYD S BGPCYD=$P($G(^BGPPEDCN(X,11)),U,4)
..I $P($G(^BGPPEDPN(X,11)),U,4)]"",$P($G(^BGPPEDPN(X,11)),U,4)<BGPPRD S BGPPRD=$P($G(^BGPPEDPN(X,11)),U,4)
..I $P($G(^BGPPEDBN(X,11)),U,4)]"",$P($G(^BGPPEDBN(X,11)),U,4)<BGPBLD S BGPBLD=$P($G(^BGPPEDBN(X,11)),U,4)
.I BGPCYD=999999999 S BGPCYD=""
.I BGPBLD=999999999 S BGPBLD=""
.I BGPPRD=999999999 S BGPPRD=""
I '$G(BGPAREAA) D
.S BGPCYD=$$V(1,BGPRPT,11,4)
.S BGPPRD=$$V(2,BGPRPT,11,4)
.S BGPBLD=$$V(3,BGPRPT,11,4)
I $Y>(BGPIOSL-4) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
W !,"Minimum Time Spent",!,"All Providers",!,"(minutes)"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
I $G(BGPAREAA) D
.S (BGPCYD,BGPPRD,BGPBLD)=""
.S X=0 F S X=$O(BGPSUL(X)) Q:X'=+X D
..I $P($G(^BGPPEDCN(X,11)),U,5)>BGPCYD S BGPCYD=$P($G(^BGPPEDCN(X,11)),U,5)
..I $P($G(^BGPPEDPN(X,11)),U,5)>BGPPRD S BGPPRD=$P($G(^BGPPEDPN(X,11)),U,5)
..I $P($G(^BGPPEDBN(X,11)),U,5)>BGPBLD S BGPBLD=$P($G(^BGPPEDBN(X,11)),U,5)
I '$G(BGPAREAA) D
.S BGPCYD=$$V(1,BGPRPT,11,5)
.S BGPPRD=$$V(2,BGPRPT,11,5)
.S BGPBLD=$$V(3,BGPRPT,11,5)
I $Y>(BGPIOSL-4) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
W !!,"Maximum Time Spent",!,"All Providers",!,"(minutes)"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
Q
3 ;
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2)
D H1^BGP9DPH
S BGPCYD=$$V(1,BGPRPT,11,8)
S BGPPRD=$$V(2,BGPRPT,11,8)
S BGPBLD=$$V(3,BGPRPT,11,8)
W !!,"Total # Education",!,"Codes"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
K BGPPROVS
S N=13 D SETNM
K BGPX
S BGPCNT=0
S X="",C=0 F S X=$O(BGPPROVS(X)) Q:X="" S Y="" F S Y=$O(BGPPROVS(X,Y)) Q:Y="" S C=C+1 S BGPX((9999999-$P(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
S BGP1=0 F S BGP1=$O(BGPX(BGP1)) Q:BGP1'=+BGP1!(BGPQUIT)!(BGPCNT>24) D
.S BGPCNT=BGPCNT+1 S BGP2=0 F S BGP2=$O(BGPX(BGP1,BGP2)) Q:BGP2'=+BGP2!(BGPQUIT) D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
..W !,BGPCNT,". ",$E($P(BGPX(BGP1,BGP2),U,2),1,15)
..S BGPCYN=$P(BGPX(BGP1,BGP2),U,3)
..S BGPPRN=$P(BGPX(BGP1,BGP2),U,4)
..S BGPBLN=$P(BGPX(BGP1,BGP2),U,5)
..S BGPCYP=$P(BGPX(BGP1,BGP2),U,6)
..S BGPPRP=$P(BGPX(BGP1,BGP2),U,7)
..S BGPBLP=$P(BGPX(BGP1,BGP2),U,8)
..D H2^BGP9DPH
Q
4 ;
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2)
D H1^BGP9DPH
S BGPCYD=$$V(1,BGPRPT,11,9)
S BGPPRD=$$V(2,BGPRPT,11,9)
S BGPBLD=$$V(3,BGPRPT,11,9)
W !!,"Total # Education",!,"Codes"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
K BGPPROVS
S N=14 D SETNM
K BGPX
S BGPCNT=0
S X="",C=0 F S X=$O(BGPPROVS(X)) Q:X="" S Y="" F S Y=$O(BGPPROVS(X,Y)) Q:Y="" S C=C+1 S BGPX((9999999-$P(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
S BGP1=0 F S BGP1=$O(BGPX(BGP1)) Q:BGP1'=+BGP1!(BGPQUIT)!(BGPCNT>24) D
.S BGPCNT=BGPCNT+1 S BGP2=0 F S BGP2=$O(BGPX(BGP1,BGP2)) Q:BGP2'=+BGP2!(BGPQUIT) D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
..W !,BGPCNT,". ",$E($P(BGPX(BGP1,BGP2),U,2),1,15)
..S BGPCYN=$P(BGPX(BGP1,BGP2),U,3)
..S BGPPRN=$P(BGPX(BGP1,BGP2),U,4)
..S BGPBLN=$P(BGPX(BGP1,BGP2),U,5)
..S BGPCYP=$P(BGPX(BGP1,BGP2),U,6)
..S BGPPRP=$P(BGPX(BGP1,BGP2),U,7)
..S BGPBLP=$P(BGPX(BGP1,BGP2),U,8)
..D H2^BGP9DPH
Q
5 ;
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2)
D H1^BGP9DPH
S BGPCYD=$$V(1,BGPRPT,11,10)
S BGPPRD=$$V(2,BGPRPT,11,10)
S BGPBLD=$$V(3,BGPRPT,11,10)
W !!,"Total # Education",!,"Codes"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
K BGPPROVS
S N=15 D SETNM
K BGPX
S BGPCNT=0
S X="",C=0 F S X=$O(BGPPROVS(X)) Q:X="" S Y="" F S Y=$O(BGPPROVS(X,Y)) Q:Y="" S C=C+1 S BGPX((9999999-$P(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
S BGP1=0 F S BGP1=$O(BGPX(BGP1)) Q:BGP1'=+BGP1!(BGPQUIT)!(BGPCNT>15) D
.S BGPCNT=BGPCNT+1 S BGP2=0 F S BGP2=$O(BGPX(BGP1,BGP2)) Q:BGP2'=+BGP2!(BGPQUIT) D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2) D H1^BGP9DPH W !
..W !,BGPCNT,". ",$E($P(BGPX(BGP1,BGP2),U,2),1,15)
..S BGPCYN=$P(BGPX(BGP1,BGP2),U,3)
..S BGPPRN=$P(BGPX(BGP1,BGP2),U,4)
..S BGPBLN=$P(BGPX(BGP1,BGP2),U,5)
..S BGPCYP=$P(BGPX(BGP1,BGP2),U,6)
..S BGPPRP=$P(BGPX(BGP1,BGP2),U,7)
..S BGPBLP=$P(BGPX(BGP1,BGP2),U,8)
..D H2^BGP9DPH
Q
6 ;
I $Y>(BGPIOSL-6) D HEADER Q:BGPQUIT W !,$P(^BGPPEIN(BGPIC,0),U,2)
D H1^BGP9DPH
S BGPCYD=$$V(1,BGPRPT,11,12)
S BGPPRD=$$V(2,BGPRPT,11,12)
S BGPBLD=$$V(3,BGPRPT,11,12)
W !!,"Total # Education",!,"Codes"
W ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
W !,"Patient Understanding"
S N=11,P=15 D SETN
W !,"Good"
D H2^BGP9DPH
S N=11,P=14 D SETN
W !,"Fair"
D H2^BGP9DPH
S N=11,P=13 D SETN
W !,"Poor"
D H2^BGP9DPH
S N=11,P=16 D SETN
W !,"Refused"
D H2^BGP9DPH
S N=11,P=17 D SETN
W !,"Group-No Assessment"
D H2^BGP9DPH
S N=11,P=18 D SETN
W !,"Blank"," (Not recorded)"
D H2^BGP9DPH
Q
7 ;
D 7^BGP9DPEQ
Q
KITM ;
K ^TMP($J)
K ^XTMP("BGP9PE",BGPJ,BGPH)
Q
G:'BGPGPG HEADER1
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 BGPQUIT=1 Q
W:$D(IOF) @IOF S BGPGPG=BGPGPG+1
I $G(BGPGUI) W "ZZZZZZZ",! ;maw
W $P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BGPGPG,!
I '$G(BGPSEAT) W $$CTR("*** IHS 2009 Patient Education with Community Specified Report ***",80),!
I $G(BGPSEAT) W $$CTR("*** IHS 2009 Patient Education with Patient Panel Population Report ***",80),!
I $G(BGPAREAA) W $$CTR("AREA AGGREGATE",80),!
I '$G(BGPAREAA) W $$CTR($P(^DIC(4,DUZ(2),0),U),80),!
S X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) W $$CTR(X,80),!
S X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED) W $$CTR(X,80),!
S X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED) W $$CTR(X,80),!
W $TR($J("",80)," ","-")
Q
EXIT ;
I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO",DIR("A")="End of report. Press ENTER" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
Q
C(X,X2,X3) ;EP
D COMMA^%DTC
Q X
S(Y,F,P) ;EP set up array
I '$G(F) S F=0
S %=$P(^TMP($J,"BGPDEL",0),U)+F,$P(^TMP($J,"BGPDEL",0),U)=%
I '$D(^TMP($J,"BGPDEL",%)) S ^TMP($J,"BGPDEL",%)=""
S $P(^TMP($J,"BGPDEL",%),U,P)=Y
Q
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
EOP ;EP - End of page.
Q:$E(IOST)'="C"
Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
NEW DIR
K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
S DIR(0)="E" D ^DIR
Q
;----------
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")
;----------
SETNM ;
K BGPPROVS
I $G(BGPAREAA) D SETNMA Q
S X=0 F S X=$O(^BGPPEDCN(BGPRPT,N,X)) Q:X'=+X D
.S C=$P(^BGPPEDCN(BGPRPT,N,X,0),U),L=$P(^BGPPEDCN(BGPRPT,N,X,0),U,2),M=$P(^BGPPEDCN(BGPRPT,N,X,0),U,3)
.;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,1)=M Q
.S $P(BGPPROVS(C,L),U,1)=M
S X=0 F S X=$O(^BGPPEDPN(BGPRPT,N,X)) Q:X'=+X D
.S C=$P(^BGPPEDPN(BGPRPT,N,X,0),U),L=$P(^BGPPEDPN(BGPRPT,N,X,0),U,2),M=$P(^BGPPEDPN(BGPRPT,N,X,0),U,3)
.;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,2)=M Q
.S $P(BGPPROVS(C,L),U,2)=M
S X=0 F S X=$O(^BGPPEDBN(BGPRPT,N,X)) Q:X'=+X D
.S C=$P(^BGPPEDBN(BGPRPT,N,X,0),U),L=$P(^BGPPEDBN(BGPRPT,N,X,0),U,2),M=$P(^BGPPEDBN(BGPRPT,N,X,0),U,3)
.;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,3)=M Q
.S $P(BGPPROVS(C,L),U,3)=M
;set %ages
S X="" F S X=$O(BGPPROVS(X)) Q:X="" S Y="" F S Y=$O(BGPPROVS(X,Y)) Q:Y="" D
.S A=$P(BGPPROVS(X,Y),U,1),$P(BGPPROVS(X,Y),U,4)=$S(BGPCYD:((A/BGPCYD)*100),1:"")
.S B=$P(BGPPROVS(X,Y),U,2),$P(BGPPROVS(X,Y),U,5)=$S(BGPPRD:((B/BGPPRD)*100),1:"")
.S C=$P(BGPPROVS(X,Y),U,3),$P(BGPPROVS(X,Y),U,6)=$S(BGPBLD:((C/BGPBLD)*100),1:"")
.Q
Q
SETNMA ;
NEW X,V,C S Z=0,C="" F S Z=$O(BGPSUL(Z)) Q:Z'=+Z D SETNMA1
S X="" F S X=$O(BGPPROVS(X)) Q:X="" S Y="" F S Y=$O(BGPPROVS(X,Y)) Q:Y="" D
.S A=$P(BGPPROVS(X,Y),U,1),$P(BGPPROVS(X,Y),U,4)=$S(BGPCYD:((A/BGPCYD)*100),1:"")
.S B=$P(BGPPROVS(X,Y),U,2),$P(BGPPROVS(X,Y),U,5)=$S(BGPPRD:((B/BGPPRD)*100),1:"")
.S C=$P(BGPPROVS(X,Y),U,3),$P(BGPPROVS(X,Y),U,6)=$S(BGPBLD:((C/BGPBLD)*100),1:"")
.Q
Q
SETNMA1 ;
S X=0 F S X=$O(^BGPPEDCN(Z,N,X)) Q:X'=+X D
.S C=$P(^BGPPEDCN(Z,N,X,0),U),L=$P(^BGPPEDCN(Z,N,X,0),U,2),M=$P(^BGPPEDCN(Z,N,X,0),U,3)
.;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,1)=M Q
.S $P(BGPPROVS(C,L),U,1)=$P($G(BGPPROVS(C,L)),U,1)+M
S X=0 F S X=$O(^BGPPEDPN(Z,N,X)) Q:X'=+X D
.S C=$P(^BGPPEDPN(Z,N,X,0),U),L=$P(^BGPPEDPN(Z,N,X,0),U,2),M=$P(^BGPPEDPN(Z,N,X,0),U,3)
.;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,2)=M Q
.S $P(BGPPROVS(C,L),U,2)=$P($G(BGPPROVS(C,L)),U,2)+M
S X=0 F S X=$O(^BGPPEDBN(Z,N,X)) Q:X'=+X D
.S C=$P(^BGPPEDBN(Z,N,X,0),U),L=$P(^BGPPEDBN(Z,N,X,0),U,2),M=$P(^BGPPEDBN(Z,N,X,0),U,3)
.;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,3)=M Q
.S $P(BGPPROVS(C,L),U,3)=$P($G(BGPPROVS(C,L)),U,3)+M
.Q
Q
SETN ;EP - set numerator fields
S BGPCYN=$$V(1,BGPRPT,N,P,2) ;SPDX
S BGPPRN=$$V(2,BGPRPT,N,P,2) ;SPDX
S BGPBLN=$$V(3,BGPRPT,N,P,2) ;SPDX
S BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
S BGPBLP=$S(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
Q
SL(V) ;
I V="" S V=0
Q $$STRIP^XLFSTR($J(V,5,1)," ")
SETEXA(T,N,P) ;EP - set denominator
Q:'$G(BGPEXCEL)
NEW X,Y,Z
S X=0 F S X=$O(BGPSUL(X)) Q:X'=+X D
.I T=1 S $P(BGPEXCT(X,T),U,2)=$P($G(^BGPPEDCN(X,N)),U,P)
.I T=2 S $P(BGPEXCT(X,T),U,2)=$P($G(^BGPPEDPN(X,N)),U,P)
.I T=3 S $P(BGPEXCT(X,T),U,2)=$P($G(^BGPGPDBN(X,N)),U,P)
Q
V(T,R,N,P,ND) ;EP ;SPDX
I $G(BGPAREAA) G VA
NEW X
I T=1 S X=$P($G(^BGPPEDCN(R,N)),U,P) Q $S(X]"":X,1:0)
I T=2 S X=$P($G(^BGPPEDPN(R,N)),U,P) Q $S(X]"":X,1:0)
I T=3 S X=$P($G(^BGPPEDBN(R,N)),U,P) Q $S(X]"":X,1:0)
Q ""
VA ;
NEW X,V,C S X=0,C="" F S X=$O(BGPSUL(X)) Q:X'=+X D
.I T=1 S C=C+$P($G(^BGPPEDCN(X,N)),U,P)
.I T=2 S C=C+$P($G(^BGPPEDPN(X,N)),U,P)
.I T=3 S C=C+$P($G(^BGPPEDBN(X,N)),U,P)
.Q
Q $S(C]"":C,1:0)
BGP9DPEP ; IHS/CMI/LAB - IHS gpra print 01 Jul 2008 7:54 PM ;
+1 ;;9.0;IHS CLINICAL REPORTING;;JUL 1, 2009
+2 ;
+3 ;
PRINT ;
+1 SET BGPRTYPE=6
SET BGP9RPTH=""
+2 KILL ^TMP($JOB)
+3 KILL BGPDELIM
+4 IF BGPROT="D"
GOTO DEL
+5 SET BGPIOSL=$SELECT($GET(BGPGUI):55,1:$GET(IOSL))
+6 DO ^BGP9DH
+7 IF BGPQHDR
DO KITM
QUIT
+8 SET BGPGPG=0
+9 SET BGPQUIT=""
+10 DO PRINT1
+11 KILL ^TMP($JOB)
+12 IF BGPROT="P"
DO KITM
QUIT
+13 ;
DEL ;create delimited output file
+1 ;close printer device
IF '$DATA(BGPGUI)
DO ^%ZISC
+2 KILL ^TMP($JOB)
+3 DO DEL^BGP9DPED
+4 KILL ^XTMP("BGP9PE",BGPJ,BGPH)
+5 KILL ^TMP($JOB)
+6 QUIT
+7 ;
PRINT1 ;EP
+1 KILL ^TMP($JOB)
+2 SET BGPIC=0
FOR
SET BGPIC=$ORDER(BGPIND(BGPIC))
IF BGPIC=""!(BGPQUIT)
QUIT
Begin DoDot:1
+3 DO HEADER
+4 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+5 WRITE !!,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+6 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+7 WRITE !!,"Denominator(s):"
+8 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPPEIN(BGPIC,61,"B",BGPX))
IF BGPX'=+BGPX!(BGPQUIT)
QUIT
Begin DoDot:2
+9 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPPEIN(BGPIC,61,"B",BGPX,BGPY))
IF BGPY'=+BGPY!(BGPQUIT)
QUIT
Begin DoDot:3
+10 SET BGPZ=0
FOR
SET BGPZ=$ORDER(^BGPPEIN(BGPIC,61,BGPY,11,BGPZ))
IF BGPZ'=+BGPZ!(BGPQUIT)
QUIT
Begin DoDot:4
+11 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+12 WRITE !,^BGPPEIN(BGPIC,61,BGPY,11,BGPZ,0)
+13 QUIT
End DoDot:4
+14 QUIT
End DoDot:3
+15 QUIT
End DoDot:2
+16 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+17 WRITE !!,"Numerator(s):"
+18 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPPEIN(BGPIC,62,"B",BGPX))
IF BGPX'=+BGPX!(BGPQUIT)
QUIT
Begin DoDot:2
+19 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPPEIN(BGPIC,62,"B",BGPX,BGPY))
IF BGPY'=+BGPY!(BGPQUIT)
QUIT
Begin DoDot:3
+20 SET BGPZ=0
FOR
SET BGPZ=$ORDER(^BGPPEIN(BGPIC,62,BGPY,11,BGPZ))
IF BGPZ'=+BGPZ!(BGPQUIT)
QUIT
Begin DoDot:4
+21 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+22 WRITE !,^BGPPEIN(BGPIC,62,BGPY,11,BGPZ,0)
+23 QUIT
End DoDot:4
+24 ;W !
+25 QUIT
End DoDot:3
+26 QUIT
End DoDot:2
+27 SET BGPNODE=11
+28 WRITE !
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPPEIN(BGPIC,BGPNODE,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+29 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+30 WRITE !,^BGPPEIN(BGPIC,BGPNODE,BGPX,0)
End DoDot:2
+31 DO @BGPIC
+32 IF BGPQUIT
QUIT
End DoDot:1
+33 ;
+34 DO ^BGP9DPEL
+35 DO EXIT
+36 QUIT
1 ;
+1 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+2 DO H1^BGP9DPH
+3 SET BGPCYD=$$V(1,BGPRPT,11,1)
+4 SET BGPPRD=$$V(2,BGPRPT,11,1)
+5 SET BGPBLD=$$V(3,BGPRPT,11,1)
+6 WRITE !!,"User Pop"
+7 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+8 SET N=11
SET P=2
DO SETN
+9 WRITE !,"# w/ patient ed"
+10 DO H2^BGP9DPH
+11 QUIT
2 ;
+1 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+2 DO H1^BGP9DPH
+3 SET BGPCYD=$$V(1,BGPRPT,11,7)
+4 SET BGPPRD=$$V(2,BGPRPT,11,7)
+5 SET BGPBLD=$$V(3,BGPRPT,11,7)
+6 WRITE !!,"Total Time Spent",!,"Providing Education",!,"(mins)"
+7 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+8 KILL BGPPROVS
+9 SET N=12
DO SETNM
+10 KILL BGPX
+11 SET X=""
SET C=0
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET Y=""
FOR
SET Y=$ORDER(BGPPROVS(X,Y))
IF Y=""
QUIT
SET C=C+1
SET BGPX((9999999-$PIECE(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
+12 SET BGP1=0
FOR
SET BGP1=$ORDER(BGPX(BGP1))
IF BGP1'=+BGP1!(BGPQUIT)
QUIT
Begin DoDot:1
+13 SET BGP2=0
FOR
SET BGP2=$ORDER(BGPX(BGP1,BGP2))
IF BGP2'=+BGP2!(BGPQUIT)
QUIT
Begin DoDot:2
+14 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+15 WRITE !,$EXTRACT($PIECE(BGPX(BGP1,BGP2),U,2),1,20)
+16 SET BGPCYN=$PIECE(BGPX(BGP1,BGP2),U,3)
+17 SET BGPPRN=$PIECE(BGPX(BGP1,BGP2),U,4)
+18 SET BGPBLN=$PIECE(BGPX(BGP1,BGP2),U,5)
+19 SET BGPCYP=$PIECE(BGPX(BGP1,BGP2),U,6)
+20 SET BGPPRP=$PIECE(BGPX(BGP1,BGP2),U,7)
+21 SET BGPBLP=$PIECE(BGPX(BGP1,BGP2),U,8)
+22 DO H2^BGP9DPH
End DoDot:2
End DoDot:1
+23 IF '$GET(BGPAREAA)
Begin DoDot:1
+24 SET BGPAA=$$V(1,BGPRPT,11,7)
+25 SET BGPAB=$$V(2,BGPRPT,11,7)
+26 SET BGPAC=$$V(3,BGPRPT,11,7)
+27 SET BGPCYN=$$V(1,BGPRPT,11,6)
+28 SET BGPPRN=$$V(2,BGPRPT,11,6)
+29 SET BGPBLN=$$V(3,BGPRPT,11,6)
+30 SET BGPCYD=$$V(1,BGPRPT,11,3)
+31 SET BGPPRD=$$V(2,BGPRPT,11,3)
+32 SET BGPBLD=$$V(3,BGPRPT,11,3)
End DoDot:1
+33 IF $GET(BGPAREAA)
Begin DoDot:1
+34 SET BGPAA=$$V(1,BGPRPT,11,7)
+35 SET BGPAB=$$V(2,BGPRPT,11,7)
+36 SET BGPAC=$$V(3,BGPRPT,11,7)
+37 SET BGPCYN=$$V(1,BGPRPT,11,6)
+38 SET BGPPRN=$$V(2,BGPRPT,11,6)
+39 SET BGPBLN=$$V(3,BGPRPT,11,6)
+40 SET BGPCYD=$SELECT(BGPAA:BGPAA/BGPCYN,1:0)
+41 SET BGPPRD=$SELECT(BGPAB:BGPAB/BGPPRN,1:0)
+42 SET BGPBLD=$SELECT(BGPAC:BGPAC/BGPBLN,1:0)
End DoDot:1
+43 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+44 WRITE !!,"Total # of Minutes recorded",!,"for All Providers"
+45 WRITE ?20,$$C(BGPAA,0,8),?35,$$C(BGPAB,0,8),?58,$$C(BGPAC,0,8),!
+46 WRITE !,"Total # of Pt Ed Codes with Provider",!,"and minutes recorded"
+47 WRITE ?20,$$C(BGPCYN,0,8),?35,$$C(BGPPRN,0,8),?58,$$C(BGPBLN,0,8)
+48 WRITE !!,"Average Time Spent",!,"All Providers",!,"(minutes)"
+49 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+50 IF $GET(BGPAREAA)
Begin DoDot:1
+51 SET BGPCYD=999999999
SET BGPBLD=999999999
SET BGPPRD=999999999
+52 SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:2
+53 IF $PIECE($GET(^BGPPEDCN(X,11)),U,4)]""
IF $PIECE($GET(^BGPPEDCN(X,11)),U,4)<BGPCYD
SET BGPCYD=$PIECE($GET(^BGPPEDCN(X,11)),U,4)
+54 IF $PIECE($GET(^BGPPEDPN(X,11)),U,4)]""
IF $PIECE($GET(^BGPPEDPN(X,11)),U,4)<BGPPRD
SET BGPPRD=$PIECE($GET(^BGPPEDPN(X,11)),U,4)
+55 IF $PIECE($GET(^BGPPEDBN(X,11)),U,4)]""
IF $PIECE($GET(^BGPPEDBN(X,11)),U,4)<BGPBLD
SET BGPBLD=$PIECE($GET(^BGPPEDBN(X,11)),U,4)
End DoDot:2
+56 IF BGPCYD=999999999
SET BGPCYD=""
+57 IF BGPBLD=999999999
SET BGPBLD=""
+58 IF BGPPRD=999999999
SET BGPPRD=""
End DoDot:1
+59 IF '$GET(BGPAREAA)
Begin DoDot:1
+60 SET BGPCYD=$$V(1,BGPRPT,11,4)
+61 SET BGPPRD=$$V(2,BGPRPT,11,4)
+62 SET BGPBLD=$$V(3,BGPRPT,11,4)
End DoDot:1
+63 IF $Y>(BGPIOSL-4)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+64 WRITE !,"Minimum Time Spent",!,"All Providers",!,"(minutes)"
+65 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+66 IF $GET(BGPAREAA)
Begin DoDot:1
+67 SET (BGPCYD,BGPPRD,BGPBLD)=""
+68 SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:2
+69 IF $PIECE($GET(^BGPPEDCN(X,11)),U,5)>BGPCYD
SET BGPCYD=$PIECE($GET(^BGPPEDCN(X,11)),U,5)
+70 IF $PIECE($GET(^BGPPEDPN(X,11)),U,5)>BGPPRD
SET BGPPRD=$PIECE($GET(^BGPPEDPN(X,11)),U,5)
+71 IF $PIECE($GET(^BGPPEDBN(X,11)),U,5)>BGPBLD
SET BGPBLD=$PIECE($GET(^BGPPEDBN(X,11)),U,5)
End DoDot:2
End DoDot:1
+72 IF '$GET(BGPAREAA)
Begin DoDot:1
+73 SET BGPCYD=$$V(1,BGPRPT,11,5)
+74 SET BGPPRD=$$V(2,BGPRPT,11,5)
+75 SET BGPBLD=$$V(3,BGPRPT,11,5)
End DoDot:1
+76 IF $Y>(BGPIOSL-4)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+77 WRITE !!,"Maximum Time Spent",!,"All Providers",!,"(minutes)"
+78 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+79 QUIT
3 ;
+1 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+2 DO H1^BGP9DPH
+3 SET BGPCYD=$$V(1,BGPRPT,11,8)
+4 SET BGPPRD=$$V(2,BGPRPT,11,8)
+5 SET BGPBLD=$$V(3,BGPRPT,11,8)
+6 WRITE !!,"Total # Education",!,"Codes"
+7 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+8 KILL BGPPROVS
+9 SET N=13
DO SETNM
+10 KILL BGPX
+11 SET BGPCNT=0
+12 SET X=""
SET C=0
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET Y=""
FOR
SET Y=$ORDER(BGPPROVS(X,Y))
IF Y=""
QUIT
SET C=C+1
SET BGPX((9999999-$PIECE(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
+13 SET BGP1=0
FOR
SET BGP1=$ORDER(BGPX(BGP1))
IF BGP1'=+BGP1!(BGPQUIT)!(BGPCNT>24)
QUIT
Begin DoDot:1
+14 SET BGPCNT=BGPCNT+1
SET BGP2=0
FOR
SET BGP2=$ORDER(BGPX(BGP1,BGP2))
IF BGP2'=+BGP2!(BGPQUIT)
QUIT
Begin DoDot:2
+15 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+16 WRITE !,BGPCNT,". ",$EXTRACT($PIECE(BGPX(BGP1,BGP2),U,2),1,15)
+17 SET BGPCYN=$PIECE(BGPX(BGP1,BGP2),U,3)
+18 SET BGPPRN=$PIECE(BGPX(BGP1,BGP2),U,4)
+19 SET BGPBLN=$PIECE(BGPX(BGP1,BGP2),U,5)
+20 SET BGPCYP=$PIECE(BGPX(BGP1,BGP2),U,6)
+21 SET BGPPRP=$PIECE(BGPX(BGP1,BGP2),U,7)
+22 SET BGPBLP=$PIECE(BGPX(BGP1,BGP2),U,8)
+23 DO H2^BGP9DPH
End DoDot:2
End DoDot:1
+24 QUIT
4 ;
+1 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+2 DO H1^BGP9DPH
+3 SET BGPCYD=$$V(1,BGPRPT,11,9)
+4 SET BGPPRD=$$V(2,BGPRPT,11,9)
+5 SET BGPBLD=$$V(3,BGPRPT,11,9)
+6 WRITE !!,"Total # Education",!,"Codes"
+7 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+8 KILL BGPPROVS
+9 SET N=14
DO SETNM
+10 KILL BGPX
+11 SET BGPCNT=0
+12 SET X=""
SET C=0
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET Y=""
FOR
SET Y=$ORDER(BGPPROVS(X,Y))
IF Y=""
QUIT
SET C=C+1
SET BGPX((9999999-$PIECE(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
+13 SET BGP1=0
FOR
SET BGP1=$ORDER(BGPX(BGP1))
IF BGP1'=+BGP1!(BGPQUIT)!(BGPCNT>24)
QUIT
Begin DoDot:1
+14 SET BGPCNT=BGPCNT+1
SET BGP2=0
FOR
SET BGP2=$ORDER(BGPX(BGP1,BGP2))
IF BGP2'=+BGP2!(BGPQUIT)
QUIT
Begin DoDot:2
+15 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+16 WRITE !,BGPCNT,". ",$EXTRACT($PIECE(BGPX(BGP1,BGP2),U,2),1,15)
+17 SET BGPCYN=$PIECE(BGPX(BGP1,BGP2),U,3)
+18 SET BGPPRN=$PIECE(BGPX(BGP1,BGP2),U,4)
+19 SET BGPBLN=$PIECE(BGPX(BGP1,BGP2),U,5)
+20 SET BGPCYP=$PIECE(BGPX(BGP1,BGP2),U,6)
+21 SET BGPPRP=$PIECE(BGPX(BGP1,BGP2),U,7)
+22 SET BGPBLP=$PIECE(BGPX(BGP1,BGP2),U,8)
+23 DO H2^BGP9DPH
End DoDot:2
End DoDot:1
+24 QUIT
5 ;
+1 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+2 DO H1^BGP9DPH
+3 SET BGPCYD=$$V(1,BGPRPT,11,10)
+4 SET BGPPRD=$$V(2,BGPRPT,11,10)
+5 SET BGPBLD=$$V(3,BGPRPT,11,10)
+6 WRITE !!,"Total # Education",!,"Codes"
+7 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+8 KILL BGPPROVS
+9 SET N=15
DO SETNM
+10 KILL BGPX
+11 SET BGPCNT=0
+12 SET X=""
SET C=0
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET Y=""
FOR
SET Y=$ORDER(BGPPROVS(X,Y))
IF Y=""
QUIT
SET C=C+1
SET BGPX((9999999-$PIECE(BGPPROVS(X,Y),U,1)),C)=X_U_Y_U_BGPPROVS(X,Y)
+13 SET BGP1=0
FOR
SET BGP1=$ORDER(BGPX(BGP1))
IF BGP1'=+BGP1!(BGPQUIT)!(BGPCNT>15)
QUIT
Begin DoDot:1
+14 SET BGPCNT=BGPCNT+1
SET BGP2=0
FOR
SET BGP2=$ORDER(BGPX(BGP1,BGP2))
IF BGP2'=+BGP2!(BGPQUIT)
QUIT
Begin DoDot:2
+15 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
DO H1^BGP9DPH
WRITE !
+16 WRITE !,BGPCNT,". ",$EXTRACT($PIECE(BGPX(BGP1,BGP2),U,2),1,15)
+17 SET BGPCYN=$PIECE(BGPX(BGP1,BGP2),U,3)
+18 SET BGPPRN=$PIECE(BGPX(BGP1,BGP2),U,4)
+19 SET BGPBLN=$PIECE(BGPX(BGP1,BGP2),U,5)
+20 SET BGPCYP=$PIECE(BGPX(BGP1,BGP2),U,6)
+21 SET BGPPRP=$PIECE(BGPX(BGP1,BGP2),U,7)
+22 SET BGPBLP=$PIECE(BGPX(BGP1,BGP2),U,8)
+23 DO H2^BGP9DPH
End DoDot:2
End DoDot:1
+24 QUIT
6 ;
+1 IF $Y>(BGPIOSL-6)
DO HEADER
IF BGPQUIT
QUIT
WRITE !,$PIECE(^BGPPEIN(BGPIC,0),U,2)
+2 DO H1^BGP9DPH
+3 SET BGPCYD=$$V(1,BGPRPT,11,12)
+4 SET BGPPRD=$$V(2,BGPRPT,11,12)
+5 SET BGPBLD=$$V(3,BGPRPT,11,12)
+6 WRITE !!,"Total # Education",!,"Codes"
+7 WRITE ?20,$$C(BGPCYD,0,8),?35,$$C(BGPPRD,0,8),?58,$$C(BGPBLD,0,8),!
+8 WRITE !,"Patient Understanding"
+9 SET N=11
SET P=15
DO SETN
+10 WRITE !,"Good"
+11 DO H2^BGP9DPH
+12 SET N=11
SET P=14
DO SETN
+13 WRITE !,"Fair"
+14 DO H2^BGP9DPH
+15 SET N=11
SET P=13
DO SETN
+16 WRITE !,"Poor"
+17 DO H2^BGP9DPH
+18 SET N=11
SET P=16
DO SETN
+19 WRITE !,"Refused"
+20 DO H2^BGP9DPH
+21 SET N=11
SET P=17
DO SETN
+22 WRITE !,"Group-No Assessment"
+23 DO H2^BGP9DPH
+24 SET N=11
SET P=18
DO SETN
+25 WRITE !,"Blank"," (Not recorded)"
+26 DO H2^BGP9DPH
+27 QUIT
7 ;
+1 DO 7^BGP9DPEQ
+2 QUIT
KITM ;
+1 KILL ^TMP($JOB)
+2 KILL ^XTMP("BGP9PE",BGPJ,BGPH)
+3 QUIT
+1 IF 'BGPGPG
GOTO HEADER1
+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 BGPQUIT=1
QUIT
+1 IF $DATA(IOF)
WRITE @IOF
SET BGPGPG=BGPGPG+1
+2 ;maw
IF $GET(BGPGUI)
WRITE "ZZZZZZZ",!
+3 WRITE $PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BGPGPG,!
+4 IF '$GET(BGPSEAT)
WRITE $$CTR("*** IHS 2009 Patient Education with Community Specified Report ***",80),!
+5 IF $GET(BGPSEAT)
WRITE $$CTR("*** IHS 2009 Patient Education with Patient Panel Population Report ***",80),!
+6 IF $GET(BGPAREAA)
WRITE $$CTR("AREA AGGREGATE",80),!
+7 IF '$GET(BGPAREAA)
WRITE $$CTR($PIECE(^DIC(4,DUZ(2),0),U),80),!
+8 SET X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED)
WRITE $$CTR(X,80),!
+9 SET X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED)
WRITE $$CTR(X,80),!
+10 SET X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED)
WRITE $$CTR(X,80),!
+11 WRITE $TRANSLATE($JUSTIFY("",80)," ","-")
+12 QUIT
EXIT ;
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
IF '$DATA(ZTQUEUED)
WRITE !
SET DIR(0)="EO"
SET DIR("A")="End of report. Press ENTER"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 QUIT
C(X,X2,X3) ;EP
+1 DO COMMA^%DTC
+2 QUIT X
S(Y,F,P) ;EP set up array
+1 IF '$GET(F)
SET F=0
+2 SET %=$PIECE(^TMP($JOB,"BGPDEL",0),U)+F
SET $PIECE(^TMP($JOB,"BGPDEL",0),U)=%
+3 IF '$DATA(^TMP($JOB,"BGPDEL",%))
SET ^TMP($JOB,"BGPDEL",%)=""
+4 SET $PIECE(^TMP($JOB,"BGPDEL",%),U,P)=Y
+5 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 ;----------
EOP ;EP - End of page.
+1 IF $EXTRACT(IOST)'="C"
QUIT
+2 IF $DATA(ZTQUEUED)!'(IOT="TRM")!$DATA(IO("S"))
QUIT
+3 NEW DIR
+4 KILL DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
+5 SET DIR(0)="E"
DO ^DIR
+6 QUIT
+7 ;----------
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 ;----------
SETNM ;
+1 KILL BGPPROVS
+2 IF $GET(BGPAREAA)
DO SETNMA
QUIT
+3 SET X=0
FOR
SET X=$ORDER(^BGPPEDCN(BGPRPT,N,X))
IF X'=+X
QUIT
Begin DoDot:1
+4 SET C=$PIECE(^BGPPEDCN(BGPRPT,N,X,0),U)
SET L=$PIECE(^BGPPEDCN(BGPRPT,N,X,0),U,2)
SET M=$PIECE(^BGPPEDCN(BGPRPT,N,X,0),U,3)
+5 ;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,1)=M Q
+6 SET $PIECE(BGPPROVS(C,L),U,1)=M
End DoDot:1
+7 SET X=0
FOR
SET X=$ORDER(^BGPPEDPN(BGPRPT,N,X))
IF X'=+X
QUIT
Begin DoDot:1
+8 SET C=$PIECE(^BGPPEDPN(BGPRPT,N,X,0),U)
SET L=$PIECE(^BGPPEDPN(BGPRPT,N,X,0),U,2)
SET M=$PIECE(^BGPPEDPN(BGPRPT,N,X,0),U,3)
+9 ;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,2)=M Q
+10 SET $PIECE(BGPPROVS(C,L),U,2)=M
End DoDot:1
+11 SET X=0
FOR
SET X=$ORDER(^BGPPEDBN(BGPRPT,N,X))
IF X'=+X
QUIT
Begin DoDot:1
+12 SET C=$PIECE(^BGPPEDBN(BGPRPT,N,X,0),U)
SET L=$PIECE(^BGPPEDBN(BGPRPT,N,X,0),U,2)
SET M=$PIECE(^BGPPEDBN(BGPRPT,N,X,0),U,3)
+13 ;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,3)=M Q
+14 SET $PIECE(BGPPROVS(C,L),U,3)=M
End DoDot:1
+15 ;set %ages
+16 SET X=""
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET Y=""
FOR
SET Y=$ORDER(BGPPROVS(X,Y))
IF Y=""
QUIT
Begin DoDot:1
+17 SET A=$PIECE(BGPPROVS(X,Y),U,1)
SET $PIECE(BGPPROVS(X,Y),U,4)=$SELECT(BGPCYD:((A/BGPCYD)*100),1:"")
+18 SET B=$PIECE(BGPPROVS(X,Y),U,2)
SET $PIECE(BGPPROVS(X,Y),U,5)=$SELECT(BGPPRD:((B/BGPPRD)*100),1:"")
+19 SET C=$PIECE(BGPPROVS(X,Y),U,3)
SET $PIECE(BGPPROVS(X,Y),U,6)=$SELECT(BGPBLD:((C/BGPBLD)*100),1:"")
+20 QUIT
End DoDot:1
+21 QUIT
SETNMA ;
+1 NEW X,V,C
SET Z=0
SET C=""
FOR
SET Z=$ORDER(BGPSUL(Z))
IF Z'=+Z
QUIT
DO SETNMA1
+2 SET X=""
FOR
SET X=$ORDER(BGPPROVS(X))
IF X=""
QUIT
SET Y=""
FOR
SET Y=$ORDER(BGPPROVS(X,Y))
IF Y=""
QUIT
Begin DoDot:1
+3 SET A=$PIECE(BGPPROVS(X,Y),U,1)
SET $PIECE(BGPPROVS(X,Y),U,4)=$SELECT(BGPCYD:((A/BGPCYD)*100),1:"")
+4 SET B=$PIECE(BGPPROVS(X,Y),U,2)
SET $PIECE(BGPPROVS(X,Y),U,5)=$SELECT(BGPPRD:((B/BGPPRD)*100),1:"")
+5 SET C=$PIECE(BGPPROVS(X,Y),U,3)
SET $PIECE(BGPPROVS(X,Y),U,6)=$SELECT(BGPBLD:((C/BGPBLD)*100),1:"")
+6 QUIT
End DoDot:1
+7 QUIT
SETNMA1 ;
+1 SET X=0
FOR
SET X=$ORDER(^BGPPEDCN(Z,N,X))
IF X'=+X
QUIT
Begin DoDot:1
+2 SET C=$PIECE(^BGPPEDCN(Z,N,X,0),U)
SET L=$PIECE(^BGPPEDCN(Z,N,X,0),U,2)
SET M=$PIECE(^BGPPEDCN(Z,N,X,0),U,3)
+3 ;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,1)=M Q
+4 SET $PIECE(BGPPROVS(C,L),U,1)=$PIECE($GET(BGPPROVS(C,L)),U,1)+M
End DoDot:1
+5 SET X=0
FOR
SET X=$ORDER(^BGPPEDPN(Z,N,X))
IF X'=+X
QUIT
Begin DoDot:1
+6 SET C=$PIECE(^BGPPEDPN(Z,N,X,0),U)
SET L=$PIECE(^BGPPEDPN(Z,N,X,0),U,2)
SET M=$PIECE(^BGPPEDPN(Z,N,X,0),U,3)
+7 ;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,2)=M Q
+8 SET $PIECE(BGPPROVS(C,L),U,2)=$PIECE($GET(BGPPROVS(C,L)),U,2)+M
End DoDot:1
+9 SET X=0
FOR
SET X=$ORDER(^BGPPEDBN(Z,N,X))
IF X'=+X
QUIT
Begin DoDot:1
+10 SET C=$PIECE(^BGPPEDBN(Z,N,X,0),U)
SET L=$PIECE(^BGPPEDBN(Z,N,X,0),U,2)
SET M=$PIECE(^BGPPEDBN(Z,N,X,0),U,3)
+11 ;I $D(BGPPROVS(C,L)) S $P(BGPPROVS(C,L),U,3)=M Q
+12 SET $PIECE(BGPPROVS(C,L),U,3)=$PIECE($GET(BGPPROVS(C,L)),U,3)+M
+13 QUIT
End DoDot:1
+14 QUIT
SETN ;EP - set numerator fields
+1 ;SPDX
SET BGPCYN=$$V(1,BGPRPT,N,P,2)
+2 ;SPDX
SET BGPPRN=$$V(2,BGPRPT,N,P,2)
+3 ;SPDX
SET BGPBLN=$$V(3,BGPRPT,N,P,2)
+4 SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+5 SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+6 SET BGPBLP=$SELECT(BGPBLD:((BGPBLN/BGPBLD)*100),1:"")
+7 QUIT
SL(V) ;
+1 IF V=""
SET V=0
+2 QUIT $$STRIP^XLFSTR($JUSTIFY(V,5,1)," ")
SETEXA(T,N,P) ;EP - set denominator
+1 IF '$GET(BGPEXCEL)
QUIT
+2 NEW X,Y,Z
+3 SET X=0
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+4 IF T=1
SET $PIECE(BGPEXCT(X,T),U,2)=$PIECE($GET(^BGPPEDCN(X,N)),U,P)
+5 IF T=2
SET $PIECE(BGPEXCT(X,T),U,2)=$PIECE($GET(^BGPPEDPN(X,N)),U,P)
+6 IF T=3
SET $PIECE(BGPEXCT(X,T),U,2)=$PIECE($GET(^BGPGPDBN(X,N)),U,P)
End DoDot:1
+7 QUIT
V(T,R,N,P,ND) ;EP ;SPDX
+1 IF $GET(BGPAREAA)
GOTO VA
+2 NEW X
+3 IF T=1
SET X=$PIECE($GET(^BGPPEDCN(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+4 IF T=2
SET X=$PIECE($GET(^BGPPEDPN(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+5 IF T=3
SET X=$PIECE($GET(^BGPPEDBN(R,N)),U,P)
QUIT $SELECT(X]"":X,1:0)
+6 QUIT ""
VA ;
+1 NEW X,V,C
SET X=0
SET C=""
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+2 IF T=1
SET C=C+$PIECE($GET(^BGPPEDCN(X,N)),U,P)
+3 IF T=2
SET C=C+$PIECE($GET(^BGPPEDPN(X,N)),U,P)
+4 IF T=3
SET C=C+$PIECE($GET(^BGPPEDBN(X,N)),U,P)
+5 QUIT
End DoDot:1
+6 QUIT $SELECT(C]"":C,1:0)