BGPMUHP7 ; IHS/MSC/JSM - MU EH measure output routines;02-Mar-2011 16:06;MGH
;;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
;
VTE3 ;EH output routine for 0373 VTE-3 (BGPMUH12)
D P3
K ^TMP("BGPMU0373",$J)
Q
P3 ;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=$$373("C")
S STRING2=$$373("P")
S STRING3=$$373("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 !,"# Discharges for Pts",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?65,$P(STRING3,U,1)
W !,"w/confirmed VTE"
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 !,"# Discharges for Pts",?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/confirmed VTE Less Exc"
W !
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/overlap therapy",?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 !,"at discharge"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o overlap therapy",?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 !,"at discharge"
I $D(BGPLIST(BGPIC)) D P3D
D SUM373^BGPMUHD6
Q
373(BGPMUTF) ;Get the numbers for this measure
N ARRAY
S DEN=+$G(^TMP("BGPMU0373",$J,BGPMUTF,"DEN"))
S NUM=+$G(^TMP("BGPMU0373",$J,BGPMUTF,"NUM"))
S EXC=+$G(^TMP("BGPMU0373",$J,BGPMUTF,"EXC"))
S NONUM=+$G(^TMP("BGPMU0374",$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
P3D ;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 diagnosed with confirmed VTE who" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="received an overlap of parenteral (intravenous [IV] or subcutaneous [subcu])" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="anticoagulation and warfarin therapy. For patients who received less than" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="5 days of overlap therapy, they must be discharged on both medications." D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="Overlap therapy must be administered for at least 5 days with an international" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="normalized ratio (INR) >= 2 prior to discontinuation of the parenteral" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="anticoagulation therapy or the patient must be discharged on both medications," D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="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=Admit date for Inpatient w/ confirmed VTE who received warfarin" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="OVLP DAYS=Number of inpt overlap days" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="INR=Last result value prior to discharge" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="RX=Discharged on overlap therapy" 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("BGPMU0373",$J,"PAT","C","NOT")) D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0373"","_$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 D373(NODE)
I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0373",$J,"PAT","C","NUM"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0373"","_$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 D373(NODE)
;Excluded patients
I BGPLIST="A"&($D(^TMP("BGPMU0373",$J,"PAT","C","EXC"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0373"","_$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 DEXC373(NODE)
S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
Q
D373(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN,CNT,DD,INR,INRDT
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 CNT=$P(NODE,U,3),INR=$P(NODE,U,4),INRDT=$P(NODE,U,5)
S DD=$P(NODE,U,6)
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(CNT'="":"M:OVLP DAYS: "_CNT,1:"NM:")
I INR'="" W ";",!,?69,"INR: "_INR_" "_INRDT
I DD'="" W ";",!,?69,"RX:"_$$FMTE^XLFDT($P(DD,".",1),2)
Q
DEXC373(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($P($P(NODE,U,2),";",1),":",2)
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
;
VTE4 ;EH output routine for 0374 VTE-4 (BGPMUH13)
D P4
K ^TMP("BGPMU0374",$J)
Q
P4 ;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=$$374("C")
S STRING2=$$374("P")
S STRING3=$$374("B")
S PRD1=$P(STRING1,U,1)-$P(STRING2,U,1) ;change from prev year Pts w/ Ischemic Stroke (line 1)
S PRD2=$P(STRING1,U,5)-$P(STRING2,U,5) ;% change from prev year # w/ antithrombolytic therapy ...
S PRD3=$P(STRING1,U,5)-$P(STRING3,U,5) ;% change from base year # w/ antithrombolytic therapy ...
S PRD4=$P(STRING1,U,6)-$P(STRING2,U,6) ;% change from prev year # w/ antithrombolytic therapy ...
S PRD5=$P(STRING1,U,6)-$P(STRING3,U,6) ;% change from prev year # w/ antithrombolytic therapy ...
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
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# Discharges for Pts",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?65,$P(STRING3,U,1)
W !,"w/confirmed VTE"
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 !,"# Discharges for Pts",?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/confirmed VTE Less Exc"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !
W !,"# w/IV UFH therapy",?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 !,"& platelet count"
I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
W !,"# w/o IV UFH therapy",?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 !,"& platelet count"
I $D(BGPLIST(BGPIC)) D P4D
D SUM374^BGPMUHD6
Q
374(BGPMUTF) ;Get the numbers for this measure
N ARRAY
S DEN=+$G(^TMP("BGPMU0374",$J,BGPMUTF,"DEN"))
S NUM=+$G(^TMP("BGPMU0374",$J,BGPMUTF,"NUM"))
S EXC=+$G(^TMP("BGPMU0374",$J,BGPMUTF,"EXC"))
S NONUM=+$G(^TMP("BGPMU0374",$J,BGPMUTF,"NOT"))
I DEN=0 S (PC2,PC1)=0
I DEN>0 D
.I DEN-EXC=0 S (PC2,PC1)=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
P4D ;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 diagnosed with confirmed VTE who" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="received intravenous (IV) unfractionated heparin (UFH) therapy dosages AND had" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="their platelet counts monitored using defined parameters such as a nomogram or" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="protocol, 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=Admit date for Inpatient w/confirmed VTE receiving IV UFH therapy" D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="MED=Start date of IV UFH therapy " D W^BGPMUPP(X,0,1,BGPPTYPE)
S X="LAB#=Date of Platelet Count Laboratory Test" D W^BGPMUPP(X,0,1,BGPPTYPE)
I $Y>(BGPIOSL-3) D HEADERL^BGPMUPH Q:BGPQUIT
W !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"NUMERATOR"
S LINE="",$P(LINE,"-",79)="" W !,LINE
S PTCT=0
I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0374",$J,"PAT","C","NOT")) D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0374"","_$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 D374(NODE)
I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0374",$J,"PAT","C","NUM"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0374"","_$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 D374(NODE)
;Excluded patients
I BGPLIST="A"&($D(^TMP("BGPMU0374",$J,"PAT","C","EXC"))) D
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0374"","_$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 DEXC374(NODE)
S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
Q
D374(NODE) ;GET DATA
N BGPI,DATA,NAME,HRN,DEN,NUMDATA,AGE,DFN,I
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 NUMDATA=$P(NODE,U,5) ;$P(UFHIP,U,2)_";"_PLATE1_";"_PLATE2_";"_PLATE3
S LINES=BGPIOSL-$S(NUMDATA="":2,1:5)
I $Y>LINES D
.D HEADERL^BGPMUPH Q:BGPQUIT
.W !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"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:""),?66,$S(NUMDATA'="":"M:MED "_$$FMTE^XLFDT($P(NUMDATA,";",1),2)_$S($P(NUMDATA,";")>1:";",1:""),1:"NM:")
;if pt is in NUM, they should have three lab dates to display:
I NUMDATA'="" F I=1:1:3 D
.W !,?68,"LAB"_I_" "_$$FMTE^XLFDT($P(NUMDATA,";",(I+1)),2)_$S(I<3:";",1:"")
Q
DEXC374(NODE) ;GET DATA
D DEXC373(NODE)
Q
XML373 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Measure number^""^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="NQF_0373"_U_""_U_+$G(^TMP("BGPMU0373",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0373",$J,"C","NUM"))_U_+$G(^TMP("BGPMU0373",$J,"C","EXC"))
K ^TMP("BGPMU0373",$J)
Q
XML374 ;Populate the BGPXML array with data for each population/numerator
; BGPXMLOUT(i)=Measure number^""^Denominator Count^Numerator Count^Exclusion Count
S BGPXML(1)="NQF_0374"_U_""_U_+$G(^TMP("BGPMU0374",$J,"C","DEN"))_U_+$G(^TMP("BGPMU0374",$J,"C","NUM"))_U_+$G(^TMP("BGPMU0374",$J,"C","EXC"))
K ^TMP("BGPMU0374",$J)
Q
BGPMUHP7 ; IHS/MSC/JSM - MU EH measure output routines;02-Mar-2011 16:06;MGH
+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 ;
VTE3 ;EH output routine for 0373 VTE-3 (BGPMUH12)
+1 DO P3
+2 KILL ^TMP("BGPMU0373",$JOB)
+3 QUIT
P3 ;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=$$373("C")
+4 SET STRING2=$$373("P")
+5 SET STRING3=$$373("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 !,"# Discharges for Pts",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?65,$PIECE(STRING3,U,1)
+17 WRITE !,"w/confirmed VTE"
+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 !,"# Discharges for Pts",?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/confirmed VTE Less Exc"
+23 WRITE !
+24 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+25 WRITE !,"# w/overlap therapy",?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)
+26 WRITE !,"at discharge"
+27 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+28 WRITE !,"# w/o overlap therapy",?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)
+29 WRITE !,"at discharge"
+30 IF $DATA(BGPLIST(BGPIC))
DO P3D
+31 DO SUM373^BGPMUHD6
+32 QUIT
373(BGPMUTF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN=+$GET(^TMP("BGPMU0373",$JOB,BGPMUTF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0373",$JOB,BGPMUTF,"NUM"))
+4 SET EXC=+$GET(^TMP("BGPMU0373",$JOB,BGPMUTF,"EXC"))
+5 SET NONUM=+$GET(^TMP("BGPMU0374",$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
P3D ;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 diagnosed with confirmed VTE who"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="received an overlap of parenteral (intravenous [IV] or subcutaneous [subcu])"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="anticoagulation and warfarin therapy. For patients who received less than"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="5 days of overlap therapy, they must be discharged on both medications."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+7 SET X="Overlap therapy must be administered for at least 5 days with an international"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+8 SET X="normalized ratio (INR) >= 2 prior to discontinuation of the parenteral"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+9 SET X="anticoagulation therapy or the patient must be discharged on both medications,"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+10 SET X="if any."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+11 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+12 SET X="by patients who do meet the numerator criteria (M:). Excluded patients are"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="listed last."
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+14 SET X="The following are the abbreviations used in the denominator and numerator"
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+15 SET X="columns:"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+16 SET X="ADM=Admit date for Inpatient w/ confirmed VTE who received warfarin"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+17 SET X="OVLP DAYS=Number of inpt overlap days"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+18 SET X="INR=Last result value prior to discharge"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+19 SET X="RX=Discharged on overlap therapy"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+20 IF $Y>(BGPIOSL-2)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+21 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?69,"NUMERATOR"
+22 SET LINE=""
SET $PIECE(LINE,"-",79)=""
WRITE !,LINE
+23 SET PTCT=0
+24 IF (BGPLIST="A")!(BGPLIST="D")&$DATA(^TMP("BGPMU0373",$JOB,"PAT","C","NOT"))
Begin DoDot:1
+25 KILL BGPARR
+26 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0373"","_$JOB_",""PAT"",""C"",""NOT"")")
+27 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+28 SET PTCT=PTCT+1
+29 SET NODE=$GET(BGPARR(PT))
+30 DO D373(NODE)
End DoDot:2
End DoDot:1
+31 IF (BGPLIST="A")!(BGPLIST="N")&($DATA(^TMP("BGPMU0373",$JOB,"PAT","C","NUM")))
Begin DoDot:1
+32 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0373"","_$JOB_",""PAT"",""C"",""NUM"")")
+33 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+34 SET PTCT=PTCT+1
+35 SET NODE=$GET(BGPARR(PT))
+36 DO D373(NODE)
End DoDot:2
End DoDot:1
+37 ;Excluded patients
+38 IF BGPLIST="A"&($DATA(^TMP("BGPMU0373",$JOB,"PAT","C","EXC")))
Begin DoDot:1
+39 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0373"","_$JOB_",""PAT"",""C"",""EXC"")")
+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 DEXC373(NODE)
End DoDot:2
End DoDot:1
+44 SET X="Total # of patients on list: "_PTCT
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+45 QUIT
D373(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN,CNT,DD,INR,INRDT
+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 CNT=$PIECE(NODE,U,3)
SET INR=$PIECE(NODE,U,4)
SET INRDT=$PIECE(NODE,U,5)
+10 SET DD=$PIECE(NODE,U,6)
+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(CNT'="":"M:OVLP DAYS: "_CNT,1:"NM:")
+16 IF INR'=""
WRITE ";",!,?69,"INR: "_INR_" "_INRDT
+17 IF DD'=""
WRITE ";",!,?69,"RX:"_$$FMTE^XLFDT($PIECE(DD,".",1),2)
+18 QUIT
DEXC373(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($PIECE($PIECE(NODE,U,2),";",1),":",2)
+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 ;
VTE4 ;EH output routine for 0374 VTE-4 (BGPMUH13)
+1 DO P4
+2 KILL ^TMP("BGPMU0374",$JOB)
+3 QUIT
P4 ;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=$$374("C")
+4 SET STRING2=$$374("P")
+5 SET STRING3=$$374("B")
+6 ;change from prev year Pts w/ Ischemic Stroke (line 1)
SET PRD1=$PIECE(STRING1,U,1)-$PIECE(STRING2,U,1)
+7 ;% change from prev year # w/ antithrombolytic therapy ...
SET PRD2=$PIECE(STRING1,U,5)-$PIECE(STRING2,U,5)
+8 ;% change from base year # w/ antithrombolytic therapy ...
SET PRD3=$PIECE(STRING1,U,5)-$PIECE(STRING3,U,5)
+9 ;% change from prev year # w/ antithrombolytic therapy ...
SET PRD4=$PIECE(STRING1,U,6)-$PIECE(STRING2,U,6)
+10 ;% change from prev year # w/ antithrombolytic therapy ...
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 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+17 WRITE !,"# Discharges for Pts",?33,$PIECE(STRING1,U,1),?44,$PIECE(STRING2,U,1),?65,$PIECE(STRING3,U,1)
+18 WRITE !,"w/confirmed VTE"
+19 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+20 WRITE !,"# Excluded (Exc)",?33,$PIECE(STRING1,U,4),?44,$PIECE(STRING2,U,4),?65,$PIECE(STRING3,U,4)
+21 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+22 WRITE !,"# Discharges for Pts",?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))
+23 WRITE !,"w/confirmed VTE Less Exc"
+24 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+25 WRITE !
+26 WRITE !,"# w/IV UFH therapy",?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 !,"& platelet count"
+28 IF $Y>(BGPIOSL-3)
DO HEADER^BGPMUPH
IF BGPQUIT
QUIT
+29 WRITE !,"# w/o IV UFH therapy",?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 WRITE !,"& platelet count"
+31 IF $DATA(BGPLIST(BGPIC))
DO P4D
+32 DO SUM374^BGPMUHD6
+33 QUIT
374(BGPMUTF) ;Get the numbers for this measure
+1 NEW ARRAY
+2 SET DEN=+$GET(^TMP("BGPMU0374",$JOB,BGPMUTF,"DEN"))
+3 SET NUM=+$GET(^TMP("BGPMU0374",$JOB,BGPMUTF,"NUM"))
+4 SET EXC=+$GET(^TMP("BGPMU0374",$JOB,BGPMUTF,"EXC"))
+5 SET NONUM=+$GET(^TMP("BGPMU0374",$JOB,BGPMUTF,"NOT"))
+6 IF DEN=0
SET (PC2,PC1)=0
+7 IF DEN>0
Begin DoDot:1
+8 IF DEN-EXC=0
SET (PC2,PC1)=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
P4D ;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 diagnosed with confirmed VTE who"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+4 SET X="received intravenous (IV) unfractionated heparin (UFH) therapy dosages AND had"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+5 SET X="their platelet counts monitored using defined parameters such as a nomogram or"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+6 SET X="protocol, 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=Admit date for Inpatient w/confirmed VTE receiving IV UFH therapy"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+13 SET X="MED=Start date of IV UFH therapy "
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+14 SET X="LAB#=Date of Platelet Count Laboratory Test"
DO W^BGPMUPP(X,0,1,BGPPTYPE)
+15 IF $Y>(BGPIOSL-3)
DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+16 WRITE !!,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"NUMERATOR"
+17 SET LINE=""
SET $PIECE(LINE,"-",79)=""
WRITE !,LINE
+18 SET PTCT=0
+19 IF (BGPLIST="A")!(BGPLIST="D")&$DATA(^TMP("BGPMU0374",$JOB,"PAT","C","NOT"))
Begin DoDot:1
+20 KILL BGPARR
+21 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0374"","_$JOB_",""PAT"",""C"",""NOT"")")
+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 D374(NODE)
End DoDot:2
End DoDot:1
+26 IF (BGPLIST="A")!(BGPLIST="N")&($DATA(^TMP("BGPMU0374",$JOB,"PAT","C","NUM")))
Begin DoDot:1
+27 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0374"","_$JOB_",""PAT"",""C"",""NUM"")")
+28 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+29 SET PTCT=PTCT+1
+30 SET NODE=$GET(BGPARR(PT))
+31 DO D374(NODE)
End DoDot:2
End DoDot:1
+32 ;Excluded patients
+33 IF BGPLIST="A"&($DATA(^TMP("BGPMU0374",$JOB,"PAT","C","EXC")))
Begin DoDot:1
+34 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0374"","_$JOB_",""PAT"",""C"",""EXC"")")
+35 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+36 SET PTCT=PTCT+1
+37 SET NODE=$GET(BGPARR(PT))
+38 DO DEXC374(NODE)
End DoDot:2
End DoDot:1
+39 SET X="Total # of patients on list: "_PTCT
DO W^BGPMUPP(X,0,2,BGPPTYPE)
+40 QUIT
D374(NODE) ;GET DATA
+1 NEW BGPI,DATA,NAME,HRN,DEN,NUMDATA,AGE,DFN,I
+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 ;$P(UFHIP,U,2)_";"_PLATE1_";"_PLATE2_";"_PLATE3
SET NUMDATA=$PIECE(NODE,U,5)
+10 SET LINES=BGPIOSL-$SELECT(NUMDATA="":2,1:5)
+11 IF $Y>LINES
Begin DoDot:1
+12 DO HEADERL^BGPMUPH
IF BGPQUIT
QUIT
+13 WRITE !,"PATIENT NAME",?25,"HRN",?33,"COMMUNITY",?44,"SEX",?48,"AGE",?53,"DENOMINATOR",?66,"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:""),?66,$SELECT(NUMDATA'="":"M:MED "_$$FMTE^XLFDT($PIECE(NUMDATA,";",1),2)_$SELECT($PIECE(NUMDATA,";")>1:";",1:""),1:"N
M:")
+16 ;if pt is in NUM, they should have three lab dates to display:
+17 IF NUMDATA'=""
FOR I=1:1:3
Begin DoDot:1
+18 WRITE !,?68,"LAB"_I_" "_$$FMTE^XLFDT($PIECE(NUMDATA,";",(I+1)),2)_$SELECT(I<3:";",1:"")
End DoDot:1
+19 QUIT
DEXC374(NODE) ;GET DATA
+1 DO DEXC373(NODE)
+2 QUIT
XML373 ;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_0373"_U_""_U_+$GET(^TMP("BGPMU0373",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0373",$JOB,"C","NUM"))_U_+$GET(^TMP("BGPMU0373",$JOB,"C","EXC"))
+3 KILL ^TMP("BGPMU0373",$JOB)
+4 QUIT
XML374 ;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_0374"_U_""_U_+$GET(^TMP("BGPMU0374",$JOB,"C","DEN"))_U_+$GET(^TMP("BGPMU0374",$JOB,"C","NUM"))_U_+$GET(^TMP("BGPMU0374",$JOB,"C","EXC"))
+3 KILL ^TMP("BGPMU0374",$JOB)
+4 QUIT