BGPMUW01 ; IHS/MSC/AJF -Meaningful Use NQF Measure ID:0024 ;22-Mar-2011 10:08;DU
;;11.1;IHS CLINICAL REPORTING SYSTEM;**1**;JUN 27, 2011;Build 106
;;This program will collect information for Weight Assessment and Counseling
;; for Children and Adolescents
;;
ENTRY ;Get Measurement Summary for a patient given a date range and a Provider
;Input:
;BEGDT: Date to begin query for Outpatient Encounters
;ENDDT: Date to end query for Outpatient Encounters
;BGPMUTF:Time frame for this report("C"-current,"B"-baseline,"P"-previous)
;Output:Temp globaal of results
;
N NOWDT,NOWYR,%
D NOW^%DTC
S NOWDT=$P(%,"."),NOWYR=$E(NOWDT,1,3),U="^"
;
N VSTSDT,VSTEDT,FIRST,AGE,AGE2,AGE10,AGE16,VIEN,NOA,NOB,NOC,PCA,PCB,PCC,FINALD1,FINALD2,FINALD3,VNODE,PCPIEN,AUPNVIEN
N DATA,VDATE,VIEN,IEN,RETVAL,CNT,PT1,PT2,AENC,BENC
;Counters for Numerators that DID NOT meet numerator criteria
N NOTCA1,NOTCA2,NOTCA3,NOTCB1,NOTCB2,NOTCB3,NOTCC1,NOTCC2,NOTCC3
N FINA,FINB,FINC,ENDDT,BEGDT
S (NOTCA1,NOTCA2,NOTCA3,NOTCB1,NOTCB2,NOTCB3,NOTCC1,NOTCC2,NOTCC3)=0
;Counters for Denominators and Numerators that MEET criteria
N POPCA,POPCB,POPCC,NUMCA1,NUMCA2,DEN,NUMCA3,NUMCB1,NUMCB2,NUMCB3,NUMCC1,NUMCC2,NUMCC3,DNOMA,DNOMB,DNOMC
S (POPCA,POPCB,POPCC,NUMCA1,NUMCA2,NUMCA3,NUMCB1,NUMCB2,NUMCB3,NUMCC1,NUMCC2,NUMCC3,DNOMA,DNOMB,DNOMC)=0
S AGE2=2,AGE10=10,AGE16=16,CNT=0
S RETVAL="",VIEN=0
S BEGDT=9999999-BGPBDATE,ENDDT=9999999-BGPEDATE
;
Q:BGPAGEB<2!(BGPAGEB>16)
S FIRST=ENDDT-0.1 F S FIRST=$O(^AUPNVSIT("AA",DFN,FIRST)) Q:FIRST=""!($P(FIRST,".",1)>BEGDT)!(+VIEN) D
.S IEN=0 F S IEN=$O(^AUPNVSIT("AA",DFN,FIRST,IEN)) Q:'+IEN!(+VIEN) D
..;Check provider, Only visits for chosen provider
..Q:'$$PRV^BGPMUUT1(IEN,BGPPROV)
..;Quit if the patient has a pregnancy diagnosis
..I ($P(^DPT(DFN,0),U,2)="F")&($$LASTDX^BGPMUUT2(DFN,BGPBDATE,BGPEDATE,"BGPMU PREGNANCY ALL ICD")) Q
..I ($P(^DPT(DFN,0),U,2)="F")&($$LASTDX^BGPMUUT2(DFN,BGPBDATE,BGPEDATE,"BGPMU BMI PREG ENC DX")) Q
..;Quit if the visit does not have a valid E&M code
..S AENC=$$VSTCPT^BGPMUUT1(DFN,IEN,"BGPMU BMI ENC PEDS EM")
..S BENC=$$VSTPOV^BGPMUUT3(DFN,IEN,"BGPMU BMI ENC PEDS DX")
..Q:(AENC=0)&(BENC=0)
..S DATA=$G(^AUPNVSIT(IEN,0))
..S VSTSDT=$P($G(^AUPNVSIT(IEN,0)),U,1),VIEN=IEN
..S DEN="EN:"_$$DATE^BGPMUUTL(VSTSDT)
I +VIEN D
.;Counter for the Initial Population Criteria 1
.S VSTSDT=$P(BGPBDATE,".",1),VSTEDT=BGPEDATE
.S POPCA=POPCA+1
.;
.;Range A (Ages 2-16 inclusive)
.D NUMATOR(DFN,"BGPMU 2-16",.NUMCA1,.NUMCA2,.NUMCA3,.DNOMA,.NOTCA1,VSTSDT,VSTEDT,DEN)
.;Range B (Ages 2-10 inclusive)
.I BGPAGEB<11 D NUMATOR(DFN,"BGPMU 2-10",.NUMCB1,.NUMCB2,.NUMCB3,.DNOMB,.NOTCB1,VSTSDT,VSTEDT,DEN)
.;Range C (Ages 11-16 inclusive)
.I BGPAGEB>10 D NUMATOR(DFN,"BGPMU 11-16",.NUMCC1,.NUMCC2,.NUMCC3,.DNOMC,.NOTCC1,VSTSDT,VSTEDT,DEN)
.;
.;Summary calculations
.S FINA=$G(^TMP("BGPMU 2-16",$J,BGPMUTF,"POPULATION"))
.S FINB=$G(^TMP("BGPMU 2-10",$J,BGPMUTF,"POPULATION"))
.S FINC=$G(^TMP("BGPMU 11-16",$J,BGPMUTF,"POPULATION"))
.;Final Denominator for all
.S FINALD1=$P(FINA,U,4)
.S $P(FINA,U,4)=$P(FINA,U,4)+DNOMA
.S $P(FINA,U,1)=$P(FINA,U,1)+NUMCA1
.S $P(FINA,U,2)=$P(FINA,U,2)+NUMCA2
.S $P(FINA,U,3)=$P(FINA,U,3)+NUMCA3
.S $P(FINA,U,5)=$P(FINA,U,5)+NOTCA1
.S FINALD2=$P(FINB,U,4)
.I BGPAGEE>1&(BGPAGEE<11) D
..S $P(FINB,U,4)=$P(FINB,U,4)+DNOMB
..S $P(FINB,U,1)=$P(FINB,U,1)+NUMCB1
..S $P(FINB,U,2)=$P(FINB,U,2)+NUMCB2
..S $P(FINB,U,3)=$P(FINB,U,3)+NUMCB3
..S $P(FINB,U,5)=$P(FINB,U,5)+NOTCB1
.S FINALD3=$P(FINC,U,4)
.I BGPAGEE>10&(BGPAGEE<17) D
..S $P(FINC,U,4)=$P(FINC,U,4)+DNOMC
..S $P(FINC,U,1)=$P(FINC,U,1)+NUMCC1
..S $P(FINC,U,2)=$P(FINC,U,2)+NUMCC2
..S $P(FINC,U,3)=$P(FINC,U,3)+NUMCC3
..S $P(FINC,U,5)=$P(FINC,U,5)+NOTCC1
.;Store Final Date into work global for printing reports
.S ^TMP("BGPMU 2-16",$J,BGPMUTF,"POPULATION")=FINA
.S ^TMP("BGPMU 2-10",$J,BGPMUTF,"POPULATION")=FINB
.S ^TMP("BGPMU 11-16",$J,BGPMUTF,"POPULATION")=FINC
Q
;
NUMATOR(DFN,PATPOP,NUM1,NUM2,NUM3,DENOM,NONUM,VSTSDT,VSTEDT,DEN) ;Calculate Numerators
;Input:
; DFN : Patient Internal Entry Number
; PATPOP : Patient Population Group ("BGPMU 2-16" or "BGPMU 2-10" or "BGPMU 11-16")
; NUM1 : Numerator Counter - (Add 1 if patient is 2-16 and had BMI)
; NUM2 : Numerator Counter - (Add 1 if patient is 2-10 and had Counseling on Nutrition)
; NUM3 : Numerator Counter - (Add 1 if patient is 11-16 and had Counseling on Physical Activity)
; DENOM : Denominator Counter - Total Patients between 2-17
; NONUM : Numerator Counter - (Total number of patients that did not receive (NUM1 or NUM2 or NUM3 above)
; VSDSDT : Visit Start Date
; VSTEDT : Visit End Date
;Output
; Temporary work global to contain calculations: ^TMP($J,PATPOP,BGPMUTF)=NUM1_U_NUM2_U_NUM3_U_DENOM_U_NONUM
;
N I,J,K,L,M,STR1,STR2,STR3,NUM
;
S DENOM=1 ;Denominator for Population Criteria
S I=$$LASTDX^BGPMUUT2(DFN,VSTSDT,VSTEDT,"BGPMU BMI PERCENTILE ICD")
S J=$$LASTDX^BGPMUUT2(DFN,VSTSDT,VSTEDT,"BGPMU COUNSELING NUTRITION ICD")
S K=$$LASTDX^BGPMUUT2(DFN,VSTSDT,VSTEDT,"BGPMU COUNSELING PHYSICAL ACT")
S L=$$VSTCPT^BGPMUUT1(DFN,VIEN,"BGPMU COUNSELING NUTRITION CPT")
S M=$$VSTCPT^BGPMUUT1(DFN,VIEN,"BGPMU COUNSELING PHYS ACT CPT")
I +I S NUM1=1 ;BMI PERCENTILE COUNTER
I +J!(+L) S NUM2=1 ;COUNSELING ON NUTRITION COUNTER
I +K!(+M) S NUM3=1 ;COUNSELING ON PHYSICAL ACTIVITY COUNTER
;Set counter if patient DID NOT receive one of the criteria above
I 'I&('J)&('K) S NONUM=1
;Set up work global to store data for final calculations
S ^TMP(PATPOP,$J,BGPMUTF)=NUM1_U_NUM2_U_NUM3_U_DENOM_U_NONUM
;Set up temp globals for patient lists (per numerator)
I PATPOP="BGPMU 2-16"&(BGPMUTF="C") D
.S (STR1,STR2,STR3)="",NUM=""
.I +I S STR1=$P(I,U,2)_" "_$$DATE^BGPMUUTL($P(I,U,3))
.I +J D
..I STR2'="" S STR2=STR2_";"_$P(J,U,2)_" "_$$DATE^BGPMUUTL($P(J,U,3))
..I STR2="" S STR2=$P(J,U,2)_" "_$$DATE^BGPMUUTL($P(J,U,3))
.I +K D
..I STR3'="" S STR3=STR3_";"_$P(K,U,2)_" "_$$DATE^BGPMUUTL($P(K,U,3))
..I STR3="" S STR3=$P(K,U,2)_" "_$$DATE^BGPMUUTL($P(K,U,3))
.I (+NUM1) D
..S PT2=$G(^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",1))
..S PT2=PT2+1
..S NUM="M:"_STR1
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",1,PT2)=DFN_U_DEN_U_NUM
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",1)=PT2
..;Setup iCare array for patient
..S BGPICARE("MU.EP.0024.1",BGPMUTF)=1_U_+NUM1_U_""_U_DEN_";"_NUM
.E D
..S PT1=$G(^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",1))
..S PT1=PT1+1
..S NUM="NM:"_STR1
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",1,PT1)=DFN_U_DEN_U_NUM
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",1)=PT1
..;Setup iCare array for patient
..S BGPICARE("MU.EP.0024.1",BGPMUTF)=1_U_0_U_""_U_DEN_";"_NUM
.I (+NUM2) D
..S PT2=$G(^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",2))
..S PT2=PT2+1
..S NUM="M:"_STR2
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",2,PT2)=DFN_U_DEN_U_NUM
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",2)=PT2
..;Setup iCare array for patient
..S BGPICARE("MU.EP.0024.3",BGPMUTF)=1_U_+NUM2_U_""_U_DEN_";"_NUM
.E D
..S PT1=$G(^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",2))
..S PT1=PT1+1
..S NUM="NM:"_STR2
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",2,PT1)=DFN_U_DEN_U_NUM
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",2)=PT1
..;Setup iCare array for patient
..S BGPICARE("MU.EP.0024.3",BGPMUTF)=1_U_0_U_""_U_DEN_";"_NUM
.I (+NUM3) D
..S PT2=$G(^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",3))
..S PT2=PT2+1
..S NUM="M:"_STR3
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",3,PT2)=DFN_U_DEN_U_NUM
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NUM",3)=PT2
..;Setup iCare array for patient
..S BGPICARE("MU.EP.0024.5",BGPMUTF)=1_U_+NUM3_U_""_U_DEN_";"_NUM
.E D
..S PT1=$G(^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",3))
..S PT1=PT1+1
..S NUM="NM:"_STR3
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",3,PT1)=DFN_U_DEN_U_NUM
..S ^TMP("BGPMU0024",$J,"PAT",BGPMUTF,"NOT",3)=PT1
..;Setup iCare array for patient
..S BGPICARE("MU.EP.0024.5",BGPMUTF)=1_U_+NUM3_U_""_U_DEN_";"_NUM
Q
BGPMUW01 ; IHS/MSC/AJF -Meaningful Use NQF Measure ID:0024 ;22-Mar-2011 10:08;DU
+1 ;;11.1;IHS CLINICAL REPORTING SYSTEM;**1**;JUN 27, 2011;Build 106
+2 ;;This program will collect information for Weight Assessment and Counseling
+3 ;; for Children and Adolescents
+4 ;;
ENTRY ;Get Measurement Summary for a patient given a date range and a Provider
+1 ;Input:
+2 ;BEGDT: Date to begin query for Outpatient Encounters
+3 ;ENDDT: Date to end query for Outpatient Encounters
+4 ;BGPMUTF:Time frame for this report("C"-current,"B"-baseline,"P"-previous)
+5 ;Output:Temp globaal of results
+6 ;
+7 NEW NOWDT,NOWYR,%
+8 DO NOW^%DTC
+9 SET NOWDT=$PIECE(%,".")
SET NOWYR=$EXTRACT(NOWDT,1,3)
SET U="^"
+10 ;
+11 NEW VSTSDT,VSTEDT,FIRST,AGE,AGE2,AGE10,AGE16,VIEN,NOA,NOB,NOC,PCA,PCB,PCC,FINALD1,FINALD2,FINALD3,VNODE,PCPIEN,AUPNVIEN
+12 NEW DATA,VDATE,VIEN,IEN,RETVAL,CNT,PT1,PT2,AENC,BENC
+13 ;Counters for Numerators that DID NOT meet numerator criteria
+14 NEW NOTCA1,NOTCA2,NOTCA3,NOTCB1,NOTCB2,NOTCB3,NOTCC1,NOTCC2,NOTCC3
+15 NEW FINA,FINB,FINC,ENDDT,BEGDT
+16 SET (NOTCA1,NOTCA2,NOTCA3,NOTCB1,NOTCB2,NOTCB3,NOTCC1,NOTCC2,NOTCC3)=0
+17 ;Counters for Denominators and Numerators that MEET criteria
+18 NEW POPCA,POPCB,POPCC,NUMCA1,NUMCA2,DEN,NUMCA3,NUMCB1,NUMCB2,NUMCB3,NUMCC1,NUMCC2,NUMCC3,DNOMA,DNOMB,DNOMC
+19 SET (POPCA,POPCB,POPCC,NUMCA1,NUMCA2,NUMCA3,NUMCB1,NUMCB2,NUMCB3,NUMCC1,NUMCC2,NUMCC3,DNOMA,DNOMB,DNOMC)=0
+20 SET AGE2=2
SET AGE10=10
SET AGE16=16
SET CNT=0
+21 SET RETVAL=""
SET VIEN=0
+22 SET BEGDT=9999999-BGPBDATE
SET ENDDT=9999999-BGPEDATE
+23 ;
+24 IF BGPAGEB<2!(BGPAGEB>16)
QUIT
+25 SET FIRST=ENDDT-0.1
FOR
SET FIRST=$ORDER(^AUPNVSIT("AA",DFN,FIRST))
IF FIRST=""!($PIECE(FIRST,".",1)>BEGDT)!(+VIEN)
QUIT
Begin DoDot:1
+26 SET IEN=0
FOR
SET IEN=$ORDER(^AUPNVSIT("AA",DFN,FIRST,IEN))
IF '+IEN!(+VIEN)
QUIT
Begin DoDot:2
+27 ;Check provider, Only visits for chosen provider
+28 IF '$$PRV^BGPMUUT1(IEN,BGPPROV)
QUIT
+29 ;Quit if the patient has a pregnancy diagnosis
+30 IF ($PIECE(^DPT(DFN,0),U,2)="F")&($$LASTDX^BGPMUUT2(DFN,BGPBDATE,BGPEDATE,"BGPMU PREGNANCY ALL ICD"))
QUIT
+31 IF ($PIECE(^DPT(DFN,0),U,2)="F")&($$LASTDX^BGPMUUT2(DFN,BGPBDATE,BGPEDATE,"BGPMU BMI PREG ENC DX"))
QUIT
+32 ;Quit if the visit does not have a valid E&M code
+33 SET AENC=$$VSTCPT^BGPMUUT1(DFN,IEN,"BGPMU BMI ENC PEDS EM")
+34 SET BENC=$$VSTPOV^BGPMUUT3(DFN,IEN,"BGPMU BMI ENC PEDS DX")
+35 IF (AENC=0)&(BENC=0)
QUIT
+36 SET DATA=$GET(^AUPNVSIT(IEN,0))
+37 SET VSTSDT=$PIECE($GET(^AUPNVSIT(IEN,0)),U,1)
SET VIEN=IEN
+38 SET DEN="EN:"_$$DATE^BGPMUUTL(VSTSDT)
End DoDot:2
End DoDot:1
+39 IF +VIEN
Begin DoDot:1
+40 ;Counter for the Initial Population Criteria 1
+41 SET VSTSDT=$PIECE(BGPBDATE,".",1)
SET VSTEDT=BGPEDATE
+42 SET POPCA=POPCA+1
+43 ;
+44 ;Range A (Ages 2-16 inclusive)
+45 DO NUMATOR(DFN,"BGPMU 2-16",.NUMCA1,.NUMCA2,.NUMCA3,.DNOMA,.NOTCA1,VSTSDT,VSTEDT,DEN)
+46 ;Range B (Ages 2-10 inclusive)
+47 IF BGPAGEB<11
DO NUMATOR(DFN,"BGPMU 2-10",.NUMCB1,.NUMCB2,.NUMCB3,.DNOMB,.NOTCB1,VSTSDT,VSTEDT,DEN)
+48 ;Range C (Ages 11-16 inclusive)
+49 IF BGPAGEB>10
DO NUMATOR(DFN,"BGPMU 11-16",.NUMCC1,.NUMCC2,.NUMCC3,.DNOMC,.NOTCC1,VSTSDT,VSTEDT,DEN)
+50 ;
+51 ;Summary calculations
+52 SET FINA=$GET(^TMP("BGPMU 2-16",$JOB,BGPMUTF,"POPULATION"))
+53 SET FINB=$GET(^TMP("BGPMU 2-10",$JOB,BGPMUTF,"POPULATION"))
+54 SET FINC=$GET(^TMP("BGPMU 11-16",$JOB,BGPMUTF,"POPULATION"))
+55 ;Final Denominator for all
+56 SET FINALD1=$PIECE(FINA,U,4)
+57 SET $PIECE(FINA,U,4)=$PIECE(FINA,U,4)+DNOMA
+58 SET $PIECE(FINA,U,1)=$PIECE(FINA,U,1)+NUMCA1
+59 SET $PIECE(FINA,U,2)=$PIECE(FINA,U,2)+NUMCA2
+60 SET $PIECE(FINA,U,3)=$PIECE(FINA,U,3)+NUMCA3
+61 SET $PIECE(FINA,U,5)=$PIECE(FINA,U,5)+NOTCA1
+62 SET FINALD2=$PIECE(FINB,U,4)
+63 IF BGPAGEE>1&(BGPAGEE<11)
Begin DoDot:2
+64 SET $PIECE(FINB,U,4)=$PIECE(FINB,U,4)+DNOMB
+65 SET $PIECE(FINB,U,1)=$PIECE(FINB,U,1)+NUMCB1
+66 SET $PIECE(FINB,U,2)=$PIECE(FINB,U,2)+NUMCB2
+67 SET $PIECE(FINB,U,3)=$PIECE(FINB,U,3)+NUMCB3
+68 SET $PIECE(FINB,U,5)=$PIECE(FINB,U,5)+NOTCB1
End DoDot:2
+69 SET FINALD3=$PIECE(FINC,U,4)
+70 IF BGPAGEE>10&(BGPAGEE<17)
Begin DoDot:2
+71 SET $PIECE(FINC,U,4)=$PIECE(FINC,U,4)+DNOMC
+72 SET $PIECE(FINC,U,1)=$PIECE(FINC,U,1)+NUMCC1
+73 SET $PIECE(FINC,U,2)=$PIECE(FINC,U,2)+NUMCC2
+74 SET $PIECE(FINC,U,3)=$PIECE(FINC,U,3)+NUMCC3
+75 SET $PIECE(FINC,U,5)=$PIECE(FINC,U,5)+NOTCC1
End DoDot:2
+76 ;Store Final Date into work global for printing reports
+77 SET ^TMP("BGPMU 2-16",$JOB,BGPMUTF,"POPULATION")=FINA
+78 SET ^TMP("BGPMU 2-10",$JOB,BGPMUTF,"POPULATION")=FINB
+79 SET ^TMP("BGPMU 11-16",$JOB,BGPMUTF,"POPULATION")=FINC
End DoDot:1
+80 QUIT
+81 ;
NUMATOR(DFN,PATPOP,NUM1,NUM2,NUM3,DENOM,NONUM,VSTSDT,VSTEDT,DEN) ;Calculate Numerators
+1 ;Input:
+2 ; DFN : Patient Internal Entry Number
+3 ; PATPOP : Patient Population Group ("BGPMU 2-16" or "BGPMU 2-10" or "BGPMU 11-16")
+4 ; NUM1 : Numerator Counter - (Add 1 if patient is 2-16 and had BMI)
+5 ; NUM2 : Numerator Counter - (Add 1 if patient is 2-10 and had Counseling on Nutrition)
+6 ; NUM3 : Numerator Counter - (Add 1 if patient is 11-16 and had Counseling on Physical Activity)
+7 ; DENOM : Denominator Counter - Total Patients between 2-17
+8 ; NONUM : Numerator Counter - (Total number of patients that did not receive (NUM1 or NUM2 or NUM3 above)
+9 ; VSDSDT : Visit Start Date
+10 ; VSTEDT : Visit End Date
+11 ;Output
+12 ; Temporary work global to contain calculations: ^TMP($J,PATPOP,BGPMUTF)=NUM1_U_NUM2_U_NUM3_U_DENOM_U_NONUM
+13 ;
+14 NEW I,J,K,L,M,STR1,STR2,STR3,NUM
+15 ;
+16 ;Denominator for Population Criteria
SET DENOM=1
+17 SET I=$$LASTDX^BGPMUUT2(DFN,VSTSDT,VSTEDT,"BGPMU BMI PERCENTILE ICD")
+18 SET J=$$LASTDX^BGPMUUT2(DFN,VSTSDT,VSTEDT,"BGPMU COUNSELING NUTRITION ICD")
+19 SET K=$$LASTDX^BGPMUUT2(DFN,VSTSDT,VSTEDT,"BGPMU COUNSELING PHYSICAL ACT")
+20 SET L=$$VSTCPT^BGPMUUT1(DFN,VIEN,"BGPMU COUNSELING NUTRITION CPT")
+21 SET M=$$VSTCPT^BGPMUUT1(DFN,VIEN,"BGPMU COUNSELING PHYS ACT CPT")
+22 ;BMI PERCENTILE COUNTER
IF +I
SET NUM1=1
+23 ;COUNSELING ON NUTRITION COUNTER
IF +J!(+L)
SET NUM2=1
+24 ;COUNSELING ON PHYSICAL ACTIVITY COUNTER
IF +K!(+M)
SET NUM3=1
+25 ;Set counter if patient DID NOT receive one of the criteria above
+26 IF 'I&('J)&('K)
SET NONUM=1
+27 ;Set up work global to store data for final calculations
+28 SET ^TMP(PATPOP,$JOB,BGPMUTF)=NUM1_U_NUM2_U_NUM3_U_DENOM_U_NONUM
+29 ;Set up temp globals for patient lists (per numerator)
+30 IF PATPOP="BGPMU 2-16"&(BGPMUTF="C")
Begin DoDot:1
+31 SET (STR1,STR2,STR3)=""
SET NUM=""
+32 IF +I
SET STR1=$PIECE(I,U,2)_" "_$$DATE^BGPMUUTL($PIECE(I,U,3))
+33 IF +J
Begin DoDot:2
+34 IF STR2'=""
SET STR2=STR2_";"_$PIECE(J,U,2)_" "_$$DATE^BGPMUUTL($PIECE(J,U,3))
+35 IF STR2=""
SET STR2=$PIECE(J,U,2)_" "_$$DATE^BGPMUUTL($PIECE(J,U,3))
End DoDot:2
+36 IF +K
Begin DoDot:2
+37 IF STR3'=""
SET STR3=STR3_";"_$PIECE(K,U,2)_" "_$$DATE^BGPMUUTL($PIECE(K,U,3))
+38 IF STR3=""
SET STR3=$PIECE(K,U,2)_" "_$$DATE^BGPMUUTL($PIECE(K,U,3))
End DoDot:2
+39 IF (+NUM1)
Begin DoDot:2
+40 SET PT2=$GET(^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",1))
+41 SET PT2=PT2+1
+42 SET NUM="M:"_STR1
+43 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",1,PT2)=DFN_U_DEN_U_NUM
+44 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",1)=PT2
+45 ;Setup iCare array for patient
+46 SET BGPICARE("MU.EP.0024.1",BGPMUTF)=1_U_+NUM1_U_""_U_DEN_";"_NUM
End DoDot:2
+47 IF '$TEST
Begin DoDot:2
+48 SET PT1=$GET(^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",1))
+49 SET PT1=PT1+1
+50 SET NUM="NM:"_STR1
+51 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",1,PT1)=DFN_U_DEN_U_NUM
+52 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",1)=PT1
+53 ;Setup iCare array for patient
+54 SET BGPICARE("MU.EP.0024.1",BGPMUTF)=1_U_0_U_""_U_DEN_";"_NUM
End DoDot:2
+55 IF (+NUM2)
Begin DoDot:2
+56 SET PT2=$GET(^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",2))
+57 SET PT2=PT2+1
+58 SET NUM="M:"_STR2
+59 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",2,PT2)=DFN_U_DEN_U_NUM
+60 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",2)=PT2
+61 ;Setup iCare array for patient
+62 SET BGPICARE("MU.EP.0024.3",BGPMUTF)=1_U_+NUM2_U_""_U_DEN_";"_NUM
End DoDot:2
+63 IF '$TEST
Begin DoDot:2
+64 SET PT1=$GET(^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",2))
+65 SET PT1=PT1+1
+66 SET NUM="NM:"_STR2
+67 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",2,PT1)=DFN_U_DEN_U_NUM
+68 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",2)=PT1
+69 ;Setup iCare array for patient
+70 SET BGPICARE("MU.EP.0024.3",BGPMUTF)=1_U_0_U_""_U_DEN_";"_NUM
End DoDot:2
+71 IF (+NUM3)
Begin DoDot:2
+72 SET PT2=$GET(^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",3))
+73 SET PT2=PT2+1
+74 SET NUM="M:"_STR3
+75 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",3,PT2)=DFN_U_DEN_U_NUM
+76 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NUM",3)=PT2
+77 ;Setup iCare array for patient
+78 SET BGPICARE("MU.EP.0024.5",BGPMUTF)=1_U_+NUM3_U_""_U_DEN_";"_NUM
End DoDot:2
+79 IF '$TEST
Begin DoDot:2
+80 SET PT1=$GET(^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",3))
+81 SET PT1=PT1+1
+82 SET NUM="NM:"_STR3
+83 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",3,PT1)=DFN_U_DEN_U_NUM
+84 SET ^TMP("BGPMU0024",$JOB,"PAT",BGPMUTF,"NOT",3)=PT1
+85 ;Setup iCare array for patient
+86 SET BGPICARE("MU.EP.0024.5",BGPMUTF)=1_U_+NUM3_U_""_U_DEN_";"_NUM
End DoDot:2
End DoDot:1
+87 QUIT