BGPMUWP1 ; IHS/MSC/AJF - MU EP measures NQF0024 ;22-Mar-2011 10:27;DU
;;11.0;IHS CLINICAL REPORTING;**4**;JAN 06, 2011;Build 84
;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 X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3,DIFF1,DIFF2,DIFF3
S STRING1=$$D24("C")
S STRING2=$$D24("P")
S STRING3=$$D24("B")
D SUMMARY^BGPMUWD1(STRING1,STRING2,STRING3)
D HEADER^BGPMUPH Q:BGPQUIT
D HDRBLK^BGPMUPH
W !,"Denominator 1"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"Pts 2-16",?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 !!,"Numerator 1"
S Z1=$P(STRING1,U,6)-$P(STRING2,U,6)
S Z2=$P(STRING1,U,6)-$P(STRING3,U,6)
S X1=$P(STRING1,U,25),X2=$P(STRING2,U,25),X3=$P(STRING3,U,25)
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
S Y2=X1-X3
W !,"# w/BMI Percentile",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,6),5,1),?44,$P(STRING2,U,2)
W ?49,$J($P(STRING2,U,6),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,2),?68,$J($P(STRING3,U,6),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o BMI Percentile",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Numerator 2"
S Z1=$P(STRING1,U,7)-$P(STRING2,U,7)
S Z2=$P(STRING1,U,7)-$P(STRING3,U,7)
S X1=$P(STRING1,U,26),X2=$P(STRING2,U,26),X3=$P(STRING3,U,26)
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
S Y2=X1-X3
W !,"# w/Nutrition edu",?33,$P(STRING1,U,3),?38,$J($P(STRING1,U,7),5,1),?44,$P(STRING2,U,3)
W ?49,$J($P(STRING2,U,7),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,3),?68,$J($P(STRING3,U,7),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o Nutrition edu",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Numerator 3"
S Z1=$P(STRING1,U,8)-$P(STRING2,U,8)
S Z2=$P(STRING1,U,8)-$P(STRING3,U,8)
S X1=$P(STRING1,U,27),X2=$P(STRING2,U,27),X3=$P(STRING3,U,27)
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
S Y2=X1-X3
W !,"# w/Activity edu",?33,$P(STRING1,U,4),?38,$J($P(STRING1,U,8),5,1),?44,$P(STRING2,U,4)
W ?49,$J($P(STRING2,U,8),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,4),?68,$J($P(STRING3,U,8),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o Activity edu",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",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 2-10",?33,$P(STRING1,U,9),?44,$P(STRING2,U,9),?64,$P(STRING3,U,9)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Numerator 1"
S Z1=$P(STRING1,U,14)-$P(STRING2,U,14)
S Z2=$P(STRING1,U,14)-$P(STRING3,U,14)
S X1=$P(STRING1,U,28),X2=$P(STRING2,U,28),X3=$P(STRING3,U,28)
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
S Y2=X1-X3
W !,"# w/BMI Percentile",?33,$P(STRING1,U,10),?38,$J($P(STRING1,U,14),5,1),?44,$P(STRING2,U,10)
W ?49,$J($P(STRING2,U,14),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,10),?68,$J($P(STRING3,U,14),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o BMI Percentile",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Numerator 2"
S Z1=$P(STRING1,U,15)-$P(STRING2,U,15)
S Z2=$P(STRING1,U,15)-$P(STRING3,U,15)
S X1=$P(STRING1,U,29),X2=$P(STRING2,U,29),X3=$P(STRING3,U,29)
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
S Y2=X1-X3
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/Nutrition edu",?33,$P(STRING1,U,11),?38,$J($P(STRING1,U,15),5,1),?44,$P(STRING2,U,11)
W ?49,$J($P(STRING2,U,15),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,11),?68,$J($P(STRING3,U,15),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o Nutrition edu",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !!,"Numerator 3"
S Z1=$P(STRING1,U,16)-$P(STRING2,U,16)
S Z2=$P(STRING1,U,16)-$P(STRING3,U,16)
S X1=$P(STRING1,U,30),X2=$P(STRING2,U,30),X3=$P(STRING3,U,30)
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
S Y2=X1-X3
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/Activity edu",?33,$P(STRING1,U,12),?38,$J($P(STRING1,U,16),5,1),?44,$P(STRING2,U,12)
W ?49,$J($P(STRING2,U,16),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,12),?68,$J($P(STRING3,U,16),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o Activity edu",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Denominator 3"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"Pts 11-16",?33,$P(STRING1,U,17),?44,$P(STRING2,U,17),?64,$P(STRING3,U,17)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !!,"Numerator 1"
S Z1=$P(STRING1,U,22)-$P(STRING2,U,22)
S Z2=$P(STRING1,U,22)-$P(STRING3,U,22)
S X1=$P(STRING1,U,31),X2=$P(STRING2,U,31),X3=$P(STRING3,U,31)
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
S Y2=X1-X3
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/BMI Percentile",?33,$P(STRING1,U,18),?38,$J($P(STRING1,U,22),5,1),?44,$P(STRING2,U,18)
W ?49,$J($P(STRING2,U,22),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,18),?68,$J($P(STRING3,U,22),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o BMI Percentile",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !!,"Numerator 2"
S Z1=$P(STRING1,U,23)-$P(STRING2,U,23)
S Z2=$P(STRING1,U,23)-$P(STRING3,U,23)
S X1=$P(STRING1,U,32),X2=$P(STRING2,U,32),X3=$P(STRING3,U,32)
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
S Y2=X1-X3
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/Nutrition edu",?33,$P(STRING1,U,19),?38,$J($P(STRING1,U,23),5,1),?44,$P(STRING2,U,19)
W ?49,$J($P(STRING2,U,23),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,19),?68,$J($P(STRING3,U,23),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o Nutrition edu",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !!,"Numerator 3"
S Z1=$P(STRING1,U,24)-$P(STRING2,U,24)
S Z2=$P(STRING1,U,24)-$P(STRING3,U,24)
S X1=$P(STRING1,U,33),X2=$P(STRING2,U,33),X3=$P(STRING3,U,33)
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
S Y2=X1-X3
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/Activity edu",?33,$P(STRING1,U,20),?38,$J($P(STRING1,U,24),5,1),?44,$P(STRING2,U,20)
W ?49,$J($P(STRING2,U,24),5,1),?56,$J($FN(Z1,",+",1),6),?64,$P(STRING3,U,20),?68,$J($P(STRING3,U,24),5,1),?74,$J($FN(Z2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
W !,"# w/o Activity edu",?33,DIFF1,?38,$J(X1,5,1),?44,DIFF2,?49,$J(X2,5,1),?56,$J($FN(Y1,",+",1),6),?64,DIFF3,?68,$J(X3,5,1),?74,$J($FN(Y2,",+",1),6)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH,HDRBLK^BGPMUPH Q:BGPQUIT
;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
N NC1,NC2,NC3,NC4,NC5,NC6,NC7,NC8,NC9
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,NC1,NC2,NC3)=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
.S NC1=$$ROUND^BGPMUA01(((DEN1-NUM1)/DEN1),3)*100
.S NC2=$$ROUND^BGPMUA01(((DEN1-NUM2)/DEN1),3)*100
.S NC3=$$ROUND^BGPMUA01(((DEN1-NUM3)/DEN1),3)*100
I DEN2=0 S (PC4,PC5,PC6,NC4,NC5,NC6)=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
.S NC4=$$ROUND^BGPMUA01(((DEN2-NUM4)/DEN2),3)*100
.S NC5=$$ROUND^BGPMUA01(((DEN2-NUM5)/DEN2),3)*100
.S NC6=$$ROUND^BGPMUA01(((DEN2-NUM6)/DEN2),3)*100
I DEN3=0 S (PC7,PC8,PC9,NC7,NC8,NC9)=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 NC7=$$ROUND^BGPMUA01(((DEN3-NUM7)/DEN3),3)*100
.S NC8=$$ROUND^BGPMUA01(((DEN3-NUM8)/DEN3),3)*100
.S NC9=$$ROUND^BGPMUA01(((DEN3-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)
S ARRAY=ARRAY_U_$G(NC1)_U_$G(NC2)_U_$G(NC3)_U_$G(NC4)_U_$G(NC5)_U_$G(NC6)_U_$G(NC7)_U_$G(NC8)_U_$G(NC9)
K AG1,AG2,AG3,NUM1,NUM2,NUM3,NUM4,NUM5,NUM6,NUM7,NUM8,NUM9
K PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,DEN1,DEN2,DEN3
K NC1,NC2,NC3,NC4,NC5,NC6,NC7,NC8,NC9
Q ARRAY
XML ;
N STRING
S STRING=$$D24("C")
S BGPXML(1)="239"_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,PTCT,NODE,NAME,VST,X,BGPARR,LINE
S PTCT=0
D HEADERL^BGPMUPH
S X="Patients 2-16 who had at least 1 outpatient encounter with the EP" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="during the reporting period, with documented BMI and counseling, if any." D W^BGPMUPP(X,0,1,BGPPTYPE)
W ! S X="Patients who do not meet the numerator criteria are listed first (NM:)," D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="followed by patients who do meet the numerator criteria (M:)." D W^BGPMUPP(X,0,1,BGPPTYPE)
W ! S X="The following are the abbreviations used in the denominator column:" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="EN=Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
F NUM=1:1:3 D
.S PTCT=0
.I $Y>(BGPIOSL-7) D HEADERL^BGPMUPH Q:BGPQUIT
.S X=$P($T(NUMHDR+NUM),";;",2) D W^BGPMUPP(X,0,2,BGPPTYPE)
.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(""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)
.W !!,"Total # of patients on list: "_PTCT
Q
NUMHDR ;Headers for indiv numerator lists
;;Numerator 1 BMI Percentile:
;;Numerator 2 Nutrition Education:
;;Numerator 3 Physical Activity Education:
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,NUM3,DEN1,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,3)
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 (NUM1,NUM2,NUM3)=""
S NUM1=$P(NUM,";",1),NUM2=$P(NUM,";",2),NUM3=$P(NUM,";",3)
W !,NAME,?23,HRN,?30,COMM,?42,SEX,?46,AGE,?50,DEN,?63,NUM1
I NUM2'="" D
.W !,?65,NUM2
I NUM3'="" D
.W !,?65,NUM3
Q
BGPMUWP1 ; IHS/MSC/AJF - MU EP measures NQF0024 ;22-Mar-2011 10:27;DU
+1 ;;11.0;IHS CLINICAL REPORTING;**4**;JAN 06, 2011;Build 84
+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 X1,X2,X3,Y1,Y2,Y3,Z1,Z2,Z3,DIFF1,DIFF2,DIFF3
+4 SET STRING1=$$D24("C")
+5 SET STRING2=$$D24("P")
+6 SET STRING3=$$D24("B")
+7 DO SUMMARY^BGPMUWD1(STRING1,STRING2,STRING3)
+8 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+9 DO HDRBLK^BGPMUPH
+10 WRITE !,"Denominator 1"
+11 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !,"Pts 2-16",?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 !!,"Numerator 1"
+15 SET Z1=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+16 SET Z2=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+17 SET X1=$PIECE(STRING1,U,25)
SET X2=$PIECE(STRING2,U,25)
SET X3=$PIECE(STRING3,U,25)
+18 SET DIFF1=$PIECE(STRING1,U,1)-$PIECE(STRING1,U,2)
SET DIFF2=$PIECE(STRING2,U,1)-$PIECE(STRING2,U,2)
+19 SET DIFF3=$PIECE(STRING3,U,1)-$PIECE(STRING3,U,2)
+20 SET Y1=X1-X2
+21 SET Y2=X1-X3
+22 WRITE !,"# w/BMI Percentile",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,6),5,1),?44,$PIECE(STRING2,U,2)
+23 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,6),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,6),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+24 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+25 WRITE !,"# w/o BMI Percentile",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+26 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+27 WRITE !!,"Numerator 2"
+28 SET Z1=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
+29 SET Z2=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
+30 SET X1=$PIECE(STRING1,U,26)
SET X2=$PIECE(STRING2,U,26)
SET X3=$PIECE(STRING3,U,26)
+31 SET DIFF1=$PIECE(STRING1,U,1)-$PIECE(STRING1,U,3)
SET DIFF2=$PIECE(STRING2,U,1)-$PIECE(STRING2,U,3)
+32 SET DIFF3=$PIECE(STRING3,U,1)-$PIECE(STRING3,U,3)
+33 SET Y1=X1-X2
+34 SET Y2=X1-X3
+35 WRITE !,"# w/Nutrition edu",?33,$PIECE(STRING1,U,3),?38,$JUSTIFY($PIECE(STRING1,U,7),5,1),?44,$PIECE(STRING2,U,3)
+36 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,7),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,3),?68,$JUSTIFY($PIECE(STRING3,U,7),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+37 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+38 WRITE !,"# w/o Nutrition edu",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+39 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+40 WRITE !!,"Numerator 3"
+41 SET Z1=$PIECE(STRING1,U,8)-$PIECE(STRING2,U,8)
+42 SET Z2=$PIECE(STRING1,U,8)-$PIECE(STRING3,U,8)
+43 SET X1=$PIECE(STRING1,U,27)
SET X2=$PIECE(STRING2,U,27)
SET X3=$PIECE(STRING3,U,27)
+44 SET DIFF1=$PIECE(STRING1,U,1)-$PIECE(STRING1,U,4)
SET DIFF2=$PIECE(STRING2,U,1)-$PIECE(STRING2,U,4)
+45 SET DIFF3=$PIECE(STRING3,U,1)-$PIECE(STRING3,U,4)
+46 SET Y1=X1-X2
+47 SET Y2=X1-X3
+48 WRITE !,"# w/Activity edu",?33,$PIECE(STRING1,U,4),?38,$JUSTIFY($PIECE(STRING1,U,8),5,1),?44,$PIECE(STRING2,U,4)
+49 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,8),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,4),?68,$JUSTIFY($PIECE(STRING3,U,8),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+50 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+51 WRITE !,"# w/o Activity edu",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+52 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+53 WRITE !!,"Denominator 2"
+54 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+55 WRITE !,"Pts 2-10",?33,$PIECE(STRING1,U,9),?44,$PIECE(STRING2,U,9),?64,$PIECE(STRING3,U,9)
+56 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+57 WRITE !!,"Numerator 1"
+58 SET Z1=$PIECE(STRING1,U,14)-$PIECE(STRING2,U,14)
+59 SET Z2=$PIECE(STRING1,U,14)-$PIECE(STRING3,U,14)
+60 SET X1=$PIECE(STRING1,U,28)
SET X2=$PIECE(STRING2,U,28)
SET X3=$PIECE(STRING3,U,28)
+61 SET DIFF1=$PIECE(STRING1,U,9)-$PIECE(STRING1,U,10)
SET DIFF2=$PIECE(STRING2,U,9)-$PIECE(STRING2,U,10)
+62 SET DIFF3=$PIECE(STRING3,U,9)-$PIECE(STRING3,U,10)
+63 SET Y1=X1-X2
+64 SET Y2=X1-X3
+65 WRITE !,"# w/BMI Percentile",?33,$PIECE(STRING1,U,10),?38,$JUSTIFY($PIECE(STRING1,U,14),5,1),?44,$PIECE(STRING2,U,10)
+66 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,14),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,10),?68,$JUSTIFY($PIECE(STRING3,U,14),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+67 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+68 WRITE !,"# w/o BMI Percentile",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+69 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+70 WRITE !!,"Numerator 2"
+71 SET Z1=$PIECE(STRING1,U,15)-$PIECE(STRING2,U,15)
+72 SET Z2=$PIECE(STRING1,U,15)-$PIECE(STRING3,U,15)
+73 SET X1=$PIECE(STRING1,U,29)
SET X2=$PIECE(STRING2,U,29)
SET X3=$PIECE(STRING3,U,29)
+74 SET DIFF1=$PIECE(STRING1,U,9)-$PIECE(STRING1,U,11)
SET DIFF2=$PIECE(STRING2,U,9)-$PIECE(STRING2,U,11)
+75 SET DIFF3=$PIECE(STRING3,U,9)-$PIECE(STRING3,U,11)
+76 SET Y1=X1-X2
+77 SET Y2=X1-X3
+78 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+79 WRITE !,"# w/Nutrition edu",?33,$PIECE(STRING1,U,11),?38,$JUSTIFY($PIECE(STRING1,U,15),5,1),?44,$PIECE(STRING2,U,11)
+80 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,15),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,11),?68,$JUSTIFY($PIECE(STRING3,U,15),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+81 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+82 WRITE !,"# w/o Nutrition edu",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+83 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+84 WRITE !!,"Numerator 3"
+85 SET Z1=$PIECE(STRING1,U,16)-$PIECE(STRING2,U,16)
+86 SET Z2=$PIECE(STRING1,U,16)-$PIECE(STRING3,U,16)
+87 SET X1=$PIECE(STRING1,U,30)
SET X2=$PIECE(STRING2,U,30)
SET X3=$PIECE(STRING3,U,30)
+88 SET DIFF1=$PIECE(STRING1,U,9)-$PIECE(STRING1,U,12)
SET DIFF2=$PIECE(STRING2,U,9)-$PIECE(STRING2,U,12)
+89 SET DIFF3=$PIECE(STRING3,U,9)-$PIECE(STRING3,U,12)
+90 SET Y1=X1-X2
+91 SET Y2=X1-X3
+92 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+93 WRITE !,"# w/Activity edu",?33,$PIECE(STRING1,U,12),?38,$JUSTIFY($PIECE(STRING1,U,16),5,1),?44,$PIECE(STRING2,U,12)
+94 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,16),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,12),?68,$JUSTIFY($PIECE(STRING3,U,16),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+95 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+96 WRITE !,"# w/o Activity edu",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+97 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+98 WRITE !!,"Denominator 3"
+99 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+100 WRITE !,"Pts 11-16",?33,$PIECE(STRING1,U,17),?44,$PIECE(STRING2,U,17),?64,$PIECE(STRING3,U,17)
+101 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+102 WRITE !!,"Numerator 1"
+103 SET Z1=$PIECE(STRING1,U,22)-$PIECE(STRING2,U,22)
+104 SET Z2=$PIECE(STRING1,U,22)-$PIECE(STRING3,U,22)
+105 SET X1=$PIECE(STRING1,U,31)
SET X2=$PIECE(STRING2,U,31)
SET X3=$PIECE(STRING3,U,31)
+106 SET DIFF1=$PIECE(STRING1,U,17)-$PIECE(STRING1,U,18)
SET DIFF2=$PIECE(STRING2,U,17)-$PIECE(STRING2,U,18)
+107 SET DIFF3=$PIECE(STRING3,U,17)-$PIECE(STRING3,U,18)
+108 SET Y1=X1-X2
+109 SET Y2=X1-X3
+110 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+111 WRITE !,"# w/BMI Percentile",?33,$PIECE(STRING1,U,18),?38,$JUSTIFY($PIECE(STRING1,U,22),5,1),?44,$PIECE(STRING2,U,18)
+112 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,22),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,18),?68,$JUSTIFY($PIECE(STRING3,U,22),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+113 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+114 WRITE !,"# w/o BMI Percentile",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+115 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+116 WRITE !!,"Numerator 2"
+117 SET Z1=$PIECE(STRING1,U,23)-$PIECE(STRING2,U,23)
+118 SET Z2=$PIECE(STRING1,U,23)-$PIECE(STRING3,U,23)
+119 SET X1=$PIECE(STRING1,U,32)
SET X2=$PIECE(STRING2,U,32)
SET X3=$PIECE(STRING3,U,32)
+120 SET DIFF1=$PIECE(STRING1,U,17)-$PIECE(STRING1,U,19)
SET DIFF2=$PIECE(STRING2,U,17)-$PIECE(STRING2,U,19)
+121 SET DIFF3=$PIECE(STRING3,U,17)-$PIECE(STRING3,U,19)
+122 SET Y1=X1-X2
+123 SET Y2=X1-X3
+124 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+125 WRITE !,"# w/Nutrition edu",?33,$PIECE(STRING1,U,19),?38,$JUSTIFY($PIECE(STRING1,U,23),5,1),?44,$PIECE(STRING2,U,19)
+126 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,23),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,19),?68,$JUSTIFY($PIECE(STRING3,U,23),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+127 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+128 WRITE !,"# w/o Nutrition edu",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+129 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+130 WRITE !!,"Numerator 3"
+131 SET Z1=$PIECE(STRING1,U,24)-$PIECE(STRING2,U,24)
+132 SET Z2=$PIECE(STRING1,U,24)-$PIECE(STRING3,U,24)
+133 SET X1=$PIECE(STRING1,U,33)
SET X2=$PIECE(STRING2,U,33)
SET X3=$PIECE(STRING3,U,33)
+134 SET DIFF1=$PIECE(STRING1,U,17)-$PIECE(STRING1,U,20)
SET DIFF2=$PIECE(STRING2,U,17)-$PIECE(STRING2,U,20)
+135 SET DIFF3=$PIECE(STRING3,U,17)-$PIECE(STRING3,U,20)
+136 SET Y1=X1-X2
+137 SET Y2=X1-X3
+138 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+139 WRITE !,"# w/Activity edu",?33,$PIECE(STRING1,U,20),?38,$JUSTIFY($PIECE(STRING1,U,24),5,1),?44,$PIECE(STRING2,U,20)
+140 WRITE ?49,$JUSTIFY($PIECE(STRING2,U,24),5,1),?56,$JUSTIFY($FNUMBER(Z1,",+",1),6),?64,$PIECE(STRING3,U,20),?68,$JUSTIFY($PIECE(STRING3,U,24),5,1),?74,$JUSTIFY($FNUMBER(Z2,",+",1),6)
+141 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+142 WRITE !,"# w/o Activity edu",?33,DIFF1,?38,$JUSTIFY(X1,5,1),?44,DIFF2,?49,$JUSTIFY(X2,5,1),?56,$JUSTIFY($FNUMBER(Y1,",+",1),6),?64,DIFF3,?68,$JUSTIFY(X3,5,1),?74,$JUSTIFY($FNUMBER(Y2,",+",1),6)
+143 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
DO HDRBLK^BGPMUPH
IF BGPQUIT
QUIT
+144 ;Output the individual data
+145 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 NEW NC1,NC2,NC3,NC4,NC5,NC6,NC7,NC8,NC9
+4 SET AG1=$GET(^TMP("BGPMU 2-16",$JOB,TF,"POPULATION"))
+5 SET AG2=$GET(^TMP("BGPMU 2-10",$JOB,TF,"POPULATION"))
+6 SET AG3=$GET(^TMP("BGPMU 11-16",$JOB,TF,"POPULATION"))
+7 ;2-16 DATA
+8 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)
+9 ; 2-10 DATA"
+10 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)
+11 ; 11-16 DATA"
+12 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)
+13 IF DEN1=0
SET (PC1,PC2,PC3,NC1,NC2,NC3)=0
+14 IF DEN1>0
Begin DoDot:1
+15 SET PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
+16 SET PC2=$$ROUND^BGPMUA01((NUM2/DEN1),3)*100
+17 SET PC3=$$ROUND^BGPMUA01((NUM3/DEN1),3)*100
+18 SET NC1=$$ROUND^BGPMUA01(((DEN1-NUM1)/DEN1),3)*100
+19 SET NC2=$$ROUND^BGPMUA01(((DEN1-NUM2)/DEN1),3)*100
+20 SET NC3=$$ROUND^BGPMUA01(((DEN1-NUM3)/DEN1),3)*100
End DoDot:1
+21 IF DEN2=0
SET (PC4,PC5,PC6,NC4,NC5,NC6)=0
+22 IF DEN2>0
Begin DoDot:1
+23 SET PC4=$$ROUND^BGPMUA01((NUM4/DEN2),3)*100
+24 SET PC5=$$ROUND^BGPMUA01((NUM5/DEN2),3)*100
+25 SET PC6=$$ROUND^BGPMUA01((NUM6/DEN2),3)*100
+26 SET NC4=$$ROUND^BGPMUA01(((DEN2-NUM4)/DEN2),3)*100
+27 SET NC5=$$ROUND^BGPMUA01(((DEN2-NUM5)/DEN2),3)*100
+28 SET NC6=$$ROUND^BGPMUA01(((DEN2-NUM6)/DEN2),3)*100
End DoDot:1
+29 IF DEN3=0
SET (PC7,PC8,PC9,NC7,NC8,NC9)=0
+30 IF DEN3>0
Begin DoDot:1
+31 SET PC7=$$ROUND^BGPMUA01((NUM7/DEN3),3)*100
+32 SET PC8=$$ROUND^BGPMUA01((NUM8/DEN3),3)*100
+33 SET PC9=$$ROUND^BGPMUA01((NUM9/DEN3),3)*100
+34 SET NC7=$$ROUND^BGPMUA01(((DEN3-NUM7)/DEN3),3)*100
+35 SET NC8=$$ROUND^BGPMUA01(((DEN3-NUM8)/DEN3),3)*100
+36 SET NC9=$$ROUND^BGPMUA01(((DEN3-NUM9)/DEN3),3)*100
End DoDot:1
+37 SET ARRAY=DEN1_U_NUM1_U_NUM2_U_NUM3_U_NONUM1_U_$GET(PC1)_U_$GET(PC2)_U_$GET(PC3)
+38 SET ARRAY=ARRAY_U_DEN2_U_NUM4_U_NUM5_U_NUM6_U_NONUM2_U_$GET(PC4)_U_$GET(PC5)_U_$GET(PC6)
+39 SET ARRAY=ARRAY_U_DEN3_U_NUM7_U_NUM8_U_NUM9_U_NONUM3_U_$GET(PC7)_U_$GET(PC8)_U_$GET(PC9)
+40 SET ARRAY=ARRAY_U_$GET(NC1)_U_$GET(NC2)_U_$GET(NC3)_U_$GET(NC4)_U_$GET(NC5)_U_$GET(NC6)_U_$GET(NC7)_U_$GET(NC8)_U_$GET(NC9)
+41 KILL AG1,AG2,AG3,NUM1,NUM2,NUM3,NUM4,NUM5,NUM6,NUM7,NUM8,NUM9
+42 KILL PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,DEN1,DEN2,DEN3
+43 KILL NC1,NC2,NC3,NC4,NC5,NC6,NC7,NC8,NC9
+44 QUIT ARRAY
XML ;
+1 NEW STRING
+2 SET STRING=$$D24("C")
+3 SET BGPXML(1)="239"_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,PTCT,NODE,NAME,VST,X,BGPARR,LINE
+2 SET PTCT=0
+3 DO HEADERL^BGPMUPH
+4 SET X="Patients 2-16 who had at least 1 outpatient encounter with the EP"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="during the reporting period, with documented BMI and counseling, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 WRITE !
SET X="Patients who do not meet the numerator criteria are listed first (NM:),"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="followed by patients who do meet the numerator criteria (M:)."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+8 WRITE !
SET X="The following are the abbreviations used in the denominator column:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 SET X="EN=Encounter"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 FOR NUM=1:1:3
Begin DoDot:1
+11 SET PTCT=0
+12 IF $Y>(BGPIOSL-7)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+13 SET X=$PIECE($TEXT(NUMHDR+NUM),";;",2)
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+14 WRITE !!,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+15 SET LINE=""
SET $PIECE(LINE,"-",81)=""
WRITE !,LINE
+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 WRITE !!,"Total # of patients on list: "_PTCT
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:
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2,NUM3,DEN1,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,3)
+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 (NUM1,NUM2,NUM3)=""
+14 SET NUM1=$PIECE(NUM,";",1)
SET NUM2=$PIECE(NUM,";",2)
SET NUM3=$PIECE(NUM,";",3)
+15 WRITE !,NAME,?23,HRN,?30,COMM,?42,SEX,?46,AGE,?50,DEN,?63,NUM1
+16 IF NUM2'=""
Begin DoDot:1
+17 WRITE !,?65,NUM2
End DoDot:1
+18 IF NUM3'=""
Begin DoDot:1
+19 WRITE !,?65,NUM3
End DoDot:1
+20 QUIT