BGPMUFD5 ; IHS/MSC/MGH - MU EP measures NQF0075 ;02-Mar-2011 11:26;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Delimited output reports for this measure
IVDLDL ;EP
D P1
K ^TMP("BGPMU0075",$J)
Q
P1 ;Write individual measure
N X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRD1,PRD2,PRD3,PRN,PRN1,PRN2,PRN3
S STRING1=$$D75^BGPMUFP5("C")
S STRING2=$$D75^BGPMUFP5("P")
S STRING3=$$D75^BGPMUFP5("B")
D SUM75^BGPMUFP5
S PRD=$P(STRING1,U,3)-$P(STRING2,U,3)
S PRN=$P(STRING1,U,3)-$P(STRING3,U,3)
S PRD1=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRN1=$P(STRING1,U,5)-$P(STRING3,U,5)
S PRD2=$P(STRING1,U,6)-$P(STRING2,U,6)
S PRN2=$P(STRING1,U,6)-$P(STRING3,U,6)
S PRD3=$P(STRING1,U,8)-$P(STRING2,U,8)
S PRN3=$P(STRING1,U,8)-$P(STRING3,U,8)
S X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG BASE %"
D S^BGPMUDEL(X,2,1)
S X="Pts 18+ w/PTCA, AMI, CABG or IVD"_U_($P(STRING1,U,1)+$P(STRING1,U,4))_U_U_($P(STRING2,U,1)+$P(STRING2,U,4))_U_U_U_($P(STRING3,U,1)+$P(STRING3,U,4))
D S^BGPMUDEL(X,2,1)
S X="Numerator 1" D S^BGPMUDEL(X,2,1)
S X="# w/LDL test result"_U_$P(STRING1,U,2)_U_$P(STRING1,U,3)_U_$P(STRING2,U,2)_U_$P(STRING2,U,3)_U_$FN(PRD,",+",1)_U_$P(STRING3,U,2)_U_$P(STRING3,U,3)_U_$FN(PRN,",+",1)
D S^BGPMUDEL(X,1,1)
S X="# w/o LDL test result"_U_($P(STRING1,U,1)-$P(STRING1,U,2))_U_$P(STRING1,U,5)_U_($P(STRING2,U,1)-$P(STRING2,U,2))_U_$P(STRING2,U,5)_U_$FN(PRD1,",+",1)
S X=X_U_($P(STRING3,U,1)-$P(STRING3,U,2))_U_$P(STRING3,U,5)_U_$FN(PRN1,",+",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,6)_U_$P(STRING1,U,7)_U_$P(STRING2,U,6)_U_$P(STRING2,U,7)_U_$FN(PRD2,",+",1)_U_$P(STRING3,U,6)_U_$P(STRING3,U,7)_U_$FN(PRN2,",+",1)
D S^BGPMUDEL(X,1,1)
S X="w/o LDL < 100mg/dL"_U_($P(STRING1,U,1)-$P(STRING1,U,6))_U_$P(STRING1,U,8)_U_($P(STRING2,U,1)-$P(STRING2,U,6))_U_$P(STRING2,U,8)_U_$FN(PRD3,",+",1)
S X=X_U_($P(STRING3,U,1)-$P(STRING3,U,6))_U_$P(STRING3,U,8)_U_$FN(PRN3,",+",1)
D S^BGPMUDEL(X,1,1)
I $D(BGPLIST(BGPIC)) D P2
K X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRD1,PRD2,PRD3,PRN,PRN1,PRN2,PRN3
Q
P2 ;Do the Details
N PT,NODE,NAME,VST,COLON,FOL,BGPARR,LINE,PTCT,NOTMET
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
S X="Patients 18+ and (a) who had at least 1 acute inpatient encounter with the" D S^BGPMUDEL(X,2,1)
S X="EP 14-24 months prior to the reporting period end date AND who underwent" D S^BGPMUDEL(X,1,1)
S X="percutaneous transluminal coronary angioplasty (PTCA), acute myocardial" D S^BGPMUDEL(X,1,1)
S X="infarction (AMI), or coronary artery bypass graft (CABG); OR (b) who had least" D S^BGPMUDEL(X,1,1)
S X="1 acute inpatient or outpatient encounter with the EP within 2 years of the" D S^BGPMUDEL(X,1,1)
S X="reporting period end date with a diagnosis of ischemic vascular disease (IVD);" D S^BGPMUDEL(X,1,1)
S X="AND (c) who had a complete lipid profile performed during the measurement year;" D S^BGPMUDEL(X,1,1)
S X="AND (d) whose LDL=C was <100 mg/dL, if any." D S^BGPMUDEL(X,1,1)
S X="Patients who do not meet the numerator criteria are listed first (NM:)," D S^BGPMUDEL(X,2,1)
S X="followed by patients who do meet the numerator criteria (M:)." D S^BGPMUDEL(X,1,1)
S X="The following are the abbreviations used in the denominator and numerator columns:" D S^BGPMUDEL(X,2,1)
S X="PTCA=PTCA Procedure" D S^BGPMUDEL(X,1,1)
S X="AMI=AMI Diagnosis" D S^BGPMUDEL(X,1,1)
S X="CABG=CABG Procedure" D S^BGPMUDEL(X,1,1)
S X="IVD=IVD Diagnosis" D S^BGPMUDEL(X,1,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="LDL=LDL Lab Test" D S^BGPMUDEL(X,1,1)
S X="CHL=Cholesterol Lab Test" D S^BGPMUDEL(X,1,1)
S X="HDL=High Density Lipoprotein Lab Test" D S^BGPMUDEL(X,1,1)
S X="TRI=Triglycerides Test" D S^BGPMUDEL(X,1,1)
S X="Numerator 1: Patients with LDL Test" D S^BGPMUDEL(X,2,1)
S PTCT=0
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
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
.S NOTMET=1
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$J_",""PAT"",""C"",""NOT"",1)")
.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
.S NOTMET=0
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$J_",""PAT"",""C"",""NUM"",1)")
.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)
S X="Numerator 2: Patients with LDL Test Result < 100mg/dL" D S^BGPMUDEL(X,2,1)
S PTCT=0
I $Y>(BGPIOSL-5) D HEADERL^BGPMUPH Q:BGPQUIT
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
.S NOTMET=1
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$J_",""PAT"",""C"",""NOT"",2)")
.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
.S NOTMET=0
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$J_",""PAT"",""C"",""NUM"",2)")
.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)
K PT,NODE,NAME,VST,COLON,FOL
Q
DATA(NODE) ;DISPLAY DATA
N X,NAME,HRN,DEN,NUM1,NUM2,NUM3,NUMVALS,NUMDATES,AGE,SEX,COMM,DFN
S (DEN1,DEN2,NUM1,NUM2,NUM3)=""
S DFN=$P(NODE,U,1)
S NAME=$$GET1^DIQ(2,$P(NODE,U,1),.01)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$P(^DPT(DFN,0),U,2)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,11)
S DEN=$P(NODE,U,2),NUMDATES=$P(NODE,U,3),NUMVALS=$P(NODE,U,4)
S:NUMVALS'="" NUM1=$P(NUMVALS,";",1)_" "_$$DATE^BGPMUUTL($P(NUMDATES,";",1))
S:$P(NUMVALS,";",2)'="" NUM2=$P(NUMVALS,";",2)_" "_$$DATE^BGPMUUTL($P(NUMDATES,";",2))
S:$P(NUMVALS,";",3)'="" NUM3=$P(NUMVALS,";",3)_" "_$$DATE^BGPMUUTL($P(NUMDATES,";",3))
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_$S(NOTMET:"NM:",1:"M:")_NUM1_$S(NUM2'="":";"_NUM2_";"_NUM3,1:"") D S^BGPMUDEL(X,1,1)
K X,NAME,HRN,DEN,NUM1,NUM2,NUM3,NUMVALS,NUMDATES,AGE,DFN,COMM
Q
BGPMUFD5 ; IHS/MSC/MGH - MU EP measures NQF0075 ;02-Mar-2011 11:26;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Delimited output reports for this measure
IVDLDL ;EP
+1 DO P1
+2 KILL ^TMP("BGPMU0075",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRD1,PRD2,PRD3,PRN,PRN1,PRN2,PRN3
+2 SET STRING1=$$D75^BGPMUFP5("C")
+3 SET STRING2=$$D75^BGPMUFP5("P")
+4 SET STRING3=$$D75^BGPMUFP5("B")
+5 DO SUM75^BGPMUFP5
+6 SET PRD=$PIECE(STRING1,U,3)-$PIECE(STRING2,U,3)
+7 SET PRN=$PIECE(STRING1,U,3)-$PIECE(STRING3,U,3)
+8 SET PRD1=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+9 SET PRN1=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+10 SET PRD2=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+11 SET PRN2=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+12 SET PRD3=$PIECE(STRING1,U,8)-$PIECE(STRING2,U,8)
+13 SET PRN3=$PIECE(STRING1,U,8)-$PIECE(STRING3,U,8)
+14 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG BASE %"
+15 DO S^BGPMUDEL(X,2,1)
+16 SET X="Pts 18+ w/PTCA, AMI, CABG or IVD"_U_($PIECE(STRING1,U,1)+$PIECE(STRING1,U,4))_U_U_($PIECE(STRING2,U,1)+$PIECE(STRING2,U,4))_U_U_U_($PIECE(STRING3,U,1)+$PIECE(STRING3,U,4))
+17 DO S^BGPMUDEL(X,2,1)
+18 SET X="Numerator 1"
DO S^BGPMUDEL(X,2,1)
+19 SET X="# w/LDL test result"_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,3)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,3)_U_$FNUMBER(PRD,",+",1)_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,3)_U_$FNUMBER(PRN,",+",1)
+20 DO S^BGPMUDEL(X,1,1)
+21 SET X="# w/o LDL test result"_U_($PIECE(STRING1,U,1)-$PIECE(STRING1,U,2))_U_$PIECE(STRING1,U,5)_U_($PIECE(STRING2,U,1)-$PIECE(STRING2,U,2))_U_$PIECE(STRING2,U,5)_U_$FNUMBER(PRD1,",+",1)
+22 SET X=X_U_($PIECE(STRING3,U,1)-$PIECE(STRING3,U,2))_U_$PIECE(STRING3,U,5)_U_$FNUMBER(PRN1,",+",1)
+23 DO S^BGPMUDEL(X,1,1)
+24 SET X="Numerator 2"
DO S^BGPMUDEL(X,2,1)
+25 SET X="w/LDL < 100mg/dL"_U_$PIECE(STRING1,U,6)_U_$PIECE(STRING1,U,7)_U_$PIECE(STRING2,U,6)_U_$PIECE(STRING2,U,7)_U_$FNUMBER(PRD2,",+",1)_U_$PIECE(STRING3,U,6)_U_$PIECE(STRING3,U,7)_U_$FNUMBER(PRN2,",+",1)
+26 DO S^BGPMUDEL(X,1,1)
+27 SET X="w/o LDL < 100mg/dL"_U_($PIECE(STRING1,U,1)-$PIECE(STRING1,U,6))_U_$PIECE(STRING1,U,8)_U_($PIECE(STRING2,U,1)-$PIECE(STRING2,U,6))_U_$PIECE(STRING2,U,8)_U_$FNUMBER(PRD3,",+",1)
+28 SET X=X_U_($PIECE(STRING3,U,1)-$PIECE(STRING3,U,6))_U_$PIECE(STRING3,U,8)_U_$FNUMBER(PRN3,",+",1)
+29 DO S^BGPMUDEL(X,1,1)
+30 IF $DATA(BGPLIST(BGPIC))
DO P2
+31 KILL X,Y,Z,DEN,NUM,PC1,STRING1,STRING2,STRING3,PRD,PRD1,PRD2,PRD3,PRN,PRN1,PRN2,PRN3
+32 QUIT
P2 ;Do the Details
+1 NEW PT,NODE,NAME,VST,COLON,FOL,BGPARR,LINE,PTCT,NOTMET
+2 SET X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****"
DO S^BGPMUDEL(X,2,1)
+3 SET X="Patients 18+ and (a) who had at least 1 acute inpatient encounter with the"
DO S^BGPMUDEL(X,2,1)
+4 SET X="EP 14-24 months prior to the reporting period end date AND who underwent"
DO S^BGPMUDEL(X,1,1)
+5 SET X="percutaneous transluminal coronary angioplasty (PTCA), acute myocardial"
DO S^BGPMUDEL(X,1,1)
+6 SET X="infarction (AMI), or coronary artery bypass graft (CABG); OR (b) who had least"
DO S^BGPMUDEL(X,1,1)
+7 SET X="1 acute inpatient or outpatient encounter with the EP within 2 years of the"
DO S^BGPMUDEL(X,1,1)
+8 SET X="reporting period end date with a diagnosis of ischemic vascular disease (IVD);"
DO S^BGPMUDEL(X,1,1)
+9 SET X="AND (c) who had a complete lipid profile performed during the measurement year;"
DO S^BGPMUDEL(X,1,1)
+10 SET X="AND (d) whose LDL=C was <100 mg/dL, if any."
DO S^BGPMUDEL(X,1,1)
+11 SET X="Patients who do not meet the numerator criteria are listed first (NM:),"
DO S^BGPMUDEL(X,2,1)
+12 SET X="followed by patients who do meet the numerator criteria (M:)."
DO S^BGPMUDEL(X,1,1)
+13 SET X="The following are the abbreviations used in the denominator and numerator columns:"
DO S^BGPMUDEL(X,2,1)
+14 SET X="PTCA=PTCA Procedure"
DO S^BGPMUDEL(X,1,1)
+15 SET X="AMI=AMI Diagnosis"
DO S^BGPMUDEL(X,1,1)
+16 SET X="CABG=CABG Procedure"
DO S^BGPMUDEL(X,1,1)
+17 SET X="IVD=IVD Diagnosis"
DO S^BGPMUDEL(X,1,1)
+18 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+19 SET X="LDL=LDL Lab Test"
DO S^BGPMUDEL(X,1,1)
+20 SET X="CHL=Cholesterol Lab Test"
DO S^BGPMUDEL(X,1,1)
+21 SET X="HDL=High Density Lipoprotein Lab Test"
DO S^BGPMUDEL(X,1,1)
+22 SET X="TRI=Triglycerides Test"
DO S^BGPMUDEL(X,1,1)
+23 SET X="Numerator 1: Patients with LDL Test"
DO S^BGPMUDEL(X,2,1)
+24 SET PTCT=0
+25 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+26 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
+27 DO S^BGPMUDEL(X,2,1)
+28 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+29 SET NOTMET=1
+30 KILL BGPARR
+31 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$JOB_",""PAT"",""C"",""NOT"",1)")
+32 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+33 SET PTCT=PTCT+1
+34 SET NODE=$GET(BGPARR(PT))
+35 DO DATA(NODE)
End DoDot:2
End DoDot:1
+36 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+37 SET NOTMET=0
+38 KILL BGPARR
+39 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$JOB_",""PAT"",""C"",""NUM"",1)")
+40 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+41 SET PTCT=PTCT+1
+42 SET NODE=$GET(BGPARR(PT))
+43 DO DATA(NODE)
End DoDot:2
End DoDot:1
+44 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+45 SET X="Numerator 2: Patients with LDL Test Result < 100mg/dL"
DO S^BGPMUDEL(X,2,1)
+46 SET PTCT=0
+47 IF $Y>(BGPIOSL-5)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+48 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
+49 DO S^BGPMUDEL(X,2,1)
+50 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+51 SET NOTMET=1
+52 KILL BGPARR
+53 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$JOB_",""PAT"",""C"",""NOT"",2)")
+54 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+55 SET PTCT=PTCT+1
+56 SET NODE=$GET(BGPARR(PT))
+57 DO DATA(NODE)
End DoDot:2
End DoDot:1
+58 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+59 SET NOTMET=0
+60 KILL BGPARR
+61 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0075"","_$JOB_",""PAT"",""C"",""NUM"",2)")
+62 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+63 SET PTCT=PTCT+1
+64 SET NODE=$GET(BGPARR(PT))
+65 DO DATA(NODE)
End DoDot:2
End DoDot:1
+66 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+67 KILL PT,NODE,NAME,VST,COLON,FOL
+68 QUIT
DATA(NODE) ;DISPLAY DATA
+1 NEW X,NAME,HRN,DEN,NUM1,NUM2,NUM3,NUMVALS,NUMDATES,AGE,SEX,COMM,DFN
+2 SET (DEN1,DEN2,NUM1,NUM2,NUM3)=""
+3 SET DFN=$PIECE(NODE,U,1)
+4 SET NAME=$$GET1^DIQ(2,$PIECE(NODE,U,1),.01)
+5 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+6 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+7 SET SEX=$PIECE(^DPT(DFN,0),U,2)
+8 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,11)
+9 SET DEN=$PIECE(NODE,U,2)
SET NUMDATES=$PIECE(NODE,U,3)
SET NUMVALS=$PIECE(NODE,U,4)
+10 IF NUMVALS'=""
SET NUM1=$PIECE(NUMVALS,";",1)_" "_$$DATE^BGPMUUTL($PIECE(NUMDATES,";",1))
+11 IF $PIECE(NUMVALS,";",2)'=""
SET NUM2=$PIECE(NUMVALS,";",2)_" "_$$DATE^BGPMUUTL($PIECE(NUMDATES,";",2))
+12 IF $PIECE(NUMVALS,";",3)'=""
SET NUM3=$PIECE(NUMVALS,";",3)_" "_$$DATE^BGPMUUTL($PIECE(NUMDATES,";",3))
+13 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE_U_DEN_U_$SELECT(NOTMET:"NM:",1:"M:")_NUM1_$SELECT(NUM2'="":";"_NUM2_";"_NUM3,1:"")
DO S^BGPMUDEL(X,1,1)
+14 KILL X,NAME,HRN,DEN,NUM1,NUM2,NUM3,NUMVALS,NUMDATES,AGE,DFN,COMM
+15 QUIT