BGPMUDP2 ; IHS/MSC/SAT - MU EH measure output routines;02-Mar-2011 16:30;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;
;This routine does the printed output of 0081 Heart Failure (BGPMUD03)
HF ;EP output routine for 0081 Heart Failure
D P2
K ^TMP("BGPMU0081",$J)
Q
P2 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,EXC1,PC1,PC11,PC13,NONUM,STRING1,STRING2,STRING3,PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,X
S STRING1=$$081("C")
S STRING2=$$081("P")
S STRING3=$$081("B")
S PRD1=$P(STRING1,U,1)-$P(STRING2,U,1) ;change from prev year (line 1)
S PRD2=$P(STRING1,U,5)-$P(STRING2,U,5) ;% change from prev year
S PRD3=$P(STRING1,U,5)-$P(STRING3,U,5) ;% change from base year
S PRD4=$P(STRING1,U,6)-$P(STRING2,U,6) ;% change from prev year
S PRD5=$P(STRING1,U,6)-$P(STRING3,U,6) ;% change from prev year
D HEADER^BGPMUPH Q:BGPQUIT
W !
D HDRBLK^BGPMUPH
W !,"Pts 18+ w/heart failure",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?64,$P(STRING3,U,1)
W !,"and LVEF < 40%"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Excluded (Exc)",?33,$P(STRING1,U,4),?44,$P(STRING2,U,4),?64,$P(STRING3,U,4)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"Pts 18+ w/heart failure",?33,$P(STRING1,U,1)-$P(STRING1,U,4),?44,$P(STRING2,U,1)-$P(STRING2,U,4),?64,$P(STRING3,U,1)-$P(STRING3,U,4)
W !,"and LVEF < 40% less Exc"
W !
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/ACE inhibitor or ARB",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,5),5,1),?44,$P(STRING2,U,2),?49,$J($P(STRING2,U,5),5,1),?56,$J($FN(PRD2,",+",1),6),?64,$P(STRING3,U,2),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRD3,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o ACE inhibitor or ARB",?33,$P(STRING1,U,3),?38,$J($P(STRING1,U,6),5,1),?44,$P(STRING2,U,3),?49,$J($P(STRING2,U,6),5,1),?56,$J($FN(PRD4,",+",1),6),?64,$P(STRING3,U,3),?68,$J($P(STRING3,U,6),5,1),?74,$J($FN(PRD5,",+",1),6)
I $D(BGPLIST(BGPIC)) D P2D
D SUM081^BGPMUDD2
Q
081(BGPMUTF) ;Get the numbers for this measure
N ARRAY
S DEN1=+$G(^TMP("BGPMU0081",$J,BGPMUTF,"DEN"))
S NUM1=+$G(^TMP("BGPMU0081",$J,BGPMUTF,"NUM"))
S NONUM=+$G(^TMP("BGPMU0081",$J,BGPMUTF,"NOT"))
S EXC1=+$G(^TMP("BGPMU0081",$J,BGPMUTF,"EXC"))
I DEN1=0 S (PC1,PC11,PC13)=0
I DEN1>0 D
.I DEN1-EXC1=0 S (PC1,PC11,PC13)=0
.E D
..S PC1=$$ROUND^BGPMUA01((NUM1/(DEN1-EXC1)),3)*100
..S PC11=$$ROUND^BGPMUA01((NONUM/(DEN1-EXC1)),3)*100
..S PC13=$$ROUND^BGPMUA01((EXC1/DEN1),3)*100
S ARRAY=DEN1_U_NUM1_U_NONUM_U_EXC1_U_PC1_U_PC11_U_PC13_U_""
Q ARRAY
P2D ;Do the Details
N PT,PTCNT,NODE,NAME,VST,BMI,FOL,X
N BGPARR
D HEADERL^BGPMUPH Q:BGPQUIT
S X="Patients 18+ with at least 1 inpatient discharge encounter OR at least" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="2 outpatient OR at least 2 nursing facility encounters with the EP during the" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="reporting period AND a diagnosis of heart failure during or before any of these" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="encounters AND a Left Ventricular Ejection Fraction (LVEF) < 40% before any of" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="these encounters during the reporting period AND who were prescribed ACE" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="inhibitors or ARB medications during the reporting period, if any." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="Patients who do not meet the numerator criteria are listed first (NM:), followed" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="by patients who do meet the numerator criteria (M:). Excluded patients are" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="listed last." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="HF=Heart Failure diagnosis" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="LVEF= Left Ventricular Ejection Fraction (LVEF) < 40%" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="EN=Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="MED=ACE Inhibitor or ARB Medication" D W^BGPMUPP(X,0,1,BGPPTYPE)
;
I $Y>(BGPIOSL-2) D HEADERL^BGPMUPH Q:BGPQUIT
W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
S LINE="",$P(LINE,"-",81)="" W !,LINE
S PTCT=0
I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0081",$J,"PAT","C","NOT")) D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0081"","_$J_",""PAT"",""C"",""NOT"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D D081(NODE)
I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0081",$J,"PAT","C","NUM"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0081"","_$J_",""PAT"",""C"",""NUM"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D D081(NODE)
;Excluded patients
I BGPLIST="A"&($D(^TMP("BGPMU0081",$J,"PAT","C","EXC"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0081"","_$J_",""PAT"",""C"",""EXC"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DEXC081(NODE)
S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
Q
;
D081(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,23)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$$SEX^AUPNPAT(DFN)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,10)
S DEN=$P(NODE,U,2)
S NUM=$P(NODE,U,3)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
.S LINE="",$P(LINE,"-",81)="" W !,LINE
W !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,$P(DEN,";",1),?69,NUM
F BGPI=2:1:4 I $P(DEN,";",BGPI)'="" W !,?53,$P(DEN,";",BGPI)
Q
DEXC081(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,23)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$$SEX^AUPNPAT(DFN)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,10)
S DEN=$P(NODE,U,2)
S NUM=$P(NODE,U,3)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
.S LINE="",$P(LINE,"-",81)="" W !,LINE
W !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,$P(DEN,";",1),?69,"Excluded"
F BGPI=2:1:4 I $P(DEN,";",BGPI)'="" W !,?53,$P(DEN,";",BGPI)
Q
;
XML081 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="5"_U_""_U_+$G(^TMP("BGPMU0081",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0081",$J,"C","NUM"))_U_+$G(^TMP("BGPMU0081",$J,"C","EXC"))
K ^TMP("BGPMU0081",$J)
Q
;
;*******************************
;
;This routine does the printed output of 0012 Prenatal HIV Screening (BGPMUD04)
PENTRY ;EP output routine for 0012 Prenatal HIV Screening
D P12
K ^TMP("BGPMU0012",$J)
Q
P12 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,EXC1,PC1,PC11,PC13,NONUM,STRING1,STRING2,STRING3,PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,X
S STRING1=$$012("C")
S STRING2=$$012("P")
S STRING3=$$012("B")
S PRD1=$P(STRING1,U,1)-$P(STRING2,U,1) ;change from prev year (line 1)
S PRD2=$P(STRING1,U,5)-$P(STRING2,U,5) ;% change from prev year
S PRD3=$P(STRING1,U,5)-$P(STRING3,U,5) ;% change from base year
S PRD4=$P(STRING1,U,6)-$P(STRING2,U,6) ;% change from prev year
S PRD5=$P(STRING1,U,6)-$P(STRING3,U,6) ;% change from prev year
D HEADER^BGPMUPH Q:BGPQUIT
;W !
D HDRBLK^BGPMUPH
W !,"Pts w/live birth and",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?64,$P(STRING3,U,1)
W !,"prenatal encounter"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Excluded (Exc)",?33,$P(STRING1,U,4),?44,$P(STRING2,U,4),?64,$P(STRING3,U,4)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"Pts w/live birth and",?33,$P(STRING1,U,1)-$P(STRING1,U,4),?44,$P(STRING2,U,1)-$P(STRING2,U,4),?64,$P(STRING3,U,1)-$P(STRING3,U,4)
W !,"prenatal encounter less Exc"
W !
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/HIV screening",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,5),5,1),?44,$P(STRING2,U,2),?49,$J($P(STRING2,U,5),5,1),?56,$J($FN(PRD2,",+",1),6),?64,$P(STRING3,U,2),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRD3,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o HIV screening",?33,$P(STRING1,U,3),?38,$J($P(STRING1,U,6),5,1),?44,$P(STRING2,U,3),?49,$J($P(STRING2,U,6),5,1),?56,$J($FN(PRD4,",+",1),6),?64,$P(STRING3,U,3),?68,$J($P(STRING3,U,6),5,1),?74,$J($FN(PRD5,",+",1),6)
I $D(BGPLIST(BGPIC)) D P12D
D SUM012^BGPMUDD2
Q
012(BGPMUTF) ;Get the numbers for this measure
N ARRAY
S DEN1=+$G(^TMP("BGPMU0012",$J,BGPMUTF,"DEN"))
S NUM1=+$G(^TMP("BGPMU0012",$J,BGPMUTF,"NUM"))
S NONUM=+$G(^TMP("BGPMU0012",$J,BGPMUTF,"NOT"))
S EXC1=+$G(^TMP("BGPMU0012",$J,BGPMUTF,"EXC"))
I DEN1=0 S (PC1,PC11,PC13)=0
I DEN1>0 D
.I DEN1-EXC1=0 S (PC1,PC11,PC13)=0
.E D
..S PC1=$$ROUND^BGPMUA01((NUM1/(DEN1-EXC1)),3)*100
..S PC11=$$ROUND^BGPMUA01((NONUM/(DEN1-EXC1)),3)*100
.S PC13=$$ROUND^BGPMUA01((EXC1/DEN1),3)*100
S ARRAY=DEN1_U_NUM1_U_NONUM_U_EXC1_U_PC1_U_PC11_U_PC13_U_""
Q ARRAY
P12D ;Do the Details
N PT,PTCNT,NODE,NAME,VST,BMI,FOL,X
N BGPARR
D HEADERL^BGPMUPH Q:BGPQUIT
S X="Patients, regardless of age, who gave birth during the reporting period who were" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="screened for HIV infection during the first or second prenatal encounter," D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="if any." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="Patients who do not meet the numerator criteria are listed first (NM:), followed" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="by patients who do meet the numerator criteria (M:). Excluded patients are" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="listed last." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="DEL=Live birth delivery" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="EN=Prenatal Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="HIV=HIV Screening" D W^BGPMUPP(X,0,1,BGPPTYPE)
;
I $Y>(BGPIOSL-2) D HEADERL^BGPMUPH Q:BGPQUIT
W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"NUMERATOR"
S LINE="",$P(LINE,"-",81)="" W !,LINE
S PTCT=0
I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0012",$J,"PAT","C","NOT")) D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0012"","_$J_",""PAT"",""C"",""NOT"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D D012(NODE)
I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0012",$J,"PAT","C","NUM"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0012"","_$J_",""PAT"",""C"",""NUM"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D D012(NODE)
;Excluded patients
I BGPLIST="A"&($D(^TMP("BGPMU0012",$J,"PAT","C","EXC"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0012"","_$J_",""PAT"",""C"",""EXC"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D D012(NODE)
S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
Q
;
D012(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,DEN1,DEN2,NUM,AGE,DFN
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,23)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$$SEX^AUPNPAT(DFN)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,10)
S DEN=$P(NODE,U,2),DEN1=$P(DEN,";"),DEN2=$P(DEN,";",2)
S NUM=$P(NODE,U,3)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"NUMERATOR"
.S LINE="",$P(LINE,"-",81)="" W !,LINE
W !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,DEN1,?66,NUM
W:DEN2'="" !,?53,DEN2
Q
;
XML012 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="NQF_012"_U_""_U_+$G(^TMP("BGPMU0012",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0012",$J,"C","NUM"))_U_+$G(^TMP("BGPMU0012",$J,"C","EXC"))
K ^TMP("BGPMU0012",$J)
Q
BGPMUDP2 ; IHS/MSC/SAT - MU EH measure output routines;02-Mar-2011 16:30;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;
+3 ;This routine does the printed output of 0081 Heart Failure (BGPMUD03)
HF ;EP output routine for 0081 Heart Failure
+1 DO P2
+2 KILL ^TMP("BGPMU0081",$JOB)
+3 QUIT
P2 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,EXC1,PC1,PC11,PC13,NONUM,STRING1,STRING2,STRING3,PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,X
+3 SET STRING1=$$081("C")
+4 SET STRING2=$$081("P")
+5 SET STRING3=$$081("B")
+6 ;change from prev year (line 1)
SET PRD1=$PIECE(STRING1,U,1)-$PIECE(STRING2,U,1)
+7 ;% change from prev year
SET PRD2=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 ;% change from base year
SET PRD3=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+9 ;% change from prev year
SET PRD4=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+10 ;% change from prev year
SET PRD5=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+11 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !
+13 DO HDRBLK^BGPMUPH
+14 WRITE !,"Pts 18+ w/heart failure",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?64,$PIECE(STRING3,U,1)
+15 WRITE !,"and LVEF < 40%"
+16 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+17 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,4),?64,$PIECE(STRING3,U,4)
+18 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+19 WRITE !,"Pts 18+ w/heart failure",?33,$PIECE(STRING1,U,1)-$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,1)-$PIECE(STRING2,U,4),?64,$PIECE(STRING3,U,1)-$PIECE(STRING3,U,4)
+20 WRITE !,"and LVEF < 40% less Exc"
+21 WRITE !
+22 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+23 WRITE !,"# w/ACE inhibitor or ARB",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,5),5,1),?44,$PIECE(STRING2,U,2),?49,$JUSTIFY(...
... $PIECE(STRING2,U,5),5,1),?56,$JUSTIFY($FNUMBER(PRD2,",+",1),6),?64,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRD3,",+",1),6)
+24 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+25 WRITE !,"# w/o ACE inhibitor or ARB",?33,$PIECE(STRING1,U,3),?38,$JUSTIFY($PIECE(STRING1,U,6),5,1),?44,$PIECE(STRING2,U,3),?49,...
... $JUSTIFY($PIECE(STRING2,U,6),5,1),?56,$JUSTIFY($FNUMBER(PRD4,",+",1),6),?64,$PIECE(STRING3,U,3),?68,$JUSTIFY($PIECE(STRING3,U,6),5,1),?74,$JUSTIFY($FNUMBER(PRD5,",+",1),6)
+26 IF $DATA(BGPLIST(BGPIC))
DO P2D
+27 DO SUM081^BGPMUDD2
+28 QUIT
081(BGPMUTF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN1=+$GET(^TMP("BGPMU0081",$JOB,BGPMUTF,"DEN"))
+3 SET NUM1=+$GET(^TMP("BGPMU0081",$JOB,BGPMUTF,"NUM"))
+4 SET NONUM=+$GET(^TMP("BGPMU0081",$JOB,BGPMUTF,"NOT"))
+5 SET EXC1=+$GET(^TMP("BGPMU0081",$JOB,BGPMUTF,"EXC"))
+6 IF DEN1=0
SET (PC1,PC11,PC13)=0
+7 IF DEN1>0
Begin DoDot:1
+8 IF DEN1-EXC1=0
SET (PC1,PC11,PC13)=0
+9 IF '$TEST
Begin DoDot:2
+10 SET PC1=$$ROUND^BGPMUA01((NUM1/(DEN1-EXC1)),3)*100
+11 SET PC11=$$ROUND^BGPMUA01((NONUM/(DEN1-EXC1)),3)*100
+12 SET PC13=$$ROUND^BGPMUA01((EXC1/DEN1),3)*100
End DoDot:2
End DoDot:1
+13 SET ARRAY=DEN1_U_NUM1_U_NONUM_U_EXC1_U_PC1_U_PC11_U_PC13_U_""
+14 QUIT ARRAY
P2D ;Do the Details
+1 NEW PT,PTCNT,NODE,NAME,VST,BMI,FOL,X
+2 NEW BGPARR
+3 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+4 SET X="Patients 18+ with at least 1 inpatient discharge encounter OR at least"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="2 outpatient OR at least 2 nursing facility encounters with the EP during the"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="reporting period AND a diagnosis of heart failure during or before any of these"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="encounters AND a Left Ventricular Ejection Fraction (LVEF) < 40% before any of"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+8 SET X="these encounters during the reporting period AND who were prescribed ACE"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 SET X="inhibitors or ARB medications during the reporting period, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+11 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+12 SET X="listed last."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="The following are the abbreviations used in the denominator and numerator"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+14 SET X="columns:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+15 SET X="HF=Heart Failure diagnosis"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+16 SET X="LVEF= Left Ventricular Ejection Fraction (LVEF) < 40%"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+17 SET X="EN=Encounter"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+18 SET X="MED=ACE Inhibitor or ARB Medication"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+19 ;
+20 IF $Y>(BGPIOSL-2)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+21 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+22 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+23 SET PTCT=0
+24 IF (BGPLIST="A")!(BGPLIST="D")&$DATA(^TMP("BGPMU0081",$JOB,"PAT","C","NOT"))
Begin DoDot:1
+25 KILL BGPARR
+26 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0081"","_$JOB_",""PAT"",""C"",""NOT"")")
+27 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+28 SET PTCT=PTCT+1
+29 SET NODE=$GET(BGPARR(PT))
+30 DO D081(NODE)
End DoDot:2
End DoDot:1
+31 IF (BGPLIST="A")!(BGPLIST="N")&($DATA(^TMP("BGPMU0081",$JOB,"PAT","C","NUM")))
Begin DoDot:1
+32 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0081"","_$JOB_",""PAT"",""C"",""NUM"")")
+33 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+34 SET PTCT=PTCT+1
+35 SET NODE=$GET(BGPARR(PT))
+36 DO D081(NODE)
End DoDot:2
End DoDot:1
+37 ;Excluded patients
+38 IF BGPLIST="A"&($DATA(^TMP("BGPMU0081",$JOB,"PAT","C","EXC")))
Begin DoDot:1
+39 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0081"","_$JOB_",""PAT"",""C"",""EXC"")")
+40 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+41 SET PTCT=PTCT+1
+42 SET NODE=$GET(BGPARR(PT))
+43 DO DEXC081(NODE)
End DoDot:2
End DoDot:1
+44 SET X="Total # of patients on list: "_PTCT
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+45 QUIT
+46 ;
D081(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,23)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET SEX=$$SEX^AUPNPAT(DFN)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,10)
+8 SET DEN=$PIECE(NODE,U,2)
+9 SET NUM=$PIECE(NODE,U,3)
+10 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+11 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+13 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+14 WRITE !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,$PIECE(DEN,";",1),?69,NUM
+15 FOR BGPI=2:1:4
IF $PIECE(DEN,";",BGPI)'=""
WRITE !,?53,$PIECE(DEN,";",BGPI)
+16 QUIT
DEXC081(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,23)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET SEX=$$SEX^AUPNPAT(DFN)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,10)
+8 SET DEN=$PIECE(NODE,U,2)
+9 SET NUM=$PIECE(NODE,U,3)
+10 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+11 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+13 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+14 WRITE !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,$PIECE(DEN,";",1),?69,"Excluded"
+15 FOR BGPI=2:1:4
IF $PIECE(DEN,";",BGPI)'=""
WRITE !,?53,$PIECE(DEN,";",BGPI)
+16 QUIT
+17 ;
XML081 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
+2 SET BGPXML(1)="5"_U_""_U_+$GET(^TMP("BGPMU0081",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0081",$JOB,"C","NUM"))_U_+$GET(^TMP("BGPMU0081",$JOB,"C","EXC"))
+3 KILL ^TMP("BGPMU0081",$JOB)
+4 QUIT
+5 ;
+6 ;*******************************
+7 ;
+8 ;This routine does the printed output of 0012 Prenatal HIV Screening (BGPMUD04)
PENTRY ;EP output routine for 0012 Prenatal HIV Screening
+1 DO P12
+2 KILL ^TMP("BGPMU0012",$JOB)
+3 QUIT
P12 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,EXC1,PC1,PC11,PC13,NONUM,STRING1,STRING2,STRING3,PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,X
+3 SET STRING1=$$012("C")
+4 SET STRING2=$$012("P")
+5 SET STRING3=$$012("B")
+6 ;change from prev year (line 1)
SET PRD1=$PIECE(STRING1,U,1)-$PIECE(STRING2,U,1)
+7 ;% change from prev year
SET PRD2=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 ;% change from base year
SET PRD3=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+9 ;% change from prev year
SET PRD4=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+10 ;% change from prev year
SET PRD5=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+11 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+12 ;W !
+13 DO HDRBLK^BGPMUPH
+14 WRITE !,"Pts w/live birth and",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?64,$PIECE(STRING3,U,1)
+15 WRITE !,"prenatal encounter"
+16 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+17 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,4),?64,$PIECE(STRING3,U,4)
+18 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+19 WRITE !,"Pts w/live birth and",?33,$PIECE(STRING1,U,1)-$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,1)-$PIECE(STRING2,U,4),?64,$PIECE(STRING3,U,1)-$PIECE(STRING3,U,4)
+20 WRITE !,"prenatal encounter less Exc"
+21 WRITE !
+22 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+23 WRITE !,"# w/HIV screening",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,5),5,1),?44,$PIECE(STRING2,U,2),?49,$JUSTIFY($PIECE(STRING2,U,5),5,1),?56,...
... $JUSTIFY($FNUMBER(PRD2,",+",1),6),?64,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRD3,",+",1),6)
+24 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+25 WRITE !,"# w/o HIV screening",?33,$PIECE(STRING1,U,3),?38,$JUSTIFY($PIECE(STRING1,U,6),5,1),?44,$PIECE(STRING2,U,3),?49,$JUSTIFY($PIECE(STRING2,U,6),5,1),?56,...
... $JUSTIFY($FNUMBER(PRD4,",+",1),6),?64,$PIECE(STRING3,U,3),?68,$JUSTIFY($PIECE(STRING3,U,6),5,1),?74,$JUSTIFY($FNUMBER(PRD5,",+",1),6)
+26 IF $DATA(BGPLIST(BGPIC))
DO P12D
+27 DO SUM012^BGPMUDD2
+28 QUIT
012(BGPMUTF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN1=+$GET(^TMP("BGPMU0012",$JOB,BGPMUTF,"DEN"))
+3 SET NUM1=+$GET(^TMP("BGPMU0012",$JOB,BGPMUTF,"NUM"))
+4 SET NONUM=+$GET(^TMP("BGPMU0012",$JOB,BGPMUTF,"NOT"))
+5 SET EXC1=+$GET(^TMP("BGPMU0012",$JOB,BGPMUTF,"EXC"))
+6 IF DEN1=0
SET (PC1,PC11,PC13)=0
+7 IF DEN1>0
Begin DoDot:1
+8 IF DEN1-EXC1=0
SET (PC1,PC11,PC13)=0
+9 IF '$TEST
Begin DoDot:2
+10 SET PC1=$$ROUND^BGPMUA01((NUM1/(DEN1-EXC1)),3)*100
+11 SET PC11=$$ROUND^BGPMUA01((NONUM/(DEN1-EXC1)),3)*100
End DoDot:2
+12 SET PC13=$$ROUND^BGPMUA01((EXC1/DEN1),3)*100
End DoDot:1
+13 SET ARRAY=DEN1_U_NUM1_U_NONUM_U_EXC1_U_PC1_U_PC11_U_PC13_U_""
+14 QUIT ARRAY
P12D ;Do the Details
+1 NEW PT,PTCNT,NODE,NAME,VST,BMI,FOL,X
+2 NEW BGPARR
+3 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+4 SET X="Patients, regardless of age, who gave birth during the reporting period who were"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="screened for HIV infection during the first or second prenatal encounter,"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+8 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 SET X="listed last."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X="The following are the abbreviations used in the denominator and numerator"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+11 SET X="columns:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+12 SET X="DEL=Live birth delivery"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="EN=Prenatal Encounter"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+14 SET X="HIV=HIV Screening"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+15 ;
+16 IF $Y>(BGPIOSL-2)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+17 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"NUMERATOR"
+18 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+19 SET PTCT=0
+20 IF (BGPLIST="A")!(BGPLIST="D")&$DATA(^TMP("BGPMU0012",$JOB,"PAT","C","NOT"))
Begin DoDot:1
+21 KILL BGPARR
+22 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0012"","_$JOB_",""PAT"",""C"",""NOT"")")
+23 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+24 SET PTCT=PTCT+1
+25 SET NODE=$GET(BGPARR(PT))
+26 DO D012(NODE)
End DoDot:2
End DoDot:1
+27 IF (BGPLIST="A")!(BGPLIST="N")&($DATA(^TMP("BGPMU0012",$JOB,"PAT","C","NUM")))
Begin DoDot:1
+28 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0012"","_$JOB_",""PAT"",""C"",""NUM"")")
+29 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+30 SET PTCT=PTCT+1
+31 SET NODE=$GET(BGPARR(PT))
+32 DO D012(NODE)
End DoDot:2
End DoDot:1
+33 ;Excluded patients
+34 IF BGPLIST="A"&($DATA(^TMP("BGPMU0012",$JOB,"PAT","C","EXC")))
Begin DoDot:1
+35 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0012"","_$JOB_",""PAT"",""C"",""EXC"")")
+36 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+37 SET PTCT=PTCT+1
+38 SET NODE=$GET(BGPARR(PT))
+39 DO D012(NODE)
End DoDot:2
End DoDot:1
+40 SET X="Total # of patients on list: "_PTCT
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+41 QUIT
+42 ;
D012(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,DEN1,DEN2,NUM,AGE,DFN
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,23)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET SEX=$$SEX^AUPNPAT(DFN)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,10)
+8 SET DEN=$PIECE(NODE,U,2)
SET DEN1=$PIECE(DEN,";")
SET DEN2=$PIECE(DEN,";",2)
+9 SET NUM=$PIECE(NODE,U,3)
+10 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+11 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"NUMERATOR"
+13 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+14 WRITE !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,DEN1,?66,NUM
+15 IF DEN2'=""
WRITE !,?53,DEN2
+16 QUIT
+17 ;
XML012 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
+2 SET BGPXML(1)="NQF_012"_U_""_U_+$GET(^TMP("BGPMU0012",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0012",$JOB,"C","NUM"))_U_+$GET(^TMP("BGPMU0012",$JOB,"C","EXC"))
+3 KILL ^TMP("BGPMU0012",$JOB)
+4 QUIT