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ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
D WALLALG^BGP0CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP0CPU
K BGPDATA
D IVUD^BGP0CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP0CPU
Q
;
HF3 ;EP
I $Y>(BGPIOSL-3) D HDR^BGP0CP Q:BGPQUIT D L1H^BGP0CP
D WDT^BGP0CPU2(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP0CU(BGPVINP) D WTT^BGP0CPU2(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP0CU(BGPVINP) D TRANSN Q:BGPQUIT
D WPPDPOV^BGP0CPU2(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP0CPU2(BGPVSIT)
Q:BGPQUIT
K BGPDATA
S BGPC=0
D LVSD^BGP0CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
D EJECFRAC^BGP0CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,BGPC)
D WLVSD^BGP0CPU
Q:BGPQUIT
K BGPDATA
S X=$$COMFORT^BGP0CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP0CPU2(X)
Q:BGPQUIT
K BGPY,BGPDATA
Q:BGPQUIT
S BGPC=0
D ALLDXS^BGP0CU2(DFN,$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,BGPC,"BGP CMS AORTIC STENOSIS DXS")
I 'BGPEXCL D WAORTIC^BGP0CPU
Q:BGPQUIT
K BGPDATA,B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CMS ACEI MEDS",0)
D NMIDRUG^BGP0CU1(DFN,$$VD^APCLV(BGPVSIT),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,"BGP CMS ARB MEDS",BGPC)
S E=+$$CODEN^ICPTCOD("G8029")
S BGPACPT=$$CPTI^BGP0DU(DFN,$$DSCH^BGP0CU(BGPVINP),$$DSCH^BGP0CU(BGPVINP),E) I Z]"" S Z=$$DATE^BGP0UTL($P(Z,U,2))_" [G8029]"
D WNMIACE^BGP0CPU2
Q:BGPQUIT
I 'BGPEXCL D
.S BGPLVAD=$$LVADEX^BGP0CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP)) I BGPLVAD S BGPLVAD=$$DATE^BGP0UTL($P(BGPLVAD,U,3))_" ["_$P(BGPLVAD,U,2)_"] "_$$VAL^XBDIQ1(9000010.08,$P(BGPLVAD,U,5),.04)
.D WLVAD^BGP0CPU2
Q:BGPQUIT
S X=$$LASTMED^BGP0CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP CMS ACEI MEDS","","BGP CMS ACEI MEDS CLASS")
S Z=$$LASTMED^BGP0CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP CMS ARB MEDS","","BGP CMS ARB MEDS CLASS")
D WLASTACE^BGP0CPU
Q:BGPQUIT
K BGPDATA
D ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
D WALLALG^BGP0CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP0CPU
K BGPDATA
D IVUD^BGP0CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP0CPU
Q
;
HF4 ;
I $Y>(BGPIOSL-3) D HDR^BGP0CP Q:BGPQUIT D L1H^BGP0CP
D WDT^BGP0CPU2(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP0CU(BGPVINP) D WTT^BGP0CPU2(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP0CU(BGPVINP) D TRANSN Q:BGPQUIT
D WPPDPOV^BGP0CPU2(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP0CPU2(BGPVSIT)
Q:BGPQUIT
S X=$$COMFORT^BGP0CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP0CPU2(X)
Q:BGPQUIT
I 'BGPEXCL D
.S BGPLVAD=$$LVADEX^BGP0CU(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP)) I BGPLVAD S BGPLVAD=$$DATE^BGP0UTL($P(BGPLVAD,U,3))_" ["_$P(BGPLVAD,U,2)_"] "_$$VAL^XBDIQ1(9000010.08,$P(BGPLVAD,U,5),.04)
.D WLVAD^BGP0CPU2
Q:BGPQUIT
K BGPDATA
S BGPC=0
D SMOKER^BGP0CU2(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
D WSMOKER^BGP0CPU
Q:BGPQUIT
K BGPDATA
D CESS^BGP0CU2(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
D WCESS^BGP0CPU
Q:BGPQUIT
K BGPDATA
D CESSMEDS^BGP0CU2(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),30),.BGPDATA)
D WCESSMED^BGP0CPU
K BGPDATA
Q:BGPQUIT
D ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
D WALLALG^BGP0CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP0CPU
Q:BGPQUIT
K BGPDATA
D IVUD^BGP0CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP0CPU
Q
;
TRANSIN ;
I $Y>(BGPIOSL-4) D HDR^BGP0CP Q:BGPQUIT D L1H^BGP0CP
W !!?3,"NOTE: Since Admission Type was ","""","Transferred,",""""," review patient's chart"
W !,"to determine if patient should be excluded if transfer was from another"
W !,"acute care hospital, including ER from another hospital.",!
Q
;
TRANSN ;
I $Y>(BGPIOSL-4) D HDR^BGP0CP Q:BGPQUIT D L1H^BGP0CP
W !!?3,"NOTE: Since Discharge Type was ","""","Transferred,",""""," review patient's chart"
W !,"to determine if patient should be excluded if transferred to another"
W !,"acute care hospital or federal hospital.",!
Q
;
BGP0CP4 ; IHS/CMI/LAB - IHS gpra print 01 Nov 2008 4:08 PM ;
+1 ;;10.0;IHS CLINICAL REPORTING;;JUN 18, 2010
+2 ;
+3 ;
HFALL ;EP
+1 ;I $Y>(BGPIOSL-3) D HDR^BGP0CP Q:BGPQUIT D L1H^BGP0CP
+2 ;S BGPNOBA=1
+3 ;D WDT^BGP0CPU2(BGPVINP)
+4 ;Q:BGPQUIT
+5 ;I $$TRANS^BGP0CU(BGPVINP) D WTT^BGP0CPU2(BGPVINP) Q:BGPQUIT
+6 ;D WPPDPOV^BGP0CPU(BGPVSIT)
+7 ;K BGPNOBA
+8 IF $Y>(BGPIOSL-3)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+9 SET BGPNOBA=1
+10 DO WRACE^BGP0CPU(DFN)
+11 IF BGPQUIT
QUIT
+12 DO WDOB^BGP0CPU(DFN)
+13 IF BGPQUIT
QUIT
+14 DO WZIP^BGP0CPU(DFN)
+15 IF BGPQUIT
QUIT
+16 DO WINS^BGP0CPU(BGPVSIT,DFN)
+17 IF BGPQUIT
QUIT
+18 DO WADM^BGP0CPU(BGPVINP)
+19 IF BGPQUIT
QUIT
+20 DO WADM92^BGP0CPU(BGPVINP)
+21 IF BGPQUIT
QUIT
+22 DO WADMS92^BGP0CPU(BGPVINP)
+23 IF BGPQUIT
QUIT
+24 DO WDT^BGP0CPU(BGPVINP)
+25 IF BGPQUIT
QUIT
+26 DO WDSGS92^BGP0CPU(BGPVINP)
+27 IF BGPQUIT
QUIT
+28 IF $$TRANS^BGP0CU(BGPVINP)
DO WTT^BGP0CPU(BGPVINP)
IF BGPQUIT
QUIT
+29 KILL BGPNOBA
+30 DO WPPDPOV^BGP0CPU(BGPVSIT)
+31 IF BGPQUIT
QUIT
+32 SET BGPNOBA=1
+33 DO OTHDPOVS^BGP0CPU(BGPVSIT)
+34 IF BGPQUIT
QUIT
+35 DO WPRINPRO^BGP0CPU2
+36 IF BGPQUIT
QUIT
+37 DO WOTHPROS^BGP0CPU2
+38 KILL BGPNOBA
+39 QUIT
+40 ;
HF1 ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 DO WDT^BGP0CPU2(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 IF $$TRANS^BGP0CU(BGPVINP)
DO WTT^BGP0CPU2(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP0CU(BGPVINP)
DO TRANSN
IF BGPQUIT
QUIT
+7 DO WPPDPOV^BGP0CPU2(BGPVSIT)
+8 IF BGPQUIT
QUIT
+9 DO OTHDPOVS^BGP0CPU2(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 SET X=$$COMFORT^BGP0CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+12 DO WCOMFORT^BGP0CPU2(X)
+13 IF BGPQUIT
QUIT
+14 SET BGPPED=$$DSCHINST^BGP0CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$$DSCH^BGP0CU(BGPVINP))
+15 DO WDSCHINT^BGP0CPU2
+16 IF BGPQUIT
QUIT
+17 DO ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+18 DO WALLALG^BGP0CPU
+19 IF BGPQUIT
QUIT
+20 KILL BGPDATA
+21 DO ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
+22 DO WALLALGT^BGP0CPU
+23 KILL BGPDATA
+24 DO IVUD^BGP0CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
+25 DO WIVUD^BGP0CPU
+26 QUIT
+27 ;
HF1W ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 DO WDT^BGP0CPU2(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 DO WPPDPOV^BGP0CPU2(BGPVSIT)
+5 IF BGPQUIT
QUIT
+6 DO OTHDPOVS^BGP0CPU2(BGPVSIT)
+7 IF BGPQUIT
QUIT
+8 SET X=$$COMFORT^BGP0CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+9 DO WCOMFORT^BGP0CPU2(X)
+10 IF BGPQUIT
QUIT
+11 SET BGPLVAD=$$LVADEX^BGP0CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP))
IF BGPLVAD
SET BGPLVAD=$$DATE^BGP0UTL($PIECE(BGPLVAD,U,3))_" ["_$PIECE(BGPLVAD,U,2)_"] "_$$VAL^XBDIQ1(9000010.08,$PIECE(BGPLVAD,U,5),.04)
+12 DO WLVAD^BGP0CPU2
+13 IF BGPQUIT
QUIT
+14 SET BGPPED=$$DSCHINST^BGP0CU(DFN,$$DSCH^BGP0CU(BGPVINP),$$DSCH^BGP0CU(BGPVINP))
+15 DO WDSCHINT^BGP0CPU2
+16 IF BGPQUIT
QUIT
+17 DO ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+18 DO WALLALG^BGP0CPU
+19 IF BGPQUIT
QUIT
+20 KILL BGPDATA
+21 DO ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
+22 DO WALLALGT^BGP0CPU
+23 KILL BGPDATA
+24 DO IVUD^BGP0CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
+25 DO WIVUD^BGP0CPU
+26 QUIT
+27 ;
HF2 ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 DO WDT^BGP0CPU2(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 IF $$TRANS^BGP0CU(BGPVINP)
DO WTT^BGP0CPU2(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP0CU(BGPVINP)
DO TRANSN
IF BGPQUIT
QUIT
+7 DO WPPDPOV^BGP0CPU2(BGPVSIT)
+8 IF BGPQUIT
QUIT
+9 DO OTHDPOVS^BGP0CPU2(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 SET X=$$COMFORT^BGP0CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+12 DO WCOMFORT^BGP0CPU2(X)
+13 IF BGPQUIT
QUIT
+14 KILL BGPDATA
+15 IF 'BGPEXCL
Begin DoDot:1
+16 SET BGPLVAD=$$LVADEX^BGP0CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP))
IF BGPLVAD
SET BGPLVAD=$$DATE^BGP0UTL($PIECE(BGPLVAD,U,3))_" ["_$PIECE(BGPLVAD,U,2)_"] "_$$VAL^XBDIQ1(9000010.08,$PIECE(BGPLVAD,U,5),.04)
+17 DO WLVAD^BGP0CPU2
End DoDot:1
+18 IF BGPQUIT
QUIT
+19 DO LVS^BGP0CU3(DFN,$$DSCH^BGP0CU(BGPVINP),.BGPDATA,$PIECE($PIECE(BGPVSIT0,U),"."))
+20 DO WLVS^BGP0CPU2
+21 IF BGPQUIT
QUIT
+22 DO ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+23 DO WALLALG^BGP0CPU
+24 IF BGPQUIT
QUIT
+25 KILL BGPDATA
+26 DO ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
+27 DO WALLALGT^BGP0CPU
+28 KILL BGPDATA
+29 DO IVUD^BGP0CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
+30 DO WIVUD^BGP0CPU
+31 QUIT
+32 ;
HF3 ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 DO WDT^BGP0CPU2(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 IF $$TRANS^BGP0CU(BGPVINP)
DO WTT^BGP0CPU2(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP0CU(BGPVINP)
DO TRANSN
IF BGPQUIT
QUIT
+7 DO WPPDPOV^BGP0CPU2(BGPVSIT)
+8 IF BGPQUIT
QUIT
+9 DO OTHDPOVS^BGP0CPU2(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 KILL BGPDATA
+12 SET BGPC=0
+13 DO LVSD^BGP0CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
+14 DO EJECFRAC^BGP0CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,BGPC)
+15 DO WLVSD^BGP0CPU
+16 IF BGPQUIT
QUIT
+17 KILL BGPDATA
+18 SET X=$$COMFORT^BGP0CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+19 DO WCOMFORT^BGP0CPU2(X)
+20 IF BGPQUIT
QUIT
+21 KILL BGPY,BGPDATA
+22 IF BGPQUIT
QUIT
+23 SET BGPC=0
+24 DO ALLDXS^BGP0CU2(DFN,$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,BGPC,"BGP CMS AORTIC STENOSIS DXS")
+25 IF 'BGPEXCL
DO WAORTIC^BGP0CPU
+26 IF BGPQUIT
QUIT
+27 KILL BGPDATA,BGPDX,BGPC
+28 SET BGPXX=0
+29 DO ANGIOED^BGP0CU6(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
+30 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+31 KILL BGPDATA
DO HYPERKAL^BGP0CU6(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
+32 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+33 KILL BGPDATA
DO HYPOTEN^BGP0CU6(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
+34 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+35 KILL BGPDATA
DO RENART^BGP0CU6(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
+36 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+37 KILL BGPDATA
DO RENAL^BGP0CU6(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,0)
+38 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+39 DO WDXS^BGP0CPU
+40 KILL BGPDATA,BGPY
+41 IF BGPQUIT
QUIT
+42 SET X=$$ACEALLEG^BGP0CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP))
+43 SET Z=$$ARBALLEG^BGP0CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP0CU(BGPVINP))
+44 DO WACEALEG^BGP0CPU
+45 IF BGPQUIT
QUIT
+46 KILL BGPDATA,BGPDX
+47 SET BGPC=0
+48 DO NMIDRUG^BGP0CU1(DFN,$$VD^APCLV(BGPVSIT),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,"BGP CMS ACEI MEDS",0)
+49 DO NMIDRUG^BGP0CU1(DFN,$$VD^APCLV(BGPVSIT),$$DSCH^BGP0CU(BGPVINP),.BGPDATA,"BGP CMS ARB MEDS",BGPC)
+50 SET E=+$$CODEN^ICPTCOD("G8029")
+51 SET BGPACPT=$$CPTI^BGP0DU(DFN,$$DSCH^BGP0CU(BGPVINP),$$DSCH^BGP0CU(BGPVINP),E)
IF Z]""
SET Z=$$DATE^BGP0UTL($PIECE(Z,U,2))_" [G8029]"
+52 DO WNMIACE^BGP0CPU2
+53 IF BGPQUIT
QUIT
+54 IF 'BGPEXCL
Begin DoDot:1
+55 SET BGPLVAD=$$LVADEX^BGP0CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP))
IF BGPLVAD
SET BGPLVAD=$$DATE^BGP0UTL($PIECE(BGPLVAD,U,3))_" ["_$PIECE(BGPLVAD,U,2)_"] "_$$VAL^XBDIQ1(9000010.08,$PIECE(BGPLVAD,U,5),.04)
+56 DO WLVAD^BGP0CPU2
End DoDot:1
+57 IF BGPQUIT
QUIT
+58 SET X=$$LASTMED^BGP0CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP CMS ACEI MEDS","","BGP CMS ACEI MEDS CLASS")
+59 SET Z=$$LASTMED^BGP0CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP CMS ARB MEDS","","BGP CMS ARB MEDS CLASS")
+60 DO WLASTACE^BGP0CPU
+61 IF BGPQUIT
QUIT
+62 KILL BGPDATA
+63 DO ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+64 DO WALLALG^BGP0CPU
+65 IF BGPQUIT
QUIT
+66 KILL BGPDATA
+67 DO ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
+68 DO WALLALGT^BGP0CPU
+69 KILL BGPDATA
+70 DO IVUD^BGP0CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
+71 DO WIVUD^BGP0CPU
+72 QUIT
+73 ;
HF4 ;
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 DO WDT^BGP0CPU2(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 IF $$TRANS^BGP0CU(BGPVINP)
DO WTT^BGP0CPU2(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP0CU(BGPVINP)
DO TRANSN
IF BGPQUIT
QUIT
+7 DO WPPDPOV^BGP0CPU2(BGPVSIT)
+8 IF BGPQUIT
QUIT
+9 DO OTHDPOVS^BGP0CPU2(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 SET X=$$COMFORT^BGP0CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+12 DO WCOMFORT^BGP0CPU2(X)
+13 IF BGPQUIT
QUIT
+14 IF 'BGPEXCL
Begin DoDot:1
+15 SET BGPLVAD=$$LVADEX^BGP0CU(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP))
IF BGPLVAD
SET BGPLVAD=$$DATE^BGP0UTL($PIECE(BGPLVAD,U,3))_" ["_$PIECE(BGPLVAD,U,2)_"] "_$$VAL^XBDIQ1(9000010.08,$PIECE(BGPLVAD,U,5),.04)
+16 DO WLVAD^BGP0CPU2
End DoDot:1
+17 IF BGPQUIT
QUIT
+18 KILL BGPDATA
+19 SET BGPC=0
+20 DO SMOKER^BGP0CU2(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+21 DO WSMOKER^BGP0CPU
+22 IF BGPQUIT
QUIT
+23 KILL BGPDATA
+24 DO CESS^BGP0CU2(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+25 DO WCESS^BGP0CPU
+26 IF BGPQUIT
QUIT
+27 KILL BGPDATA
+28 DO CESSMEDS^BGP0CU2(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($$DSCH^BGP0CU(BGPVINP),30),.BGPDATA)
+29 DO WCESSMED^BGP0CPU
+30 KILL BGPDATA
+31 IF BGPQUIT
QUIT
+32 DO ALLALG1^BGP0CU1(DFN,DT,$$DSCH^BGP0CU(BGPVINP),.BGPDATA)
+33 DO WALLALG^BGP0CPU
+34 IF BGPQUIT
QUIT
+35 KILL BGPDATA
+36 DO ALLALGA1^BGP0CU1(DFN,DT,.BGPDATA)
+37 DO WALLALGT^BGP0CPU
+38 IF BGPQUIT
QUIT
+39 KILL BGPDATA
+40 DO IVUD^BGP0CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP0CU(BGPVINP),,.BGPDATA)
+41 DO WIVUD^BGP0CPU
+42 QUIT
+43 ;
TRANSIN ;
+1 IF $Y>(BGPIOSL-4)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 WRITE !!?3,"NOTE: Since Admission Type was ","""","Transferred,",""""," review patient's chart"
+3 WRITE !,"to determine if patient should be excluded if transfer was from another"
+4 WRITE !,"acute care hospital, including ER from another hospital.",!
+5 QUIT
+6 ;
TRANSN ;
+1 IF $Y>(BGPIOSL-4)
DO HDR^BGP0CP
IF BGPQUIT
QUIT
DO L1H^BGP0CP
+2 WRITE !!?3,"NOTE: Since Discharge Type was ","""","Transferred,",""""," review patient's chart"
+3 WRITE !,"to determine if patient should be excluded if transferred to another"
+4 WRITE !,"acute care hospital or federal hospital.",!
+5 QUIT
+6 ;