BGPMUFP1 ;IHS/MSC/MMT - MU Reports Measure NQF0038 ;01-Mar-2011 15:50;MGH
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;
CHIMM ;EP
D P1
K ^TMP("BGPMU0038",$J)
Q
P1 ;Print measure details
N TOTALS,BGPI,TF,CMP,PMP,BMP,CMPWO,PMPWO,BMPWO,BGPDNCNT,BGPSSTR
S BGPDNCNT=0
F TF="C","P","B" D NEW
F TF="C","P","B" D LOAD
;Initialize iCare/summary global
K ^TMP("BGPMU SUMMARY",$J,BGPIC)
S ^TMP("BGPMU SUMMARY",$J,BGPIC)="0038^240"
D HEADER^BGPMUPH Q:BGPQUIT
D HDRBLK^BGPMUPH
F N=1:1:12 D
.I $Y>(BGPIOSL-7) D HEADER^BGPMUPH Q:BGPQUIT
.W !!,"Numerator "_N_" ("_$P($T(ITEXT+N),";;",2)_")"
.W !,"Pts 2 yrs old",?33,(@("CDEN"_N_"CT")+@("CEXC"_N_"CT")),?44,(@("PDEN"_N_"CT")+@("PEXC"_N_"CT")),?64,(@("BDEN"_N_"CT")+@("BEXC"_N_"CT"))
.W !,"# Excluded (Exc)",?33,@("CEXC"_N_"CT"),?44,@("PEXC"_N_"CT"),?64,@("BEXC"_N_"CT")
.W !,"Pts 2 yrs old less Exc",?33,@("CDEN"_N_"CT"),?44,@("PDEN"_N_"CT"),?64,@("BDEN"_N_"CT")
.D CALCS(N,.CMP,.PMP,.BMP)
.D CALCSWO(N,.CMPWO,.PMPWO,.BMPWO)
.W !!,$P($T(NTEXT+N),";;",2),?33,@("CNUM"_N_"CT"),?38,$J(CMP,5,1),?44,@("PNUM"_N_"CT"),?49,$J(PMP,5,1),?56,$J($FN(CMP-PMP,"+,",1),6),?64,@("BNUM"_N_"CT"),?68,$J(BMP,5,1),?74,$J($FN(CMP-BMP,"+,",1),6)
.W !,$P($T(OTEXT+N),";;",2),?33,(@("CDEN"_N_"CT")-@("CNUM"_N_"CT")),?38,$J(CMPWO,5,1),?44,(@("PDEN"_N_"CT")-@("PNUM"_N_"CT")),?49,$J(PMPWO,5,1),?56,$J($FN(CMPWO-PMPWO,"+,",1),6)
.W ?64,(@("BDEN"_N_"CT")-@("BNUM"_N_"CT")),?68,$J(BMPWO,5,1),?74,$J($FN(CMPWO-BMPWO,"+,",1),6)
.I $Y>(BGPIOSL-7) D HEADER^BGPMUPH Q:BGPQUIT
.;Setup summary page/iCare ^TMP global
.S BGPDNCNT=BGPDNCNT+1
.S BGPSSTR="MU.EP.0038."_N_U_$P($T(ITEXT+N),";;",2)_U_@("CEXC"_N_"CT")_U_(@("CDEN"_N_"CT")+@("CEXC"_N_"CT"))_U_@("CNUM"_N_"CT")_U_CMP_"^^^^"
.; 11 12 13 14
.S BGPSSTR=BGPSSTR_U_@("PEXC"_N_"CT")_U_(@("PDEN"_N_"CT")+@("PEXC"_N_"CT"))_U_@("PNUM"_N_"CT")_U_PMP
.; 15 16 17 18
.S BGPSSTR=BGPSSTR_U_@("BEXC"_N_"CT")_U_(@("BDEN"_N_"CT")+@("BEXC"_N_"CT"))_U_@("BNUM"_N_"CT")_U_BMP
.S ^TMP("BGPMU SUMMARY",$J,BGPIC,BGPDNCNT)=BGPSSTR
I $D(BGPLIST(BGPIC)) D P2
F TF="C","P","B" D KILL
Q
;
P2 ;Print the Patient List Details
N PT,NODE,NAME,VST,BMI,FOL,X,N,BGPARR,PTCT
D HEADERL^BGPMUPH
S X="Patients who reached 2 years of age and who had at least 1 encounter with the" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="EP, both during the reporting period." 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)
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
F N=1:1:12 D
.I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
.W !!,$P($T(LITEXT+N),";;",2)
.S PTCT=0
.I BGPLIST="D"!(BGPLIST="A") D
..W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
..W !,$TR($J("",80)," ","-")
..K BGPARR
..D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0038"","_$J_",""C"",""PAT"",""NOT"","_N_")")
..S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
...S PTCT=PTCT+1
...S NODE=$G(BGPARR(PT))
...S $P(NODE,U,3)="NM:"_$P(NODE,U,3) ; uglify the display
...D DATA(NODE)
.I BGPLIST="N"!(BGPLIST="A") D
..I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT D
...W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
...W !,$TR($J("",80)," ","-")
..K BGPARR
..D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0038"","_$J_",""C"",""PAT"",""INCL"","_N_")")
..S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
...S PTCT=PTCT+1
...S NODE=$G(BGPARR(PT))
...S $P(NODE,U,3)="M:"_$P(NODE,U,3) ; uglify the display
...D DATA(NODE)
.I BGPLIST="A" D
..I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT D
...W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
...W !,$TR($J("",80)," ","-")
..K BGPARR
..D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0038"","_$J_",""C"",""PAT"",""EXCL"","_N_")")
..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
;F N=1:1:12 D
;.I BGPLIST="N"!(BGPLIST="A") D
;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
;..W !!,$P($T(LITEXT+N),";;",2)
;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
;.. W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
;..S PT=0 F S PT=$O(^TMP("BGPMU0038",$J,"C","PAT","INCL",N,PT)) Q:PT="" D
;...S NODE=$G(^TMP("BGPMU0038",$J,"C","PAT","INCL",N,PT))
;...D DATA(PT,NODE)
;.I BGPLIST="D"!(BGPLIST="A") D
;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
;..W !!,$P($T(LNTEXT+N),";;",2)
;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
;.. W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
;..S PT=0 F S PT=$O(^TMP("BGPMU0038",$J,"C","PAT","NOT",N,PT)) Q:PT="" D
;...S NODE=$G(^TMP("BGPMU0038",$J,"C","PAT","NOT",N,PT))
;...D DATA2(PT,NODE)
;.I BGPLIST="A" D
;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
;..W !!,$P($T(LETEXT+N),";;",2)
;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
;.. W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
;..S PT=0 F S PT=$O(^TMP("BGPMU0038",$J,"C","PAT","EXCL",N,PT)) Q:PT="" D
;...S NODE=$G(^TMP("BGPMU0038",$J,"C","PAT","EXCL",N,PT))
;...D DATA2(PT,NODE)
;Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM
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)
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"
.W !,$TR($J("",80)," ","-")
W !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN,?63,NUM
Q
CALCS(N,CMP,PMP,BMP) ;
S CMP=$FN($S(@("CDEN"_N_"CT")>0:$$ROUND^BGPMUA01((@("CNUM"_N_"CT")/@("CDEN"_N_"CT")),3)*100,1:0),",",1)
S PMP=$FN($S(@("PDEN"_N_"CT")>0:$$ROUND^BGPMUA01((@("PNUM"_N_"CT")/@("PDEN"_N_"CT")),3)*100,1:0),",",1)
S BMP=$FN($S(@("BDEN"_N_"CT")>0:$$ROUND^BGPMUA01((@("BNUM"_N_"CT")/@("BDEN"_N_"CT")),3)*100,1:0),",",1)
Q
CALCSWO(N,CMP,PMP,BMP) ;
S CMP=$FN($S(@("CDEN"_N_"CT")>0:$$ROUND^BGPMUA01(((@("CDEN"_N_"CT")-@("CNUM"_N_"CT"))/@("CDEN"_N_"CT")),3)*100,1:0),",",1)
S PMP=$FN($S(@("PDEN"_N_"CT")>0:$$ROUND^BGPMUA01(((@("PDEN"_N_"CT")-@("PNUM"_N_"CT"))/@("PDEN"_N_"CT")),3)*100,1:0),",",1)
S BMP=$FN($S(@("BDEN"_N_"CT")>0:$$ROUND^BGPMUA01(((@("BDEN"_N_"CT")-@("BNUM"_N_"CT"))/@("BDEN"_N_"CT")),3)*100,1:0),",",1)
Q
NEW ;NEW all variables for timeframe
F BGPI=1:1:12 N @(TF_"EXC"_BGPI_"CT")
F BGPI=1:1:12 N @(TF_"DEN"_BGPI_"CT")
F BGPI=1:1:12 N @(TF_"NUM"_BGPI_"CT")
Q
LOAD ;Load variables from TMP global
S @(TF_"TOTALS")=$G(^TMP("BGPMU0038",$J,TF,"TOT"))
;exclusion counts
F BGPI=1:1:12 S @(TF_"EXC"_BGPI_"CT")=+$G(^TMP("BGPMU0038",$J,TF,"EXC",BGPI))
;denominator counts
F BGPI=1:1:12 S @(TF_"DEN"_BGPI_"CT")=+$G(^TMP("BGPMU0038",$J,TF,"DEN",BGPI))
;numerator counts
F BGPI=1:1:12 S @(TF_"NUM"_BGPI_"CT")=+$G(^TMP("BGPMU0038",$J,TF,"NUM",BGPI))
Q
KILL ;KILL all varables for timeframe
F BGPI=1:1:12 N @(TF_"EXC"_BGPI_"CT")
F BGPI=1:1:12 N @(TF_"DEN"_BGPI_"CT")
F BGPI=1:1:12 N @(TF_"NUM"_BGPI_"CT")
Q
XML38 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
;F BGPI=1:1:12 S BGPXML(BGPI)="1"_U_BGPI_U_+$G(^TMP("BGPMU0038",$J,"C","DEN",BGPI))_U_+$G(^TMP("BGPMU0038",$J,"C","NUM",BGPI))_U_+$G(^TMP("BGPMU0038",$J,"C","EXC",BGPI))
S BGPXML(1)="240"_U_""_U_+$G(^TMP("BGPMU0038",$J,"C","DEN",12))_U_+$G(^TMP("BGPMU0038",$J,"C","NUM",12))_U_+$G(^TMP("BGPMU0038",$J,"C","EXC",12))
K ^TMP("BGPMU0038",$J)
Q
ITEXT ;
;;4 DTaP
;;3 IPV
;;1 MMR
;;3 HiB
;;3 HepB
;;1 VZV
;;4 Pneumococcal
;;2 HepA
;;2 Rotavirus
;;2 Influenza
;;4:3:1:3:3:1
;;4:3:1:3:3:1:4
NTEXT ;
;;# w/4 DTaP
;;# w/3 IPV
;;# w/1 MMR
;;# w/3 HiB
;;# w/3 Hep B
;;# w/1 VZV
;;# w/4 Pneumococcal
;;# w/2 Hep A
;;# w/2 Rotavirus
;;# w/2 Influenza
;;# w/1-6 (4:3:1:3:3:1)
;;# w/1-7 (4:3:1:3:3:1:4)
OTEXT ;
;;# w/o 4 DTaP
;;# w/o 3 IPV
;;# w/o 1 MMR
;;# w/o 3 HiB
;;# w/o 3 Hep B
;;# w/o 1 VZV
;;# w/o 4 Pneumococcal
;;# w/o 2 Hep A
;;# w/o 2 Rotavirus
;;# w/o 2 Influenza
;;# w/o 1-6 (4:3:1:3:3:1)
;;# w/o 1-7 (4:3:1:3:3:1:4)
LITEXT ;
;;1: 4 DTaP Patients
;;2: 3 IPV Patients
;;3: 1 MMR Patients
;;4: 3 HiB Patients
;;5: 3 Hepatitis B Patients
;;6: 1 VZV Patients
;;7: 4 Pneumococcal Patients
;;8: 2 Hepatitis A Patients
;;9: 2 Rotavirus Patients
;;10: 2 Influenza Patients
;;11: 4:3:1:3:3:1 Patients
;;12: 4:3:1:3:3:1:4 Patients
;;
;;DTAP numerator patients
;;IPV numerator patients
;;MMR numerator patients
;;HiB numerator patients
;;HepB numerator patients
;;VZV numerator patients
;;Pneumo numerator patients
;;HepA numerator patients
;;Rotavirus numerator patients
;;Influenza numerator patients
;;Numerator patients for 1 thru 6
;;Numerator patients for 1 thru 7
LNTEXT ;
;;Denominator patients not in numerator for DTAP
;;Denominator patients not in numerator for IPV
;;Denominator patients not in numerator for MMR
;;Denominator patients not in numerator for HiB
;;Denominator patients not in numerator for Hep B
;;Denominator patients not in numerator for VZV
;;Denominator patients not in numerator for Pneumococcal
;;Denominator patients not in numerator for Hep A
;;Denominator patients not in numerator for Rotavirus
;;Denominator patients not in numerator for Influenza
;;Denominator patients not in numerator for 1 thru 6
;;Denominator patients not in numerator for 1 thru 7
LETEXT ;
;;Exclusion patients for DTAP
;;Exclusion patients for IPV
;;Exclusion patients for MMR
;;Exclusion patients for HiB
;;Exclusion patients for Hep B
;;Exclusion patients for VZV
;;Exclusion patients for Pneumococcal
;;Exclusion patients for Hep A
;;Exclusion patients for Rotavirus
;;Exclusion patients for Influenza
;;Exclusion patients for 1 thru 6
;;Exclusion patients for 1 thru 7
BGPMUFP1 ;IHS/MSC/MMT - MU Reports Measure NQF0038 ;01-Mar-2011 15:50;MGH
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;
CHIMM ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0038",$JOB)
+3 QUIT
P1 ;Print measure details
+1 NEW TOTALS,BGPI,TF,CMP,PMP,BMP,CMPWO,PMPWO,BMPWO,BGPDNCNT,BGPSSTR
+2 SET BGPDNCNT=0
+3 FOR TF="C","P","B"
DO NEW
+4 FOR TF="C","P","B"
DO LOAD
+5 ;Initialize iCare/summary global
+6 KILL ^TMP("BGPMU SUMMARY",$JOB,BGPIC)
+7 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC)="0038^240"
+8 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+9 DO HDRBLK^BGPMUPH
+10 FOR N=1:1:12
Begin DoDot:1
+11 IF $Y>(BGPIOSL-7)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !!,"Numerator "_N_" ("_$PIECE($TEXT(ITEXT+N),";;",2)_")"
+13 WRITE !,"Pts 2 yrs old",?33,(@("CDEN"_N_"CT")+@("CEXC"_N_"CT")),?44,(@("PDEN"_N_"CT")+@("PEXC"_N_"CT")),?64,(@("BDEN"_N_"CT")+@("BEXC"_N_"CT"))
+14 WRITE !,"# Excluded (Exc)",?33,@("CEXC"_N_"CT"),?44,@("PEXC"_N_"CT"),?64,@("BEXC"_N_"CT")
+15 WRITE !,"Pts 2 yrs old less Exc",?33,@("CDEN"_N_"CT"),?44,@("PDEN"_N_"CT"),?64,@("BDEN"_N_"CT")
+16 DO CALCS(N,.CMP,.PMP,.BMP)
+17 DO CALCSWO(N,.CMPWO,.PMPWO,.BMPWO)
+18 WRITE !!,$PIECE($TEXT(NTEXT+N),";;",2),?33,@("CNUM"_N_"CT"),?38,$JUSTIFY(CMP,5,1),?44,@("PNUM"_N_"CT"),?49,$JUSTIFY(PMP,5,1),?56,$JUSTIFY($FNUMBER(CMP-PMP,"+,",1),6),?64,@("BNUM"_N_"CT"),?68,$JUSTIFY(BMP,5,1),?74,$JUSTIFY($FNUMBER(CMP-B
MP,"+,",1),6)
+19 WRITE !,$PIECE($TEXT(OTEXT+N),";;",2),?33,(@("CDEN"_N_"CT")-@("CNUM"_N_"CT")),?38,$JUSTIFY(CMPWO,5,1),?44,(@("PDEN"_N_"CT")-@("PNUM"_N_"CT")),?49,$JUSTIFY(PMPWO,5,1),?56,$JUSTIFY($FNUMBER(CMPWO-PMPWO,"+,",1),6)
+20 WRITE ?64,(@("BDEN"_N_"CT")-@("BNUM"_N_"CT")),?68,$JUSTIFY(BMPWO,5,1),?74,$JUSTIFY($FNUMBER(CMPWO-BMPWO,"+,",1),6)
+21 IF $Y>(BGPIOSL-7)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+22 ;Setup summary page/iCare ^TMP global
+23 SET BGPDNCNT=BGPDNCNT+1
+24 SET BGPSSTR="MU.EP.0038."_N_U_$PIECE($TEXT(ITEXT+N),";;",2)_U_@("CEXC"_N_"CT")_U_(@("CDEN"_N_"CT")+@("CEXC"_N_"CT"))_U_@("CNUM"_N_"CT")_U_CMP_"^^^^"
+25 ; 11 12 13 14
+26 SET BGPSSTR=BGPSSTR_U_@("PEXC"_N_"CT")_U_(@("PDEN"_N_"CT")+@("PEXC"_N_"CT"))_U_@("PNUM"_N_"CT")_U_PMP
+27 ; 15 16 17 18
+28 SET BGPSSTR=BGPSSTR_U_@("BEXC"_N_"CT")_U_(@("BDEN"_N_"CT")+@("BEXC"_N_"CT"))_U_@("BNUM"_N_"CT")_U_BMP
+29 SET ^TMP("BGPMU SUMMARY",$JOB,BGPIC,BGPDNCNT)=BGPSSTR
End DoDot:1
+30 IF $DATA(BGPLIST(BGPIC))
DO P2
+31 FOR TF="C","P","B"
DO KILL
+32 QUIT
+33 ;
P2 ;Print the Patient List Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X,N,BGPARR,PTCT
+2 DO HEADERL^BGPMUPH
+3 SET X="Patients who reached 2 years of age and who had at least 1 encounter with the"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="EP, both during the reporting period."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+6 SET X="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="EN=Encounter"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+10 FOR N=1:1:12
Begin DoDot:1
+11 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !!,$PIECE($TEXT(LITEXT+N),";;",2)
+13 SET PTCT=0
+14 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:2
+15 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+16 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+17 KILL BGPARR
+18 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0038"","_$JOB_",""C"",""PAT"",""NOT"","_N_")")
+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 ; uglify the display
SET $PIECE(NODE,U,3)="NM:"_$PIECE(NODE,U,3)
+23 DO DATA(NODE)
End DoDot:3
End DoDot:2
+24 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:2
+25 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
Begin DoDot:3
+26 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+27 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
End DoDot:3
+28 KILL BGPARR
+29 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0038"","_$JOB_",""C"",""PAT"",""INCL"","_N_")")
+30 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:3
+31 SET PTCT=PTCT+1
+32 SET NODE=$GET(BGPARR(PT))
+33 ; uglify the display
SET $PIECE(NODE,U,3)="M:"_$PIECE(NODE,U,3)
+34 DO DATA(NODE)
End DoDot:3
End DoDot:2
+35 IF BGPLIST="A"
Begin DoDot:2
+36 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
Begin DoDot:3
+37 WRITE !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+38 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
End DoDot:3
+39 KILL BGPARR
+40 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0038"","_$JOB_",""C"",""PAT"",""EXCL"","_N_")")
+41 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:3
+42 SET PTCT=PTCT+1
+43 SET NODE=$GET(BGPARR(PT))
+44 DO DATA(NODE)
End DoDot:3
End DoDot:2
+45 WRITE !!,"Total # of patients on list: "_PTCT
End DoDot:1
+46 QUIT
+47 ;F N=1:1:12 D
+48 ;.I BGPLIST="N"!(BGPLIST="A") D
+49 ;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
+50 ;..W !!,$P($T(LITEXT+N),";;",2)
+51 ;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
+52 ;.. W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+53 ;..S PT=0 F S PT=$O(^TMP("BGPMU0038",$J,"C","PAT","INCL",N,PT)) Q:PT="" D
+54 ;...S NODE=$G(^TMP("BGPMU0038",$J,"C","PAT","INCL",N,PT))
+55 ;...D DATA(PT,NODE)
+56 ;.I BGPLIST="D"!(BGPLIST="A") D
+57 ;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
+58 ;..W !!,$P($T(LNTEXT+N),";;",2)
+59 ;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
+60 ;.. W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+61 ;..S PT=0 F S PT=$O(^TMP("BGPMU0038",$J,"C","PAT","NOT",N,PT)) Q:PT="" D
+62 ;...S NODE=$G(^TMP("BGPMU0038",$J,"C","PAT","NOT",N,PT))
+63 ;...D DATA2(PT,NODE)
+64 ;.I BGPLIST="A" D
+65 ;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
+66 ;..W !!,$P($T(LETEXT+N),";;",2)
+67 ;..I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
+68 ;.. W !,"PATIENT NAME",?23,"HRN",?30,"COMMUNITY",?42,"SEX",?46,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
+69 ;..S PT=0 F S PT=$O(^TMP("BGPMU0038",$J,"C","PAT","EXCL",N,PT)) Q:PT="" D
+70 ;...S NODE=$G(^TMP("BGPMU0038",$J,"C","PAT","EXCL",N,PT))
+71 ;...D DATA2(PT,NODE)
+72 ;Q
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM
+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 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 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
End DoDot:1
+13 WRITE !,NAME,?23,HRN,?30,COMM,?43,SEX,?46,AGE,?50,DEN,?63,NUM
+14 QUIT
CALCS(N,CMP,PMP,BMP) ;
+1 SET CMP=$FNUMBER($SELECT(@("CDEN"_N_"CT")>0:$$ROUND^BGPMUA01((@("CNUM"_N_"CT")/@("CDEN"_N_"CT")),3)*100,1:0),",",1)
+2 SET PMP=$FNUMBER($SELECT(@("PDEN"_N_"CT")>0:$$ROUND^BGPMUA01((@("PNUM"_N_"CT")/@("PDEN"_N_"CT")),3)*100,1:0),",",1)
+3 SET BMP=$FNUMBER($SELECT(@("BDEN"_N_"CT")>0:$$ROUND^BGPMUA01((@("BNUM"_N_"CT")/@("BDEN"_N_"CT")),3)*100,1:0),",",1)
+4 QUIT
CALCSWO(N,CMP,PMP,BMP) ;
+1 SET CMP=$FNUMBER($SELECT(@("CDEN"_N_"CT")>0:$$ROUND^BGPMUA01(((@("CDEN"_N_"CT")-@("CNUM"_N_"CT"))/@("CDEN"_N_"CT")),3)*100,1:0),",",1)
+2 SET PMP=$FNUMBER($SELECT(@("PDEN"_N_"CT")>0:$$ROUND^BGPMUA01(((@("PDEN"_N_"CT")-@("PNUM"_N_"CT"))/@("PDEN"_N_"CT")),3)*100,1:0),",",1)
+3 SET BMP=$FNUMBER($SELECT(@("BDEN"_N_"CT")>0:$$ROUND^BGPMUA01(((@("BDEN"_N_"CT")-@("BNUM"_N_"CT"))/@("BDEN"_N_"CT")),3)*100,1:0),",",1)
+4 QUIT
NEW ;NEW all variables for timeframe
+1 FOR BGPI=1:1:12
NEW @(TF_"EXC"_BGPI_"CT")
+2 FOR BGPI=1:1:12
NEW @(TF_"DEN"_BGPI_"CT")
+3 FOR BGPI=1:1:12
NEW @(TF_"NUM"_BGPI_"CT")
+4 QUIT
LOAD ;Load variables from TMP global
+1 SET @(TF_"TOTALS")=$GET(^TMP("BGPMU0038",$JOB,TF,"TOT"))
+2 ;exclusion counts
+3 FOR BGPI=1:1:12
SET @(TF_"EXC"_BGPI_"CT")=+$GET(^TMP("BGPMU0038",$JOB,TF,"EXC",BGPI))
+4 ;denominator counts
+5 FOR BGPI=1:1:12
SET @(TF_"DEN"_BGPI_"CT")=+$GET(^TMP("BGPMU0038",$JOB,TF,"DEN",BGPI))
+6 ;numerator counts
+7 FOR BGPI=1:1:12
SET @(TF_"NUM"_BGPI_"CT")=+$GET(^TMP("BGPMU0038",$JOB,TF,"NUM",BGPI))
+8 QUIT
KILL ;KILL all varables for timeframe
+1 FOR BGPI=1:1:12
NEW @(TF_"EXC"_BGPI_"CT")
+2 FOR BGPI=1:1:12
NEW @(TF_"DEN"_BGPI_"CT")
+3 FOR BGPI=1:1:12
NEW @(TF_"NUM"_BGPI_"CT")
+4 QUIT
XML38 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
+2 ;F BGPI=1:1:12 S BGPXML(BGPI)="1"_U_BGPI_U_+$G(^TMP("BGPMU0038",$J,"C","DEN",BGPI))_U_+$G(^TMP("BGPMU0038",$J,"C","NUM",BGPI))_U_+$G(^TMP("BGPMU0038",$J,"C","EXC",BGPI))
+3 SET BGPXML(1)="240"_U_""_U_+$GET(^TMP("BGPMU0038",$JOB,"C","DEN",12))_U_+$GET(^TMP("BGPMU0038",$JOB,"C","NUM",12))_U_+$GET(^TMP("BGPMU0038",$JOB,"C","EXC",12))
+4 KILL ^TMP("BGPMU0038",$JOB)
+5 QUIT
ITEXT ;
+1 ;;4 DTaP
+2 ;;3 IPV
+3 ;;1 MMR
+4 ;;3 HiB
+5 ;;3 HepB
+6 ;;1 VZV
+7 ;;4 Pneumococcal
+8 ;;2 HepA
+9 ;;2 Rotavirus
+10 ;;2 Influenza
+11 ;;4:3:1:3:3:1
+12 ;;4:3:1:3:3:1:4
NTEXT ;
+1 ;;# w/4 DTaP
+2 ;;# w/3 IPV
+3 ;;# w/1 MMR
+4 ;;# w/3 HiB
+5 ;;# w/3 Hep B
+6 ;;# w/1 VZV
+7 ;;# w/4 Pneumococcal
+8 ;;# w/2 Hep A
+9 ;;# w/2 Rotavirus
+10 ;;# w/2 Influenza
+11 ;;# w/1-6 (4:3:1:3:3:1)
+12 ;;# w/1-7 (4:3:1:3:3:1:4)
OTEXT ;
+1 ;;# w/o 4 DTaP
+2 ;;# w/o 3 IPV
+3 ;;# w/o 1 MMR
+4 ;;# w/o 3 HiB
+5 ;;# w/o 3 Hep B
+6 ;;# w/o 1 VZV
+7 ;;# w/o 4 Pneumococcal
+8 ;;# w/o 2 Hep A
+9 ;;# w/o 2 Rotavirus
+10 ;;# w/o 2 Influenza
+11 ;;# w/o 1-6 (4:3:1:3:3:1)
+12 ;;# w/o 1-7 (4:3:1:3:3:1:4)
LITEXT ;
+1 ;;1: 4 DTaP Patients
+2 ;;2: 3 IPV Patients
+3 ;;3: 1 MMR Patients
+4 ;;4: 3 HiB Patients
+5 ;;5: 3 Hepatitis B Patients
+6 ;;6: 1 VZV Patients
+7 ;;7: 4 Pneumococcal Patients
+8 ;;8: 2 Hepatitis A Patients
+9 ;;9: 2 Rotavirus Patients
+10 ;;10: 2 Influenza Patients
+11 ;;11: 4:3:1:3:3:1 Patients
+12 ;;12: 4:3:1:3:3:1:4 Patients
+13 ;;
+14 ;;DTAP numerator patients
+15 ;;IPV numerator patients
+16 ;;MMR numerator patients
+17 ;;HiB numerator patients
+18 ;;HepB numerator patients
+19 ;;VZV numerator patients
+20 ;;Pneumo numerator patients
+21 ;;HepA numerator patients
+22 ;;Rotavirus numerator patients
+23 ;;Influenza numerator patients
+24 ;;Numerator patients for 1 thru 6
+25 ;;Numerator patients for 1 thru 7
LNTEXT ;
+1 ;;Denominator patients not in numerator for DTAP
+2 ;;Denominator patients not in numerator for IPV
+3 ;;Denominator patients not in numerator for MMR
+4 ;;Denominator patients not in numerator for HiB
+5 ;;Denominator patients not in numerator for Hep B
+6 ;;Denominator patients not in numerator for VZV
+7 ;;Denominator patients not in numerator for Pneumococcal
+8 ;;Denominator patients not in numerator for Hep A
+9 ;;Denominator patients not in numerator for Rotavirus
+10 ;;Denominator patients not in numerator for Influenza
+11 ;;Denominator patients not in numerator for 1 thru 6
+12 ;;Denominator patients not in numerator for 1 thru 7
LETEXT ;
+1 ;;Exclusion patients for DTAP
+2 ;;Exclusion patients for IPV
+3 ;;Exclusion patients for MMR
+4 ;;Exclusion patients for HiB
+5 ;;Exclusion patients for Hep B
+6 ;;Exclusion patients for VZV
+7 ;;Exclusion patients for Pneumococcal
+8 ;;Exclusion patients for Hep A
+9 ;;Exclusion patients for Rotavirus
+10 ;;Exclusion patients for Influenza
+11 ;;Exclusion patients for 1 thru 6
+12 ;;Exclusion patients for 1 thru 7