BGPMUWD1 ; IHS/MSC/AJF - MU EP measures NQF0024 ;22-Mar-2011 10:12;DU
;;11.1;IHS CLINICAL REPORTING SYSTEM;**1**;JUN 27, 2011;Build 106
;This rouine does the printed output for EP measures 0024;;;;;Build 33
ENT ;
D P1
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3,NONUM1,NONUM2,NONUM3
N DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,PRD1,PRD2,PRB1,PRB2
N DIFF1,DIFF2,DIFF3,X1,X2,X3,Y1,Y2,Z1,Z2
S STRING1=$$D24("C")
S STRING2=$$D24("P")
S STRING3=$$D24("B")
D SUMMARY(STRING1,STRING2,STRING3)
S X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
D S^BGPMUDEL(X,2,1)
S X="Denominator 1" D S^BGPMUDEL(X,2,1)
S X="Pts 2-16"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1)
D S^BGPMUDEL(X,1,1)
S X="Numerator 1" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,6)-$P(STRING2,U,6) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,6)-$P(STRING3,U,6) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,6),X2=100-$P(STRING2,U,6),X3=100-$P(STRING3,U,6)
S DIFF1=$P(STRING1,U,1)-$P(STRING1,U,2),DIFF2=$P(STRING2,U,1)-$P(STRING2,U,2)
S DIFF3=$P(STRING3,U,1)-$P(STRING3,U,2)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/BMI Percentile"_U_$P(STRING1,U,2)_U_$P(STRING1,U,6)_U_$P(STRING2,U,2)_U_$P(STRING2,U,6)_U_Z1_U_$P(STRING3,U,2)_U_$P(STRING3,U,6)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o BMI Percentile"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Numerator 2" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,7)-$P(STRING2,U,7) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,7)-$P(STRING3,U,7) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,7),X2=100-$P(STRING2,U,7),X3=100-$P(STRING3,U,7)
S DIFF1=$P(STRING1,U,1)-$P(STRING1,U,3),DIFF2=$P(STRING2,U,1)-$P(STRING2,U,3)
S DIFF3=$P(STRING3,U,1)-$P(STRING3,U,3)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/Nutrition edu"_U_$P(STRING1,U,3)_U_$P(STRING1,U,7)_U_$P(STRING2,U,3)_U_$P(STRING2,U,7)_U_Z1_U_$P(STRING3,U,3)_U_$P(STRING3,U,7)
D S^BGPMUDEL(X,1,1)
S X="# w/o Nutrition edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Numerator 3" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,8)-$P(STRING2,U,8) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,8)-$P(STRING3,U,8) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,8),X2=100-$P(STRING2,U,8),X3=100-$P(STRING3,U,8)
S DIFF1=$P(STRING1,U,1)-$P(STRING1,U,4),DIFF2=$P(STRING2,U,1)-$P(STRING2,U,4)
S DIFF3=$P(STRING3,U,1)-$P(STRING3,U,4)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/Activity edu"_U_$P(STRING1,U,4)_U_$P(STRING1,U,8)_U_$P(STRING2,U,4)_U_$P(STRING2,U,8)_U_Z1_U_$P(STRING3,U,4)_U_$P(STRING3,U,8)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o Activity edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Denominator 2" D S^BGPMUDEL(X,2,1)
S X="Pts 2-10"_U_$P(STRING1,U,9)_U_U_$P(STRING2,U,9)_U_U_U_$P(STRING3,U,9) D S^BGPMUDEL(X,1,1)
S X="Numerator 1" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,14)-$P(STRING2,U,14) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,14)-$P(STRING3,U,14) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,14),X2=100-$P(STRING2,U,14),X3=100-$P(STRING3,U,14)
S DIFF1=$P(STRING1,U,9)-$P(STRING1,U,10),DIFF2=$P(STRING2,U,9)-$P(STRING2,U,10)
S DIFF3=$P(STRING3,U,9)-$P(STRING3,U,10)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/BMI Percentile"_U_$P(STRING1,U,10)_U_$P(STRING1,U,14)_U_$P(STRING2,U,10)_U_$P(STRING2,U,14)_U_Z1_U_$P(STRING3,U,10)_U_$P(STRING3,U,14)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o BMI Percentile"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Numerator 2" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,15)-$P(STRING2,U,15) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,15)-$P(STRING3,U,15) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,15),X2=100-$P(STRING2,U,15),X3=100-$P(STRING3,U,15)
S DIFF1=$P(STRING1,U,9)-$P(STRING1,U,11),DIFF2=$P(STRING2,U,9)-$P(STRING2,U,11)
S DIFF3=$P(STRING3,U,9)-$P(STRING3,U,11)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/Nutrition edu"_U_$P(STRING1,U,11)_U_$P(STRING1,U,15)_U_$P(STRING2,U,11)_U_$P(STRING2,U,15)_U_Z1_U_$P(STRING3,U,11)_U_$P(STRING3,U,15)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o Nutrition edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Numerator 3" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,16)-$P(STRING2,U,16) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,16)-$P(STRING3,U,16) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,16),X2=100-$P(STRING2,U,16),X3=100-$P(STRING3,U,16)
S DIFF1=$P(STRING1,U,9)-$P(STRING1,U,12),DIFF2=$P(STRING2,U,9)-$P(STRING2,U,12)
S DIFF3=$P(STRING3,U,9)-$P(STRING3,U,12)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/Activity edu"_U_$P(STRING1,U,12)_U_$P(STRING1,U,16)_U_$P(STRING2,U,12)_U_$P(STRING2,U,16)_U_Z1_U_$P(STRING3,U,12)_U_$P(STRING3,U,16)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o Activity edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2 D S^BGPMUDEL(X,1,1)
S X="Denominator 3" D S^BGPMUDEL(X,2,1)
S X="Pts 11-16"_U_$P(STRING1,U,17)_U_U_$P(STRING2,U,17)_U_U_U_$P(STRING3,U,17) D S^BGPMUDEL(X,1,1)
S X="Numerator 1" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,22)-$P(STRING2,U,22) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,22)-$P(STRING3,U,22) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,22),X2=100-$P(STRING2,U,22),X3=100-$P(STRING3,U,22)
S DIFF1=$P(STRING1,U,17)-$P(STRING1,U,18),DIFF2=$P(STRING2,U,17)-$P(STRING2,U,18)
S DIFF3=$P(STRING3,U,17)-$P(STRING3,U,18)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/BMI Percentile"_U_$P(STRING1,U,18)_U_$P(STRING1,U,22)_U_$P(STRING2,U,18)_U_$P(STRING2,U,22)_U_Z1_U_$P(STRING3,U,18)_U_$P(STRING3,U,22)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o BMI Percentile"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Numerator 2" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,23)-$P(STRING2,U,23) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,23)-$P(STRING3,U,23) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,23),X2=100-$P(STRING2,U,23),X3=100-$P(STRING3,U,23)
S DIFF1=$P(STRING1,U,17)-$P(STRING1,U,19),DIFF2=$P(STRING2,U,17)-$P(STRING2,U,19)
S DIFF3=$P(STRING3,U,17)-$P(STRING3,U,19)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/Nutrition edu"_U_$P(STRING1,U,19)_U_$P(STRING1,U,23)_U_$P(STRING2,U,19)_U_$P(STRING2,U,23)_U_Z1_U_$P(STRING3,U,19)_U_$P(STRING3,U,23)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o Nutrition edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
S X="Numerator 3" D S^BGPMUDEL(X,2,1)
S Z1=$P(STRING1,U,24)-$P(STRING2,U,24) I Z1>0 S Z1=+Z1
S Z2=$P(STRING1,U,24)-$P(STRING3,U,24) I Z2>0 S Z2=+Z2
S X1=100-$P(STRING1,U,24),X2=100-$P(STRING2,U,24),X3=100-$P(STRING3,U,24)
S DIFF1=$P(STRING1,U,17)-$P(STRING1,U,20),DIFF2=$P(STRING2,U,17)-$P(STRING2,U,20)
S DIFF3=$P(STRING3,U,17)-$P(STRING3,U,20)
S Y1=X1-X2 I Y1>0 S Y1=+Y1
S Y2=X1-X3 I Y2>0 S Y2=+Y2
S X="# w/Activity edu"_U_$P(STRING1,U,20)_U_$P(STRING1,U,24)_U_$P(STRING2,U,20)_U_$P(STRING2,U,24)_U_Z1_U_$P(STRING3,U,20)_U_$P(STRING3,U,24)_U_Z2
D S^BGPMUDEL(X,1,1)
S X="# w/o Activity edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
D S^BGPMUDEL(X,1,1)
;Output the individual data
I $D(BGPLIST(BGPIC)) D P2
P1Q K ^TMP("BGPMU 2-10",$J)
K ^TMP("BGPMU 11-16",$J)
K ^TMP("BGPMU 2-16",$J)
K ^TMP("BGPMU0024",$J)
Q
D24(TF) ;Get the numbers for this measure
N ARRAY,AG1,AG2,AG3,NUM1,NUM2,NUM3,NUM4,NUM5,NUM6,NUM7,NUM8,NUM9
N PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,DEN1,DEN2,DEN3
S AG1=$G(^TMP("BGPMU 2-16",$J,TF,"POPULATION"))
S AG2=$G(^TMP("BGPMU 2-10",$J,TF,"POPULATION"))
S AG3=$G(^TMP("BGPMU 11-16",$J,TF,"POPULATION"))
;2-16 DATA
S NUM1=+$P(AG1,U,1),NUM2=+$P(AG1,U,2),NUM3=+$P(AG1,U,3),DEN1=+$P(AG1,U,4),NONUM1=+$P(AG1,U,5)
; 2-10 DATA"
S NUM4=+$P(AG2,U,1),NUM5=+$P(AG2,U,2),NUM6=+$P(AG2,U,3),DEN2=+$P(AG2,U,4),NONUM2=+$P(AG2,U,5)
; 11-16 DATA"
S NUM7=+$P(AG3,U,1),NUM8=+$P(AG3,U,2),NUM9=+$P(AG3,U,3),DEN3=+$P(AG3,U,4),NONUM3=+$P(AG3,U,5)
I DEN1=0 S (PC1,PC2,PC3)=0
I DEN1>0 D
.S PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
.S PC2=$$ROUND^BGPMUA01((NUM2/DEN1),3)*100
.S PC3=$$ROUND^BGPMUA01((NUM3/DEN1),3)*100
I DEN2=0 S (PC4,PC5,PC6)=0
I DEN2>0 D
.S PC4=$$ROUND^BGPMUA01((NUM4/DEN2),3)*100
.S PC5=$$ROUND^BGPMUA01((NUM5/DEN2),3)*100
.S PC6=$$ROUND^BGPMUA01((NUM6/DEN2),3)*100
I DEN3=0 S (PC7,PC8,PC9)=0
I DEN3>0 D
.S PC7=$$ROUND^BGPMUA01((NUM7/DEN3),3)*100
.S PC8=$$ROUND^BGPMUA01((NUM8/DEN3),3)*100
.S PC9=$$ROUND^BGPMUA01((NUM9/DEN3),3)*100
S ARRAY=DEN1_U_NUM1_U_NUM2_U_NUM3_U_NONUM1_U_$G(PC1)_U_$G(PC2)_U_$G(PC3)
S ARRAY=ARRAY_U_DEN2_U_NUM4_U_NUM5_U_NUM6_U_NONUM2_U_$G(PC4)_U_$G(PC5)_U_$G(PC6)
S ARRAY=ARRAY_U_DEN3_U_NUM7_U_NUM8_U_NUM9_U_NONUM3_U_$G(PC7)_U_$G(PC8)_U_$G(PC9)
Q ARRAY
XML ;
N STRING
S STRING=$$D24("C")
S BGPXML(1)="NQF_0024"_U_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)
K ^TMP("BGPMU0024",$J)
K ^TMP("BGPMU 2-10",$J)
K ^TMP("BGPMU 11-16",$J)
K ^TMP("BGPMU 2-16",$J)
Q
P2 ;Do the details
N PT,NODE,NAME,VST,X,PTCT,NUM
S PTCT=0
D HEADER^BGPMUPH
S X="Patients 2-16 who had at least 1 outpatient encounter with the EP" D S^BGPMUDEL(X,2,1)
S X="during the reporting period, with documented BMI and counseling, if any." D S^BGPMUDEL(X,1,1)
S X="Patients who do not meet the numerator criteria are listed first (NM:)," D S^BGPMUDEL(X,2,1)
S X="followed by patients who do meet the numerator criteria (M:)." D S^BGPMUDEL(X,1,1)
S X="The following are the abbreviations used in the denominator column:" D S^BGPMUDEL(X,2,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
F NUM=1:1:3 D
.S PTCT=0
.S X=$P($T(NUMHDR+NUM),";;",2) D S^BGPMUDEL(X,2,1)
.S X="NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
.D S^BGPMUDEL(X,2,1)
.S LINE="",$P(LINE,"-",81)="" D S^BGPMUDEL(LINE,1,1)
.I BGPLIST="D"!(BGPLIST="A") D
..K BGPARR
..D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0024"","_$J_",""PAT"",""C"",""NOT"","_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="N"!(BGPLIST="A") D
..K BGPARR
..D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0024"","_$J_",""PAT"",""C"",""NUM"","_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)
.S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
Q
NUMHDR ;Headers for indiv numerator lists
;;Numerator 1 BMI Percentile:
;;Numerator 2 Nutrition Education:
;;Numerator 3 Physical Activity Education:
Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,NUM3,DEN1
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,3)
S COMM=$$GET1^DIQ(9000001,DFN,1118)
S SEX=$P(^DPT(DFN,0),U,2)
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM
D S^BGPMUDEL(X,1,1)
Q
SUMMARY(STRING1,STRING2,STRING3) ;Save data for output routine
N DESC,LINE
K ^TMP("BGPMU SUMMARY",$J,BGPIC)
S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0024^239"
;den1,num2
S DESC="2-16 w/BMI Percentile"
S LINE=""
S LINE="MU.EP.0024.1"_U_DESC_U_U_$P(STRING1,U,1)_U_$P(STRING1,U,2)_U_$P(STRING1,U,6)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,1)_U_$P(STRING2,U,2)_U_$P(STRING2,U,6)_U_U_$P(STRING3,U,1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,6)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,1)=LINE
;den1,num2
S DESC="2-16 w/Nutrition Counseling"
S LINE=""
S LINE="MU.EP.0024.2"_U_DESC_U_U_$P(STRING1,U,1)_U_$P(STRING1,U,3)_U_$P(STRING1,U,7)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,1)_U_$P(STRING2,U,3)_U_$P(STRING2,U,7)_U_U_$P(STRING3,U,1)_U_$P(STRING3,U,3)_U_$P(STRING3,U,7)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,2)=LINE
;den1,num3
S DESC="2-16 w/Physical Activity Counseling"
S LINE=""
S LINE="MU.EP.0024.3"_U_DESC_U_U_$P(STRING1,U,1)_U_$P(STRING1,U,4)_U_$P(STRING1,U,8)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,1)_U_$P(STRING2,U,4)_U_$P(STRING2,U,8)_U_U_$P(STRING3,U,1)_U_$P(STRING3,U,4)_U_$P(STRING3,U,8)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,3)=LINE
;den2,num1
S DESC="2-10 w/BMI Percentile"
S LINE=""
S LINE="MU.EP.0024.4"_U_DESC_U_U_$P(STRING1,U,9)_U_$P(STRING1,U,10)_U_$P(STRING1,U,14)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,9)_U_$P(STRING2,U,10)_U_$P(STRING2,U,14)_U_U_$P(STRING3,U,9)_U_$P(STRING3,U,10)_U_$P(STRING3,U,14)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,4)=LINE
;den2,num2
S DESC="2-10 w/Nutrition Counseling"
S LINE=""
S LINE="MU.EP.0024.5"_U_DESC_U_U_$P(STRING1,U,9)_U_$P(STRING1,U,11)_U_$P(STRING1,U,15)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,9)_U_$P(STRING2,U,11)_U_$P(STRING2,U,15)_U_U_$P(STRING3,U,9)_U_$P(STRING3,U,11)_U_$P(STRING3,U,15)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,5)=LINE
;den2,num3
S DESC="2-10 w/Physical Activity Counseling"
S LINE=""
S LINE="MU.EP.0024.6"_U_DESC_U_U_$P(STRING1,U,9)_U_$P(STRING1,U,12)_U_$P(STRING1,U,16)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,9)_U_$P(STRING2,U,12)_U_$P(STRING2,U,16)_U_U_$P(STRING3,U,9)_U_$P(STRING3,U,12)_U_$P(STRING3,U,16)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,6)=LINE
;den3,num1
S DESC="11-16 w/BMI Percentile"
S LINE=""
S LINE="MU.EP.0024.7"_U_DESC_U_U_$P(STRING1,U,17)_U_$P(STRING1,U,18)_U_$P(STRING1,U,22)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,17)_U_$P(STRING2,U,18)_U_$P(STRING2,U,22)_U_U_$P(STRING3,U,17)_U_$P(STRING3,U,18)_U_$P(STRING3,U,22)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,7)=LINE
;den3,num2
S DESC="11-16 w/Nutrition Counseling"
S LINE=""
S LINE="MU.EP.0024.8"_U_DESC_U_U_$P(STRING1,U,17)_U_$P(STRING1,U,19)_U_$P(STRING1,U,23)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,17)_U_$P(STRING2,U,19)_U_$P(STRING2,U,23)_U_U_$P(STRING3,U,17)_U_$P(STRING3,U,19)_U_$P(STRING3,U,23)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,8)=LINE
;den3,num3
S DESC="11-16 w/Physical Activity Counseling"
S LINE=""
S LINE="MU.EP.0024.9"_U_DESC_U_U_$P(STRING1,U,17)_U_$P(STRING1,U,20)_U_$P(STRING1,U,24)_U_U_U_U_U
S LINE=LINE_U_$P(STRING2,U,17)_U_$P(STRING2,U,20)_U_$P(STRING2,U,24)_U_U_$P(STRING3,U,17)_U_$P(STRING3,U,20)_U_$P(STRING3,U,24)
S ^TMP("BGPMU SUMMARY",$J,BGPIC,9)=LINE
Q
BGPMUWD1 ; IHS/MSC/AJF - MU EP measures NQF0024 ;22-Mar-2011 10:12;DU
+1 ;;11.1;IHS CLINICAL REPORTING SYSTEM;**1**;JUN 27, 2011;Build 106
+2 ;This rouine does the printed output for EP measures 0024;;;;;Build 33
ENT ;
+1 DO P1
+2 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3,NONUM1,NONUM2,NONUM3
+2 NEW DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3,PRD1,PRD2,PRB1,PRB2
+3 NEW DIFF1,DIFF2,DIFF3,X1,X2,X3,Y1,Y2,Z1,Z2
+4 SET STRING1=$$D24("C")
+5 SET STRING2=$$D24("P")
+6 SET STRING3=$$D24("B")
+7 DO SUMMARY(STRING1,STRING2,STRING3)
+8 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+9 DO S^BGPMUDEL(X,2,1)
+10 SET X="Denominator 1"
DO S^BGPMUDEL(X,2,1)
+11 SET X="Pts 2-16"_U_$PIECE(STRING1,U,1)_U_U_$PIECE(STRING2,U,1)_U_U_U_$PIECE(STRING3,U,1)
+12 DO S^BGPMUDEL(X,1,1)
+13 SET X="Numerator 1"
DO S^BGPMUDEL(X,2,1)
+14 SET Z1=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
IF Z1>0
SET Z1=+Z1
+15 SET Z2=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
IF Z2>0
SET Z2=+Z2
+16 SET X1=100-$PIECE(STRING1,U,6)
SET X2=100-$PIECE(STRING2,U,6)
SET X3=100-$PIECE(STRING3,U,6)
+17 SET DIFF1=$PIECE(STRING1,U,1)-$PIECE(STRING1,U,2)
SET DIFF2=$PIECE(STRING2,U,1)-$PIECE(STRING2,U,2)
+18 SET DIFF3=$PIECE(STRING3,U,1)-$PIECE(STRING3,U,2)
+19 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+20 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+21 SET X="# w/BMI Percentile"_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,6)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,6)_U_Z1_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,6)_U_Z2
+22 DO S^BGPMUDEL(X,1,1)
+23 SET X="# w/o BMI Percentile"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+24 DO S^BGPMUDEL(X,1,1)
+25 SET X="Numerator 2"
DO S^BGPMUDEL(X,2,1)
+26 SET Z1=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
IF Z1>0
SET Z1=+Z1
+27 SET Z2=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
IF Z2>0
SET Z2=+Z2
+28 SET X1=100-$PIECE(STRING1,U,7)
SET X2=100-$PIECE(STRING2,U,7)
SET X3=100-$PIECE(STRING3,U,7)
+29 SET DIFF1=$PIECE(STRING1,U,1)-$PIECE(STRING1,U,3)
SET DIFF2=$PIECE(STRING2,U,1)-$PIECE(STRING2,U,3)
+30 SET DIFF3=$PIECE(STRING3,U,1)-$PIECE(STRING3,U,3)
+31 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+32 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+33 SET X="# w/Nutrition edu"_U_$PIECE(STRING1,U,3)_U_$PIECE(STRING1,U,7)_U_$PIECE(STRING2,U,3)_U_$PIECE(STRING2,U,7)_U_Z1_U_$PIECE(STRING3,U,3)_U_$PIECE(STRING3,U,7)
+34 DO S^BGPMUDEL(X,1,1)
+35 SET X="# w/o Nutrition edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+36 DO S^BGPMUDEL(X,1,1)
+37 SET X="Numerator 3"
DO S^BGPMUDEL(X,2,1)
+38 SET Z1=$PIECE(STRING1,U,8)-$PIECE(STRING2,U,8)
IF Z1>0
SET Z1=+Z1
+39 SET Z2=$PIECE(STRING1,U,8)-$PIECE(STRING3,U,8)
IF Z2>0
SET Z2=+Z2
+40 SET X1=100-$PIECE(STRING1,U,8)
SET X2=100-$PIECE(STRING2,U,8)
SET X3=100-$PIECE(STRING3,U,8)
+41 SET DIFF1=$PIECE(STRING1,U,1)-$PIECE(STRING1,U,4)
SET DIFF2=$PIECE(STRING2,U,1)-$PIECE(STRING2,U,4)
+42 SET DIFF3=$PIECE(STRING3,U,1)-$PIECE(STRING3,U,4)
+43 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+44 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+45 SET X="# w/Activity edu"_U_$PIECE(STRING1,U,4)_U_$PIECE(STRING1,U,8)_U_$PIECE(STRING2,U,4)_U_$PIECE(STRING2,U,8)_U_Z1_U_$PIECE(STRING3,U,4)_U_$PIECE(STRING3,U,8)_U_Z2
+46 DO S^BGPMUDEL(X,1,1)
+47 SET X="# w/o Activity edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+48 DO S^BGPMUDEL(X,1,1)
+49 SET X="Denominator 2"
DO S^BGPMUDEL(X,2,1)
+50 SET X="Pts 2-10"_U_$PIECE(STRING1,U,9)_U_U_$PIECE(STRING2,U,9)_U_U_U_$PIECE(STRING3,U,9)
DO S^BGPMUDEL(X,1,1)
+51 SET X="Numerator 1"
DO S^BGPMUDEL(X,2,1)
+52 SET Z1=$PIECE(STRING1,U,14)-$PIECE(STRING2,U,14)
IF Z1>0
SET Z1=+Z1
+53 SET Z2=$PIECE(STRING1,U,14)-$PIECE(STRING3,U,14)
IF Z2>0
SET Z2=+Z2
+54 SET X1=100-$PIECE(STRING1,U,14)
SET X2=100-$PIECE(STRING2,U,14)
SET X3=100-$PIECE(STRING3,U,14)
+55 SET DIFF1=$PIECE(STRING1,U,9)-$PIECE(STRING1,U,10)
SET DIFF2=$PIECE(STRING2,U,9)-$PIECE(STRING2,U,10)
+56 SET DIFF3=$PIECE(STRING3,U,9)-$PIECE(STRING3,U,10)
+57 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+58 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+59 SET X="# w/BMI Percentile"_U_$PIECE(STRING1,U,10)_U_$PIECE(STRING1,U,14)_U_$PIECE(STRING2,U,10)_U_$PIECE(STRING2,U,14)_U_Z1_U_$PIECE(STRING3,U,10)_U_$PIECE(STRING3,U,14)_U_Z2
+60 DO S^BGPMUDEL(X,1,1)
+61 SET X="# w/o BMI Percentile"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+62 DO S^BGPMUDEL(X,1,1)
+63 SET X="Numerator 2"
DO S^BGPMUDEL(X,2,1)
+64 SET Z1=$PIECE(STRING1,U,15)-$PIECE(STRING2,U,15)
IF Z1>0
SET Z1=+Z1
+65 SET Z2=$PIECE(STRING1,U,15)-$PIECE(STRING3,U,15)
IF Z2>0
SET Z2=+Z2
+66 SET X1=100-$PIECE(STRING1,U,15)
SET X2=100-$PIECE(STRING2,U,15)
SET X3=100-$PIECE(STRING3,U,15)
+67 SET DIFF1=$PIECE(STRING1,U,9)-$PIECE(STRING1,U,11)
SET DIFF2=$PIECE(STRING2,U,9)-$PIECE(STRING2,U,11)
+68 SET DIFF3=$PIECE(STRING3,U,9)-$PIECE(STRING3,U,11)
+69 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+70 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+71 SET X="# w/Nutrition edu"_U_$PIECE(STRING1,U,11)_U_$PIECE(STRING1,U,15)_U_$PIECE(STRING2,U,11)_U_$PIECE(STRING2,U,15)_U_Z1_U_$PIECE(STRING3,U,11)_U_$PIECE(STRING3,U,15)_U_Z2
+72 DO S^BGPMUDEL(X,1,1)
+73 SET X="# w/o Nutrition edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+74 DO S^BGPMUDEL(X,1,1)
+75 SET X="Numerator 3"
DO S^BGPMUDEL(X,2,1)
+76 SET Z1=$PIECE(STRING1,U,16)-$PIECE(STRING2,U,16)
IF Z1>0
SET Z1=+Z1
+77 SET Z2=$PIECE(STRING1,U,16)-$PIECE(STRING3,U,16)
IF Z2>0
SET Z2=+Z2
+78 SET X1=100-$PIECE(STRING1,U,16)
SET X2=100-$PIECE(STRING2,U,16)
SET X3=100-$PIECE(STRING3,U,16)
+79 SET DIFF1=$PIECE(STRING1,U,9)-$PIECE(STRING1,U,12)
SET DIFF2=$PIECE(STRING2,U,9)-$PIECE(STRING2,U,12)
+80 SET DIFF3=$PIECE(STRING3,U,9)-$PIECE(STRING3,U,12)
+81 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+82 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+83 SET X="# w/Activity edu"_U_$PIECE(STRING1,U,12)_U_$PIECE(STRING1,U,16)_U_$PIECE(STRING2,U,12)_U_$PIECE(STRING2,U,16)_U_Z1_U_$PIECE(STRING3,U,12)_U_$PIECE(STRING3,U,16)_U_Z2
+84 DO S^BGPMUDEL(X,1,1)
+85 SET X="# w/o Activity edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
DO S^BGPMUDEL(X,1,1)
+86 SET X="Denominator 3"
DO S^BGPMUDEL(X,2,1)
+87 SET X="Pts 11-16"_U_$PIECE(STRING1,U,17)_U_U_$PIECE(STRING2,U,17)_U_U_U_$PIECE(STRING3,U,17)
DO S^BGPMUDEL(X,1,1)
+88 SET X="Numerator 1"
DO S^BGPMUDEL(X,2,1)
+89 SET Z1=$PIECE(STRING1,U,22)-$PIECE(STRING2,U,22)
IF Z1>0
SET Z1=+Z1
+90 SET Z2=$PIECE(STRING1,U,22)-$PIECE(STRING3,U,22)
IF Z2>0
SET Z2=+Z2
+91 SET X1=100-$PIECE(STRING1,U,22)
SET X2=100-$PIECE(STRING2,U,22)
SET X3=100-$PIECE(STRING3,U,22)
+92 SET DIFF1=$PIECE(STRING1,U,17)-$PIECE(STRING1,U,18)
SET DIFF2=$PIECE(STRING2,U,17)-$PIECE(STRING2,U,18)
+93 SET DIFF3=$PIECE(STRING3,U,17)-$PIECE(STRING3,U,18)
+94 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+95 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+96 SET X="# w/BMI Percentile"_U_$PIECE(STRING1,U,18)_U_$PIECE(STRING1,U,22)_U_$PIECE(STRING2,U,18)_U_$PIECE(STRING2,U,22)_U_Z1_U_$PIECE(STRING3,U,18)_U_$PIECE(STRING3,U,22)_U_Z2
+97 DO S^BGPMUDEL(X,1,1)
+98 SET X="# w/o BMI Percentile"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+99 DO S^BGPMUDEL(X,1,1)
+100 SET X="Numerator 2"
DO S^BGPMUDEL(X,2,1)
+101 SET Z1=$PIECE(STRING1,U,23)-$PIECE(STRING2,U,23)
IF Z1>0
SET Z1=+Z1
+102 SET Z2=$PIECE(STRING1,U,23)-$PIECE(STRING3,U,23)
IF Z2>0
SET Z2=+Z2
+103 SET X1=100-$PIECE(STRING1,U,23)
SET X2=100-$PIECE(STRING2,U,23)
SET X3=100-$PIECE(STRING3,U,23)
+104 SET DIFF1=$PIECE(STRING1,U,17)-$PIECE(STRING1,U,19)
SET DIFF2=$PIECE(STRING2,U,17)-$PIECE(STRING2,U,19)
+105 SET DIFF3=$PIECE(STRING3,U,17)-$PIECE(STRING3,U,19)
+106 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+107 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+108 SET X="# w/Nutrition edu"_U_$PIECE(STRING1,U,19)_U_$PIECE(STRING1,U,23)_U_$PIECE(STRING2,U,19)_U_$PIECE(STRING2,U,23)_U_Z1_U_$PIECE(STRING3,U,19)_U_$PIECE(STRING3,U,23)_U_Z2
+109 DO S^BGPMUDEL(X,1,1)
+110 SET X="# w/o Nutrition edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+111 DO S^BGPMUDEL(X,1,1)
+112 SET X="Numerator 3"
DO S^BGPMUDEL(X,2,1)
+113 SET Z1=$PIECE(STRING1,U,24)-$PIECE(STRING2,U,24)
IF Z1>0
SET Z1=+Z1
+114 SET Z2=$PIECE(STRING1,U,24)-$PIECE(STRING3,U,24)
IF Z2>0
SET Z2=+Z2
+115 SET X1=100-$PIECE(STRING1,U,24)
SET X2=100-$PIECE(STRING2,U,24)
SET X3=100-$PIECE(STRING3,U,24)
+116 SET DIFF1=$PIECE(STRING1,U,17)-$PIECE(STRING1,U,20)
SET DIFF2=$PIECE(STRING2,U,17)-$PIECE(STRING2,U,20)
+117 SET DIFF3=$PIECE(STRING3,U,17)-$PIECE(STRING3,U,20)
+118 SET Y1=X1-X2
IF Y1>0
SET Y1=+Y1
+119 SET Y2=X1-X3
IF Y2>0
SET Y2=+Y2
+120 SET X="# w/Activity edu"_U_$PIECE(STRING1,U,20)_U_$PIECE(STRING1,U,24)_U_$PIECE(STRING2,U,20)_U_$PIECE(STRING2,U,24)_U_Z1_U_$PIECE(STRING3,U,20)_U_$PIECE(STRING3,U,24)_U_Z2
+121 DO S^BGPMUDEL(X,1,1)
+122 SET X="# w/o Activity edu"_U_DIFF1_U_X1_U_DIFF2_U_X2_U_Y1_U_DIFF3_U_X3_U_Y2
+123 DO S^BGPMUDEL(X,1,1)
+124 ;Output the individual data
+125 IF $DATA(BGPLIST(BGPIC))
DO P2
P1Q KILL ^TMP("BGPMU 2-10",$JOB)
+1 KILL ^TMP("BGPMU 11-16",$JOB)
+2 KILL ^TMP("BGPMU 2-16",$JOB)
+3 KILL ^TMP("BGPMU0024",$JOB)
+4 QUIT
D24(TF) ;Get the numbers for this measure
+1 NEW ARRAY,AG1,AG2,AG3,NUM1,NUM2,NUM3,NUM4,NUM5,NUM6,NUM7,NUM8,NUM9
+2 NEW PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,DEN1,DEN2,DEN3
+3 SET AG1=$GET(^TMP("BGPMU 2-16",$JOB,TF,"POPULATION"))
+4 SET AG2=$GET(^TMP("BGPMU 2-10",$JOB,TF,"POPULATION"))
+5 SET AG3=$GET(^TMP("BGPMU 11-16",$JOB,TF,"POPULATION"))
+6 ;2-16 DATA
+7 SET NUM1=+$PIECE(AG1,U,1)
SET NUM2=+$PIECE(AG1,U,2)
SET NUM3=+$PIECE(AG1,U,3)
SET DEN1=+$PIECE(AG1,U,4)
SET NONUM1=+$PIECE(AG1,U,5)
+8 ; 2-10 DATA"
+9 SET NUM4=+$PIECE(AG2,U,1)
SET NUM5=+$PIECE(AG2,U,2)
SET NUM6=+$PIECE(AG2,U,3)
SET DEN2=+$PIECE(AG2,U,4)
SET NONUM2=+$PIECE(AG2,U,5)
+10 ; 11-16 DATA"
+11 SET NUM7=+$PIECE(AG3,U,1)
SET NUM8=+$PIECE(AG3,U,2)
SET NUM9=+$PIECE(AG3,U,3)
SET DEN3=+$PIECE(AG3,U,4)
SET NONUM3=+$PIECE(AG3,U,5)
+12 IF DEN1=0
SET (PC1,PC2,PC3)=0
+13 IF DEN1>0
Begin DoDot:1
+14 SET PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
+15 SET PC2=$$ROUND^BGPMUA01((NUM2/DEN1),3)*100
+16 SET PC3=$$ROUND^BGPMUA01((NUM3/DEN1),3)*100
End DoDot:1
+17 IF DEN2=0
SET (PC4,PC5,PC6)=0
+18 IF DEN2>0
Begin DoDot:1
+19 SET PC4=$$ROUND^BGPMUA01((NUM4/DEN2),3)*100
+20 SET PC5=$$ROUND^BGPMUA01((NUM5/DEN2),3)*100
+21 SET PC6=$$ROUND^BGPMUA01((NUM6/DEN2),3)*100
End DoDot:1
+22 IF DEN3=0
SET (PC7,PC8,PC9)=0
+23 IF DEN3>0
Begin DoDot:1
+24 SET PC7=$$ROUND^BGPMUA01((NUM7/DEN3),3)*100
+25 SET PC8=$$ROUND^BGPMUA01((NUM8/DEN3),3)*100
+26 SET PC9=$$ROUND^BGPMUA01((NUM9/DEN3),3)*100
End DoDot:1
+27 SET ARRAY=DEN1_U_NUM1_U_NUM2_U_NUM3_U_NONUM1_U_$GET(PC1)_U_$GET(PC2)_U_$GET(PC3)
+28 SET ARRAY=ARRAY_U_DEN2_U_NUM4_U_NUM5_U_NUM6_U_NONUM2_U_$GET(PC4)_U_$GET(PC5)_U_$GET(PC6)
+29 SET ARRAY=ARRAY_U_DEN3_U_NUM7_U_NUM8_U_NUM9_U_NONUM3_U_$GET(PC7)_U_$GET(PC8)_U_$GET(PC9)
+30 QUIT ARRAY
XML ;
+1 NEW STRING
+2 SET STRING=$$D24("C")
+3 SET BGPXML(1)="NQF_0024"_U_U_+$PIECE(STRING,U,1)_U_+$PIECE(STRING,U,2)
+4 KILL ^TMP("BGPMU0024",$JOB)
+5 KILL ^TMP("BGPMU 2-10",$JOB)
+6 KILL ^TMP("BGPMU 11-16",$JOB)
+7 KILL ^TMP("BGPMU 2-16",$JOB)
+8 QUIT
P2 ;Do the details
+1 NEW PT,NODE,NAME,VST,X,PTCT,NUM
+2 SET PTCT=0
+3 DO HEADER^BGPMUPH
+4 SET X="Patients 2-16 who had at least 1 outpatient encounter with the EP"
DO S^BGPMUDEL(X,2,1)
+5 SET X="during the reporting period, with documented BMI and counseling, if any."
DO S^BGPMUDEL(X,1,1)
+6 SET X="Patients who do not meet the numerator criteria are listed first (NM:),"
DO S^BGPMUDEL(X,2,1)
+7 SET X="followed by patients who do meet the numerator criteria (M:)."
DO S^BGPMUDEL(X,1,1)
+8 SET X="The following are the abbreviations used in the denominator column:"
DO S^BGPMUDEL(X,2,1)
+9 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+10 FOR NUM=1:1:3
Begin DoDot:1
+11 SET PTCT=0
+12 SET X=$PIECE($TEXT(NUMHDR+NUM),";;",2)
DO S^BGPMUDEL(X,2,1)
+13 SET X="NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
+14 DO S^BGPMUDEL(X,2,1)
+15 SET LINE=""
SET $PIECE(LINE,"-",81)=""
DO S^BGPMUDEL(LINE,1,1)
+16 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:2
+17 KILL BGPARR
+18 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0024"","_$JOB_",""PAT"",""C"",""NOT"","_NUM_")")
+19 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF '+PT
QUIT
Begin DoDot:3
+20 SET PTCT=PTCT+1
+21 SET NODE=$GET(BGPARR(PT))
+22 DO DATA(NODE)
End DoDot:3
End DoDot:2
+23 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:2
+24 KILL BGPARR
+25 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0024"","_$JOB_",""PAT"",""C"",""NUM"","_NUM_")")
+26 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF '+PT
QUIT
Begin DoDot:3
+27 SET PTCT=PTCT+1
+28 SET NODE=$GET(BGPARR(PT))
+29 DO DATA(NODE)
End DoDot:3
End DoDot:2
+30 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
End DoDot:1
+31 QUIT
NUMHDR ;Headers for indiv numerator lists
+1 ;;Numerator 1 BMI Percentile:
+2 ;;Numerator 2 Nutrition Education:
+3 ;;Numerator 3 Physical Activity Education:
+4 QUIT
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,NUM3,DEN1
+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,3)
+7 SET COMM=$$GET1^DIQ(9000001,DFN,1118)
+8 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+9 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM
+10 DO S^BGPMUDEL(X,1,1)
+11 QUIT
SUMMARY(STRING1,STRING2,STRING3) ;Save data for output routine
+1 NEW DESC,LINE
+2 KILL ^TMP("BGPMU SUMMARY",$JOB,BGPIC)
+3 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC)="0024^239"
+4 ;den1,num2
+5 SET DESC="2-16 w/BMI Percentile"
+6 SET LINE=""
+7 SET LINE="MU.EP.0024.1"_U_DESC_U_U_$PIECE(STRING1,U,1)_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,6)_U_U_U_U_U
+8 SET LINE=LINE_U_$PIECE(STRING2,U,1)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,6)_U_U_$PIECE(STRING3,U,1)_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,6)
+9 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,1)=LINE
+10 ;den1,num2
+11 SET DESC="2-16 w/Nutrition Counseling"
+12 SET LINE=""
+13 SET LINE="MU.EP.0024.2"_U_DESC_U_U_$PIECE(STRING1,U,1)_U_$PIECE(STRING1,U,3)_U_$PIECE(STRING1,U,7)_U_U_U_U_U
+14 SET LINE=LINE_U_$PIECE(STRING2,U,1)_U_$PIECE(STRING2,U,3)_U_$PIECE(STRING2,U,7)_U_U_$PIECE(STRING3,U,1)_U_$PIECE(STRING3,U,3)_U_$PIECE(STRING3,U,7)
+15 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,2)=LINE
+16 ;den1,num3
+17 SET DESC="2-16 w/Physical Activity Counseling"
+18 SET LINE=""
+19 SET LINE="MU.EP.0024.3"_U_DESC_U_U_$PIECE(STRING1,U,1)_U_$PIECE(STRING1,U,4)_U_$PIECE(STRING1,U,8)_U_U_U_U_U
+20 SET LINE=LINE_U_$PIECE(STRING2,U,1)_U_$PIECE(STRING2,U,4)_U_$PIECE(STRING2,U,8)_U_U_$PIECE(STRING3,U,1)_U_$PIECE(STRING3,U,4)_U_$PIECE(STRING3,U,8)
+21 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,3)=LINE
+22 ;den2,num1
+23 SET DESC="2-10 w/BMI Percentile"
+24 SET LINE=""
+25 SET LINE="MU.EP.0024.4"_U_DESC_U_U_$PIECE(STRING1,U,9)_U_$PIECE(STRING1,U,10)_U_$PIECE(STRING1,U,14)_U_U_U_U_U
+26 SET LINE=LINE_U_$PIECE(STRING2,U,9)_U_$PIECE(STRING2,U,10)_U_$PIECE(STRING2,U,14)_U_U_$PIECE(STRING3,U,9)_U_$PIECE(STRING3,U,10)_U_$PIECE(STRING3,U,14)
+27 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,4)=LINE
+28 ;den2,num2
+29 SET DESC="2-10 w/Nutrition Counseling"
+30 SET LINE=""
+31 SET LINE="MU.EP.0024.5"_U_DESC_U_U_$PIECE(STRING1,U,9)_U_$PIECE(STRING1,U,11)_U_$PIECE(STRING1,U,15)_U_U_U_U_U
+32 SET LINE=LINE_U_$PIECE(STRING2,U,9)_U_$PIECE(STRING2,U,11)_U_$PIECE(STRING2,U,15)_U_U_$PIECE(STRING3,U,9)_U_$PIECE(STRING3,U,11)_U_$PIECE(STRING3,U,15)
+33 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,5)=LINE
+34 ;den2,num3
+35 SET DESC="2-10 w/Physical Activity Counseling"
+36 SET LINE=""
+37 SET LINE="MU.EP.0024.6"_U_DESC_U_U_$PIECE(STRING1,U,9)_U_$PIECE(STRING1,U,12)_U_$PIECE(STRING1,U,16)_U_U_U_U_U
+38 SET LINE=LINE_U_$PIECE(STRING2,U,9)_U_$PIECE(STRING2,U,12)_U_$PIECE(STRING2,U,16)_U_U_$PIECE(STRING3,U,9)_U_$PIECE(STRING3,U,12)_U_$PIECE(STRING3,U,16)
+39 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,6)=LINE
+40 ;den3,num1
+41 SET DESC="11-16 w/BMI Percentile"
+42 SET LINE=""
+43 SET LINE="MU.EP.0024.7"_U_DESC_U_U_$PIECE(STRING1,U,17)_U_$PIECE(STRING1,U,18)_U_$PIECE(STRING1,U,22)_U_U_U_U_U
+44 SET LINE=LINE_U_$PIECE(STRING2,U,17)_U_$PIECE(STRING2,U,18)_U_$PIECE(STRING2,U,22)_U_U_$PIECE(STRING3,U,17)_U_$PIECE(STRING3,U,18)_U_$PIECE(STRING3,U,22)
+45 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,7)=LINE
+46 ;den3,num2
+47 SET DESC="11-16 w/Nutrition Counseling"
+48 SET LINE=""
+49 SET LINE="MU.EP.0024.8"_U_DESC_U_U_$PIECE(STRING1,U,17)_U_$PIECE(STRING1,U,19)_U_$PIECE(STRING1,U,23)_U_U_U_U_U
+50 SET LINE=LINE_U_$PIECE(STRING2,U,17)_U_$PIECE(STRING2,U,19)_U_$PIECE(STRING2,U,23)_U_U_$PIECE(STRING3,U,17)_U_$PIECE(STRING3,U,19)_U_$PIECE(STRING3,U,23)
+51 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,8)=LINE
+52 ;den3,num3
+53 SET DESC="11-16 w/Physical Activity Counseling"
+54 SET LINE=""
+55 SET LINE="MU.EP.0024.9"_U_DESC_U_U_$PIECE(STRING1,U,17)_U_$PIECE(STRING1,U,20)_U_$PIECE(STRING1,U,24)_U_U_U_U_U
+56 SET LINE=LINE_U_$PIECE(STRING2,U,17)_U_$PIECE(STRING2,U,20)_U_$PIECE(STRING2,U,24)_U_U_$PIECE(STRING3,U,17)_U_$PIECE(STRING3,U,20)_U_$PIECE(STRING3,U,24)
+57 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,9)=LINE
+58 QUIT