BGPMUAD6 ; IHS/MSC/MGH - Print MI measure NQF0062 and NQF0064 ;07-Jul-2011 14:19;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Delimeted output
;Diabetes Nephropathy screening
NEPH(CNT) ;EP
D P1
K ^TMP("BGPMU0062",$J)
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3
N PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRD7,PRD8,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRN7,PRN8
S STRING1=$$NUM62("C")
S STRING2=$$NUM62("P")
S STRING3=$$NUM62("B")
D SUMMARY1^BGPMUAP6(STRING1,STRING2,STRING3)
;population
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5) S PRD1=$FN(PRD1,",+",1)
S PRD2=$P(STRING1,U,6)-$P(STRING2,U,6) S PRD2=$FN(PRD2,",+",1)
S PRD3=$P(STRING1,U,7)-$P(STRING2,U,7) S PRD3=$FN(PRD3,",+",1)
S PRD7=$P(STRING1,U,9)-$P(STRING2,U,9) S PRD7=$FN(PRD7,",+",1)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5) S PRN1=$FN(PRN1,",+",1)
S PRN2=$P(STRING1,U,6)-$P(STRING3,U,6) S PRN2=$FN(PRN2,",+",1)
S PRN3=$P(STRING1,U,7)-$P(STRING3,U,7) S PRN3=$FN(PRN3,",+",1)
S PRN7=$P(STRING1,U,9)-$P(STRING3,U,9) S PRN7=$FN(PRN7,",+",1)
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="Pts 18-75 w/diabetes"_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="# Excluded (Exc)"_U_$P(STRING1,U,4)_U_U_$P(STRING2,U,4)_U_U_U_$P(STRING3,U,4)
D S^BGPMUDEL(X,1,1)
S X="Pts 18-75 w/diabetes less Exc"_U_$P(STRING1,U,3)_U_U_$P(STRING2,U,3)_U_U_U_$P(STRING3,U,3)
D S^BGPMUDEL(X,1,1)
S X="# w/nephropathy test or evidence"_U_$P(STRING1,U,2)_U_$J($P(STRING1,U,5),5,1)_U_$P(STRING2,U,2)_U_$J($P(STRING2,U,5),5,1)_U_$FN(PRD1,",+",1)_U_$P(STRING3,U,2)_U_$J($P(STRING3,U,5),5,1)_U_$FN(PRN1,",+",1)
D S^BGPMUDEL(X,2,1)
S X="# w/o nephropathy test or evidence"_U_$P(STRING1,U,8)_U_$J($P(STRING1,U,9),5,1)_U_$P(STRING2,U,8)_U_$J($P(STRING2,U,9),5,1)_U_$FN(PRD7,",+",1)_U_$P(STRING3,U,8)_U_$J($P(STRING3,U,9),5,1)_U_$FN(PRN7,",+",1)
D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
I $D(BGPLIST(BGPIC)) D P2
Q
NUM62(TF) ;Get the numbers for this measure
N ARRAY,DEN,NUM,EXC,NOT,PC1,PC11,PC2,PC14,PC21,PC13,NNUM
S DEN=+$G(^TMP("BGPMU0062",$J,TF,"DEN"))
S NUM=+$G(^TMP("BGPMU0062",$J,TF,"NUM"))
S NOT=+$G(^TMP("BGPMU0062",$J,TF,"NOT"))
S EXC=+$G(^TMP("BGPMU0062",$J,TF,"EXC"))
S NNUM=DEN-EXC
I DEN=0 S (PC1,PC11,PC13,PC14)=0
I DEN>0&(NNUM=0) D
.S (PC1,PC11,PC14)=0
.S PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
I DEN>0&(NNUM>0) D
.S PC1=$$ROUND^BGPMUA01((NUM/NNUM),3)*100
.S PC11=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
.S PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
.S PC14=$$ROUND^BGPMUA01((NOT/NNUM),3)*100
S ARRAY=DEN_U_NUM_U_NNUM_U_EXC_U_PC1_U_PC11_U_PC13_U_NOT_U_PC14
Q ARRAY
P2 ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X,PTCT
S PTCT=0
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
S X="Diabetic patients 18-75 years of age with at least 1 or 2 encounters with the EP" D S^BGPMUDEL(X,1,1)
S X="during the reporting period, who had a nephropathy screening test or evidence of " D S^BGPMUDEL(X,1,1)
S X="nephropathy, or who were treated with ACE inhibitors/ARBs, if any." D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
S X="Patients who did not meet the numerator criteria are listed first (NM:)," D S^BGPMUDEL(X,1,1)
S X="followed by patients who do meet the numerator criteria (M:). Excluded patients" D S^BGPMUDEL(X,1,1)
S X="are listed last." D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
S X="The following are the abbreviations used in the denominator and numerator" D S^BGPMUDEL(X,1,1)
S X="columns: " D S^BGPMUDEL(X,1,1)
S X="ICD-9 Code=Diabetes Diagnosis" D S^BGPMUDEL(X,1,1)
S X="MED=Medication Indicative of Diabetes" D S^BGPMUDEL(X,1,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="ACE=ACE/ARB Medication" D S^BGPMUDEL(X,1,1)
S X="ACR=Urine Microalbumin Laboratory Test" D S^BGPMUDEL(X,1,1)
S X="NEP=Nephropathy Screening" D S^BGPMUDEL(X,1,1)
S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,2,1)
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0062"","_$J_",""PAT"",""C"",""NOT"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0062"","_$J_",""PAT"",""C"",""NUM"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0062"","_$J_",""PAT"",""C"",""EXC"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
Q
DATA(NODE) ;GET DATA
N NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,30)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S COMM=$$GET1^DIQ(9000001,DFN,1118)
S SEX=$P(^DPT(DFN,0),U,2)
S DEN=$P(NODE,U,2)
S NUM=$P(NODE,U,3)
S NUM1=$P(NUM,";",1),NUM2=$$DATE^BGPMUAP3($P($P(NUM,";",2),".",1))
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM1_" "_NUM2 D S^BGPMUDEL(X,1,1)
Q
DATA2(NODE) ;GET DATA
N NAME,HRN,DEN,AGE,DFN,SEX,COMM,NUM,NUM1,NUM2
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,30)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S COMM=$$GET1^DIQ(9000001,DFN,1118)
S SEX=$P(^DPT(DFN,0),U,2)
S DEN=$P(NODE,U,2),NUM=$P(NODE,U,3)
S NUM1=$P(NUM,";",1),NUM2=$$DATE^BGPMUAP3($P($P(NUM,";",2),".",1))
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM1_" "_NUM2 D S^BGPMUDEL(X,1,1)
Q
;Get printout for diabetes lipid control
LIPID ;EP
D LDL
K ^TMP("BGPMU0064",$J)
Q
LDL ;Write individual measure
N X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRD1,PRN1,PRD2,PRD3,PRN3,PRN3
S STRING1=$$NUM0064("C")
S STRING2=$$NUM0064("P")
S STRING3=$$NUM0064("B")
D SUMMARY2^BGPMUAP9(STRING1,STRING2,STRING3)
S PRD=$P(STRING1,U,4)-$P(STRING2,U,4) S PRD=$FN(PRD,",+",1)
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5) S PRD1=$FN(PRD1,",+",1)
S PRD2=$P(STRING1,U,7)-$P(STRING2,U,7) S PRD2=$FN(PRD2,",+",1)
S PRD3=$P(STRING1,U,9)-$P(STRING2,U,9) S PRD3=$FN(PRD3,",+",1)
S PRD4=$P(STRING1,U,11)-$P(STRING2,U,11) S PRD4=$FN(PRD4,",+",1)
S PRD5=$P(STRING1,U,13)-$P(STRING2,U,13) S PRD5=$FN(PRD5,",+",1)
S PRN=$P(STRING1,U,4)-$P(STRING3,U,4) S PRN=$FN(PRN,",+",1)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5) S PRN1=$FN(PRN1,",+",1)
S PRN2=$P(STRING1,U,7)-$P(STRING3,U,7) S PRN2=$FN(PRN2,",+",1)
S PRN3=$P(STRING1,U,9)-$P(STRING3,U,9) S PRN3=$FN(PRN3,",+",1)
S PRN4=$P(STRING1,U,11)-$P(STRING3,U,11) S PRN4=$FN(PRN4,",+",1)
S PRN5=$P(STRING1,U,13)-$P(STRING3,U,13) S PRN5=$FN(PRN5,",+",1)
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="Pts 18-75 w/diabetes"_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="# Excluded (Exc)"_U_$P(STRING1,U,4)_U_U_$P(STRING2,U,4)_U_U_U_$P(STRING3,U,4)
D S^BGPMUDEL(X,1,1)
S X="Pts 18-75 w/diabetes less Exc"_U_$P(STRING1,U,3)_U_U_$P(STRING2,U,3)_U_U_U_$P(STRING3,U,3)
D S^BGPMUDEL(X,1,1)
S X="Numerator 1" D S^BGPMUDEL(X,2,1)
S X="# w/LDL test result"_U_$P(STRING1,U,2)_U_$J($P(STRING1,U,5),5,1)_U_$P(STRING2,U,2)_U_$J($P(STRING2,U,5),5,1)_U_$FN(PRD1,",+",1)_U_$P(STRING3,U,2)_U_$J($P(STRING3,U,5),5,1)_U_$FN(PRN1,",+",1)
D S^BGPMUDEL(X,1,1)
S X="# w/o LDL test result"_U_$P(STRING1,U,8)_U_$J($P(STRING1,U,9),5,1)_U_$P(STRING2,U,8)_U_$J($P(STRING2,U,9),5,1)_U_$FN(PRD3,",+",1)_U_$P(STRING3,U,8)_U_$J($P(STRING3,U,9),5,1)_U_$FN(PRN3,",+",1)
D S^BGPMUDEL(X,1,1)
S X="Numerator 2" D S^BGPMUDEL(X,2,1)
S X="# w/LDL < 100mg/dL"_U_$P(STRING1,U,10)_U_$J($P(STRING1,U,11),5,1)_U_$P(STRING2,U,10)_U_$J($P(STRING2,U,11),5,1)_U_$FN(PRD4,",+",1)_U_$P(STRING3,U,2)_U_$J($P(STRING3,U,5),5,1)_U_$FN(PRN4,",+",1)
D S^BGPMUDEL(X,1,1)
S X="# w/o LDL or LDL => 100mg/dL"_U_$P(STRING1,U,12)_U_$J($P(STRING1,U,13),5,1)_U_$P(STRING2,U,12)_U_$J($P(STRING2,U,13),5,1)_U_$FN(PRD5,",+",1)_U_$P(STRING3,U,12)_U_$J($P(STRING3,U,13),5,1)_U_$FN(PRN5,",+",1)
D S^BGPMUDEL(X,1,1)
I $D(BGPLIST(BGPIC)) D LDL2
Q
NUM0064(TF) ;Get the numbers for this measure
N ARRAY,DEN,NUM1,PC1,PC2,NOT2,NOT1,NUM2,PC3,PC4,PC5,PC6,EXC
S DEN=+$G(^TMP("BGPMU0064",$J,TF,"DEN"))
S NUM1=+$G(^TMP("BGPMU0064",$J,TF,"NUM1"))
S NUM2=+$G(^TMP("BGPMU0064",$J,TF,"NUM2"))
S NOT1=+$G(^TMP("BGPMU0064",$J,TF,"NOT1"))
S NOT2=+$G(^TMP("BGPMU0064",$J,TF,"NOT2"))
S EXC=+$G(^TMP("BGPMU0064",$J,TF,"EXC"))
S NNUM=DEN-EXC
I DEN=0 S (PC1,PC2,PC3,PC4,PC5,PC6)=0
I DEN>0&(NNUM=0) D
.S (PC4,PC6)=0
.S PC1=$$ROUND^BGPMUA01((NUM1/DEN),3)*100
.S PC2=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
.S PC3=$$ROUND^BGPMUA01((EXC/DEN),3)*100
.S PC5=$$ROUND^BGPMUA01((NUM2/DEN),3)*100
I DEN>0&(NNUM>0) D
.S PC1=$$ROUND^BGPMUA01((NUM1/DEN),3)*100
.S PC2=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
.S PC3=$$ROUND^BGPMUA01((EXC/DEN),3)*100
.S PC4=$$ROUND^BGPMUA01((NOT1/NNUM),3)*100
.S PC5=$$ROUND^BGPMUA01((NUM2/DEN),3)*100
.S PC6=$$ROUND^BGPMUA01((NOT1/NNUM),3)*100
S ARRAY=DEN_U_NUM1_U_NNUM_U_EXC_U_PC1_U_PC2_U_PC3_U_NOT1_U_PC4_U_NUM2_U_PC5_U_NOT2_U_PC6
Q ARRAY
LDL2 ;Do the Details
N PT,NODE,NAME,BP,PTCT
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
S X="Diabetic patients 18-75 years of age with at least 1 or 2 encounters with the EP" D S^BGPMUDEL(X,1,1)
S X="during the reporting period, who had LDL-C < 100mg/dL, if any." D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
S X="Patients who do not meet the numerator criteria are listed first (NM:), followed" D S^BGPMUDEL(X,1,1)
S X="by patients who do meet the numerator criteria (M:). Excluded patients are" D S^BGPMUDEL(X,1,1)
S X="listed last" D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
S X="The following are the abbreviations used in the denominator and numerator" D S^BGPMUDEL(X,1,1)
S X="columns: " D S^BGPMUDEL(X,1,1)
S X="ICD=Diabetes Diagnosis" D S^BGPMUDEL(X,1,1)
S X="MED=Medication Indicative of Diabetes" D S^BGPMUDEL(X,1,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="" D S^BGPMUDEL(X,1,1)
S PTCT=0
S X="Numerator 1: Patients with LDL-C Test" D S^BGPMUDEL(X,1,1)
S X="NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR" D S^BGPMUDEL(X,1,1)
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$J_",""PAT"",""C"",""NOT1"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$J_",""PAT"",""C"",""NUM1"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$J_",""PAT"",""C"",""EXC"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
S X="" D S^BGPMUDEL(X,1,1)
S X="Numerator 2: Patients with LDL-C Test Result < 100mg/dL" D S^BGPMUDEL(X,1,1)
S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
D S^BGPMUDEL(X,1,1)
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$J_",""PAT"",""C"",""NOT2"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$J_",""PAT"",""C"",""NUM2"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
I BGPLIST="A" D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$J_",""PAT"",""C"",""EXC"")")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA2(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,1,1)
Q
XML0062 ;XML output for diabetes nephrology screning
; BGPXML(i)=Population Number^Numerator Number^Denominator Count^exclusion number
N STRING,TOTN,TOTD,TOTE
S STRING=$$NUM62("C")
S TOTD=$P(STRING,U,1)
S TOTN=$P(STRING,U,2)
S TOTE=$P(STRING,U,4)
S BGPXML(1)="119"_U_U_+TOTD_U_TOTN_U_TOTE
K ^TMP("BGPMU0062",$J)
Q
XML0064 ;XML output for LDL screen and value
; BGPXML(i)=Population Number^Numerator Number^Denominator Count^Numerator count^exclusion number
N STRING
S STRING=$$NUM0064("C")
S BGPXML(1)="2"_U_1_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)_U_+$P(STRING,U,4)
S BGPXML(2)=""_U_2_U_+$P(STRING,U,1)_U_+$P(STRING,U,10)_U_+$P(STRING,U,4)
K ^TMP("BGPMU0064",$J)
Q
BGPMUAD6 ; IHS/MSC/MGH - Print MI measure NQF0062 and NQF0064 ;07-Jul-2011 14:19;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Delimeted output
+3 ;Diabetes Nephropathy screening
NEPH(CNT) ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0062",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN1,NUM1,DEN2,NUM2,PC1,PC2,EXC1,EXC2,STRING1,STRING2,STRING3
+3 NEW PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,PRD7,PRD8,PRN1,PRN2,PRN3,PRN4,PRN5,PRN6,PRN7,PRN8
+4 SET STRING1=$$NUM62("C")
+5 SET STRING2=$$NUM62("P")
+6 SET STRING3=$$NUM62("B")
+7 DO SUMMARY1^BGPMUAP6(STRING1,STRING2,STRING3)
+8 ;population
+9 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
SET PRD1=$FNUMBER(PRD1,",+",1)
+10 SET PRD2=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
SET PRD2=$FNUMBER(PRD2,",+",1)
+11 SET PRD3=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
SET PRD3=$FNUMBER(PRD3,",+",1)
+12 SET PRD7=$PIECE(STRING1,U,9)-$PIECE(STRING2,U,9)
SET PRD7=$FNUMBER(PRD7,",+",1)
+13 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
SET PRN1=$FNUMBER(PRN1,",+",1)
+14 SET PRN2=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
SET PRN2=$FNUMBER(PRN2,",+",1)
+15 SET PRN3=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
SET PRN3=$FNUMBER(PRN3,",+",1)
+16 SET PRN7=$PIECE(STRING1,U,9)-$PIECE(STRING3,U,9)
SET PRN7=$FNUMBER(PRN7,",+",1)
+17 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+18 DO S^BGPMUDEL(X,2,1)
+19 SET X="Pts 18-75 w/diabetes"_U_$PIECE(STRING1,U,1)_U_U_$PIECE(STRING2,U,1)_U_U_U_$PIECE(STRING3,U,1)
DO S^BGPMUDEL(X,1,1)
+20 SET X="# Excluded (Exc)"_U_$PIECE(STRING1,U,4)_U_U_$PIECE(STRING2,U,4)_U_U_U_$PIECE(STRING3,U,4)
+21 DO S^BGPMUDEL(X,1,1)
+22 SET X="Pts 18-75 w/diabetes less Exc"_U_$PIECE(STRING1,U,3)_U_U_$PIECE(STRING2,U,3)_U_U_U_$PIECE(STRING3,U,3)
+23 DO S^BGPMUDEL(X,1,1)
+24 SET X="# w/nephropathy test or evidence"_U_$PIECE(STRING1,U,2)_U_$JUSTIFY($PIECE(STRING1,U,5),5,1)_U_$PIECE(STRING2,U,2)_U_$JUSTIFY($PIECE(STRING2,U,5),5,1)_U_$FNUMBER(PRD1,",+",1)_U_$PIECE(STRING3,U,2)_U_$JUSTIFY(...
... $PIECE(STRING3,U,5),5,1)_U_$FNUMBER(PRN1,",+",1)
+25 DO S^BGPMUDEL(X,2,1)
+26 SET X="# w/o nephropathy test or evidence"_U_$PIECE(STRING1,U,8)_U_$JUSTIFY($PIECE(STRING1,U,9),5,1)_U_$PIECE(STRING2,U,8)_U_$JUSTIFY($PIECE(STRING2,U,9),5,1)_U_$FNUMBER(PRD7,",+",1)_U_$PIECE(STRING3,U,8)_U_$JUSTIFY(...
... $PIECE(STRING3,U,9),5,1)_U_$FNUMBER(PRN7,",+",1)
+27 DO S^BGPMUDEL(X,1,1)
+28 SET X=""
DO S^BGPMUDEL(X,1,1)
+29 IF $DATA(BGPLIST(BGPIC))
DO P2
+30 QUIT
NUM62(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN,NUM,EXC,NOT,PC1,PC11,PC2,PC14,PC21,PC13,NNUM
+2 SET DEN=+$GET(^TMP("BGPMU0062",$JOB,TF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0062",$JOB,TF,"NUM"))
+4 SET NOT=+$GET(^TMP("BGPMU0062",$JOB,TF,"NOT"))
+5 SET EXC=+$GET(^TMP("BGPMU0062",$JOB,TF,"EXC"))
+6 SET NNUM=DEN-EXC
+7 IF DEN=0
SET (PC1,PC11,PC13,PC14)=0
+8 IF DEN>0&(NNUM=0)
Begin DoDot:1
+9 SET (PC1,PC11,PC14)=0
+10 SET PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
End DoDot:1
+11 IF DEN>0&(NNUM>0)
Begin DoDot:1
+12 SET PC1=$$ROUND^BGPMUA01((NUM/NNUM),3)*100
+13 SET PC11=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
+14 SET PC13=$$ROUND^BGPMUA01((EXC/DEN),3)*100
+15 SET PC14=$$ROUND^BGPMUA01((NOT/NNUM),3)*100
End DoDot:1
+16 SET ARRAY=DEN_U_NUM_U_NNUM_U_EXC_U_PC1_U_PC11_U_PC13_U_NOT_U_PC14
+17 QUIT ARRAY
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X,PTCT
+2 SET PTCT=0
+3 SET X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****"
DO S^BGPMUDEL(X,2,1)
+4 SET X="Diabetic patients 18-75 years of age with at least 1 or 2 encounters with the EP"
DO S^BGPMUDEL(X,1,1)
+5 SET X="during the reporting period, who had a nephropathy screening test or evidence of "
DO S^BGPMUDEL(X,1,1)
+6 SET X="nephropathy, or who were treated with ACE inhibitors/ARBs, if any."
DO S^BGPMUDEL(X,1,1)
+7 SET X=""
DO S^BGPMUDEL(X,1,1)
+8 SET X="Patients who did not meet the numerator criteria are listed first (NM:),"
DO S^BGPMUDEL(X,1,1)
+9 SET X="followed by patients who do meet the numerator criteria (M:). Excluded patients"
DO S^BGPMUDEL(X,1,1)
+10 SET X="are listed last."
DO S^BGPMUDEL(X,1,1)
+11 SET X=""
DO S^BGPMUDEL(X,1,1)
+12 SET X="The following are the abbreviations used in the denominator and numerator"
DO S^BGPMUDEL(X,1,1)
+13 SET X="columns: "
DO S^BGPMUDEL(X,1,1)
+14 SET X="ICD-9 Code=Diabetes Diagnosis"
DO S^BGPMUDEL(X,1,1)
+15 SET X="MED=Medication Indicative of Diabetes"
DO S^BGPMUDEL(X,1,1)
+16 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+17 SET X="ACE=ACE/ARB Medication"
DO S^BGPMUDEL(X,1,1)
+18 SET X="ACR=Urine Microalbumin Laboratory Test"
DO S^BGPMUDEL(X,1,1)
+19 SET X="NEP=Nephropathy Screening"
DO S^BGPMUDEL(X,1,1)
+20 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
DO S^BGPMUDEL(X,2,1)
+21 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+22 KILL BGPARR
+23 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0062"","_$JOB_",""PAT"",""C"",""NOT"")")
+24 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+25 SET PTCT=PTCT+1
+26 SET NODE=$GET(BGPARR(PT))
+27 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+28 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+29 KILL BGPARR
+30 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0062"","_$JOB_",""PAT"",""C"",""NUM"")")
+31 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+32 SET PTCT=PTCT+1
+33 SET NODE=$GET(BGPARR(PT))
+34 DO DATA(NODE)
End DoDot:2
End DoDot:1
+35 IF BGPLIST="A"
Begin DoDot:1
+36 KILL BGPARR
+37 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0062"","_$JOB_",""PAT"",""C"",""EXC"")")
+38 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+39 SET PTCT=PTCT+1
+40 SET NODE=$GET(BGPARR(PT))
+41 DO DATA(NODE)
End DoDot:2
End DoDot:1
+42 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+43 QUIT
DATA(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,NUM,AGE,DFN,SEX,COMM,NUM1,NUM2
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,30)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET COMM=$$GET1^DIQ(9000001,DFN,1118)
+7 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+8 SET DEN=$PIECE(NODE,U,2)
+9 SET NUM=$PIECE(NODE,U,3)
+10 SET NUM1=$PIECE(NUM,";",1)
SET NUM2=$$DATE^BGPMUAP3($PIECE($PIECE(NUM,";",2),".",1))
+11 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM1_" "_NUM2
DO S^BGPMUDEL(X,1,1)
+12 QUIT
DATA2(NODE) ;GET DATA
+1 NEW NAME,HRN,DEN,AGE,DFN,SEX,COMM,NUM,NUM1,NUM2
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,30)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET COMM=$$GET1^DIQ(9000001,DFN,1118)
+7 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+8 SET DEN=$PIECE(NODE,U,2)
SET NUM=$PIECE(NODE,U,3)
+9 SET NUM1=$PIECE(NUM,";",1)
SET NUM2=$$DATE^BGPMUAP3($PIECE($PIECE(NUM,";",2),".",1))
+10 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_NUM1_" "_NUM2
DO S^BGPMUDEL(X,1,1)
+11 QUIT
+12 ;Get printout for diabetes lipid control
LIPID ;EP
+1 DO LDL
+2 KILL ^TMP("BGPMU0064",$JOB)
+3 QUIT
LDL ;Write individual measure
+1 NEW X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRD1,PRN1,PRD2,PRD3,PRN3,PRN3
+2 SET STRING1=$$NUM0064("C")
+3 SET STRING2=$$NUM0064("P")
+4 SET STRING3=$$NUM0064("B")
+5 DO SUMMARY2^BGPMUAP9(STRING1,STRING2,STRING3)
+6 SET PRD=$PIECE(STRING1,U,4)-$PIECE(STRING2,U,4)
SET PRD=$FNUMBER(PRD,",+",1)
+7 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
SET PRD1=$FNUMBER(PRD1,",+",1)
+8 SET PRD2=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
SET PRD2=$FNUMBER(PRD2,",+",1)
+9 SET PRD3=$PIECE(STRING1,U,9)-$PIECE(STRING2,U,9)
SET PRD3=$FNUMBER(PRD3,",+",1)
+10 SET PRD4=$PIECE(STRING1,U,11)-$PIECE(STRING2,U,11)
SET PRD4=$FNUMBER(PRD4,",+",1)
+11 SET PRD5=$PIECE(STRING1,U,13)-$PIECE(STRING2,U,13)
SET PRD5=$FNUMBER(PRD5,",+",1)
+12 SET PRN=$PIECE(STRING1,U,4)-$PIECE(STRING3,U,4)
SET PRN=$FNUMBER(PRN,",+",1)
+13 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
SET PRN1=$FNUMBER(PRN1,",+",1)
+14 SET PRN2=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
SET PRN2=$FNUMBER(PRN2,",+",1)
+15 SET PRN3=$PIECE(STRING1,U,9)-$PIECE(STRING3,U,9)
SET PRN3=$FNUMBER(PRN3,",+",1)
+16 SET PRN4=$PIECE(STRING1,U,11)-$PIECE(STRING3,U,11)
SET PRN4=$FNUMBER(PRN4,",+",1)
+17 SET PRN5=$PIECE(STRING1,U,13)-$PIECE(STRING3,U,13)
SET PRN5=$FNUMBER(PRN5,",+",1)
+18 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+19 DO S^BGPMUDEL(X,2,1)
+20 SET X="Pts 18-75 w/diabetes"_U_$PIECE(STRING1,U,1)_U_U_$PIECE(STRING2,U,1)_U_U_U_$PIECE(STRING3,U,1)
+21 DO S^BGPMUDEL(X,1,1)
+22 SET X="# Excluded (Exc)"_U_$PIECE(STRING1,U,4)_U_U_$PIECE(STRING2,U,4)_U_U_U_$PIECE(STRING3,U,4)
+23 DO S^BGPMUDEL(X,1,1)
+24 SET X="Pts 18-75 w/diabetes less Exc"_U_$PIECE(STRING1,U,3)_U_U_$PIECE(STRING2,U,3)_U_U_U_$PIECE(STRING3,U,3)
+25 DO S^BGPMUDEL(X,1,1)
+26 SET X="Numerator 1"
DO S^BGPMUDEL(X,2,1)
+27 SET X="# w/LDL test result"_U_$PIECE(STRING1,U,2)_U_$JUSTIFY($PIECE(STRING1,U,5),5,1)_U_$PIECE(STRING2,U,2)_U_$JUSTIFY($PIECE(STRING2,U,5),5,1)_U_$FNUMBER(PRD1,",+",1)_U_$PIECE(STRING3,U,2)_U_$JUSTIFY($PIECE(STRING3,U,5),5,1)_U_$FNUMBER(PRN1,",
+",1)
+28 DO S^BGPMUDEL(X,1,1)
+29 SET X="# w/o LDL test result"_U_$PIECE(STRING1,U,8)_U_$JUSTIFY($PIECE(STRING1,U,9),5,1)_U_$PIECE(STRING2,U,8)_U_$JUSTIFY($PIECE(STRING2,U,9),5,1)_U_$FNUMBER(PRD3,",+",1)_U_$PIECE(STRING3,U,8)_U_$JUSTIFY($PIECE(STRING3,U,9),5,1)_U_$FNUMBER(PRN3,
",+",1)
+30 DO S^BGPMUDEL(X,1,1)
+31 SET X="Numerator 2"
DO S^BGPMUDEL(X,2,1)
+32 SET X="# w/LDL < 100mg/dL"_U_$PIECE(STRING1,U,10)_U_$JUSTIFY($PIECE(STRING1,U,11),5,1)_U_$PIECE(STRING2,U,10)_U_$JUSTIFY($PIECE(STRING2,U,11),5,1)_U_$FNUMBER(PRD4,",+",1)_U_$PIECE(STRING3,U,2)_U_$JUSTIFY($PIECE(STRING3,U,5),5,1)_U_$FNUMBER(PRN4
,",+",1)
+33 DO S^BGPMUDEL(X,1,1)
+34 SET X="# w/o LDL or LDL => 100mg/dL"_U_$PIECE(STRING1,U,12)_U_$JUSTIFY($PIECE(STRING1,U,13),5,1)_U_$PIECE(STRING2,U,12)_U_$JUSTIFY($PIECE(STRING2,U,13),5,1)_U_$FNUMBER(PRD5,",+",1)_U_$PIECE(STRING3,U,12)_U_$JUSTIFY(...
... $PIECE(STRING3,U,13),5,1)_U_$FNUMBER(PRN5,",+",1)
+35 DO S^BGPMUDEL(X,1,1)
+36 IF $DATA(BGPLIST(BGPIC))
DO LDL2
+37 QUIT
NUM0064(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN,NUM1,PC1,PC2,NOT2,NOT1,NUM2,PC3,PC4,PC5,PC6,EXC
+2 SET DEN=+$GET(^TMP("BGPMU0064",$JOB,TF,"DEN"))
+3 SET NUM1=+$GET(^TMP("BGPMU0064",$JOB,TF,"NUM1"))
+4 SET NUM2=+$GET(^TMP("BGPMU0064",$JOB,TF,"NUM2"))
+5 SET NOT1=+$GET(^TMP("BGPMU0064",$JOB,TF,"NOT1"))
+6 SET NOT2=+$GET(^TMP("BGPMU0064",$JOB,TF,"NOT2"))
+7 SET EXC=+$GET(^TMP("BGPMU0064",$JOB,TF,"EXC"))
+8 SET NNUM=DEN-EXC
+9 IF DEN=0
SET (PC1,PC2,PC3,PC4,PC5,PC6)=0
+10 IF DEN>0&(NNUM=0)
Begin DoDot:1
+11 SET (PC4,PC6)=0
+12 SET PC1=$$ROUND^BGPMUA01((NUM1/DEN),3)*100
+13 SET PC2=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
+14 SET PC3=$$ROUND^BGPMUA01((EXC/DEN),3)*100
+15 SET PC5=$$ROUND^BGPMUA01((NUM2/DEN),3)*100
End DoDot:1
+16 IF DEN>0&(NNUM>0)
Begin DoDot:1
+17 SET PC1=$$ROUND^BGPMUA01((NUM1/DEN),3)*100
+18 SET PC2=$$ROUND^BGPMUA01((NNUM/DEN),3)*100
+19 SET PC3=$$ROUND^BGPMUA01((EXC/DEN),3)*100
+20 SET PC4=$$ROUND^BGPMUA01((NOT1/NNUM),3)*100
+21 SET PC5=$$ROUND^BGPMUA01((NUM2/DEN),3)*100
+22 SET PC6=$$ROUND^BGPMUA01((NOT1/NNUM),3)*100
End DoDot:1
+23 SET ARRAY=DEN_U_NUM1_U_NNUM_U_EXC_U_PC1_U_PC2_U_PC3_U_NOT1_U_PC4_U_NUM2_U_PC5_U_NOT2_U_PC6
+24 QUIT ARRAY
LDL2 ;Do the Details
+1 NEW PT,NODE,NAME,BP,PTCT
+2 SET X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****"
DO S^BGPMUDEL(X,2,1)
+3 SET X="Diabetic patients 18-75 years of age with at least 1 or 2 encounters with the EP"
DO S^BGPMUDEL(X,1,1)
+4 SET X="during the reporting period, who had LDL-C < 100mg/dL, if any."
DO S^BGPMUDEL(X,1,1)
+5 SET X=""
DO S^BGPMUDEL(X,1,1)
+6 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO S^BGPMUDEL(X,1,1)
+7 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO S^BGPMUDEL(X,1,1)
+8 SET X="listed last"
DO S^BGPMUDEL(X,1,1)
+9 SET X=""
DO S^BGPMUDEL(X,1,1)
+10 SET X="The following are the abbreviations used in the denominator and numerator"
DO S^BGPMUDEL(X,1,1)
+11 SET X="columns: "
DO S^BGPMUDEL(X,1,1)
+12 SET X="ICD=Diabetes Diagnosis"
DO S^BGPMUDEL(X,1,1)
+13 SET X="MED=Medication Indicative of Diabetes"
DO S^BGPMUDEL(X,1,1)
+14 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+15 SET X=""
DO S^BGPMUDEL(X,1,1)
+16 SET PTCT=0
+17 SET X="Numerator 1: Patients with LDL-C Test"
DO S^BGPMUDEL(X,1,1)
+18 SET X="NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
DO S^BGPMUDEL(X,1,1)
+19 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+20 KILL BGPARR
+21 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$JOB_",""PAT"",""C"",""NOT1"")")
+22 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+23 SET PTCT=PTCT+1
+24 SET NODE=$GET(BGPARR(PT))
+25 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+26 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+27 KILL BGPARR
+28 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$JOB_",""PAT"",""C"",""NUM1"")")
+29 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+30 SET PTCT=PTCT+1
+31 SET NODE=$GET(BGPARR(PT))
+32 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+33 IF BGPLIST="A"
Begin DoDot:1
+34 KILL BGPARR
+35 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$JOB_",""PAT"",""C"",""EXC"")")
+36 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+37 SET PTCT=PTCT+1
+38 SET NODE=$GET(BGPARR(PT))
+39 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+40 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+41 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+42 SET X=""
DO S^BGPMUDEL(X,1,1)
+43 SET X="Numerator 2: Patients with LDL-C Test Result < 100mg/dL"
DO S^BGPMUDEL(X,1,1)
+44 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
+45 DO S^BGPMUDEL(X,1,1)
+46 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+47 KILL BGPARR
+48 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$JOB_",""PAT"",""C"",""NOT2"")")
+49 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+50 SET PTCT=PTCT+1
+51 SET NODE=$GET(BGPARR(PT))
+52 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+53 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+54 KILL BGPARR
+55 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$JOB_",""PAT"",""C"",""NUM2"")")
+56 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+57 SET PTCT=PTCT+1
+58 SET NODE=$GET(BGPARR(PT))
+59 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+60 IF BGPLIST="A"
Begin DoDot:1
+61 KILL BGPARR
+62 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0064"","_$JOB_",""PAT"",""C"",""EXC"")")
+63 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+64 SET PTCT=PTCT+1
+65 SET NODE=$GET(BGPARR(PT))
+66 DO DATA2(NODE)
End DoDot:2
End DoDot:1
+67 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,1,1)
+68 QUIT
XML0062 ;XML output for diabetes nephrology screning
+1 ; BGPXML(i)=Population Number^Numerator Number^Denominator Count^exclusion number
+2 NEW STRING,TOTN,TOTD,TOTE
+3 SET STRING=$$NUM62("C")
+4 SET TOTD=$PIECE(STRING,U,1)
+5 SET TOTN=$PIECE(STRING,U,2)
+6 SET TOTE=$PIECE(STRING,U,4)
+7 SET BGPXML(1)="119"_U_U_+TOTD_U_TOTN_U_TOTE
+8 KILL ^TMP("BGPMU0062",$JOB)
+9 QUIT
XML0064 ;XML output for LDL screen and value
+1 ; BGPXML(i)=Population Number^Numerator Number^Denominator Count^Numerator count^exclusion number
+2 NEW STRING
+3 SET STRING=$$NUM0064("C")
+4 SET BGPXML(1)="2"_U_1_U_+$PIECE(STRING,U,1)_U_+$PIECE(STRING,U,2)_U_+$PIECE(STRING,U,4)
+5 SET BGPXML(2)=""_U_2_U_+$PIECE(STRING,U,1)_U_+$PIECE(STRING,U,10)_U_+$PIECE(STRING,U,4)
+6 KILL ^TMP("BGPMU0064",$JOB)
+7 QUIT