BGPMUAP1 ; IHS/MSC/MGH - MU EP measures NQF0421 and NQF0013 ;22-Mar-2011 10:06;DU
;;16.0;IHS CLINICAL REPORTING;;NOV 09, 2015;Build 159
;This rouine does the printed output of these 2 EP measures
BMI ;EP
D P1
;I BGPMUDET="D" D
;.D P2
K ^TMP("BGPMU0421",$J)
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,SUMCT
N PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRD7,PRD8,PRN7,PRN8
S SUMCT=0
S STRING1=$$421("C")
S STRING2=$$421("P")
S STRING3=$$421("B")
D SUMMARY1(STRING1,STRING2,STRING3)
;First population
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRD2=$P(STRING1,U,6)-$P(STRING2,U,6)
S PRD3=$P(STRING1,U,7)-$P(STRING2,U,7)
S PRD7=$P(STRING1,U,16)-$P(STRING2,U,16)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
S PRN2=$P(STRING1,U,6)-$P(STRING3,U,6)
S PRN3=$P(STRING1,U,7)-$P(STRING3,U,7)
S PRN7=$P(STRING1,U,16)-$P(STRING3,U,16)
;second population
S PRD4=$P(STRING1,U,12)-$P(STRING2,U,12)
S PRD5=$P(STRING1,U,13)-$P(STRING2,U,13)
S PRD6=$P(STRING1,U,14)-$P(STRING2,U,14)
S PRD8=$P(STRING1,U,18)-$P(STRING2,U,18)
S PRN4=$P(STRING1,U,12)-$P(STRING3,U,12)
S PRN5=$P(STRING1,U,13)-$P(STRING3,U,13)
S PRN6=$P(STRING1,U,14)-$P(STRING3,U,14)
S PRN8=$P(STRING1,U,18)-$P(STRING3,U,18)
D HEADER^BGPMUPH Q:BGPQUIT
D HDRBLK^BGPMUPH
;W !,"Patients with visit and wt >65yrs of age"
W !,"Denominator 1"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"Pts 65+",?33,$P(STRING1,U,1),?44,($P(STRING2,U,1)+$P(STRING2,U,4)),?64,$P(STRING3,U,1)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^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,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"Pts 65+ less Exc",?33,$P(STRING1,U,3),?44,$P(STRING2,U,3),?64,$P(STRING3,U,3)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"# w/BMI + plan if req",?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(PRD1,",+",1),6),?64,$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,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o BMI or no plan if req",?33,$P(STRING1,U,15),?38,$J($P(STRING1,U,16),5,1),?44,$P(STRING2,U,15),?49,$J($P(STRING2,U,16),5,1),?56,$J($FN(PRD7,",+",1),6),?64,$P(STRING3,U,15),?68,$J($P(STRING3,U,16),5,1),?74,$J($FN(PRN7,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
;
W !!,"Denominator 2"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"Pts 18-64",?33,$P(STRING1,U,8),?44,$P(STRING2,U,8),?64,$P(STRING3,U,8)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# Excluded (Exc)",?33,$P(STRING1,U,11),?44,$P(STRING2,U,11),?64,$P(STRING3,U,11)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"Pts 18-64 less Exc",?33,$P(STRING1,U,10),?44,$P(STRING2,U,10),?64,$P(STRING3,U,10)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"# w/BMI + plan if req",?33,$P(STRING1,U,9),?38,$J($P(STRING1,U,12),5,1),?44,$P(STRING2,U,9),?49,$J($P(STRING2,U,12),5,1),?56,$J($FN(PRD4,",+",1),6),?64,$P(STRING3,U,9),?68,$J($P(STRING3,U,12),5,1),?74,$J($FN(PRN4,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o BMI or no plan if req",?33,$P(STRING1,U,17),?38,$J($P(STRING1,U,18),5,1),?44,$P(STRING2,U,17),?49,$J($P(STRING2,U,18),5,1),?56,$J($FN(PRD8,",+",1),6),?64,$P(STRING3,U,17),?68,$J($P(STRING3,U,18),5,1),?74,$J($FN(PRN8,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
I $D(BGPLIST(BGPIC)) D P2
Q
421(TF) ;Get the numbers for this measure
N ARRAY,DEN1,NUM1,EXC1,DEN2,NUM2,EXC2,NOT1,NOT2,PC1,PC11,PC2,PC21,PC13,PC23,NNUM1,NNUM2,PC14,PC24
S DEN1=+$G(^TMP("BGPMU0421",$J,TF,"DEN",1))
S NUM1=+$G(^TMP("BGPMU0421",$J,TF,"NUM",1))
S NOT1=+$G(^TMP("BGPMU0421",$J,TF,"NOT",1))
S EXC1=+$G(^TMP("BGPMU0421",$J,TF,"EXC",1))
S DEN2=+$G(^TMP("BGPMU0421",$J,TF,"DEN",2))
S NUM2=+$G(^TMP("BGPMU0421",$J,TF,"NUM",2))
S NOT2=+$G(^TMP("BGPMU0421",$J,TF,"NOT",2))
S EXC2=+$G(^TMP("BGPMU0421",$J,TF,"EXC",2))
S NNUM1=DEN1-EXC1
S NNUM2=DEN2-EXC2
I DEN1=0 S (PC1,PC11,PC13,PC14)=0
I NNUM1=0 S (PC1,PC14)=0 ;/IHS/BEM/RAM
I DEN1>0 D
.S:NNUM1'=0 PC1=$$ROUND^BGPMUA01((NUM1/NNUM1),3)*100
.S PC11=$$ROUND^BGPMUA01((NNUM1/DEN1),3)*100
.S PC13=$$ROUND^BGPMUA01((EXC1/DEN1),3)*100
.S:NNUM1'=0 PC14=$$ROUND^BGPMUA01((NOT1/NNUM1),3)*100
I DEN2=0 S (PC2,PC21,PC23,PC24)=0
I NNUM2=0 S (PC2,PC24)=""
I DEN2>0 D
.S:NNUM2'=0 PC2=$$ROUND^BGPMUA01((NUM2/NNUM2),3)*100
.S PC21=$$ROUND^BGPMUA01((NNUM2/DEN2),3)*100
.S PC23=$$ROUND^BGPMUA01((EXC2/DEN2),3)*100
.S:NNUM2'=0 PC24=$$ROUND^BGPMUA01((NOT2/NNUM2),3)*100
S ARRAY=DEN1_U_NUM1_U_NNUM1_U_EXC1_U_PC1_U_PC11_U_PC13_U_DEN2_U_NUM2_U_NNUM2_U_EXC2_U_PC2_U_PC21_U_PC23
S ARRAY=ARRAY_U_NOT1_U_PC14_U_NOT2_U_PC24
Q ARRAY
P2 ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X,PTCT,BGPARR,LINE
S PTCT=0
D HEADERL^BGPMUPH
S X="Patients 18+ with at least 1 encounter with the EP during the reporting period," D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="with documented BMI and follow-up, 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:)." 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)
W !!
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
W "Patients 65+"
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(""BGPMU0421"","_$J_",""PAT"",""C"",1,""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(""BGPMU0421"","_$J_",""PAT"",""C"",1,""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)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0421"","_$J_",""PAT"",""C"",1,""EXC"")")
.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
I $Y>(BGPIOSL-7) D HEADERL^BGPMUPH Q:BGPQUIT
S PTCT=0
W !!,"Patients 18-64"
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(""BGPMU0421"","_$J_",""PAT"",""C"",2,""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(""BGPMU0421"","_$J_",""PAT"",""C"",2,""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)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0421"","_$J_",""PAT"",""C"",2,""EXC"")")
.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
Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,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 DEN=$P(NODE,U,2),NUM=$P(NODE,U,4)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
S SEX=$P(^DPT(DFN,0),U,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
S NUM2=""
S NUM1=$P(NUM,";",1),NUM2=$P(NUM,";",2)
W !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN,?63,NUM1
I NUM2'="" D
.W !,?65,NUM2
Q
DATA2(NODE) ;GET DATA
N NAME,HRN,DEN,SEX,COMM,DEN1,DEN2,DEN3,NUM1,NUM2,LINE
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,18)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$P(^DPT(DFN,0),U,2)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
S DEN=$P(NODE,U,2)
S DEN1=$P(DEN,";",1),DEN2=$P(DEN,";",2),DEN3=$P(DEN,";",3)
S NUM=$P(NODE,U,3)
S NUM1=$P(NUM,";",1),NUM2=$P(NUM,";",2)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?20,"HRN",?26,"COMMUNITY",?37,"SEX",?42,"AGE",?46,"DENOMINATOR",?59,"NUMERATOR"
.S LINE="",$P(LINE,"-",81)="" W !,LINE
W !,NAME,?20,HRN,?26,COMM,?38,SEX,?42,AGE,?46,DEN1
I NUM1'="" W !,?46,DEN2,?59,NUM1
I NUM1=""&(DEN2'="") W !,?46,DEN2
I NUM2'="" W !,?46,DEN3,?59,NUM2
I NUM2=""&(DEN3'="") W !,?46,DEN3
Q
;Get printout for BP measure
BLOODP ;EP
D BP1
;I BGPMUDET="D" D BP2
K ^TMP("BGPMU0013",$J)
Q
BP1 ;Write individual measure
N X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRN1,PRD1
S STRING1=$$0013("C")
S STRING2=$$0013("P")
S STRING3=$$0013("B")
D SUMMARY2(STRING1,STRING2,STRING3)
S PRD=$P(STRING1,U,4)-$P(STRING2,U,4)
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRN=$P(STRING1,U,4)-$P(STRING3,U,4)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
D HEADER^BGPMUPH Q:BGPQUIT
D HDRBLK^BGPMUPH
W !,"Pts 18+ w/HTN",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?64,$P(STRING3,U,1)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"# w/=>2 BP recorded",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,4),5,1),?44,$P(STRING2,U,2),?49,$J($P(STRING2,U,4),5,1),?56,$J($FN(PRD,",+",1),6),?64,$P(STRING3,U,2),?68,$J($P(STRING3,U,4),5,1),?74,$J($FN(PRN,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o=> 2 BP recorded",?33,$P(STRING1,U,3),?38,$J($P(STRING1,U,5),5,1),?44,$P(STRING2,U,3),?49,$J($P(STRING2,U,5),5,1),?56,$J($FN(PRD1,",+",1),6),?64,$P(STRING3,U,3),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRN1,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
I $D(BGPLIST(BGPIC)) D BP2
Q
0013(TF) ;Get the numbers for this measure
N ARRAY,DEN,NUM,PC1,PC2,NOT
S DEN=+$G(^TMP("BGPMU0013",$J,TF,"DEN"))
S NUM=+$G(^TMP("BGPMU0013",$J,TF,"NUM"))
S NOT=+$G(^TMP("BGPMU0013",$J,TF,"NOT"))
I DEN=0 S (PC1,PC2)=0
I DEN>0 D
.S PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100
.S PC2=100-PC1
S ARRAY=DEN_U_NUM_U_NOT_U_PC1_U_PC2
Q ARRAY
BP2 ;Do the Details
N PT,NODE,NAME,BP,PTCT,BGPARR,LINE
D HEADERL^BGPMUPH
S X="Hypertensive patients 18+ with at least 2 encounters with the EP during the" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="reporting period, with 2 documented BPs during the encounters, 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="ICD-9 Code=Hypertension Diagnosis" D W^BGPMUPP(X,0,1,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",?20,"HRN",?26,"COMMUNITY",?37,"SEX",?42,"AGE",?46,"DENOMINATOR",?59,"NUMERATOR"
S LINE="",$P(LINE,"-",81)="" W !,LINE
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0013"","_$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 DATA2(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0013"","_$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 DATA2(NODE)
W !!,"Total # of patients on list: "_PTCT
Q
SUMMARY1(STRING1,STRING2,STRING3,CT) ;Summmary setup
N DESC,DESC2,LINE
K ^TMP("BGPMU SUMMARY",$J,BGPIC)
S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0421^128"
S DESC="65+ w/BMI+Plan if req"
S DESC2="18-64 w/BMI+Plan if req"
S LINE=""
S LINE="MU.EP.0421.1"_U_DESC_U_$P(STRING1,U,4)_U_$P(STRING1,U,1)_U_$P(STRING1,U,2)_U_$P(STRING1,U,5)_U_U_U_U_U
S LINE=LINE_$P(STRING2,U,4)_U_$P(STRING2,U,1)_U_$P(STRING2,U,2)_U_$P(STRING2,U,5)_U_$P(STRING3,U,4)_U_$P(STRING3,U,1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,5)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,1)=LINE
S LINE=""
S LINE="MU.EP.0421.2"_U_DESC2_U_$P(STRING1,U,11)_U_$P(STRING1,U,8)_U_$P(STRING1,U,9)_U_$P(STRING1,U,12)_U_U_U_U_U
S LINE=LINE_$P(STRING2,U,11)_U_$P(STRING2,U,8)_U_$P(STRING2,U,9)_U_$P(STRING2,U,12)_U_$P(STRING3,U,11)_U_$P(STRING3,U,8)_U_$P(STRING3,U,9)_U_$P(STRING3,U,12)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,2)=LINE
Q
SUMMARY2(STRING1,STRING2,STRING3) ;Summary setup
N DESC
K ^TMP("BGPMU SUMMARY",$J,BGPIC)
S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0013^237"
S DESC="18+ w/2 BP Recorded"
S LINE="MU.EP.0013.1"_U_DESC_U_U_$P(STRING1,U,1)_U_$P(STRING1,U,2)_U_$P(STRING1,U,4)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,1)_U_$P(STRING2,U,2)_U_$P(STRING2,U,4)_U_U_$P(STRING3,U,1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,4)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,1)=LINE
Q
DATE(D) ;EP
I D="" Q ""
Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
BGPMUAP1 ; IHS/MSC/MGH - MU EP measures NQF0421 and NQF0013 ;22-Mar-2011 10:06;DU
+1 ;;16.0;IHS CLINICAL REPORTING;;NOV 09, 2015;Build 159
+2 ;This rouine does the printed output of these 2 EP measures
BMI ;EP
+1 DO P1
+2 ;I BGPMUDET="D" D
+3 ;.D P2
+4 KILL ^TMP("BGPMU0421",$JOB)
+5 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,SUMCT
+3 NEW PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRD7,PRD8,PRN7,PRN8
+4 SET SUMCT=0
+5 SET STRING1=$$421("C")
+6 SET STRING2=$$421("P")
+7 SET STRING3=$$421("B")
+8 DO SUMMARY1(STRING1,STRING2,STRING3)
+9 ;First population
+10 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+11 SET PRD2=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+12 SET PRD3=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
+13 SET PRD7=$PIECE(STRING1,U,16)-$PIECE(STRING2,U,16)
+14 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+15 SET PRN2=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+16 SET PRN3=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
+17 SET PRN7=$PIECE(STRING1,U,16)-$PIECE(STRING3,U,16)
+18 ;second population
+19 SET PRD4=$PIECE(STRING1,U,12)-$PIECE(STRING2,U,12)
+20 SET PRD5=$PIECE(STRING1,U,13)-$PIECE(STRING2,U,13)
+21 SET PRD6=$PIECE(STRING1,U,14)-$PIECE(STRING2,U,14)
+22 SET PRD8=$PIECE(STRING1,U,18)-$PIECE(STRING2,U,18)
+23 SET PRN4=$PIECE(STRING1,U,12)-$PIECE(STRING3,U,12)
+24 SET PRN5=$PIECE(STRING1,U,13)-$PIECE(STRING3,U,13)
+25 SET PRN6=$PIECE(STRING1,U,14)-$PIECE(STRING3,U,14)
+26 SET PRN8=$PIECE(STRING1,U,18)-$PIECE(STRING3,U,18)
+27 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+28 DO HDRBLK^BGPMUPH
+29 ;W !,"Patients with visit and wt >65yrs of age"
+30 WRITE !,"Denominator 1"
+31 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+32 WRITE !,"Pts 65+",?33,$PIECE(STRING1,U,1),?44,($PIECE(STRING2,U,1)+$PIECE(STRING2,U,4)),?64,$PIECE(STRING3,U,1)
+33 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+34 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,4),?64,$PIECE(STRING3,U,4)
+35 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+36 WRITE !,"Pts 65+ less Exc",?33,$PIECE(STRING1,U,3),?44,$PIECE(STRING2,U,3),?64,$PIECE(STRING3,U,3)
+37 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+38 WRITE !!,"# w/BMI + plan if req",?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(PRD1,",+",1),6),?64,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRN1,",+",1),6)
+39 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+40 WRITE !,"# w/o BMI or no plan if req",?33,$PIECE(STRING1,U,15),?38,$JUSTIFY($PIECE(STRING1,U,16),5,1),?44,...
... $PIECE(STRING2,U,15),?49,$JUSTIFY($PIECE(STRING2,U,16),5,1),?56,$JUSTIFY($FNUMBER(PRD7,",+",1),6),?64,$PIECE(STRING3,U,15),?68,$JUSTIFY($PIECE(STRING3,U,16),5,1),?74,$JUSTIFY($FNUMBER(PRN7,",+",1),6)
+41 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+42 ;
+43 WRITE !!,"Denominator 2"
+44 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+45 WRITE !,"Pts 18-64",?33,$PIECE(STRING1,U,8),?44,$PIECE(STRING2,U,8),?64,$PIECE(STRING3,U,8)
+46 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+47 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,11),?44,$PIECE(STRING2,U,11),?64,$PIECE(STRING3,U,11)
+48 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+49 WRITE !,"Pts 18-64 less Exc",?33,$PIECE(STRING1,U,10),?44,$PIECE(STRING2,U,10),?64,$PIECE(STRING3,U,10)
+50 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+51 WRITE !!,"# w/BMI + plan if req",?33,$PIECE(STRING1,U,9),?38,$JUSTIFY($PIECE(STRING1,U,12),5,1),?44,$PIECE(STRING2,U,9),?49,$JUSTIFY(...
... $PIECE(STRING2,U,12),5,1),?56,$JUSTIFY($FNUMBER(PRD4,",+",1),6),?64,$PIECE(STRING3,U,9),?68,$JUSTIFY($PIECE(STRING3,U,12),5,1),?74,$JUSTIFY($FNUMBER(PRN4,",+",1),6)
+52 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+53 WRITE !,"# w/o BMI or no plan if req",?33,$PIECE(STRING1,U,17),?38,$JUSTIFY($PIECE(STRING1,U,18),5,1),?44,...
... $PIECE(STRING2,U,17),?49,$JUSTIFY($PIECE(STRING2,U,18),5,1),?56,$JUSTIFY($FNUMBER(PRD8,",+",1),6),?64,$PIECE(STRING3,U,17),?68,$JUSTIFY($PIECE(STRING3,U,18),5,1),?74,$JUSTIFY($FNUMBER(PRN8,",+",1),6)
+54 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+55 IF $DATA(BGPLIST(BGPIC))
DO P2
+56 QUIT
421(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN1,NUM1,EXC1,DEN2,NUM2,EXC2,NOT1,NOT2,PC1,PC11,PC2,PC21,PC13,PC23,NNUM1,NNUM2,PC14,PC24
+2 SET DEN1=+$GET(^TMP("BGPMU0421",$JOB,TF,"DEN",1))
+3 SET NUM1=+$GET(^TMP("BGPMU0421",$JOB,TF,"NUM",1))
+4 SET NOT1=+$GET(^TMP("BGPMU0421",$JOB,TF,"NOT",1))
+5 SET EXC1=+$GET(^TMP("BGPMU0421",$JOB,TF,"EXC",1))
+6 SET DEN2=+$GET(^TMP("BGPMU0421",$JOB,TF,"DEN",2))
+7 SET NUM2=+$GET(^TMP("BGPMU0421",$JOB,TF,"NUM",2))
+8 SET NOT2=+$GET(^TMP("BGPMU0421",$JOB,TF,"NOT",2))
+9 SET EXC2=+$GET(^TMP("BGPMU0421",$JOB,TF,"EXC",2))
+10 SET NNUM1=DEN1-EXC1
+11 SET NNUM2=DEN2-EXC2
+12 IF DEN1=0
SET (PC1,PC11,PC13,PC14)=0
+13 ;/IHS/BEM/RAM
IF NNUM1=0
SET (PC1,PC14)=0
+14 IF DEN1>0
Begin DoDot:1
+15 IF NNUM1'=0
SET PC1=$$ROUND^BGPMUA01((NUM1/NNUM1),3)*100
+16 SET PC11=$$ROUND^BGPMUA01((NNUM1/DEN1),3)*100
+17 SET PC13=$$ROUND^BGPMUA01((EXC1/DEN1),3)*100
+18 IF NNUM1'=0
SET PC14=$$ROUND^BGPMUA01((NOT1/NNUM1),3)*100
End DoDot:1
+19 IF DEN2=0
SET (PC2,PC21,PC23,PC24)=0
+20 IF NNUM2=0
SET (PC2,PC24)=""
+21 IF DEN2>0
Begin DoDot:1
+22 IF NNUM2'=0
SET PC2=$$ROUND^BGPMUA01((NUM2/NNUM2),3)*100
+23 SET PC21=$$ROUND^BGPMUA01((NNUM2/DEN2),3)*100
+24 SET PC23=$$ROUND^BGPMUA01((EXC2/DEN2),3)*100
+25 IF NNUM2'=0
SET PC24=$$ROUND^BGPMUA01((NOT2/NNUM2),3)*100
End DoDot:1
+26 SET ARRAY=DEN1_U_NUM1_U_NNUM1_U_EXC1_U_PC1_U_PC11_U_PC13_U_DEN2_U_NUM2_U_NNUM2_U_EXC2_U_PC2_U_PC21_U_PC23
+27 SET ARRAY=ARRAY_U_NOT1_U_PC14_U_NOT2_U_PC24
+28 QUIT ARRAY
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X,PTCT,BGPARR,LINE
+2 SET PTCT=0
+3 DO HEADERL^BGPMUPH
+4 SET X="Patients 18+ with at least 1 encounter with the EP during the reporting period,"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="with documented BMI and follow-up, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+7 SET X="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 WRITE !!
+11 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE "Patients 65+"
+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(""BGPMU0421"","_$JOB_",""PAT"",""C"",1,""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(""BGPMU0421"","_$JOB_",""PAT"",""C"",1,""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 IF BGPLIST="A"
Begin DoDot:1
+30 KILL BGPARR
+31 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0421"","_$JOB_",""PAT"",""C"",1,""EXC"")")
+32 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+33 SET PTCT=PTCT+1
+34 SET NODE=$GET(BGPARR(PT))
+35 DO DATA(NODE)
End DoDot:2
End DoDot:1
+36 WRITE !!,"Total # of patients on list: "_PTCT
+37 IF $Y>(BGPIOSL-7)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+38 SET PTCT=0
+39 WRITE !!,"Patients 18-64"
+40 WRITE !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+41 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+42 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+43 KILL BGPARR
+44 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0421"","_$JOB_",""PAT"",""C"",2,""NOT"")")
+45 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+46 SET PTCT=PTCT+1
+47 SET NODE=$GET(BGPARR(PT))
+48 DO DATA(NODE)
End DoDot:2
End DoDot:1
+49 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+50 KILL BGPARR
+51 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0421"","_$JOB_",""PAT"",""C"",2,""NUM"")")
+52 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+53 SET PTCT=PTCT+1
+54 SET NODE=$GET(BGPARR(PT))
+55 DO DATA(NODE)
End DoDot:2
End DoDot:1
+56 IF BGPLIST="A"
Begin DoDot:1
+57 KILL BGPARR
+58 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0421"","_$JOB_",""PAT"",""C"",2,""EXC"")")
+59 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+60 SET PTCT=PTCT+1
+61 SET NODE=$GET(BGPARR(PT))
+62 DO DATA(NODE)
End DoDot:2
End DoDot:1
+63 WRITE !!,"Total # of patients on list: "_PTCT
+64 QUIT
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,DEN1,DEN2,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 DEN=$PIECE(NODE,U,2)
SET NUM=$PIECE(NODE,U,4)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,11)
+8 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+9 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+10 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+11 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+12 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+13 SET NUM2=""
+14 SET NUM1=$PIECE(NUM,";",1)
SET NUM2=$PIECE(NUM,";",2)
+15 WRITE !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN,?63,NUM1
+16 IF NUM2'=""
Begin DoDot:1
+17 WRITE !,?65,NUM2
End DoDot:1
+18 QUIT
DATA2(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,SEX,COMM,DEN1,DEN2,DEN3,NUM1,NUM2,LINE
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,18)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,11)
+8 SET DEN=$PIECE(NODE,U,2)
+9 SET DEN1=$PIECE(DEN,";",1)
SET DEN2=$PIECE(DEN,";",2)
SET DEN3=$PIECE(DEN,";",3)
+10 SET NUM=$PIECE(NODE,U,3)
+11 SET NUM1=$PIECE(NUM,";",1)
SET NUM2=$PIECE(NUM,";",2)
+12 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+13 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+14 WRITE !,"PATIENT NAME",?20,"HRN",?26,"COMMUNITY",?37,"SEX",?42,"AGE",?46,"DENOMINATOR",?59,"NUMERATOR"
+15 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
End DoDot:1
+16 WRITE !,NAME,?20,HRN,?26,COMM,?38,SEX,?42,AGE,?46,DEN1
+17 IF NUM1'=""
WRITE !,?46,DEN2,?59,NUM1
+18 IF NUM1=""&(DEN2'="")
WRITE !,?46,DEN2
+19 IF NUM2'=""
WRITE !,?46,DEN3,?59,NUM2
+20 IF NUM2=""&(DEN3'="")
WRITE !,?46,DEN3
+21 QUIT
+22 ;Get printout for BP measure
BLOODP ;EP
+1 DO BP1
+2 ;I BGPMUDET="D" D BP2
+3 KILL ^TMP("BGPMU0013",$JOB)
+4 QUIT
BP1 ;Write individual measure
+1 NEW X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRN1,PRD1
+2 SET STRING1=$$0013("C")
+3 SET STRING2=$$0013("P")
+4 SET STRING3=$$0013("B")
+5 DO SUMMARY2(STRING1,STRING2,STRING3)
+6 SET PRD=$PIECE(STRING1,U,4)-$PIECE(STRING2,U,4)
+7 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 SET PRN=$PIECE(STRING1,U,4)-$PIECE(STRING3,U,4)
+9 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+10 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+11 DO HDRBLK^BGPMUPH
+12 WRITE !,"Pts 18+ w/HTN",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?64,$PIECE(STRING3,U,1)
+13 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+14 WRITE !!,"# w/=>2 BP recorded",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,4),5,1),?44,$PIECE(STRING2,U,2),?49,$JUSTIFY($PIECE(STRING2,U,4),5,1),?56,...
... $JUSTIFY($FNUMBER(PRD,",+",1),6),?64,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,4),5,1),?74,$JUSTIFY($FNUMBER(PRN,",+",1),6)
+15 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+16 WRITE !,"# w/o=> 2 BP recorded",?33,$PIECE(STRING1,U,3),?38,$JUSTIFY($PIECE(STRING1,U,5),5,1),?44,$PIECE(STRING2,U,3),?49,$JUSTIFY(...
... $PIECE(STRING2,U,5),5,1),?56,$JUSTIFY($FNUMBER(PRD1,",+",1),6),?64,$PIECE(STRING3,U,3),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRN1,",+",1),6)
+17 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+18 IF $DATA(BGPLIST(BGPIC))
DO BP2
+19 QUIT
0013(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN,NUM,PC1,PC2,NOT
+2 SET DEN=+$GET(^TMP("BGPMU0013",$JOB,TF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0013",$JOB,TF,"NUM"))
+4 SET NOT=+$GET(^TMP("BGPMU0013",$JOB,TF,"NOT"))
+5 IF DEN=0
SET (PC1,PC2)=0
+6 IF DEN>0
Begin DoDot:1
+7 SET PC1=$$ROUND^BGPMUA01((NUM/DEN),3)*100
+8 SET PC2=100-PC1
End DoDot:1
+9 SET ARRAY=DEN_U_NUM_U_NOT_U_PC1_U_PC2
+10 QUIT ARRAY
BP2 ;Do the Details
+1 NEW PT,NODE,NAME,BP,PTCT,BGPARR,LINE
+2 DO HEADERL^BGPMUPH
+3 SET X="Hypertensive patients 18+ with at least 2 encounters with the EP during the"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="reporting period, with 2 documented BPs during the encounters, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="Patients who do not meet the numerator criteria are listed first (NM:),"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+6 SET X="followed by patients who do meet the numerator criteria (M:)."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="The following are the abbreviations used in the denominator column:"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+8 SET X="ICD-9 Code=Hypertension Diagnosis"
DO W^BGPMUPP(X,0,1,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",?20,"HRN",?26,"COMMUNITY",?37,"SEX",?42,"AGE",?46,"DENOMINATOR",?59,"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(""BGPMU0013"","_$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 DATA2(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(""BGPMU0013"","_$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 DATA2(NODE)
End DoDot:2
End DoDot:1
+29 WRITE !!,"Total # of patients on list: "_PTCT
+30 QUIT
SUMMARY1(STRING1,STRING2,STRING3,CT) ;Summmary setup
+1 NEW DESC,DESC2,LINE
+2 KILL ^TMP("BGPMU SUMMARY",$JOB,BGPIC)
+3 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC)="0421^128"
+4 SET DESC="65+ w/BMI+Plan if req"
+5 SET DESC2="18-64 w/BMI+Plan if req"
+6 SET LINE=""
+7 SET LINE="MU.EP.0421.1"_U_DESC_U_$PIECE(STRING1,U,4)_U_$PIECE(STRING1,U,1)_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,5)_U_U_U_U_U
+8 SET LINE=LINE_$PIECE(STRING2,U,4)_U_$PIECE(STRING2,U,1)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,5)_U_$PIECE(STRING3,U,4)_U_$PIECE(STRING3,U,1)_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,5)
+9 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,1)=LINE
+10 SET LINE=""
+11 SET LINE="MU.EP.0421.2"_U_DESC2_U_$PIECE(STRING1,U,11)_U_$PIECE(STRING1,U,8)_U_$PIECE(STRING1,U,9)_U_$PIECE(STRING1,U,12)_U_U_U_U_U
+12 SET LINE=LINE_$PIECE(STRING2,U,11)_U_$PIECE(STRING2,U,8)_U_$PIECE(STRING2,U,9)_U_$PIECE(STRING2,U,12)_U_$PIECE(STRING3,U,11)_U_$PIECE(STRING3,U,8)_U_$PIECE(STRING3,U,9)_U_$PIECE(STRING3,U,12)
+13 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,2)=LINE
+14 QUIT
SUMMARY2(STRING1,STRING2,STRING3) ;Summary setup
+1 NEW DESC
+2 KILL ^TMP("BGPMU SUMMARY",$JOB,BGPIC)
+3 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC)="0013^237"
+4 SET DESC="18+ w/2 BP Recorded"
+5 SET LINE="MU.EP.0013.1"_U_DESC_U_U_$PIECE(STRING1,U,1)_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,4)_U_U_U_U_U
+6 SET LINE=LINE_U_$PIECE(STRING2,U,1)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,4)_U_U_$PIECE(STRING3,U,1)_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,4)
+7 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,1)=LINE
+8 QUIT
DATE(D) ;EP
+1 IF D=""
QUIT ""
+2 QUIT $EXTRACT(D,4,5)_"/"_$EXTRACT(D,6,7)_"/"_$EXTRACT(D,2,3)