BGPMUHP6 ; IHS/MSC/JSM - MU EH measure output routines;02-Mar-2011 16:29;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
; ED1^BGPMUHP1 = output routine for 0495 ED-1;;;;;Build 33
; ED2^BGPMUHP1 = output routine for 0497 ED-2
;
; STK2^BGPMUHP2 = output routine for 0435 STK-2 Antithrombolytic Therapy at discharge
; STK3^BGPMUHP2 = output routine for 0436 STK-3 Anticoagulation Therapy at discharge
; STK4^BGPMUHP3 = output routine for 0437 STK-4 thrombolytic therapy within 3 hours
; STK5^BGPMUHP3 = output routine for 0438 STK-5 Antithrombolytic Therapy by end of day 2
; STK6^BGPMUHP4 = output routine for 0439 STK-6 Statin Medicine at Discharge
; STK8^BGPMUHP4 = output routine for 0440 STK-8 Educational Materials at discharge
; STK10^BGPMUHP5 = output routine for 0441 STK-10 Rehabilitation Service at discharge
;
; VTE1^BGPMUHP6 = output routine for 0371 VTE-1 Prophylaxis within 24 hours
; VTE2^BGPMUHP6 = output routine for 0372 VTE-2 Prophylaxis for ICU pts
; VTE3^BGPMUHP7 = output routine for 0373 VTE-3 Anticoagulation overlap therapy
; VTE4^BGPMUHP7 = output routine for 0374 VTE-4 Platelet monitoring for UFH
; VTE5^BGPMUHP8 = output routine for 0375 VTE-5 VTE discharge instructions
; VTE6^BGPMUHP8 = output routine for 0376 VTE-6 Potentially preventable VTE
;
VTE1 ;EH output routine for 0371 VTE-1 (BGPMUH10)
D P1
K ^TMP("BGPMU0371",$J)
Q
P1 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN,NUM,NONUM,EXC,STRING1,STRING2,STRING3,PC1,PC2,PRD1,PRD2,PRB1,PRB2
S STRING1=$$371("C")
S STRING2=$$371("P")
S STRING3=$$371("B")
S PRD1=$P(STRING1,U,1)-$P(STRING2,U,1)
S PRD2=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRD3=$P(STRING1,U,5)-$P(STRING3,U,5)
S PRD4=$P(STRING1,U,6)-$P(STRING2,U,6)
S PRD5=$P(STRING1,U,6)-$P(STRING3,U,6)
I $P(STRING3,U,1)'=0 S PRD6=$$ROUND^BGPMUA01(($P(STRING1,U,1)/$P(STRING3,U,1)),3)*100
E S PRD6=0
D HEADER^BGPMUPH Q:BGPQUIT
W !
D HDRBLK^BGPMUPH
W !,"# Inpatient discharges",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?65,$P(STRING3,U,1)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Excluded (Exc)",?33,$P(STRING1,U,4),?44,$P(STRING2,U,4),?65,$P(STRING3,U,4)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Inpatient discharges",?33,$P(STRING1,U,1)-$P(STRING1,U,4),?44,$P(STRING2,U,1)-$P(STRING2,U,4),?65,$P(STRING3,U,1)-$P(STRING3,U,4)
W !,"Less Exc"
W !
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/received VTE",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,5),5,1),?44,$P(STRING2,U,2),?49,$J($P(STRING2,U,5),5,1),?56,$J($FN(PRD2,",+",1),6),?65,$P(STRING3,U,2),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRD3,",+",1),6)
W !,"prophylaxis"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o received VTE",?33,$P(STRING1,U,3),?38,$J($P(STRING1,U,6),5,1),?44,$P(STRING2,U,3),?49,$J($P(STRING2,U,6),5,1),?56,$J($FN(PRD4,",+",1),6),?65,$P(STRING3,U,3),?68,$J($P(STRING3,U,6),5,1),?74,$J($FN(PRD5,",+",1),6)
W !,"prophylaxis"
I $D(BGPLIST(BGPIC)) D P1D
D SUM371^BGPMUHD5
Q
371(BGPMUTF) ;Get the numbers for this measure
N ARRAY
S DEN=+$G(^TMP("BGPMU0371",$J,BGPMUTF,"DEN"))
S NUM=+$G(^TMP("BGPMU0371",$J,BGPMUTF,"NUM"))
S EXC=+$G(^TMP("BGPMU0371",$J,BGPMUTF,"EXC"))
S NONUM=+$G(^TMP("BGPMU0371",$J,BGPMUTF,"NOT"))
I DEN=0 S (PC1,PC2)=0
I DEN>0 D
.I DEN-EXC=0 S (PC1,PC2)=0
.E D
..S PC1=$$ROUND^BGPMUA01((NUM/(DEN-EXC)),3)*100
..S PC2=$$ROUND^BGPMUA01((NONUM/(DEN-EXC)),3)*100
S ARRAY=DEN_U_NUM_U_NONUM_U_EXC_U_PC1_U_PC2
Q ARRAY
P1D ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X
D HEADERL^BGPMUPH Q:BGPQUIT
S X="This measure assesses the number of patients who received VTE prophylaxis or" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="have documentation why no VTE prophylaxis was given the day of or the day after" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="hospital admission or surgery end date for surgeries that start the day of or" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="the day after hospital admission, if any." 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:). Excluded patients are" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="listed last." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="ADM=Inpatient Admission" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="NMI=Not Medical Indicated" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="REF=Refusals" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="MED=Medication Date" D W^BGPMUPP(X,0,1,BGPPTYPE)
I $Y>(BGPIOSL-2) D HEADERL^BGPMUPH Q:BGPQUIT
W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
S LINE="",$P(LINE,"-",79)="" W !,LINE
S PTCT=0
I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0371",$J,"PAT","C","NOT")) D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0371"","_$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 D371(NODE)
I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0371",$J,"PAT","C","NUM"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0371"","_$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 D371(NODE)
;Excluded patients
I BGPLIST="A"&($D(^TMP("BGPMU0371",$J,"PAT","C","EXC"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0371"","_$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 DEXC371(NODE)
S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
Q
D372(NODE) ;GET DATA
D D371(NODE)
Q
D371(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN,CODE
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,23)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$$SEX^AUPNPAT(DFN)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,10)
S DEN=$P($P($P(NODE,U,2),";",1),":",1)
S NUM=$P(NODE,U,3)
S CODE=$P(NODE,U,4)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
.S LINE="",$P(LINE,"-",79)="" W !,LINE
W !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,"ADM: "_$$FMTE^XLFDT(DEN,2)_$S($L($P(NODE,"U",2),";")>1:";",1:""),?69,$S(NUM'="":"M:"_CODE_" "_$$FMTE^XLFDT($P(NUM,".",1),2)_$S($L($P(NODE,"U",2),";")>1:";",1:""),1:"NM:")
Q
DEXC372(NODE) ;GET DATA
D DEXC371(NODE)
Q
DEXC371(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,23)
S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
S AGE=$$AGE^AUPNPAT(DFN,BGPED)
S SEX=$$SEX^AUPNPAT(DFN)
S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,10)
S DEN=$P($P($P(NODE,U,2),";",1),":",1)
S NUM=$P(NODE,U,3)
I $Y>(BGPIOSL-2) D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
.S LINE="",$P(LINE,"-",79)="" W !,LINE
W !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,"Excluded"
Q
;
VTE2 ;EH output routine for 0372 VTE-2 (BGPMUH11)
D P2
K ^TMP("BGPMU0372",$J)
Q
P2 ;Write individual measure
N X,Y,Z,LIST1,LIST2,LIST3
N DEN,NUM,NONUM,EXC,STRING1,STRING2,STRING3,PC1,PC2,PRD1,PRD2,PRB1,PRB2
S STRING1=$$372("C")
S STRING2=$$372("P")
S STRING3=$$372("B")
S PRD1=$P(STRING1,U,1)-$P(STRING2,U,1)
S PRD2=$P(STRING1,U,5)-$P(STRING2,U,5)
S PRD3=$P(STRING1,U,5)-$P(STRING3,U,5)
S PRD4=$P(STRING1,U,6)-$P(STRING2,U,6)
S PRD5=$P(STRING1,U,6)-$P(STRING3,U,6)
I $P(STRING3,U,1)'=0 S PRD6=$$ROUND^BGPMUA01(($P(STRING1,U,1)/$P(STRING3,U,1)),3)*100
E S PRD6=0
D HEADER^BGPMUPH Q:BGPQUIT
W !
D HDRBLK^BGPMUPH
W !,"# Inpatient discharges",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?65,$P(STRING3,U,1)
W !,"w/ICU LOS => 1 day"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Excluded (Exc)",?33,$P(STRING1,U,4),?44,$P(STRING2,U,4),?65,$P(STRING3,U,4)
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Inpatient discharges",?33,$P(STRING1,U,1)-$P(STRING1,U,4),?44,$P(STRING2,U,1)-$P(STRING2,U,4),?65,$P(STRING3,U,1)-$P(STRING3,U,4)
W !,"w/ICU LOS => 1 day"
W !,"Less Exc"
W !
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/received VTE",?33,$P(STRING1,U,2),?38,$J($P(STRING1,U,5),5,1),?44,$P(STRING2,U,2),?49,$J($P(STRING2,U,5),5,1),?56,$J($FN(PRD2,",+",1),6),?65,$P(STRING3,U,2),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRD3,",+",1),6)
W !,"Prophylaxis"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o VTE prophylaxis",?33,$P(STRING1,U,3),?38,$J($P(STRING1,U,6),5,1),?44,$P(STRING2,U,3),?49,$J($P(STRING2,U,6),5,1),?56,$J($FN(PRD4,",+",1),6),?65,$P(STRING3,U,3),?68,$J($P(STRING3,U,6),5,1),?74,$J($FN(PRD5,",+",1),6)
I $D(BGPLIST(BGPIC)) D P2D
D SUM372^BGPMUHD5
Q
372(BGPMUTF) ;Get the numbers for this measure
N ARRAY
S DEN=+$G(^TMP("BGPMU0372",$J,BGPMUTF,"DEN"))
S NUM=+$G(^TMP("BGPMU0372",$J,BGPMUTF,"NUM"))
S EXC=+$G(^TMP("BGPMU0372",$J,BGPMUTF,"EXC"))
S NONUM=+$G(^TMP("BGPMU0372",$J,BGPMUTF,"NOT"))
I DEN=0 S (PC1,PC2)=0
I DEN>0 D
.I DEN-EXC=0 S (PC1,PC2)=0
.E D
..S PC1=$$ROUND^BGPMUA01((NUM/(DEN-EXC)),3)*100
..S PC2=$$ROUND^BGPMUA01((NONUM/(DEN-EXC)),3)*100
S ARRAY=DEN_U_NUM_U_NONUM_U_EXC_U_PC1_U_PC2
Q ARRAY
P2D ;Do the Details
N PT,NODE,NAME,VST,BMI,FOL,X
D HEADERL^BGPMUPH Q:BGPQUIT
S X="This measure assesses the number of patients who received VTE prophylaxis or" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="have documentation why no VTE prophylaxis was given the day of or the day after" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="the initial admission (or transfer) to the Intensive Care Unit (ICU) or surgery" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="end date for surgeries that start the day of or the day after ICU admission" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="(or transfer), if any." 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:). Excluded patients are" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="listed last." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="ADM=Inpatient Admission" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="MED=Medication Date" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="REF=Refusals" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="NMI=Not Medically Indicated" D W^BGPMUPP(X,0,1,BGPPTYPE)
I $Y>(BGPIOSL-2) D HEADERL^BGPMUPH Q:BGPQUIT
W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
S LINE="",$P(LINE,"-",79)="" W !,LINE
S PTCT=0
I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0372",$J,"PAT","C","NOT")) D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0372"","_$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 D372(NODE)
I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0372",$J,"PAT","C","NUM"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0372"","_$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 D372(NODE)
;Excluded patients
I BGPLIST="A"&($D(^TMP("BGPMU0372",$J,"PAT","C","EXC"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0372"","_$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 DEXC372(NODE)
S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
Q
;
XML371 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Measure number^""^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="NQF_0371"_U_""_U_+$G(^TMP("BGPMU0371",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0371",$J,"C","NUM"))_U_+$G(^TMP("BGPMU0371",$J,"C","EXC"))
K ^TMP("BGPMU0371",$J)
Q
XML372 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Measure number^""^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="NQF_0372"_U_""_U_+$G(^TMP("BGPMU0372",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0372",$J,"C","NUM"))_U_+$G(^TMP("BGPMU0372",$J,"C","EXC"))
K ^TMP("BGPMU0372",$J)
Q
BGPMUHP6 ; IHS/MSC/JSM - MU EH measure output routines;02-Mar-2011 16:29;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ; ED1^BGPMUHP1 = output routine for 0495 ED-1;;;;;Build 33
+3 ; ED2^BGPMUHP1 = output routine for 0497 ED-2
+4 ;
+5 ; STK2^BGPMUHP2 = output routine for 0435 STK-2 Antithrombolytic Therapy at discharge
+6 ; STK3^BGPMUHP2 = output routine for 0436 STK-3 Anticoagulation Therapy at discharge
+7 ; STK4^BGPMUHP3 = output routine for 0437 STK-4 thrombolytic therapy within 3 hours
+8 ; STK5^BGPMUHP3 = output routine for 0438 STK-5 Antithrombolytic Therapy by end of day 2
+9 ; STK6^BGPMUHP4 = output routine for 0439 STK-6 Statin Medicine at Discharge
+10 ; STK8^BGPMUHP4 = output routine for 0440 STK-8 Educational Materials at discharge
+11 ; STK10^BGPMUHP5 = output routine for 0441 STK-10 Rehabilitation Service at discharge
+12 ;
+13 ; VTE1^BGPMUHP6 = output routine for 0371 VTE-1 Prophylaxis within 24 hours
+14 ; VTE2^BGPMUHP6 = output routine for 0372 VTE-2 Prophylaxis for ICU pts
+15 ; VTE3^BGPMUHP7 = output routine for 0373 VTE-3 Anticoagulation overlap therapy
+16 ; VTE4^BGPMUHP7 = output routine for 0374 VTE-4 Platelet monitoring for UFH
+17 ; VTE5^BGPMUHP8 = output routine for 0375 VTE-5 VTE discharge instructions
+18 ; VTE6^BGPMUHP8 = output routine for 0376 VTE-6 Potentially preventable VTE
+19 ;
VTE1 ;EH output routine for 0371 VTE-1 (BGPMUH10)
+1 DO P1
+2 KILL ^TMP("BGPMU0371",$JOB)
+3 QUIT
P1 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN,NUM,NONUM,EXC,STRING1,STRING2,STRING3,PC1,PC2,PRD1,PRD2,PRB1,PRB2
+3 SET STRING1=$$371("C")
+4 SET STRING2=$$371("P")
+5 SET STRING3=$$371("B")
+6 SET PRD1=$PIECE(STRING1,U,1)-$PIECE(STRING2,U,1)
+7 SET PRD2=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 SET PRD3=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+9 SET PRD4=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+10 SET PRD5=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+11 IF $PIECE(STRING3,U,1)'=0
SET PRD6=$$ROUND^BGPMUA01(($PIECE(STRING1,U,1)/$PIECE(STRING3,U,1)),3)*100
+12 IF '$TEST
SET PRD6=0
+13 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+14 WRITE !
+15 DO HDRBLK^BGPMUPH
+16 WRITE !,"# Inpatient discharges",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?65,$PIECE(STRING3,U,1)
+17 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+18 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,4),?65,$PIECE(STRING3,U,4)
+19 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+20 WRITE !,"# Inpatient discharges",?33,$PIECE(STRING1,U,1)-$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,1)-$PIECE(STRING2,U,4),?65,$PIECE(STRING3,U,1)-$PIECE(STRING3,U,4)
+21 WRITE !,"Less Exc"
+22 WRITE !
+23 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+24 WRITE !,"# w/received VTE",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,5),5,1),?44,$PIECE(STRING2,U,2),?49,$JUSTIFY($PIECE(STRING2,U,5),5,1),?56,...
... $JUSTIFY($FNUMBER(PRD2,",+",1),6),?65,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRD3,",+",1),6)
+25 WRITE !,"prophylaxis"
+26 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+27 WRITE !,"# w/o received VTE",?33,$PIECE(STRING1,U,3),?38,$JUSTIFY($PIECE(STRING1,U,6),5,1),?44,$PIECE(STRING2,U,3),?49,$JUSTIFY($PIECE(STRING2,U,6),5,1),?56,...
... $JUSTIFY($FNUMBER(PRD4,",+",1),6),?65,$PIECE(STRING3,U,3),?68,$JUSTIFY($PIECE(STRING3,U,6),5,1),?74,$JUSTIFY($FNUMBER(PRD5,",+",1),6)
+28 WRITE !,"prophylaxis"
+29 IF $DATA(BGPLIST(BGPIC))
DO P1D
+30 DO SUM371^BGPMUHD5
+31 QUIT
371(BGPMUTF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN=+$GET(^TMP("BGPMU0371",$JOB,BGPMUTF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0371",$JOB,BGPMUTF,"NUM"))
+4 SET EXC=+$GET(^TMP("BGPMU0371",$JOB,BGPMUTF,"EXC"))
+5 SET NONUM=+$GET(^TMP("BGPMU0371",$JOB,BGPMUTF,"NOT"))
+6 IF DEN=0
SET (PC1,PC2)=0
+7 IF DEN>0
Begin DoDot:1
+8 IF DEN-EXC=0
SET (PC1,PC2)=0
+9 IF '$TEST
Begin DoDot:2
+10 SET PC1=$$ROUND^BGPMUA01((NUM/(DEN-EXC)),3)*100
+11 SET PC2=$$ROUND^BGPMUA01((NONUM/(DEN-EXC)),3)*100
End DoDot:2
End DoDot:1
+12 SET ARRAY=DEN_U_NUM_U_NONUM_U_EXC_U_PC1_U_PC2
+13 QUIT ARRAY
P1D ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X
+2 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+3 SET X="This measure assesses the number of patients who received VTE prophylaxis or"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="have documentation why no VTE prophylaxis was given the day of or the day after"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="hospital admission or surgery end date for surgeries that start the day of or"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="the day after hospital admission, if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+8 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 SET X="listed last."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X="The following are the abbreviations used in the denominator and numerator"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+11 SET X="columns:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+12 SET X="ADM=Inpatient Admission"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="NMI=Not Medical Indicated"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+14 SET X="REF=Refusals"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+15 SET X="MED=Medication Date"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+16 IF $Y>(BGPIOSL-2)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+17 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+18 SET LINE=""
SET $PIECE(LINE,"-",79)=""
WRITE !,LINE
+19 SET PTCT=0
+20 IF (BGPLIST="A")!(BGPLIST="D")&$DATA(^TMP("BGPMU0371",$JOB,"PAT","C","NOT"))
Begin DoDot:1
+21 KILL BGPARR
+22 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0371"","_$JOB_",""PAT"",""C"",""NOT"")")
+23 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+24 SET PTCT=PTCT+1
+25 SET NODE=$GET(BGPARR(PT))
+26 DO D371(NODE)
End DoDot:2
End DoDot:1
+27 IF (BGPLIST="A")!(BGPLIST="N")&($DATA(^TMP("BGPMU0371",$JOB,"PAT","C","NUM")))
Begin DoDot:1
+28 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0371"","_$JOB_",""PAT"",""C"",""NUM"")")
+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 D371(NODE)
End DoDot:2
End DoDot:1
+33 ;Excluded patients
+34 IF BGPLIST="A"&($DATA(^TMP("BGPMU0371",$JOB,"PAT","C","EXC")))
Begin DoDot:1
+35 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0371"","_$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 DEXC371(NODE)
End DoDot:2
End DoDot:1
+40 SET X="Total # of patients on list: "_PTCT
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+41 QUIT
D372(NODE) ;GET DATA
+1 DO D371(NODE)
+2 QUIT
D371(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN,CODE
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,23)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET SEX=$$SEX^AUPNPAT(DFN)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,10)
+8 SET DEN=$PIECE($PIECE($PIECE(NODE,U,2),";",1),":",1)
+9 SET NUM=$PIECE(NODE,U,3)
+10 SET CODE=$PIECE(NODE,U,4)
+11 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+12 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+13 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+14 SET LINE=""
SET $PIECE(LINE,"-",79)=""
WRITE !,LINE
End DoDot:1
+15 WRITE !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,"ADM: "_$$FMTE^XLFDT(DEN,2)_$SELECT($LENGTH($PIECE(NODE,"U",2),";")>1:";",1:""),?69,$SELECT(NUM'="":"M:"_CODE_" "_$$FMTE^XLFDT($PIECE(NUM,".",1),2)_$SELECT($LENGTH(...
... $PIECE(NODE,"U",2),";")>1:";",1:""),1:"NM:")
+16 QUIT
DEXC372(NODE) ;GET DATA
+1 DO DEXC371(NODE)
+2 QUIT
DEXC371(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,23)
+4 SET HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
+5 SET AGE=$$AGE^AUPNPAT(DFN,BGPED)
+6 SET SEX=$$SEX^AUPNPAT(DFN)
+7 SET COMM=$EXTRACT($$GET1^DIQ(9000001,DFN,1118),1,10)
+8 SET DEN=$PIECE($PIECE($PIECE(NODE,U,2),";",1),":",1)
+9 SET NUM=$PIECE(NODE,U,3)
+10 IF $Y>(BGPIOSL-2)
Begin DoDot:1
+11 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+12 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+13 SET LINE=""
SET $PIECE(LINE,"-",79)=""
WRITE !,LINE
End DoDot:1
+14 WRITE !,NAME,?25,HRN,?33,COMM,?44,SEX,?48,AGE,?53,"Excluded"
+15 QUIT
+16 ;
VTE2 ;EH output routine for 0372 VTE-2 (BGPMUH11)
+1 DO P2
+2 KILL ^TMP("BGPMU0372",$JOB)
+3 QUIT
P2 ;Write individual measure
+1 NEW X,Y,Z,LIST1,LIST2,LIST3
+2 NEW DEN,NUM,NONUM,EXC,STRING1,STRING2,STRING3,PC1,PC2,PRD1,PRD2,PRB1,PRB2
+3 SET STRING1=$$372("C")
+4 SET STRING2=$$372("P")
+5 SET STRING3=$$372("B")
+6 SET PRD1=$PIECE(STRING1,U,1)-$PIECE(STRING2,U,1)
+7 SET PRD2=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 SET PRD3=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+9 SET PRD4=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+10 SET PRD5=$PIECE(STRING1,U,6)-$PIECE(STRING3,U,6)
+11 IF $PIECE(STRING3,U,1)'=0
SET PRD6=$$ROUND^BGPMUA01(($PIECE(STRING1,U,1)/$PIECE(STRING3,U,1)),3)*100
+12 IF '$TEST
SET PRD6=0
+13 DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+14 WRITE !
+15 DO HDRBLK^BGPMUPH
+16 WRITE !,"# Inpatient discharges",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?65,$PIECE(STRING3,U,1)
+17 WRITE !,"w/ICU LOS => 1 day"
+18 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+19 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,4),?65,$PIECE(STRING3,U,4)
+20 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+21 WRITE !,"# Inpatient discharges",?33,$PIECE(STRING1,U,1)-$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,1)-$PIECE(STRING2,U,4),?65,$PIECE(STRING3,U,1)-$PIECE(STRING3,U,4)
+22 WRITE !,"w/ICU LOS => 1 day"
+23 WRITE !,"Less Exc"
+24 WRITE !
+25 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+26 WRITE !,"# w/received VTE",?33,$PIECE(STRING1,U,2),?38,$JUSTIFY($PIECE(STRING1,U,5),5,1),?44,$PIECE(STRING2,U,2),?49,$JUSTIFY($PIECE(STRING2,U,5),5,1),?56,...
... $JUSTIFY($FNUMBER(PRD2,",+",1),6),?65,$PIECE(STRING3,U,2),?68,$JUSTIFY($PIECE(STRING3,U,5),5,1),?74,$JUSTIFY($FNUMBER(PRD3,",+",1),6)
+27 WRITE !,"Prophylaxis"
+28 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+29 WRITE !,"# w/o VTE prophylaxis",?33,$PIECE(STRING1,U,3),?38,$JUSTIFY($PIECE(STRING1,U,6),5,1),?44,$PIECE(STRING2,U,3),?49,$JUSTIFY(...
... $PIECE(STRING2,U,6),5,1),?56,$JUSTIFY($FNUMBER(PRD4,",+",1),6),?65,$PIECE(STRING3,U,3),?68,$JUSTIFY($PIECE(STRING3,U,6),5,1),?74,$JUSTIFY($FNUMBER(PRD5,",+",1),6)
+30 IF $DATA(BGPLIST(BGPIC))
DO P2D
+31 DO SUM372^BGPMUHD5
+32 QUIT
372(BGPMUTF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN=+$GET(^TMP("BGPMU0372",$JOB,BGPMUTF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0372",$JOB,BGPMUTF,"NUM"))
+4 SET EXC=+$GET(^TMP("BGPMU0372",$JOB,BGPMUTF,"EXC"))
+5 SET NONUM=+$GET(^TMP("BGPMU0372",$JOB,BGPMUTF,"NOT"))
+6 IF DEN=0
SET (PC1,PC2)=0
+7 IF DEN>0
Begin DoDot:1
+8 IF DEN-EXC=0
SET (PC1,PC2)=0
+9 IF '$TEST
Begin DoDot:2
+10 SET PC1=$$ROUND^BGPMUA01((NUM/(DEN-EXC)),3)*100
+11 SET PC2=$$ROUND^BGPMUA01((NONUM/(DEN-EXC)),3)*100
End DoDot:2
End DoDot:1
+12 SET ARRAY=DEN_U_NUM_U_NONUM_U_EXC_U_PC1_U_PC2
+13 QUIT ARRAY
P2D ;Do the Details
+1 NEW PT,NODE,NAME,VST,BMI,FOL,X
+2 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+3 SET X="This measure assesses the number of patients who received VTE prophylaxis or"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="have documentation why no VTE prophylaxis was given the day of or the day after"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="the initial admission (or transfer) to the Intensive Care Unit (ICU) or surgery"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="end date for surgeries that start the day of or the day after ICU admission"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="(or transfer), if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+8 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+9 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X="listed last."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+11 SET X="The following are the abbreviations used in the denominator and numerator"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+12 SET X="columns:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="ADM=Inpatient Admission"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+14 SET X="MED=Medication Date"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+15 SET X="REF=Refusals"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+16 SET X="NMI=Not Medically Indicated"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+17 IF $Y>(BGPIOSL-2)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+18 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+19 SET LINE=""
SET $PIECE(LINE,"-",79)=""
WRITE !,LINE
+20 SET PTCT=0
+21 IF (BGPLIST="A")!(BGPLIST="D")&$DATA(^TMP("BGPMU0372",$JOB,"PAT","C","NOT"))
Begin DoDot:1
+22 KILL BGPARR
+23 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0372"","_$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 D372(NODE)
End DoDot:2
End DoDot:1
+28 IF (BGPLIST="A")!(BGPLIST="N")&($DATA(^TMP("BGPMU0372",$JOB,"PAT","C","NUM")))
Begin DoDot:1
+29 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0372"","_$JOB_",""PAT"",""C"",""NUM"")")
+30 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+31 SET PTCT=PTCT+1
+32 SET NODE=$GET(BGPARR(PT))
+33 DO D372(NODE)
End DoDot:2
End DoDot:1
+34 ;Excluded patients
+35 IF BGPLIST="A"&($DATA(^TMP("BGPMU0372",$JOB,"PAT","C","EXC")))
Begin DoDot:1
+36 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0372"","_$JOB_",""PAT"",""C"",""EXC"")")
+37 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+38 SET PTCT=PTCT+1
+39 SET NODE=$GET(BGPARR(PT))
+40 DO DEXC372(NODE)
End DoDot:2
End DoDot:1
+41 SET X="Total # of patients on list: "_PTCT
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+42 QUIT
+43 ;
XML371 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=Measure number^""^Denominator Count^Numerator Count^Exclusion Count
+2 SET BGPXML(1)="NQF_0371"_U_""_U_+$GET(^TMP("BGPMU0371",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0371",$JOB,"C","NUM"))_U_+$GET(^TMP("BGPMU0371",$JOB,"C","EXC"))
+3 KILL ^TMP("BGPMU0371",$JOB)
+4 QUIT
XML372 ;Populate the BGPXML array with data for each population/numerator
+1 ; BGPXMLOUT(i)=Measure number^""^Denominator Count^Numerator Count^Exclusion Count
+2 SET BGPXML(1)="NQF_0372"_U_""_U_+$GET(^TMP("BGPMU0372",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0372",$JOB,"C","NUM"))_U_+$GET(^TMP("BGPMU0372",$JOB,"C","EXC"))
+3 KILL ^TMP("BGPMU0372",$JOB)
+4 QUIT