BGP4HEL ; IHS/CMI/LAB - IHS gpra print ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
;
DEL ;
K ^TMP($J)
S ^TMP($J,"BGPDEL",0)=0
D ^BGP4HEHH
D DEL1
D ^BGP4HESL ;print lists to delimited file
;if screen selected do screen
I BGPDELT="S" D SCREEN,EXIT Q
;call xbgsave to create output file
S XBGL="TMP("_$J_",""BGPDEL"","
K ^TMP($J,"SUMMARYDEL")
S XBFLT=1,XBFN=BGPDELF_".txt",XBMED="F",XBTLE="GPRA 04 HEDIS DELIMITED OUTPUT",XBQ="N",XBE=$J
D ^XBGSAVE
K XBFLT,XBFN,XBMED,XBTLE,XBE,XBF
D EXIT
Q
;
SCREEN ;
S X=0 F S X=$O(^TMP($J,"BGPDEL",X)) Q:X'=+X W !,^TMP($J,"BGPDEL",X)
Q
DEL1 ;EP
S BGPIC=0 F S BGPIC=$O(BGPIND(BGPIC)) Q:BGPIC="" D
.;now print individual indicator
.S X=" " D S(X,1,1),S(X,1,1)
.S X=$P(^BGPHEIF(BGPIC,0),U,3) D S(X,1,1)
.S X=" " D S(X,1,1)
.S X="Denominator(s):" D S(X,1,1)
.S BGPX=0 F S BGPX=$O(^BGPHEIF(BGPIC,61,"B",BGPX)) Q:BGPX'=+BGPX D
..S BGPY=0 F S BGPY=$O(^BGPHEIF(BGPIC,61,"B",BGPX,BGPY)) Q:BGPY'=+BGPY D
...I $P(^BGPHEIF(BGPIC,61,BGPY,0),U,2)'[BGPRTYPE Q ;not a denom def for this report
...S BGPZ=0 F S BGPZ=$O(^BGPHEIF(BGPIC,61,BGPY,1,BGPZ)) Q:BGPZ'=+BGPZ D
....S Y=^BGPHEIF(BGPIC,61,BGPY,1,BGPZ,0) D S(Y,1,1)
....Q
...Q
..Q
.S X=" " D S(X,1,1)
.S X="Numerator(s):" D S(X,1,1)
.S BGPX=0 F S BGPX=$O(^BGPHEIF(BGPIC,62,"B",BGPX)) Q:BGPX'=+BGPX D
..S BGPY=0 F S BGPY=$O(^BGPHEIF(BGPIC,62,"B",BGPX,BGPY)) Q:BGPY'=+BGPY D
...I $P(^BGPHEIF(BGPIC,62,BGPY,0),U,2)'[BGPRTYPE Q ;not a denom def for this report
...S BGPZ=0 F S BGPZ=$O(^BGPHEIF(BGPIC,62,BGPY,1,BGPZ)) Q:BGPZ'=+BGPZ D
....S X=^BGPHEIF(BGPIC,62,BGPY,1,BGPZ,0) D S(X,1,1)
....Q
...Q
..Q
.S X=" " D S(X,1,1)
.S BGPX=0 F S BGPX=$O(^BGPHEIF(BGPIC,11,BGPX)) Q:BGPX'=+BGPX D
..S X=^BGPHEIF(BGPIC,11,BGPX,0) D S(X,1,1)
.S X=" " D S(X,1,1) S BGPX=0 F S BGPX=$O(^BGPHEIF(BGPIC,51,BGPX)) Q:BGPX'=+BGPX D
..S X=^BGPHEIF(BGPIC,51,BGPX,0) D S(X,1,1)
.S X=" " D S(X,1,1) S BGPX=0 F S BGPX=$O(^BGPHEIF(BGPIC,52,BGPX)) Q:BGPX'=+BGPX D
..S X=^BGPHEIF(BGPIC,52,BGPX,0) D S(X,1,1)
.X ^BGPHEIF(BGPIC,4)
Q
S Y=$P(^VA(200,DUZ,0),U,2),$E(Y,35)=$$FMTE^XLFDT(DT) D S(Y,1,1)
I BGPRTYPE=4 S Y="*** IHS FY04 Clinical Performance Report ***" D S(Y,1,1)
I BGPRTYPE=1 S Y="*** IHS FY04 GPRA Clinical Performance Indicators ***" D S(Y,1,1)
I BGPRTYPE=2 S Y="*** IHS FY04 Area Director's Clinical Performance Indicators ***" D S(Y,1,1)
I BGPRTYPE=3 S Y="*** IHS FY04 HEDIS Clinical Performace ***" D S(Y,1,1)
I $G(BGPAREAA) S Y=$S(BGPSUCNT=1:BGPSUNM,1:"AREA AGGREGATE") D S(Y,1,1)
I '$G(BGPAREAA) S Y=$P(^DIC(4,DUZ(2),0),U) D S(Y,1,1)
S X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) D S(X,1,1)
S X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED) D S(X,1,1)
S X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED) D S(X,1,1)
S X=$TR($J(""," ","-"),80) D S(X,1,1)
Q
EXIT ;
K ^TMP($J)
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")
;----------
S(Y,F,P) ;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
C(X,X2,X3) ;
D COMMA^%DTC
Q X
BGP4HEL ; IHS/CMI/LAB - IHS gpra print ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+2 ;
+3 ;
DEL ;
+1 KILL ^TMP($JOB)
+2 SET ^TMP($JOB,"BGPDEL",0)=0
+3 DO ^BGP4HEHH
+4 DO DEL1
+5 ;print lists to delimited file
DO ^BGP4HESL
+6 ;if screen selected do screen
+7 IF BGPDELT="S"
DO SCREEN
DO EXIT
QUIT
+8 ;call xbgsave to create output file
+9 SET XBGL="TMP("_$JOB_",""BGPDEL"","
+10 KILL ^TMP($JOB,"SUMMARYDEL")
+11 SET XBFLT=1
SET XBFN=BGPDELF_".txt"
SET XBMED="F"
SET XBTLE="GPRA 04 HEDIS DELIMITED OUTPUT"
SET XBQ="N"
SET XBE=$JOB
+12 DO ^XBGSAVE
+13 KILL XBFLT,XBFN,XBMED,XBTLE,XBE,XBF
+14 DO EXIT
+15 QUIT
+16 ;
SCREEN ;
+1 SET X=0
FOR
SET X=$ORDER(^TMP($JOB,"BGPDEL",X))
IF X'=+X
QUIT
WRITE !,^TMP($JOB,"BGPDEL",X)
+2 QUIT
DEL1 ;EP
+1 SET BGPIC=0
FOR
SET BGPIC=$ORDER(BGPIND(BGPIC))
IF BGPIC=""
QUIT
Begin DoDot:1
+2 ;now print individual indicator
+3 SET X=" "
DO S(X,1,1)
DO S(X,1,1)
+4 SET X=$PIECE(^BGPHEIF(BGPIC,0),U,3)
DO S(X,1,1)
+5 SET X=" "
DO S(X,1,1)
+6 SET X="Denominator(s):"
DO S(X,1,1)
+7 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIF(BGPIC,61,"B",BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+8 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPHEIF(BGPIC,61,"B",BGPX,BGPY))
IF BGPY'=+BGPY
QUIT
Begin DoDot:3
+9 ;not a denom def for this report
IF $PIECE(^BGPHEIF(BGPIC,61,BGPY,0),U,2)'[BGPRTYPE
QUIT
+10 SET BGPZ=0
FOR
SET BGPZ=$ORDER(^BGPHEIF(BGPIC,61,BGPY,1,BGPZ))
IF BGPZ'=+BGPZ
QUIT
Begin DoDot:4
+11 SET Y=^BGPHEIF(BGPIC,61,BGPY,1,BGPZ,0)
DO S(Y,1,1)
+12 QUIT
End DoDot:4
+13 QUIT
End DoDot:3
+14 QUIT
End DoDot:2
+15 SET X=" "
DO S(X,1,1)
+16 SET X="Numerator(s):"
DO S(X,1,1)
+17 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIF(BGPIC,62,"B",BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+18 SET BGPY=0
FOR
SET BGPY=$ORDER(^BGPHEIF(BGPIC,62,"B",BGPX,BGPY))
IF BGPY'=+BGPY
QUIT
Begin DoDot:3
+19 ;not a denom def for this report
IF $PIECE(^BGPHEIF(BGPIC,62,BGPY,0),U,2)'[BGPRTYPE
QUIT
+20 SET BGPZ=0
FOR
SET BGPZ=$ORDER(^BGPHEIF(BGPIC,62,BGPY,1,BGPZ))
IF BGPZ'=+BGPZ
QUIT
Begin DoDot:4
+21 SET X=^BGPHEIF(BGPIC,62,BGPY,1,BGPZ,0)
DO S(X,1,1)
+22 QUIT
End DoDot:4
+23 QUIT
End DoDot:3
+24 QUIT
End DoDot:2
+25 SET X=" "
DO S(X,1,1)
+26 SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIF(BGPIC,11,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+27 SET X=^BGPHEIF(BGPIC,11,BGPX,0)
DO S(X,1,1)
End DoDot:2
+28 SET X=" "
DO S(X,1,1)
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIF(BGPIC,51,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+29 SET X=^BGPHEIF(BGPIC,51,BGPX,0)
DO S(X,1,1)
End DoDot:2
+30 SET X=" "
DO S(X,1,1)
SET BGPX=0
FOR
SET BGPX=$ORDER(^BGPHEIF(BGPIC,52,BGPX))
IF BGPX'=+BGPX
QUIT
Begin DoDot:2
+31 SET X=^BGPHEIF(BGPIC,52,BGPX,0)
DO S(X,1,1)
End DoDot:2
+32 XECUTE ^BGPHEIF(BGPIC,4)
End DoDot:1
+33 QUIT
+1 SET Y=$PIECE(^VA(200,DUZ,0),U,2)
SET $EXTRACT(Y,35)=$$FMTE^XLFDT(DT)
DO S(Y,1,1)
+2 IF BGPRTYPE=4
SET Y="*** IHS FY04 Clinical Performance Report ***"
DO S(Y,1,1)
+3 IF BGPRTYPE=1
SET Y="*** IHS FY04 GPRA Clinical Performance Indicators ***"
DO S(Y,1,1)
+4 IF BGPRTYPE=2
SET Y="*** IHS FY04 Area Director's Clinical Performance Indicators ***"
DO S(Y,1,1)
+5 IF BGPRTYPE=3
SET Y="*** IHS FY04 HEDIS Clinical Performace ***"
DO S(Y,1,1)
+6 IF $GET(BGPAREAA)
SET Y=$SELECT(BGPSUCNT=1:BGPSUNM,1:"AREA AGGREGATE")
DO S(Y,1,1)
+7 IF '$GET(BGPAREAA)
SET Y=$PIECE(^DIC(4,DUZ(2),0),U)
DO S(Y,1,1)
+8 SET X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED)
DO S(X,1,1)
+9 SET X="Previous Year Period: "_$$FMTE^XLFDT(BGPPBD)_" to "_$$FMTE^XLFDT(BGPPED)
DO S(X,1,1)
+10 SET X="Baseline Period: "_$$FMTE^XLFDT(BGPBBD)_" to "_$$FMTE^XLFDT(BGPBED)
DO S(X,1,1)
+11 SET X=$TRANSLATE($JUSTIFY(""," ","-"),80)
DO S(X,1,1)
+12 QUIT
EXIT ;
+1 KILL ^TMP($JOB)
+2 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 ;----------
S(Y,F,P) ;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
C(X,X2,X3) ;
+1 DO COMMA^%DTC
+2 QUIT X