BGP0HES ; IHS/CMI/LAB - IHS gpra print 01 May 2009 4:31 PM ;
;;10.0;IHS CLINICAL REPORTING;;JUN 18, 2010
;
START ;
Q:$G(BGPAREAA)
Q:'$D(BGPLIST)
S BGPQUIT="",BGPGPG=0
;S BGPL=0 F S BGPL=$O(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL)) Q:BGPL'=+BGPL!(BGPQUIT) D
S BGPL=0 F S BGPL=$O(BGPLIST(BGPL)) Q:BGPL'=+BGPL!(BGPQUIT) D
.S BGPCOUNT=0,BGPPCNT=0
.D HEADER Q:BGPQUIT
.S BGPCNT=$G(BGPLIST(BGPL))
.S:'BGPCNT BGPCNT=0
.I BGPCNT<11!(BGPLIST'="R") S BGPCNT=1 G GO
.I BGPCNT<100 S BGPCNT=BGPCNT\10 G GO
.S BGPCNT=10
GO .;
.W !,$P(^BGPHEIT(BGPL,0),U,3),!
.W !,"Denominator(s):"
.S BGPNODE=61
.S BGPX=0 F S BGPX=$O(^BGPHEIT(BGPL,61,"B",BGPX)) Q:BGPX'=+BGPX!(BGPQUIT) D
..S BGPY=0 F S BGPY=$O(^BGPHEIT(BGPL,61,"B",BGPX,BGPY)) Q:BGPY'=+BGPY!(BGPQUIT) D
...I $P(^BGPHEIT(BGPL,61,BGPY,0),U,2)'[BGPRTYPE Q ;not a denom def for this report
...D WP
.I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
.W !!,"Numerator(s):"
.S BGPNODE=62
.S BGPX=0 F S BGPX=$O(^BGPHEIT(BGPL,62,"B",BGPX)) Q:BGPX'=+BGPX!(BGPQUIT) D
..S BGPY=0 F S BGPY=$O(^BGPHEIT(BGPL,62,"B",BGPX,BGPY)) Q:BGPY'=+BGPY!(BGPQUIT) D
...I $P(^BGPHEIT(BGPL,62,BGPY,0),U,2)'[BGPRTYPE Q ;not a denom def for this report
...D WP
.W ! S BGPX=0 F S BGPX=$O(^BGPHEIT(BGPL,11,BGPX)) Q:BGPX'=+BGPX D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
..W !,^BGPHEIT(BGPL,11,BGPX,0)
.W ! S BGPX=0 F S BGPX=$O(^BGPHEIT(BGPL,51,BGPX)) Q:BGPX'=+BGPX D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
..W !,^BGPHEIT(BGPL,51,BGPX,0)
.W ! S BGPX=0 F S BGPX=$O(^BGPHEIT(BGPL,52,BGPX)) Q:BGPX'=+BGPX D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
..W !,^BGPHEIT(BGPL,52,BGPX,0)
.W ! S BGPX=0 F S BGPX=$O(^BGPHEIT(BGPL,71,BGPX)) Q:BGPX'=+BGPX D
..I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
..W !,^BGPHEIT(BGPL,71,BGPX,0)
.D H1
.S BGPCOM="" F S BGPCOM=$O(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM)) Q:BGPCOM=""!(BGPQUIT) D
..S BGPSEX="" F S BGPSEX=$O(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX)) Q:BGPSEX=""!(BGPQUIT) D
...S BGPAGE="" F S BGPAGE=$O(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE)) Q:BGPAGE=""!(BGPQUIT) D
....S DFN=0 F S DFN=$O(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE,DFN)) Q:DFN'=+DFN!(BGPQUIT) S BGPCOUNT=BGPCOUNT+1 D PRINTL
....Q
...Q
..Q
.I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
.W !!,"Total # of Patients on list: ",+$G(BGPPCNT)
Q
WP ;
K ^UTILITY($J,"W")
S BGPZ=0,BGPLCNT=0
S DIWL=1,DIWR=80,DIWF="",BGPZ=0 F S BGPZ=$O(^BGPHEIT(BGPL,BGPNODE,BGPY,1,BGPZ)) Q:BGPZ'=+BGPZ D
.S BGPLCNT=BGPLCNT+1
.S X=^BGPHEIT(BGPL,BGPNODE,BGPY,1,BGPZ,0) S:BGPLCNT=1 X=" - "_X D ^DIWP
.Q
WPS ;
S Z=0 F S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z D
.I $Y>(BGPIOSL-3) D HEADER^BGP0DPH Q:BGPQUIT
.W !,^UTILITY($J,"W",DIWL,Z,0)
K DIWL,DIWR,DIWF,Z
K ^UTILITY($J,"W"),X
Q
;
PRINTL ;print one line
Q:(BGPCOUNT#BGPCNT)
I $Y>(BGPIOSL-3) D HEADER Q:BGPQUIT D
.S X=0 F S X=$O(^BGPHEIT(BGPL,72,X)) Q:X'=+X W !,^BGPHEIT(BGPL,72,X,0)
.D H1
S BGPPCNT=BGPPCNT+1
W !,$E($P(^DPT(DFN,0),U),1,22),?24,$$HRN^AUPNPAT(DFN,DUZ(2)),?31,$E(BGPCOM,1,14),?46,BGPSEX,?49,BGPAGE
W ?53,$P(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE,DFN),"|||",1),?65,$P(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE,DFN),"|||",2)
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 !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BGPGPG,!
W !,$$CTR("*** IHS 2010 HEDIS Clinical Performance Report Patient List ***",80),!
W $$CTR($P(^DIC(4,DUZ(2),0),U),80),!
S X="Reporting Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) W $$CTR(X,80),!
W $$CTR($S(BGPLIST="A":"Entire Patient List",BGPLIST="R":"Random Patient List",1:"Patient List by Provider: "_BGPLPROV),80),!
W !,$TR($J("",80)," ","-")
Q
H1 ;
W !,"UP=User Pop; AC=Active Clinical; AD=Active Diabetic; AAD=Active Adult Diabetic",!,"PREG=Pregnant Female; IMM=Active IMM Pkg Pt",!
W !,"PATIENT NAME",?24,"HRN",?31,"COMMUNITY",?45,"SEX",?49,"AGE",?53,"DENOMINATOR",?65,"NUMERATOR"
W !,$TR($J("",80)," ","-")
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")
;----------
BGP0HES ; IHS/CMI/LAB - IHS gpra print 01 May 2009 4:31 PM ;
+1 ;;10.0;IHS CLINICAL REPORTING;;JUN 18, 2010
+2 ;
START ;
+1 IF $GET(BGPAREAA)
QUIT
+2 IF '$DATA(BGPLIST)
QUIT
+3 SET BGPQUIT=""
SET BGPGPG=0
+4 ;S BGPL=0 F S BGPL=$O(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL)) Q:BGPL'=+BGPL!(BGPQUIT) D
+5 SET BGPL=0
FOR
SET BGPL=$ORDER(BGPLIST(BGPL))
IF BGPL'=+BGPL!(BGPQUIT)
QUIT
Begin DoDot:1
+6 SET BGPCOUNT=0
SET BGPPCNT=0
+7 DO HEADER
IF BGPQUIT
QUIT
+8 SET BGPCNT=$GET(BGPLIST(BGPL))
+9 IF 'BGPCNT
SET BGPCNT=0
+10 IF BGPCNT<11!(BGPLIST'="R")
SET BGPCNT=1
GOTO GO
+11 IF BGPCNT<100
SET BGPCNT=BGPCNT\10
GOTO GO
+12 SET BGPCNT=10
GO ;
+1 WRITE !,$PIECE(^BGPHEIT(BGPL,0),U,3),!
+2 WRITE !,"Denominator(s):"
+3 SET BGPNODE=61
+4 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIT(BGPL,61,"B",BGPX))
IF BGPX'=+BGPX!(BGPQUIT)
QUIT
Begin DoDot:2
+5 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPHEIT(BGPL,61,"B",BGPX,BGPY))
IF BGPY'=+BGPY!(BGPQUIT)
QUIT
Begin DoDot:3
+6 ;not a denom def for this report
IF $PIECE(^BGPHEIT(BGPL,61,BGPY,0),U,2)'[BGPRTYPE
QUIT
+7 DO WP
End DoDot:3
End DoDot:2
+8 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+9 WRITE !!,"Numerator(s):"
+10 SET BGPNODE=62
+11 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIT(BGPL,62,"B",BGPX))
IF BGPX'=+BGPX!(BGPQUIT)
QUIT
Begin DoDot:2
+12 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPHEIT(BGPL,62,"B",BGPX,BGPY))
IF BGPY'=+BGPY!(BGPQUIT)
QUIT
Begin DoDot:3
+13 ;not a denom def for this report
IF $PIECE(^BGPHEIT(BGPL,62,BGPY,0),U,2)'[BGPRTYPE
QUIT
+14 DO WP
End DoDot:3
End DoDot:2
+15 WRITE !
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIT(BGPL,11,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+16 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+17 WRITE !,^BGPHEIT(BGPL,11,BGPX,0)
End DoDot:2
+18 WRITE !
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIT(BGPL,51,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+19 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+20 WRITE !,^BGPHEIT(BGPL,51,BGPX,0)
End DoDot:2
+21 WRITE !
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIT(BGPL,52,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+22 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+23 WRITE !,^BGPHEIT(BGPL,52,BGPX,0)
End DoDot:2
+24 WRITE !
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIT(BGPL,71,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+25 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+26 WRITE !,^BGPHEIT(BGPL,71,BGPX,0)
End DoDot:2
+27 DO H1
+28 SET BGPCOM=""
FOR
SET BGPCOM=$ORDER(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM))
IF BGPCOM=""!(BGPQUIT)
QUIT
Begin DoDot:2
+29 SET BGPSEX=""
FOR
SET BGPSEX=$ORDER(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX))
IF BGPSEX=""!(BGPQUIT)
QUIT
Begin DoDot:3
+30 SET BGPAGE=""
FOR
SET BGPAGE=$ORDER(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE))
IF BGPAGE=""!(BGPQUIT)
QUIT
Begin DoDot:4
+31 SET DFN=0
FOR
SET DFN=$ORDER(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE,DFN))
IF DFN'=+DFN!(BGPQUIT)
QUIT
SET BGPCOUNT=BGPCOUNT+1
DO PRINTL
+32 QUIT
End DoDot:4
+33 QUIT
End DoDot:3
+34 QUIT
End DoDot:2
+35 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
+36 WRITE !!,"Total # of Patients on list: ",+$GET(BGPPCNT)
End DoDot:1
+37 QUIT
WP ;
+1 KILL ^UTILITY($JOB,"W")
+2 SET BGPZ=0
SET BGPLCNT=0
+3 SET DIWL=1
SET DIWR=80
SET DIWF=""
SET BGPZ=0
FOR
SET BGPZ=$ORDER(^BGPHEIT(BGPL,BGPNODE,BGPY,1,BGPZ))
IF BGPZ'=+BGPZ
QUIT
Begin DoDot:1
+4 SET BGPLCNT=BGPLCNT+1
+5 SET X=^BGPHEIT(BGPL,BGPNODE,BGPY,1,BGPZ,0)
IF BGPLCNT=1
SET X=" - "_X
DO ^DIWP
+6 QUIT
End DoDot:1
WPS ;
+1 SET Z=0
FOR
SET Z=$ORDER(^UTILITY($JOB,"W",DIWL,Z))
IF Z'=+Z
QUIT
Begin DoDot:1
+2 IF $Y>(BGPIOSL-3)
DO HEADER^BGP0DPH
IF BGPQUIT
QUIT
+3 WRITE !,^UTILITY($JOB,"W",DIWL,Z,0)
End DoDot:1
+4 KILL DIWL,DIWR,DIWF,Z
+5 KILL ^UTILITY($JOB,"W"),X
+6 QUIT
+7 ;
PRINTL ;print one line
+1 IF (BGPCOUNT#BGPCNT)
QUIT
+2 IF $Y>(BGPIOSL-3)
DO HEADER
IF BGPQUIT
QUIT
Begin DoDot:1
+3 SET X=0
FOR
SET X=$ORDER(^BGPHEIT(BGPL,72,X))
IF X'=+X
QUIT
WRITE !,^BGPHEIT(BGPL,72,X,0)
+4 DO H1
End DoDot:1
+5 SET BGPPCNT=BGPPCNT+1
+6 WRITE !,$EXTRACT($PIECE(^DPT(DFN,0),U),1,22),?24,$$HRN^AUPNPAT(DFN,DUZ(2)),?31,$EXTRACT(BGPCOM,1,14),?46,BGPSEX,?49,BGPAGE
+7 WRITE ?53,$PIECE(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE,DFN),"|||",1),?65,$PIECE(^XTMP("BGP0D",BGPJ,BGPH,"LIST",BGPL,BGPCOM,BGPSEX,BGPAGE,DFN),"|||",2)
+8 QUIT
+9 ;
+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 !,"***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****"
+4 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BGPGPG,!
+5 WRITE !,$$CTR("*** IHS 2010 HEDIS Clinical Performance Report Patient List ***",80),!
+6 WRITE $$CTR($PIECE(^DIC(4,DUZ(2),0),U),80),!
+7 SET X="Reporting Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED)
WRITE $$CTR(X,80),!
+8 WRITE $$CTR($SELECT(BGPLIST="A":"Entire Patient List",BGPLIST="R":"Random Patient List",1:"Patient List by Provider: "_BGPLPROV),80),!
+9 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+10 QUIT
H1 ;
+1 WRITE !,"UP=User Pop; AC=Active Clinical; AD=Active Diabetic; AAD=Active Adult Diabetic",!,"PREG=Pregnant Female; IMM=Active IMM Pkg Pt",!
+2 WRITE !,"PATIENT NAME",?24,"HRN",?31,"COMMUNITY",?45,"SEX",?49,"AGE",?53,"DENOMINATOR",?65,"NUMERATOR"
+3 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+4 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 ;----------