BGP8C2 ; IHS/CMI/LAB - calc CMS measures 26 Sep 2004 11:28 AM 04 May 2008 2:38 PM ;
;;8.0;IHS CLINICAL REPORTING;**2**;MAR 12, 2008
;
HFALL ;EP
;was there an AMI pov on this visit
Q:'$$HFDX^BGP8CU(BGPVSIT)
I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q ; no one under 18 at admission date
I $$LVADEX^BGP8CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP)) Q ;
S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=""
Q
;
HF1 ;EP
S BGPEX=""
Q:'$$HFDX^BGP8CU(BGPVSIT)
I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q ; no one under 18 at admission date
I '$$REGDSCH^BGP8CU(BGPVINP) Q ;not regular discharge so don't count this patient
I $$LVADEX^BGP8CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=1
HF1A ;
I $G(BGPEXCL),BGPEX]"" Q
S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
Q
;
HF2 ;EP
S BGPEX=""
Q:'$$HFDX^BGP8CU(BGPVSIT)
I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q ; no one under 18 at admission date
I $$LVADEX^BGP8CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=1
I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|2" ;HF exclusion 2 death or ama
HF2A ;
I $G(BGPEXCL),BGPEX]"" Q
S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
Q
;
HF3 ;EP
S BGPEX=""
Q:'$$HFDX^BGP8CU(BGPVSIT)
I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q ; no one under 18 at admission date
K BGPDATA S BGPLVSD=0
D LVSD^BGP8CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP8CU(BGPVINP),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
I $D(BGPDATA) S BGPLVSD=1
K BGPDATA S BGPEJEC=0
D EJECFRAC^BGP8CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP8CU(BGPVINP),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
I $D(BGPDATA) S BGPEJEC=1
I 'BGPLVSD,'BGPEJEC Q ;no lsvd or ejection fraction
I $$LVADEX^BGP8CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=1
I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|2" ;HF exclusion 2 death or ama
I $$ACEALLEG^BGP8CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)),$$ARBALLEG^BGP8CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|6"
I $$SAORSTEN^BGP8CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP8CU(BGPVINP),-365),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|7"
HF3A ;
I $G(BGPEXCL),BGPEX]"" Q
S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
Q
;
;
HF4 ;EP
S BGPEX=""
Q:'$$HFDX^BGP8CU(BGPVSIT)
I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q ; no one under 18 at admission date
K BGPDATA
D SMOKER^BGP8CU2(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
I '$D(BGPDATA) Q ;not a smoker
I $$LVADEX^BGP8CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=1
I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|2" ;HF exclusion 2 death or ama
HF4A ;
I $G(BGPEXCL),BGPEX]"" Q
S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
Q
;
BGP8C2 ; IHS/CMI/LAB - calc CMS measures 26 Sep 2004 11:28 AM 04 May 2008 2:38 PM ;
+1 ;;8.0;IHS CLINICAL REPORTING;**2**;MAR 12, 2008
+2 ;
HFALL ;EP
+1 ;was there an AMI pov on this visit
+2 IF '$$HFDX^BGP8CU(BGPVSIT)
QUIT
+3 ; no one under 18 at admission date
IF $$AGE^AUPNPAT(DFN,$PIECE($PIECE(BGPVSIT0,U),"."))<18
QUIT
+4 ;
IF $$LVADEX^BGP8CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP))
QUIT
+5 SET ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$PIECE(^DPT(DFN,0),U),DFN,BGPVSIT)=""
+6 QUIT
+7 ;
HF1 ;EP
+1 SET BGPEX=""
+2 IF '$$HFDX^BGP8CU(BGPVSIT)
QUIT
+3 ; no one under 18 at admission date
IF $$AGE^AUPNPAT(DFN,$PIECE($PIECE(BGPVSIT0,U),"."))<18
QUIT
+4 ;not regular discharge so don't count this patient
IF '$$REGDSCH^BGP8CU(BGPVINP)
QUIT
+5 IF $$LVADEX^BGP8CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP))
SET BGPEX=1
HF1A ;
+1 IF $GET(BGPEXCL)
IF BGPEX]""
QUIT
+2 SET ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$PIECE(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
+3 QUIT
+4 ;
HF2 ;EP
+1 SET BGPEX=""
+2 IF '$$HFDX^BGP8CU(BGPVSIT)
QUIT
+3 ; no one under 18 at admission date
IF $$AGE^AUPNPAT(DFN,$PIECE($PIECE(BGPVSIT0,U),"."))<18
QUIT
+4 IF $$LVADEX^BGP8CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP))
SET BGPEX=1
+5 ;HF exclusion 2 death or ama
IF $$DEATHAMA^BGP8CU(BGPVINP)
SET BGPEX=BGPEX_"|2"
HF2A ;
+1 IF $GET(BGPEXCL)
IF BGPEX]""
QUIT
+2 SET ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$PIECE(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
+3 QUIT
+4 ;
HF3 ;EP
+1 SET BGPEX=""
+2 IF '$$HFDX^BGP8CU(BGPVSIT)
QUIT
+3 ; no one under 18 at admission date
IF $$AGE^AUPNPAT(DFN,$PIECE($PIECE(BGPVSIT0,U),"."))<18
QUIT
+4 KILL BGPDATA
SET BGPLVSD=0
+5 DO LVSD^BGP8CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP8CU(BGPVINP),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
+6 IF $DATA(BGPDATA)
SET BGPLVSD=1
+7 KILL BGPDATA
SET BGPEJEC=0
+8 DO EJECFRAC^BGP8CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP8CU(BGPVINP),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
+9 IF $DATA(BGPDATA)
SET BGPEJEC=1
+10 ;no lsvd or ejection fraction
IF 'BGPLVSD
IF 'BGPEJEC
QUIT
+11 IF $$LVADEX^BGP8CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP))
SET BGPEX=1
+12 ;HF exclusion 2 death or ama
IF $$DEATHAMA^BGP8CU(BGPVINP)
SET BGPEX=BGPEX_"|2"
+13 IF $$ACEALLEG^BGP8CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP))
IF $$ARBALLEG^BGP8CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP))
SET BGPEX=BGPEX_"|6"
+14 IF $$SAORSTEN^BGP8CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP8CU(BGPVINP),-365),$$DSCH^BGP8CU(BGPVINP))
SET BGPEX=BGPEX_"|7"
HF3A ;
+1 IF $GET(BGPEXCL)
IF BGPEX]""
QUIT
+2 SET ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$PIECE(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
+3 QUIT
+4 ;
+5 ;
HF4 ;EP
+1 SET BGPEX=""
+2 IF '$$HFDX^BGP8CU(BGPVSIT)
QUIT
+3 ; no one under 18 at admission date
IF $$AGE^AUPNPAT(DFN,$PIECE($PIECE(BGPVSIT0,U),"."))<18
QUIT
+4 KILL BGPDATA
+5 DO SMOKER^BGP8CU2(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
+6 ;not a smoker
IF '$DATA(BGPDATA)
QUIT
+7 IF $$LVADEX^BGP8CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP))
SET BGPEX=1
+8 ;HF exclusion 2 death or ama
IF $$DEATHAMA^BGP8CU(BGPVINP)
SET BGPEX=BGPEX_"|2"
HF4A ;
+1 IF $GET(BGPEXCL)
IF BGPEX]""
QUIT
+2 SET ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$PIECE(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
+3 QUIT
+4 ;