BGPMUDD1 ; IHS/MSC/SAT - Print MI measure NQF0028 ;21-Mar-2011 13:15;DU
;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
;Delimited output
;Get printout for Tobacco Assessment measure 0028A
TOB2 ;EP
D P1A
K ^TMP("BGPMU0028A",$J)
Q
P1A ;Write individual measure
N BGPPTYPE,X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRD1,PRN1
S BGPPTYPE="D"
S STRING1=$$A28("C")
S STRING2=$$A28("P")
S STRING3=$$A28("B")
D SUM28A^BGPMUDP1
S PRD1=$P(STRING1,U,7)-$P(STRING2,U,7)
S PRD2=$P(STRING1,U,8)-$P(STRING2,U,8)
S PRB1=$P(STRING1,U,7)-$P(STRING3,U,7)
S PRB2=$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 FROM BASE"
D S^BGPMUDEL(X,2,1)
S X="Pts 18+"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1) D S^BGPMUDEL(X,2,1)
S X="# w/tob screen-24 mos"_U_$P(STRING1,U,2)_U_$P(STRING1,U,7)_U_$P(STRING2,U,2)_U_$P(STRING2,U,7)_U_PRD1_U_$P(STRING3,U,2)_U_$P(STRING3,U,7)_U_PRB1
D S^BGPMUDEL(X,2,1)
S X="# w/o tob screen-24 mos"_U_$P(STRING1,U,3)_U_$P(STRING1,U,8)_U_$P(STRING2,U,3)_U_$P(STRING2,U,8)_U_PRB2_U_$P(STRING3,U,3)_U_$P(STRING3,U,7)_U_PRB2
D S^BGPMUDEL(X,1,1)
I $D(BGPLIST(BGPIC)) D TA
Q
A28(TF) ;Get the numbers for this measure
N ARRAY,DEN1,NONUM,NUM1,PC1
S DEN1=+$G(^TMP("BGPMU0028A",$J,TF,"DEN",1))
S NUM1=+$G(^TMP("BGPMU0028A",$J,TF,"INCL",1))
S NONUM=+$G(^TMP("BGPMU0028A",$J,TF,"NOT",1))
I DEN1=0 S (PC1,PC2)=0
I DEN1>0 D
.S PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
.S PC2=$$ROUND^BGPMUA01((NONUM/DEN1),3)*100
S ARRAY=DEN1_U_NUM1_U_NONUM_U_""_U_""_U_""_U_PC1_U_PC2
Q ARRAY
TA ;Do the Details
N PT,NODE,NAME,BP,PTCT
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
;D HEADER^BGPMUPH Q:BGPQUIT
S X="Preventive Care and Screening Measure Pair: Tobacco Use Assessment, NQF 0028a/PQRI 114" D S^BGPMUDEL(X,2,1)
S X="Patients 18+ with at least 1 or 2 encounters with the EP during the reporting period, with documented tobacco screening within 24 months, if any." D S^BGPMUDEL(X,2,1)
S X="Patients who do not meet the numerator criteria are listed first (NM:), followed by patients who do meet the numerator criteria (M:)." D S^BGPMUDEL(X,2,1)
S X="The following are the abbreviations used in the denominator column:" D S^BGPMUDEL(X,2,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR" D S^BGPMUDEL(X,2,1)
S PTCT=0
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028A"","_$J_",""C"",""NOT"",""PAT"",1)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA3(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028A"","_$J_",""C"",""INCL"",""PAT"",1)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA3(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
Q
;
DATA3(NODE) ;GET DATA
N AGE,DEN,DFN,COMM,HRN,NAME,NUM,SEX
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,15)
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,9)
S DEN=$P(NODE,U,2)
S NUM=$P(NODE,U,3)
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE
S X=X_U_"EN:"_$P($$FMTE^XLFDT($P($P(DEN,":",1),";",1),2),"@",1)
S X=X_$S($L($P(DEN,":",1),";")>1:";",1:"")_$S($P($P(DEN,":",1),";",2)'="":"EN:"_$P($$FMTE^XLFDT($P($P(DEN,":",1),";",2),2),"@",1),1:"")_$S($P(DEN,":",2)'="":";"_"HF:"_$P($$FMTE^XLFDT($P(DEN,":",2),2),"@",1),1:"")
S X=X_U_$S(NUM'="":"M:"_$P(NUM,";",1)_" "_$$FMTE^XLFDT($P(NUM,";",2),2),1:"NM:")
D S^BGPMUDEL(X,1,1)
Q
;
;Get printout for Tobacco Cessation measure 0028B
TOB ;EP
D P1B
K ^TMP("BGPMU0028B",$J)
Q
P1B ;Write individual measure
N BGPPTYPE,X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRD1,PRN1
S BGPPTYPE="D"
S STRING1=$$B28("C")
S STRING2=$$B28("P")
S STRING3=$$B28("B")
D SUM28B^BGPMUDP1
S PRD1=$P(STRING1,U,7)-$P(STRING2,U,7)
S PRD2=$P(STRING1,U,8)-$P(STRING2,U,8)
S PRB1=$P(STRING1,U,7)-$P(STRING3,U,7)
S PRB2=$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 FROM BASE"
D S^BGPMUDEL(X,2,1)
S X="Pts 18+/Tobacco user/24mos"_U_$P(STRING1,U,1)_U_U_$P(STRING2,U,1)_U_U_U_$P(STRING3,U,1) D S^BGPMUDEL(X,2,1)
S X="# w/cess counsel/agent/24 mos"_U_$P(STRING1,U,2)_U_$P(STRING1,U,7)_U_$P(STRING2,U,2)_U_$P(STRING2,U,7)_U_PRD1_U_$P(STRING3,U,2)_U_$P(STRING3,U,7)_U_PRB1
D S^BGPMUDEL(X,2,1)
S X="# w/o cess counsel/agent/24mos"_U_$P(STRING1,U,3)_U_$P(STRING1,U,7)_U_$P(STRING2,U,3)_U_$P(STRING2,U,7)_U_PRB2_U_$P(STRING3,U,3)_U_$P(STRING3,U,7)_U_PRB2
D S^BGPMUDEL(X,1,1)
I $D(BGPLIST(BGPIC)) D TC
Q
B28(TF) ;Get the numbers for this measure
N ARRAY,DEN1,NONUM,NUM1,PC1
S DEN1=+$G(^TMP("BGPMU0028B",$J,TF,"DEN",1))
S NUM1=+$G(^TMP("BGPMU0028B",$J,TF,"INCL",1))
S NONUM=+$G(^TMP("BGPMU0028B",$J,TF,"NOT",1))
I DEN1=0 S (PC1,PC2)=0
I DEN1>0 D
.S PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
.S PC2=$$ROUND^BGPMUA01((NONUM/DEN1),3)*100
S ARRAY=DEN1_U_NUM1_U_NONUM_U_""_U_""_U_""_U_PC1_U_PC2
Q ARRAY
TC ;Do the Details
N PT,NODE,NAME,BP
S X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****" D S^BGPMUDEL(X,2,1)
;D HEADER^BGPMUPH Q:BGPQUIT
S X="Preventive Care and Screening Measure Pair: Tobacco Use Assessment, NQF 0028b/PQRI 115" D S^BGPMUDEL(X,2,1)
S X="Patients 18+ with at least 1 or 2 encounters with the EP during the reporting" D S^BGPMUDEL(X,2,1)
S X="period and who have been identified as tobacco users within the last 24 months," D S^BGPMUDEL(X,1,1)
S X="with documented cessation intervention, if any." 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,2,1)
S X="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 column:" D S^BGPMUDEL(X,2,1)
S X="EN=Encounter" D S^BGPMUDEL(X,1,1)
S X="HF=Tobacco User health Factor" 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)
S PTCT=0
I BGPLIST="D"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028B"","_$J_",""C"",""NOT"",""PAT"",1)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA4(NODE)
I BGPLIST="N"!(BGPLIST="A") D
.K BGPARR
.D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028B"","_$J_",""C"",""INCL"",""PAT"",1)")
.S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
..S PTCT=PTCT+1
..S NODE=$G(BGPARR(PT))
..D DATA4(NODE)
S X="Total # of patients on list: "_PTCT D S^BGPMUDEL(X,2,1)
Q
;
DATA4(NODE) ;GET DATA
N AGE,DEN,DFN,COMM,HRN,NAME,NUM,SEX
S DFN=$P(NODE,U,1)
S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,15)
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,9)
S DEN=$P(NODE,U,2),NUM=$P(NODE,U,3)
;line 1
S X=NAME_U_HRN_U_COMM_U_SEX_U_AGE
S X=X_U_$S($P(DEN,";",1)'="":"EN:"_$P($$FMTE^XLFDT($P(DEN,";",1),2),"@",1)_$S($L(DEN,";")>1:";",1:""),1:"")
I $L(DEN,";")>1 S X=X_";"_$S($P(DEN,";",2)'="":"EN:"_$P($$FMTE^XLFDT($P(DEN,";",2),2),"@",1),1:"")
S X=X_U_$S(NUM'="":"M:"_$E($P(NUM,";",1),1,15),1:"NM:")
I $L(NUM,";")>1 S X=X_";"_$S($P(NUM,";",2)'="":$P($$FMTE^XLFDT($P(NUM,";",2),2),"@",1),1:"")
D S^BGPMUDEL(X,1,1)
Q
;
XML0028A ;XML output for TOBACCO ASSESSMENT measure
; BGPXML(i)=Population Number^Numerator Number^Denominator Count
N STRING
S STRING=$$A28("C")
S BGPXML(1)="NQF_0028A"_U_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)
K ^TMP("BGPMU0028A",$J)
Q
;
XML0028B ;XML output for TOBACCO ASSESSMENT measure
; BGPXML(i)=Population Number^Numerator Number^Denominator Count
N STRING
S STRING=$$B28("C")
S BGPXML(1)="NQF_0028B"_U_U_+$P(STRING,U,1)_U_+$P(STRING,U,2)
K ^TMP("BGPMU0028B",$J)
Q
BGPMUDD1 ; IHS/MSC/SAT - Print MI measure NQF0028 ;21-Mar-2011 13:15;DU
+1 ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
+2 ;Delimited output
+3 ;Get printout for Tobacco Assessment measure 0028A
TOB2 ;EP
+1 DO P1A
+2 KILL ^TMP("BGPMU0028A",$JOB)
+3 QUIT
P1A ;Write individual measure
+1 NEW BGPPTYPE,X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRD1,PRN1
+2 SET BGPPTYPE="D"
+3 SET STRING1=$$A28("C")
+4 SET STRING2=$$A28("P")
+5 SET STRING3=$$A28("B")
+6 DO SUM28A^BGPMUDP1
+7 SET PRD1=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
+8 SET PRD2=$PIECE(STRING1,U,8)-$PIECE(STRING2,U,8)
+9 SET PRB1=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
+10 SET PRB2=$PIECE(STRING1,U,8)-$PIECE(STRING3,U,8)
+11 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+12 DO S^BGPMUDEL(X,2,1)
+13 SET X="Pts 18+"_U_$PIECE(STRING1,U,1)_U_U_$PIECE(STRING2,U,1)_U_U_U_$PIECE(STRING3,U,1)
DO S^BGPMUDEL(X,2,1)
+14 SET X="# w/tob screen-24 mos"_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,7)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,7)_U_PRD1_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,7)_U_PRB1
+15 DO S^BGPMUDEL(X,2,1)
+16 SET X="# w/o tob screen-24 mos"_U_$PIECE(STRING1,U,3)_U_$PIECE(STRING1,U,8)_U_$PIECE(STRING2,U,3)_U_$PIECE(STRING2,U,8)_U_PRB2_U_$PIECE(STRING3,U,3)_U_$PIECE(STRING3,U,7)_U_PRB2
+17 DO S^BGPMUDEL(X,1,1)
+18 IF $DATA(BGPLIST(BGPIC))
DO TA
+19 QUIT
A28(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN1,NONUM,NUM1,PC1
+2 SET DEN1=+$GET(^TMP("BGPMU0028A",$JOB,TF,"DEN",1))
+3 SET NUM1=+$GET(^TMP("BGPMU0028A",$JOB,TF,"INCL",1))
+4 SET NONUM=+$GET(^TMP("BGPMU0028A",$JOB,TF,"NOT",1))
+5 IF DEN1=0
SET (PC1,PC2)=0
+6 IF DEN1>0
Begin DoDot:1
+7 SET PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
+8 SET PC2=$$ROUND^BGPMUA01((NONUM/DEN1),3)*100
End DoDot:1
+9 SET ARRAY=DEN1_U_NUM1_U_NONUM_U_""_U_""_U_""_U_PC1_U_PC2
+10 QUIT ARRAY
TA ;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 ;D HEADER^BGPMUPH Q:BGPQUIT
+4 SET X="Preventive Care and Screening Measure Pair: Tobacco Use Assessment, NQF 0028a/PQRI 114"
DO S^BGPMUDEL(X,2,1)
+5 SET X="Patients 18+ with at least 1 or 2 encounters with the EP during the reporting period, with documented tobacco screening within 24 months, if any."
DO S^BGPMUDEL(X,2,1)
+6 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed by patients who do meet the numerator criteria (M:)."
DO S^BGPMUDEL(X,2,1)
+7 SET X="The following are the abbreviations used in the denominator column:"
DO S^BGPMUDEL(X,2,1)
+8 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+9 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"
DO S^BGPMUDEL(X,2,1)
+10 SET PTCT=0
+11 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+12 KILL BGPARR
+13 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028A"","_$JOB_",""C"",""NOT"",""PAT"",1)")
+14 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+15 SET PTCT=PTCT+1
+16 SET NODE=$GET(BGPARR(PT))
+17 DO DATA3(NODE)
End DoDot:2
End DoDot:1
+18 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+19 KILL BGPARR
+20 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028A"","_$JOB_",""C"",""INCL"",""PAT"",1)")
+21 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+22 SET PTCT=PTCT+1
+23 SET NODE=$GET(BGPARR(PT))
+24 DO DATA3(NODE)
End DoDot:2
End DoDot:1
+25 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+26 QUIT
+27 ;
DATA3(NODE) ;GET DATA
+1 NEW AGE,DEN,DFN,COMM,HRN,NAME,NUM,SEX
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,15)
+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,9)
+8 SET DEN=$PIECE(NODE,U,2)
+9 SET NUM=$PIECE(NODE,U,3)
+10 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE
+11 SET X=X_U_"EN:"_$PIECE($$FMTE^XLFDT($PIECE($PIECE(DEN,":",1),";",1),2),"@",1)
+12 SET X=X_$SELECT($LENGTH($PIECE(DEN,":",1),";")>1:";",1:"")_$SELECT($PIECE($PIECE(DEN,":",1),";",2)'="":"EN:"_$PIECE($$FMTE^XLFDT($PIECE($PIECE(DEN,":",1),";",2),2),"@",1),1:"")_...
... $SELECT($PIECE(DEN,":",2)'="":";"_"HF:"_$PIECE($$FMTE^XLFDT($PIECE(DEN,":",2),2),"@",1),1:"")
+13 SET X=X_U_$SELECT(NUM'="":"M:"_$PIECE(NUM,";",1)_" "_$$FMTE^XLFDT($PIECE(NUM,";",2),2),1:"NM:")
+14 DO S^BGPMUDEL(X,1,1)
+15 QUIT
+16 ;
+17 ;Get printout for Tobacco Cessation measure 0028B
TOB ;EP
+1 DO P1B
+2 KILL ^TMP("BGPMU0028B",$JOB)
+3 QUIT
P1B ;Write individual measure
+1 NEW BGPPTYPE,X,Y,Z,DEN,NUM,PC,STRING1,STRING2,PRD,PRN,PRD1,PRN1
+2 SET BGPPTYPE="D"
+3 SET STRING1=$$B28("C")
+4 SET STRING2=$$B28("P")
+5 SET STRING3=$$B28("B")
+6 DO SUM28B^BGPMUDP1
+7 SET PRD1=$PIECE(STRING1,U,7)-$PIECE(STRING2,U,7)
+8 SET PRD2=$PIECE(STRING1,U,8)-$PIECE(STRING2,U,8)
+9 SET PRB1=$PIECE(STRING1,U,7)-$PIECE(STRING3,U,7)
+10 SET PRB2=$PIECE(STRING1,U,8)-$PIECE(STRING3,U,8)
+11 SET X=U_"REPORT PERIOD"_U_"%"_U_"PREV YR PERIOD"_U_"%"_U_"CHG FROM PREV YR"_U_"BASE YEAR"_U_"%"_U_"CHG FROM BASE"
+12 DO S^BGPMUDEL(X,2,1)
+13 SET X="Pts 18+/Tobacco user/24mos"_U_$PIECE(STRING1,U,1)_U_U_$PIECE(STRING2,U,1)_U_U_U_$PIECE(STRING3,U,1)
DO S^BGPMUDEL(X,2,1)
+14 SET X="# w/cess counsel/agent/24 mos"_U_$PIECE(STRING1,U,2)_U_$PIECE(STRING1,U,7)_U_$PIECE(STRING2,U,2)_U_$PIECE(STRING2,U,7)_U_PRD1_U_$PIECE(STRING3,U,2)_U_$PIECE(STRING3,U,7)_U_PRB1
+15 DO S^BGPMUDEL(X,2,1)
+16 SET X="# w/o cess counsel/agent/24mos"_U_$PIECE(STRING1,U,3)_U_$PIECE(STRING1,U,7)_U_$PIECE(STRING2,U,3)_U_$PIECE(STRING2,U,7)_U_PRB2_U_$PIECE(STRING3,U,3)_U_$PIECE(STRING3,U,7)_U_PRB2
+17 DO S^BGPMUDEL(X,1,1)
+18 IF $DATA(BGPLIST(BGPIC))
DO TC
+19 QUIT
B28(TF) ;Get the numbers for this measure
+1 NEW ARRAY,DEN1,NONUM,NUM1,PC1
+2 SET DEN1=+$GET(^TMP("BGPMU0028B",$JOB,TF,"DEN",1))
+3 SET NUM1=+$GET(^TMP("BGPMU0028B",$JOB,TF,"INCL",1))
+4 SET NONUM=+$GET(^TMP("BGPMU0028B",$JOB,TF,"NOT",1))
+5 IF DEN1=0
SET (PC1,PC2)=0
+6 IF DEN1>0
Begin DoDot:1
+7 SET PC1=$$ROUND^BGPMUA01((NUM1/DEN1),3)*100
+8 SET PC2=$$ROUND^BGPMUA01((NONUM/DEN1),3)*100
End DoDot:1
+9 SET ARRAY=DEN1_U_NUM1_U_NONUM_U_""_U_""_U_""_U_PC1_U_PC2
+10 QUIT ARRAY
TC ;Do the Details
+1 NEW PT,NODE,NAME,BP
+2 SET X="**** CONFIDENTIAL PATIENT INFORMATION COVERED BY PRIVACY ACT ****"
DO S^BGPMUDEL(X,2,1)
+3 ;D HEADER^BGPMUPH Q:BGPQUIT
+4 SET X="Preventive Care and Screening Measure Pair: Tobacco Use Assessment, NQF 0028b/PQRI 115"
DO S^BGPMUDEL(X,2,1)
+5 SET X="Patients 18+ with at least 1 or 2 encounters with the EP during the reporting"
DO S^BGPMUDEL(X,2,1)
+6 SET X="period and who have been identified as tobacco users within the last 24 months,"
DO S^BGPMUDEL(X,1,1)
+7 SET X="with documented cessation intervention, if any."
DO S^BGPMUDEL(X,1,1)
+8 SET X="Patients who do not meet the numerator criteria are listed first (NM:), followed"
DO S^BGPMUDEL(X,2,1)
+9 SET X="by patients who do meet the numerator criteria (M:)."
DO S^BGPMUDEL(X,1,1)
+10 SET X="The following are the abbreviations used in the denominator column:"
DO S^BGPMUDEL(X,2,1)
+11 SET X="EN=Encounter"
DO S^BGPMUDEL(X,1,1)
+12 SET X="HF=Tobacco User health Factor"
DO S^BGPMUDEL(X,1,1)
+13 SET X="PATIENT NAME"_U_"HRN"_U_"COMMUNITY"_U_"SEX"_U_"AGE"_U_"DENOMINATOR"_U_"NUMERATOR"
DO S^BGPMUDEL(X,1,1)
+14 SET PTCT=0
+15 IF BGPLIST="D"!(BGPLIST="A")
Begin DoDot:1
+16 KILL BGPARR
+17 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028B"","_$JOB_",""C"",""NOT"",""PAT"",1)")
+18 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+19 SET PTCT=PTCT+1
+20 SET NODE=$GET(BGPARR(PT))
+21 DO DATA4(NODE)
End DoDot:2
End DoDot:1
+22 IF BGPLIST="N"!(BGPLIST="A")
Begin DoDot:1
+23 KILL BGPARR
+24 DO PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0028B"","_$JOB_",""C"",""INCL"",""PAT"",1)")
+25 SET PT=0
FOR
SET PT=$ORDER(BGPARR(PT))
IF PT=""
QUIT
Begin DoDot:2
+26 SET PTCT=PTCT+1
+27 SET NODE=$GET(BGPARR(PT))
+28 DO DATA4(NODE)
End DoDot:2
End DoDot:1
+29 SET X="Total # of patients on list: "_PTCT
DO S^BGPMUDEL(X,2,1)
+30 QUIT
+31 ;
DATA4(NODE) ;GET DATA
+1 NEW AGE,DEN,DFN,COMM,HRN,NAME,NUM,SEX
+2 SET DFN=$PIECE(NODE,U,1)
+3 SET NAME=$EXTRACT($$GET1^DIQ(2,$PIECE(NODE,U,1),.01),1,15)
+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,9)
+8 SET DEN=$PIECE(NODE,U,2)
SET NUM=$PIECE(NODE,U,3)
+9 ;line 1
+10 SET X=NAME_U_HRN_U_COMM_U_SEX_U_AGE
+11 SET X=X_U_$SELECT($PIECE(DEN,";",1)'="":"EN:"_$PIECE($$FMTE^XLFDT($PIECE(DEN,";",1),2),"@",1)_$SELECT($LENGTH(DEN,";")>1:";",1:""),1:"")
+12 IF $LENGTH(DEN,";")>1
SET X=X_";"_$SELECT($PIECE(DEN,";",2)'="":"EN:"_$PIECE($$FMTE^XLFDT($PIECE(DEN,";",2),2),"@",1),1:"")
+13 SET X=X_U_$SELECT(NUM'="":"M:"_$EXTRACT($PIECE(NUM,";",1),1,15),1:"NM:")
+14 IF $LENGTH(NUM,";")>1
SET X=X_";"_$SELECT($PIECE(NUM,";",2)'="":$PIECE($$FMTE^XLFDT($PIECE(NUM,";",2),2),"@",1),1:"")
+15 DO S^BGPMUDEL(X,1,1)
+16 QUIT
+17 ;
XML0028A ;XML output for TOBACCO ASSESSMENT measure
+1 ; BGPXML(i)=Population Number^Numerator Number^Denominator Count
+2 NEW STRING
+3 SET STRING=$$A28("C")
+4 SET BGPXML(1)="NQF_0028A"_U_U_+$PIECE(STRING,U,1)_U_+$PIECE(STRING,U,2)
+5 KILL ^TMP("BGPMU0028A",$JOB)
+6 QUIT
+7 ;
XML0028B ;XML output for TOBACCO ASSESSMENT measure
+1 ; BGPXML(i)=Population Number^Numerator Number^Denominator Count
+2 NEW STRING
+3 SET STRING=$$B28("C")
+4 SET BGPXML(1)="NQF_0028B"_U_U_+$PIECE(STRING,U,1)_U_+$PIECE(STRING,U,2)
+5 KILL ^TMP("BGPMU0028B",$JOB)
+6 QUIT