BGPMUFP4 ; IHS/MSC/MMT - Print MU EP measures NQF0043 ;20-JUL-2011 11:27;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Printed output reports for this measure
PNEUMO ;EP
D P1
K ^TMP("BGPMU0043",$J)
Q
P1 ;Write individual measure
N X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRN
S STRING1=$$0043("C")
S STRING2=$$0043("P")
S STRING3=$$0043("B")
S PRD=$P(STRING1,U,3)-$P(STRING2,U,3)
S PRN=$P(STRING1,U,3)-$P(STRING3,U,3)
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
D HEADER^BGPMUPH Q:BGPQUIT
D HDRBLK^BGPMUPH
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"Pts 65+",?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))
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !!,"# w/pneumococcal vaccine",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,3),5,1),?44,$P(STRING2,U,2),?49,$J($P(STRING2,U,3),5,1),?56,$J($FN(PRD,",+",1),6),?64,$P(STRING3,U,2),?68,$J($P(STRING3,U,3),5,1),?74,$J($FN(PRN,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o pneumococcal vaccine",?33,($P(STRING1,U,1)-$P(STRING1,U,2)),?38,$J($P(STRING1,U,5),5,1),?44,($P(STRING2,U,1)-$P(STRING2,U,2)),?49,$J($P(STRING2,U,5),5,1),?56,$J($FN(PRD1,",+",1),6)
W ?64,($P(STRING3,U,1)-$P(STRING3,U,2)),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRN1,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
I $D(BGPLIST(BGPIC)) D P2
D SUM43
K X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRN
Q
0043(TF) ;Get the numbers for this measure
N ARRAY
S DEN=+$G(^TMP("BGPMU0043",$J,TF,"DEN"))
S NUM=+$G(^TMP("BGPMU0043",$J,TF,"NUM"))
I DEN=0 S PC1=0,PC2=0
I DEN>0 S PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100,PC2=$$ROUND^BGPMUA01(((DEN-NUM)/DEN),3)*100
S ARRAY=DEN_U_NUM_U_PC1_U_""_U_PC2
Q ARRAY
P2 ;Do the Details
N PT,NODE,NAME,VST,COLON,FOL,BGPARR,LINE,PTCT
D HEADERL^BGPMUPH
S X="Patients 65 years of age and older with at least 1 outpatient encounter with" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="the EP within 1 year of the reporting period end date who received a" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="pneumococcal vaccine 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:)," D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="followed by patients who do meet the numerator criteria (M:)." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="The following are the abbreviations used in the denominator column:" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="EN=Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="" D W^BGPMUPP(X,0,1,BGPPTYPE)
S PTCT=0
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
S LINE="",$P(LINE,"-",81)="" W !,LINE
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0043"","_$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 DATA(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0043"","_$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 DATA(NODE)
W !!,"Total # of patients on list: "_PTCT
K PT,NODE,NAME,VST,COLON,FOL
Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,DEN1,DEN2,NUM,AGE,DFN,LINE
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,22)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
S SEX=$P(^DPT(DFN,0),U,2)
S DEN=$P(NODE,U,2),NUM=$P(NODE,U,3)
S DEN1=$P(DEN,";",1),DEN2=$P(DEN,";",2)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
.S LINE="",$P(LINE,"-",81)="" W !,LINE
W !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN1,?63,$S($G(NUM)="":"NM:",1:"M:"_NUM)
W:DEN2'="" !,?50,DEN2
K NAME,HRN,DEN,NUM,AGE,DFN
Q
XML43 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=PQRI number^""^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="111"_U_""_U_+$G(^TMP("BGPMU0043",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0043",$J,"C","NUM"))
K ^TMP("BGPMU0043",$J)
Q
SUM43 ;Populate "BGPMU SUMMARY" for Colorectal Cancer
;Initialize iCare/summary global
N BGPDNCNT,BGPSSTR,J,N
S BGPDNCNT=0
K ^TMP("BGPMU SUMMARY",$J,BGPIC)
S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0043"_U_"111"
S N=1 ;only 1 numerator
;Setup summary page/iCare ^TMP global
S CDEN1CT=+$G(^TMP("BGPMU0043",$J,"C","DEN")) ;current
S CNUM1CT=+$G(^TMP("BGPMU0043",$J,"C","NUM"))
S CMP=$S(CDEN1CT>0:$$ROUND^BGPMUA01(CNUM1CT/CDEN1CT,3)*100,1:0)
S PDEN1CT=+$G(^TMP("BGPMU0043",$J,"P","DEN")) ;previous
S PNUM1CT=+$G(^TMP("BGPMU0043",$J,"P","NUM"))
S PMP=$S(PDEN1CT>0:$$ROUND^BGPMUA01(PNUM1CT/PDEN1CT,3)*100,1:0)
S BDEN1CT=+$G(^TMP("BGPMU0043",$J,"B","DEN")) ;baseline
S BNUM1CT=+$G(^TMP("BGPMU0043",$J,"B","NUM"))
S BMP=$S(BDEN1CT>0:$$ROUND^BGPMUA01(BNUM1CT/BDEN1CT,3)*100,1:0)
S BGPDNCNT=BGPDNCNT+1
S BGPSSTR="MU.EP.0043."_N_U_"65+ w/pneumonia vaccine"_U_""_U_CDEN1CT_U_CNUM1CT_U_CMP_U_U_U_U
; 11 12 13 14
S BGPSSTR=BGPSSTR_U_""_U_PDEN1CT_U_PNUM1CT_U_PMP
; 15 16 17 18
S BGPSSTR=BGPSSTR_U_""_U_BDEN1CT_U_BNUM1CT_U_BMP
S ^TMP("BGPMU SUMMARY",$J,BGPIC,BGPDNCNT)=BGPSSTR
Q
BGPMUFP4 ; IHS/MSC/MMT - Print MU EP measures NQF0043 ;20-JUL-2011 11:27;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Printed output reports for this measure
PNEUMO ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0043",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRN
+2 SET STRING1=$$0043("C")
+3 SET STRING2=$$0043("P")
+4 SET STRING3=$$0043("B")
+5 SET PRD=$PIECE(STRING1,U,3)-$PIECE(STRING2,U,3)
+6 SET PRN=$PIECE(STRING1,U,3)-$PIECE(STRING3,U,3)
+7 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+9 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+10 DO HDRBLK^BGPMUPH
+11 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,"Pts 65+",?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))
+13 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+14 WRITE !!,"# w/pneumococcal vaccine",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,3),5,1),?44,$PIECE(STRING2,U,2),?49,$JUSTIFY(...
... $PIECE(STRING2,U,3),5,1),?56,$JUSTIFY($FNUMBER(PRD,",+",1),6),?64,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,3),5,1),?74,$JUSTIFY($FNUMBER(PRN,",+",1),6)
+15 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+16 WRITE !,"# w/o pneumococcal vaccine",?33,($PIECE(STRING1,U,1)-$PIECE(STRING1,U,2)),?38,$JUSTIFY($PIECE(STRING1,U,5),5,1),?44,($PIECE(STRING2,U,1)-$PIECE(STRING2,U,2)),?49,$JUSTIFY($PIECE(STRING2,U,5),5,1),?56,$JUSTIFY($FNUMBER(PRD1,",+",1),6)
+17 WRITE ?64,($PIECE(STRING3,U,1)-$PIECE(STRING3,U,2)),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRN1,",+",1),6)
+18 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+19 IF $DATA(BGPLIST(BGPIC))
DO P2
+20 DO SUM43
+21 KILL X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRN
+22 QUIT
0043(TF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN=+$GET(^TMP("BGPMU0043",$JOB,TF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0043",$JOB,TF,"NUM"))
+4 IF DEN=0
SET PC1=0
SET PC2=0
+5 IF DEN>0
SET PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100
SET PC2=$$ROUND^BGPMUA01(((DEN-NUM)/DEN),3)*100
+6 SET ARRAY=DEN_U_NUM_U_PC1_U_""_U_PC2
+7 QUIT ARRAY
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,COLON,FOL,BGPARR,LINE,PTCT
+2 DO HEADERL^BGPMUPH
+3 SET X="Patients 65 years of age and older with at least 1 outpatient encounter with"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="the EP within 1 year of the reporting period end date who received a"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="pneumococcal vaccine during the reporting period, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="Patients who do not meet the numerator criteria are listed first (NM:),"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+7 SET X="followed by patients who do meet the numerator criteria (M:)."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+8 SET X="The following are the abbreviations used in the denominator column:"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+9 SET X="EN=Encounter"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X=""
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+11 SET PTCT=0
+12 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+13 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+14 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+15 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+16 KILL BGPARR
+17 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0043"","_$JOB_",""PAT"",""C"",""NOT"")")
+18 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+19 SET PTCT=PTCT+1
+20 SET NODE=$GET(BGPARR(PT))
+21 DO DATA(NODE)
End DoDot:2
End DoDot:1
+22 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+23 KILL BGPARR
+24 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0043"","_$JOB_",""PAT"",""C"",""NUM"")")
+25 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+26 SET PTCT=PTCT+1
+27 SET NODE=$GET(BGPARR(PT))
+28 DO DATA(NODE)
End DoDot:2
End DoDot:1
+29 WRITE !!,"Total # of patients on list: "_PTCT
+30 KILL PT,NODE,NAME,VST,COLON,FOL
+31 QUIT
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,DEN1,DEN2,NUM,AGE,DFN,LINE
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,22)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,11)
+7 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+8 SET DEN=$PIECE(NODE,U,2)
SET NUM=$PIECE(NODE,U,3)
+9 SET DEN1=$PIECE(DEN,";",1)
SET DEN2=$PIECE(DEN,";",2)
+10 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+11 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+13 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+14 WRITE !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN1,?63,$SELECT($GET(NUM)="":"NM:",1:"M:"_NUM)
+15 IF DEN2'=""
WRITE !,?50,DEN2
+16 KILL NAME,HRN,DEN,NUM,AGE,DFN
+17 QUIT
XML43 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=PQRI number^""^Denominator Count^Numerator Count^Exclusion Count
+2 SET BGPXML(1)="111"_U_""_U_+$GET(^TMP("BGPMU0043",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0043",$JOB,"C","NUM"))
+3 KILL ^TMP("BGPMU0043",$JOB)
+4 QUIT
SUM43 ;Populate "BGPMU SUMMARY" for Colorectal Cancer
+1 ;Initialize iCare/summary global
+2 NEW BGPDNCNT,BGPSSTR,J,N
+3 SET BGPDNCNT=0
+4 KILL ^TMP("BGPMU SUMMARY",$JOB,BGPIC)
+5 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC)="0043"_U_"111"
+6 ;only 1 numerator
SET N=1
+7 ;Setup summary page/iCare ^TMP global
+8 ;current
SET CDEN1CT=+$GET(^TMP("BGPMU0043",$JOB,"C","DEN"))
+9 SET CNUM1CT=+$GET(^TMP("BGPMU0043",$JOB,"C","NUM"))
+10 SET CMP=$SELECT(CDEN1CT>0:$$ROUND^BGPMUA01(CNUM1CT/CDEN1CT,3)*100,1:0)
+11 ;previous
SET PDEN1CT=+$GET(^TMP("BGPMU0043",$JOB,"P","DEN"))
+12 SET PNUM1CT=+$GET(^TMP("BGPMU0043",$JOB,"P","NUM"))
+13 SET PMP=$SELECT(PDEN1CT>0:$$ROUND^BGPMUA01(PNUM1CT/PDEN1CT,3)*100,1:0)
+14 ;baseline
SET BDEN1CT=+$GET(^TMP("BGPMU0043",$JOB,"B","DEN"))
+15 SET BNUM1CT=+$GET(^TMP("BGPMU0043",$JOB,"B","NUM"))
+16 SET BMP=$SELECT(BDEN1CT>0:$$ROUND^BGPMUA01(BNUM1CT/BDEN1CT,3)*100,1:0)
+17 SET BGPDNCNT=BGPDNCNT+1
+18 SET BGPSSTR="MU.EP.0043."_N_U_"65+ w/pneumonia vaccine"_U_""_U_CDEN1CT_U_CNUM1CT_U_CMP_U_U_U_U
+19 ; 11 12 13 14
+20 SET BGPSSTR=BGPSSTR_U_""_U_PDEN1CT_U_PNUM1CT_U_PMP
+21 ; 15 16 17 18
+22 SET BGPSSTR=BGPSSTR_U_""_U_BDEN1CT_U_BNUM1CT_U_BMP
+23 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,BGPDNCNT)=BGPSSTR
+24 QUIT