Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BGPMUDP4

BGPMUDP4.m

Go to the documentation of this file.
  1. BGPMUDP4 ; IHS/MSC/SAT - MU EH measure output routines;12-JUL-2011 16:30;DU
  1. ;;14.1;IHS CLINICAL REPORTING;**1**;MAY 29, 2014;Build 2
  1. ;
  1. ;This routine does the printed output of 0014 Prenatal Anti-D Immune Globulin (BGPMUD05)
  1. P27ENT ;EP output routine for 0027 Prenatal Anti-D Immune Globulin
  1. D P27
  1. K ^TMP("BGPMU0027",$J)
  1. Q
  1. P27 ;Write individual measure
  1. N X,Y,Z,LIST1,LIST2,LIST3
  1. N DEN,NUM1,EXC1,PC1,PC11,PC13,NONUM,STRING1,STRING2,STRING3,PRD1,PRD2,PRD3,PRD4,PRD5,PRD6,X
  1. S STRING1=$$027("C")
  1. S STRING2=$$027("P")
  1. S STRING3=$$027("B")
  1. ;S PRD11=$P(STRING1,U,1)-$P(STRING2,U,1) ;change from prev year (line 1)
  1. S PRD12=$P(STRING1,U,5)-$P(STRING2,U,5) ;% change from prev year
  1. S PRD13=$P(STRING1,U,5)-$P(STRING3,U,5) ;% change from base year
  1. S PRD14=$P(STRING1,U,6)-$P(STRING2,U,6) ;% change from prev year
  1. S PRD15=$P(STRING1,U,6)-$P(STRING3,U,6) ;% change from prev year
  1. ;S PRD21=$P(STRING1,U,1)-$P(STRING2,U,1) ;change from prev year (line 1)
  1. S PRD22=$P(STRING1,U,11)-$P(STRING2,U,11) ;% change from prev year
  1. S PRD23=$P(STRING1,U,11)-$P(STRING3,U,11) ;% change from base year
  1. S PRD24=$P(STRING1,U,12)-$P(STRING2,U,12) ;% change from prev year
  1. S PRD25=$P(STRING1,U,12)-$P(STRING3,U,12) ;% change from prev year
  1. D HEADER^BGPMUPH Q:BGPQUIT
  1. ;W !
  1. D HDRBLK^BGPMUPH
  1. W !!,"Pts 18+",?33,$P(STRING1,U,1),?44,$P(STRING2,U,1),?64,$P(STRING3,U,1)
  1. I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
  1. W !
  1. W !,"Numerator 1"
  1. W !,"# w/tobacco use",?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(PRD12,",+",1),6),?64,$P(STRING3,U,2),?68,$J($P(STRING3,U,5),5,1),?74,$J($FN(PRD13,",+",1),6)
  1. W !,"# w/o tobacco use",?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(PRD14,",+",1),6),?64,$P(STRING3,U,3),?68,$J($P(STRING3,U,6),5,1),?74,$J($FN(PRD15,",+",1),6)
  1. I $Y>(BGPIOSL-3) D HEADER^BGPMUPH Q:BGPQUIT
  1. W !
  1. W !,"Numerator 2"
  1. W !,"# w/tobacco use and",?33,$P(STRING1,U,8),?38,$J($P(STRING1,U,11),5,1),?44,$P(STRING2,U,8),?49,$J($P(STRING2,U,11),5,1),?56,$J($FN(PRD22,",+",1),6),?64,$P(STRING3,U,8),?68,$J($P(STRING3,U,11),5,1),?74,$J($FN(PRD23,",+",1),6)
  1. W !,"cessation counseling"
  1. W !,"# w/o tobacco use or",?33,$P(STRING1,U,9),?38,$J($P(STRING1,U,12),5,1),?44,$P(STRING2,U,9),?49,$J($P(STRING2,U,12),5,1),?56,$J($FN(PRD24,",+",1),6),?64,$P(STRING3,U,9),?68,$J($P(STRING3,U,12),5,1),?74,$J($FN(PRD25,",+",1),6)
  1. W !,"w/tobacco use and no"
  1. W !,"cessation counseling"
  1. I $D(BGPLIST(BGPIC)) D P27D
  1. D SUM027^BGPMUDD4
  1. Q
  1. 027(BGPMUTF) ;Get the numbers for this measure
  1. N ARRAY
  1. S DEN=+$G(^TMP("BGPMU0027",$J,BGPMUTF,"DEN",1))
  1. S NUM1=+$G(^TMP("BGPMU0027",$J,BGPMUTF,"NUM",1))
  1. S NONUM1=+$G(^TMP("BGPMU0027",$J,BGPMUTF,"NOT",1))
  1. S NUM2=+$G(^TMP("BGPMU0027",$J,BGPMUTF,"NUM",2))
  1. S NONUM2=+$G(^TMP("BGPMU0027",$J,BGPMUTF,"NOT",2))
  1. I DEN=0 S (PC1,PC11)=0,(PC2,PC21)=0
  1. I DEN>0 D
  1. .I DEN=0 S (PC1,PC11)=0,(PC2,PC21)=0
  1. .E D
  1. ..S PC1=$$ROUND^BGPMUA01((NUM1/DEN),3)*100
  1. ..S PC11=$$ROUND^BGPMUA01((NONUM1/DEN),3)*100
  1. ..S PC2=$$ROUND^BGPMUA01((NUM2/DEN),3)*100
  1. ..S PC21=$$ROUND^BGPMUA01((NONUM2/DEN),3)*100
  1. ; 1 2 3 4 5 6 7 8 9 10 11 12 13
  1. S ARRAY=DEN_U_NUM1_U_NONUM1_U_""_U_PC1_U_PC11_U_0_U_NUM2_U_NONUM2_U_""_U_PC2_U_PC21_U_0
  1. Q ARRAY
  1. P27D ;Do the Details
  1. N PT,PTCNT,NODE,NAME,VST,BMI,FOL,X
  1. N BGPARR
  1. D HEADERL^BGPMUPH Q:BGPQUIT
  1. S X="Patients 18 years of age and older with at least 1 encounter with the EP within" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="2 years of the reporting period end date, who have been identified as tobacco" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="users within 1 year before or during the reporting period and who received" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="advice to quit smoking or tobacco use or whose EP recommended or discussed" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="smoking or tobacco use cessation medications, methods or strategies within" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="1 year of the reporting period end date, if any." D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="Patients who do not meet the numerator criteria are listed first (NM:), followed" D W^BGPMUPP(X,0,2,BGPPTYPE)
  1. S X="by patients who do meet the numerator criteria (M:)." D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="The following are the abbreviations used in the denominator and numerator" D W^BGPMUPP(X,0,2,BGPPTYPE)
  1. S X="columns:" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="EN=Encounter" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. S X="HF=Tobacco User Health Factor" D W^BGPMUPP(X,0,1,BGPPTYPE)
  1. ;
  1. I $Y>(BGPIOSL-2) D HEADERL^BGPMUPH Q:BGPQUIT
  1. W !!,"Numerator 1: Tobacco users"
  1. W !!,"PATIENT NAME",?23,"HRN",?31,"COMMUNITY",?41,"SEX",?45,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
  1. S LINE="",$P(LINE,"-",81)="" W !,LINE
  1. S PTCT=0
  1. I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0027",$J,"PAT","C","NOT",1)) D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0027"","_$J_",""PAT"",""C"",""NOT"",1)")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D D027(NODE)
  1. I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0027",$J,"PAT","C","NUM",1))) D
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0027"","_$J_",""PAT"",""C"",""NUM"",1)")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D D027(NODE)
  1. S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
  1. W !!,"Numerator 2: Tobacco users who received tobacco use cessation counseling"
  1. W !!,"PATIENT NAME",?23,"HRN",?31,"COMMUNITY",?41,"SEX",?45,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
  1. S LINE="",$P(LINE,"-",81)="" W !,LINE
  1. S PTCT=0
  1. I (BGPLIST="A")!(BGPLIST="D")&$D(^TMP("BGPMU0027",$J,"PAT","C","NOT",2)) D
  1. .K BGPARR
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0027"","_$J_",""PAT"",""C"",""NOT"",2)")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D D027(NODE)
  1. I (BGPLIST="A")!(BGPLIST="N")&($D(^TMP("BGPMU0027",$J,"PAT","C","NUM",2))) D
  1. .D PTLSORT^BGPMUUTL(.BGPARR,"^TMP(""BGPMU0027"","_$J_",""PAT"",""C"",""NUM"",2)")
  1. .S PT=0 F S PT=$O(BGPARR(PT)) Q:PT="" D
  1. ..S PTCT=PTCT+1
  1. ..S NODE=$G(BGPARR(PT))
  1. ..D D027(NODE)
  1. S X="Total # of patients on list: "_PTCT D W^BGPMUPP(X,0,2,BGPPTYPE)
  1. Q
  1. ;
  1. D027(NODE) ;GET DATA
  1. N BGPI,DATA,NAME,HRN,DEN,NUM,AGE,DFN
  1. S DFN=$P(NODE,U,1)
  1. S NAME=$E($$GET1^DIQ(2,$P(NODE,U,1),.01),1,21)
  1. S HRN=$$HRN^AUPNPAT(DFN,DUZ(2))
  1. S AGE=$$AGE^AUPNPAT(DFN,BGPED)
  1. S SEX=$$SEX^AUPNPAT(DFN)
  1. S COMM=$E($$GET1^DIQ(9000001,DFN,1118),1,10)
  1. S DEN=$P(NODE,U,2)
  1. S NUM=$P(NODE,U,3)
  1. I $Y>(BGPIOSL-2) D
  1. .D HEADERL^BGPMUPH Q:BGPQUIT
  1. .W !,"PATIENT NAME",?23,"HRN",?31,"COMMUNITY",?41,"SEX",?45,"AGE",?50,"DENOMINATOR",?63,"NUMERATOR"
  1. .S LINE="",$P(LINE,"-",81)="" W !,LINE
  1. W !,NAME,?23,HRN,?31,COMM,?41,SEX,?45,AGE,?50,$P(DEN,";",1),?63,$P(NUM,";",1)
  1. I ($P(DEN,";",2)'="")!($P(NUM,";",2)'="") W !,?50,$S($P(DEN,";",2)'="":$P(DEN,";",2),1:""),?63,$S($P(NUM,";",2)'="":$P(NUM,";",2),1:"")
  1. I ($P(DEN,";",3)'="")!($P(NUM,";",3)'="") W !,?50,$S($P(DEN,";",3)'="":$P(DEN,";",3),1:""),?63,$S($P(NUM,";",3)'="":$P(NUM,";",3),1:"")
  1. Q
  1. ;
  1. XML027 ;Populate the BGPXML array with data for each population/numerator
  1. ; BGPXMLOUT(i)=Population Number^Numerator Number^Denominator Count^Numerator Count^Exclusion Count
  1. S BGPXML(1)="115"_U_""_U_+$G(^TMP("BGPMU0027",$J,"C","DEN",1))_U_+$G(^TMP("BGPMU0027",$J,"C","NUM",1))
  1. S BGPXML(2)="115"_U_""_U_+$G(^TMP("BGPMU0027",$J,"C","DEN",1))_U_+$G(^TMP("BGPMU0027",$J,"C","NUM",2))
  1. K ^TMP("BGPMU0027",$J)
  1. Q
  1. ;
  1. ;*********************
  1. ;