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

BGP6D213.m

Go to the documentation of this file.
BGP6D213 ; IHS/CMI/LAB - measure 6 13 Aug 2015 6:58 AM ; 
 ;;16.1;IHS CLINICAL REPORTING;;MAR 22, 2016;Build 170
 ;
CVD ;EP - called from report execution
 I BGPAGEB<21 S BGPSTOP=1 Q  ;ONLY 21+
 NEW BGPCVDL
 F X=1:1:6 S Y="BGPD"_X S @Y=""  ;6 denominators
 S (BGPN1,BGPN2,BGPN3)=""  ;2 numerators
 S BGPCVDL=$$CHDLDL^BGP6D212(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)  ;CHD OR LDL^CHD^LDL
 I BGPAGEB>20,BGPAGEB<40,'BGPCVDL S BGPSTOP=1 Q  ;21-39 and no cvd/ldl
 I BGPAGEB>75,'BGPCVDL S BGPSTOP=1 Q  ;>75 and no cvd/ldl
 ;DENOM 1
 I BGPDMD1,BGPAGEB>39,BGPAGEB<76 S BGPD1=1  ;up diabetic ages 40-75
 I BGPAGEB>20,BGPCVDL S BGPD1=1   ;or UP 21+ w/CVD or LDL =>190
 ;DENOM 2  21-39, UP with CVD or LDL >=190
 I BGPAGEB>20,BGPAGEB<40,BGPCVDL S BGPD2=1
 ;DENOM 3 40-75, UP with CVD or LDL =>190
 I BGPAGEB>39,BGPAGEB<76,BGPCVDL S BGPD3=1
 ;DENOM 4 76+ with cvd or ldl >=190
 I BGPAGEB>75,BGPCVDL S BGPD4=1
 ;DENOM 5 UP diabetic 40-75
 I BGPDMD1,BGPAGEB>39,BGPAGEB<76 S BGPD5=1
 ;DENOM 6 up 21+
 I BGPD1 S BGPD6=1
 ;I 'BGPD6 S BGPSTOP=1 Q  ;not in at least UP denominator
 ;now exclude people
 S (BGPEXL1,BGPEXL2,BGPEXL3,BGPEXL4,BGPEXL5,BGPEXL6)=""
 S BGPEXL1=$$STATALG^BGP6D212(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,BGPBDATE,BGPEDATE) I BGPEXL1 S (BGPN2,BGPN3)=1 G SETL  ;excl 1
 ;ALCOHOL HEP
 S BGPEXL1=$$ALCHEP^BGP6D212(DFN,BGPBDATE,BGPEDATE) I BGPEXL1 S BGPN2=1 G SETL
 ;NMI
 S BGPEXL1=$$STATNMI^BGP6D212(DFN,BGPBDATE,BGPEDATE) I BGPEXL1 S BGPN2=1 G SETL
 ;PREGNANCY
 S BGPEXL2=$$PREG^BGP6D7(DFN,BGPBDATE,BGPEDATE,1,1,1) I BGPEXL2 S BGPN2=1 G SETL
 ;BREASTFEEDING
 S BGPEXL2=$$BF^BGP6D21(DFN,BGPBDATE,BGPEDATE) I BGPEXL2 S BGPN2=1 G SETL
 ;cirrhosis of liver
 S BGPEXL6=$$CLIVER(DFN,BGPPBD,BGPEDATE) I BGPEXL6 S BGPN2=1 G SETL
 ;PALLIATIVE
 S BGPEXL3=$$LASTDX^BGP6UTL1(DFN,"BGP PALLIATIVE CARE DXS",BGPBDATE,BGPEDATE) I BGPEXL3 S BGPN2=1,BGPEXL3=1_U_$$DATE^BGP6UTL($P(BGPEXL3,U,3))_" Palliative Care" G SETL  ;excl 3
 ;ESRD
 S BGPEXL4=$$ESRD^BGP6D211(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE) I BGPEXL4 S BGPEXL4=1_U_$$DATE^BGP6UTL($P(BGPEXL4,U,3))_" ESRD" S BGPN2=1 G SETL  ;excl 4 ESRD
 ;EXCL 5
 NEW BGPSTAT
 S BGPSTAT=$$STATIN^BGP6D214(DFN,BGPBDATE,BGPEDATE,0)
 S BGPEXL5=$$LASTLDLV^BGP6D212(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE) I BGPEXL5,'$P(BGPCVDL,U,3),'BGPSTAT S BGPN2=1 G SETL   ;excl 5
 ;numerator
 S BGPN1=BGPSTAT
SETL ;
 I BGPN2 S (BGPD1,BGPD2,BGPD3,BGPD4,BGPD5)=""  ;if exclusion don't count in those denoms per Megan
 I BGPN2,BGPD1 S BGPD6=1
 S BGPVALUD=$S(BGPDMD2:"UP,AD",1:"UP") I BGPDMD1!(BGPCVDL) D
 .;S BGPVALUD=BGPVALUD_" ("
 .I BGPDMD1,'BGPCVDL S BGPVALUD=BGPVALUD_" (DM)"_"|||" Q
 .I BGPDMD1,BGPCVDL S BGPVALUD=BGPVALUD_$S($P(BGPCVDL,U,2):" (DM,CHD)",$P(BGPCVDL,U,3):" (DM,LDL)",1:"")_"|||" Q
 .S BGPVALUD=BGPVALUD_$S($P(BGPCVDL,U,2):" (CHD)",$P(BGPCVDL,U,3):" (LDL)",1:"")_"|||"
 I BGPN1 S BGPVALUD=BGPVALUD_$P(BGPN1,U,2)
 I BGPEXL1 S BGPVALUD=BGPVALUD_"Exclusion: "_$P(BGPEXL1,U,2)
 I BGPEXL2 S BGPVALUD=BGPVALUD_"Exclusion: "_$P(BGPEXL2,U,2)_" Pregnant/Breastfeeding"
 I BGPEXL3 S BGPVALUD=BGPVALUD_"Exclusion: "_$P(BGPEXL3,U,2)
 I BGPEXL4 S BGPVALUD=BGPVALUD_"Exclusion: "_$P(BGPEXL4,U,2)
 I BGPEXL6 S BGPVALUD=BGPVALUD_"Exclusion: "_$P(BGPEXL6,U,2)_" Cirrhosis"
 I BGPEXL5,BGPN2 S BGPVALUD=BGPVALUD_"Exclusion: "_$P(BGPEXL5,U,2)
 K BGPEXL1,BGPEXL2,BGPEXL3,BGPEXL4,BGPEXL5,BGPCVDL
 Q
CLIVER(P,BD,ED) ;EP - cirrhosis of liver?
 NEW %,X
 S X=$$LASTDX^BGP6UTL1(P,"BGP CIRRHOSIS OF LIVER DXS",BD,ED)
 I X Q 1_U_$$DATE^BGP6UTL($P(X,U,3))
 Q ""