BGP2CP1 ; IHS/CMI/LAB - IHS gpra print ;
;;12.1;IHS CLINICAL REPORTING;;MAY 17, 2012;Build 66
;
;
AMIALL ;EP
I $Y>(BGPIOSL-3) D HDR^BGP2CP Q:BGPQUIT D L1H^BGP2CP
S BGPNOBA=1
D WRACE^BGP2CPU(DFN)
Q:BGPQUIT
D WDOB^BGP2CPU(DFN)
Q:BGPQUIT
D WZIP^BGP2CPU(DFN)
Q:BGPQUIT
D WINS^BGP2CPU(BGPVSIT,DFN)
Q:BGPQUIT
D WADM^BGP2CPU(BGPVINP)
Q:BGPQUIT
D WADM92^BGP2CPU(BGPVINP)
Q:BGPQUIT
D WADMS92^BGP2CPU(BGPVINP)
Q:BGPQUIT
D WDT^BGP2CPU(BGPVINP)
Q:BGPQUIT
D WDSGS92^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D WTT^BGP2CPU(BGPVINP) Q:BGPQUIT
K BGPNOBA
D WPPDPOV^BGP2CPU(BGPVSIT)
Q:BGPQUIT
S BGPNOBA=1
D OTHDPOVS^BGP2CPU(BGPVSIT)
Q:BGPQUIT
D WPRINPRO^BGP2CPU2
Q:BGPQUIT
D WOTHPROS^BGP2CPU2
K BGPNOBA
Q
;
AMI1 ;EP
I $Y>(BGPIOSL-3) D HDR^BGP2CP Q:BGPQUIT D L1H^BGP2CP
I $$TRANSIN^BGP2CU(BGPVINP) D TRANSIN^BGP2CP3 Q:BGPQUIT
D WDT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D WTT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP),$$DODA^BGP2CU(BGPVSIT,BGPVINP) D TRANSN^BGP2CP2 Q:BGPQUIT
D WPPDPOV^BGP2CPU(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP2CPU(BGPVSIT)
Q:BGPQUIT
S X=$$COMFORT^BGP2CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP2CPU(X)
Q:BGPQUIT
K BGPY,BGPDATA
D NMIDRUG^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-1),$P($P(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
D WNMIASP^BGP2CPU
Q:BGPQUIT
K X
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS") I X]"" S X="Last Outpatient Rx: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
D WLASTASP^BGP2CPU
Q:BGPQUIT
S X=$$LASTASPC^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30))
D WASPCPT^BGP2CPU(X)
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS") I X]"" S X="Last Outpatient Rx: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
D WLASTAP^BGP2CPU
Q:BGPQUIT
D ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
D WALLALG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP2CPU
K BGPDATA
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP2CPU
Q
AMI1W ;EP
I $Y>(BGPIOSL-3) D HDR^BGP2CP Q:BGPQUIT D L1H^BGP2CP
I $$TRANSIN^BGP2CU(BGPVINP) D TRANSIN^BGP2CP3 Q:BGPQUIT
D WDOD^BGP2CPU(DFN)
Q:BGPQUIT
D WDT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D WTT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP),$$DODA^BGP2CU(BGPVSIT,BGPVINP) D TRANSN^BGP2CP2 Q:BGPQUIT
D WPPDPOV^BGP2CPU(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP2CPU(BGPVSIT)
Q:BGPQUIT
S X=$$COMFORT^BGP2CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP2CPU(X)
Q:BGPQUIT
S X=$$ASAALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP)),X=$P(X,U,2,999)
D WASAALEG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D WARRX^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-180),$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),1,.BGPDATA)
D WWARRX^BGP2CPU
Q:BGPQUIT
K BGPDATA,BGPY
D NMIDRUG^BGP2CU1(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
D WNMIASP^BGP2CPU
Q:BGPQUIT
K X
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS") I X]"" S X="Last Outpatient Rx: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
D WLASTASP^BGP2CPU
Q:BGPQUIT
S X=$$LASTASPC^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30))
D WASPCPT^BGP2CPU(X)
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS") I X]"" S X="Last Outpatient RX: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
D WLASTAP^BGP2CPU
Q:BGPQUIT
D ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
D WALLALG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP2CPU
Q:BGPQUIT
K BGPDATA
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP2CPU
Q
AMI2 ;EP
I $Y>(BGPIOSL-3) D HDR^BGP2CP Q:BGPQUIT D L1H^BGP2CP
D WDT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D WTT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D TRANSN^BGP2CP2 Q:BGPQUIT
D WPPDPOV^BGP2CPU(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP2CPU(BGPVSIT)
Q:BGPQUIT
S X=$$COMFORT^BGP2CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP2CPU(X)
Q:BGPQUIT
K BGPY,BGPDATA
D NMIDRUG^BGP2CU1(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
D WNMIASP^BGP2CPU
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS") I X]"" S X="Last Outpatient Rx: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
D WLASTASP^BGP2CPU
Q:BGPQUIT
S X=$$LASTASPC^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30))
D WASPCPT^BGP2CPU(X)
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS") I X]"" S X="Last Outpatient RX: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
D WLASTAP^BGP2CPU
Q:BGPQUIT
D ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
D WALLALG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP2CPU
K BGPDATA
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP2CPU
Q
AMI2W ;EP
I $Y>(BGPIOSL-3) D HDR^BGP2CP Q:BGPQUIT D L1H^BGP2CP
D WDOD^BGP2CPU(DFN)
Q:BGPQUIT
D WDT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D WTT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D TRANSN^BGP2CP2 Q:BGPQUIT
D WPPDPOV^BGP2CPU(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP2CPU(BGPVSIT)
Q:BGPQUIT
S X=$$COMFORT^BGP2CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP2CPU(X)
Q:BGPQUIT
S X=$$ASAALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
D WASAALEG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D WARRX^BGP2CU1(DFN,$P($P(^AUPNVINP(BGPVINP,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."),1,.BGPDATA)
D WWARRX^BGP2CPU
Q:BGPQUIT
K BGPDATA
D NMIDRUG^BGP2CU1(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
D WNMIASP^BGP2CPU
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS") I X]"" S X="Last Outpatient Rx: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
D WLASTASP^BGP2CPU
Q:BGPQUIT
S X=$$LASTASPC^BGP2CU1(DFN,$P($P(^AUPNVINP(BGPVINP,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WASPCPT^BGP2CPU(X)
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($P($P(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS") I X]"" S X="Last Outpatient RX: "_X
K BGPUD
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$O(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
D WLASTAP^BGP2CPU
Q:BGPQUIT
D ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
D WALLALG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP2CPU
Q:BGPQUIT
K BGPDATA
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP2CPU
Q
AMI3 ;EP
I $Y>(BGPIOSL-3) D HDR^BGP2CP Q:BGPQUIT D L1H^BGP2CP
D WDT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D WTT^BGP2CPU(BGPVINP)
Q:BGPQUIT
I $$TRANS^BGP2CU(BGPVINP) D TRANSN^BGP2CP2 Q:BGPQUIT
D WPPDPOV^BGP2CPU(BGPVSIT)
Q:BGPQUIT
D OTHDPOVS^BGP2CPU(BGPVSIT)
Q:BGPQUIT
K BGPDATA
S BGPC=0
D LVSD^BGP2CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
D EJECFRAC^BGP2CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,BGPC)
D WLVSD^BGP2CPU
Q:BGPQUIT
K BGPDATA
S X=$$COMFORT^BGP2CU(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."))
D WCOMFORT^BGP2CPU(X)
Q:BGPQUIT
K BGPDATA,BGPDX
S BGPXX=0
D ANGIOED^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X S BGPXX=BGPXX+1,BGPDX(BGPXX)=BGPDATA(X)
K BGPDATA D HYPERKAL^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X S BGPXX=BGPXX+1,BGPDX(BGPXX)=BGPDATA(X)
K BGPDATA D HYPOTEN^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X S BGPXX=BGPXX+1,BGPDX(BGPXX)=BGPDATA(X)
K BGPDATA D RENART^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X S BGPXX=BGPXX+1,BGPDX(BGPXX)=BGPDATA(X)
K BGPDATA D RENAL^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X S BGPXX=BGPXX+1,BGPDX(BGPXX)=BGPDATA(X)
D WDXS^BGP2CPU
K BGPDATA
K BGPY
Q:BGPQUIT
S X=$$ACEALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
S Z=$$ARBALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
D WACEALEG^BGP2CPU
Q:BGPQUIT
K BGPDATA
S BGPC=0
D NMIDRUG^BGP2CU1(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"BGP CMS ACEI MEDS",0)
D NMIDRUG^BGP2CU1(DFN,$P($P(^AUPNVSIT(BGPVSIT,0),U),"."),$P($P(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"BGP CMS ARB MEDS",BGPC)
D WNMIACE^BGP2CPU(.BGPDATA)
Q:BGPQUIT
S X=$$LASTMED^BGP2CU1(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^BGP2CU1(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^BGP2CPU
Q:BGPQUIT
D ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
D WALLALG^BGP2CPU
Q:BGPQUIT
K BGPDATA
D ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
D WALLALGT^BGP2CPU
K BGPDATA
D IVUD^BGP2CU1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
D WIVUD^BGP2CPU
Q
;
AMI3W ;EP
D AMI3W^BGP2CP11
Q
BGP2CP1 ; IHS/CMI/LAB - IHS gpra print ;
+1 ;;12.1;IHS CLINICAL REPORTING;;MAY 17, 2012;Build 66
+2 ;
+3 ;
AMIALL ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP2CP
IF BGPQUIT
QUIT
DO L1H^BGP2CP
+2 SET BGPNOBA=1
+3 DO WRACE^BGP2CPU(DFN)
+4 IF BGPQUIT
QUIT
+5 DO WDOB^BGP2CPU(DFN)
+6 IF BGPQUIT
QUIT
+7 DO WZIP^BGP2CPU(DFN)
+8 IF BGPQUIT
QUIT
+9 DO WINS^BGP2CPU(BGPVSIT,DFN)
+10 IF BGPQUIT
QUIT
+11 DO WADM^BGP2CPU(BGPVINP)
+12 IF BGPQUIT
QUIT
+13 DO WADM92^BGP2CPU(BGPVINP)
+14 IF BGPQUIT
QUIT
+15 DO WADMS92^BGP2CPU(BGPVINP)
+16 IF BGPQUIT
QUIT
+17 DO WDT^BGP2CPU(BGPVINP)
+18 IF BGPQUIT
QUIT
+19 DO WDSGS92^BGP2CPU(BGPVINP)
+20 IF BGPQUIT
QUIT
+21 IF $$TRANS^BGP2CU(BGPVINP)
DO WTT^BGP2CPU(BGPVINP)
IF BGPQUIT
QUIT
+22 KILL BGPNOBA
+23 DO WPPDPOV^BGP2CPU(BGPVSIT)
+24 IF BGPQUIT
QUIT
+25 SET BGPNOBA=1
+26 DO OTHDPOVS^BGP2CPU(BGPVSIT)
+27 IF BGPQUIT
QUIT
+28 DO WPRINPRO^BGP2CPU2
+29 IF BGPQUIT
QUIT
+30 DO WOTHPROS^BGP2CPU2
+31 KILL BGPNOBA
+32 QUIT
+33 ;
AMI1 ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP2CP
IF BGPQUIT
QUIT
DO L1H^BGP2CP
+2 IF $$TRANSIN^BGP2CU(BGPVINP)
DO TRANSIN^BGP2CP3
IF BGPQUIT
QUIT
+3 DO WDT^BGP2CPU(BGPVINP)
+4 IF BGPQUIT
QUIT
+5 IF $$TRANS^BGP2CU(BGPVINP)
DO WTT^BGP2CPU(BGPVINP)
+6 IF BGPQUIT
QUIT
+7 IF $$TRANS^BGP2CU(BGPVINP)
IF $$DODA^BGP2CU(BGPVSIT,BGPVINP)
DO TRANSN^BGP2CP2
IF BGPQUIT
QUIT
+8 DO WPPDPOV^BGP2CPU(BGPVSIT)
+9 IF BGPQUIT
QUIT
+10 DO OTHDPOVS^BGP2CPU(BGPVSIT)
+11 IF BGPQUIT
QUIT
+12 SET X=$$COMFORT^BGP2CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+13 DO WCOMFORT^BGP2CPU(X)
+14 IF BGPQUIT
QUIT
+15 KILL BGPY,BGPDATA
+16 DO NMIDRUG^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-1),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
+17 DO WNMIASP^BGP2CPU
+18 IF BGPQUIT
QUIT
+19 KILL X
+20 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS")
IF X]""
SET X="Last Outpatient Rx: "_X
+21 KILL BGPUD
+22 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
+23 DO WLASTASP^BGP2CPU
+24 IF BGPQUIT
QUIT
+25 SET X=$$LASTASPC^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30))
+26 DO WASPCPT^BGP2CPU(X)
+27 IF BGPQUIT
QUIT
+28 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS")
IF X]""
SET X="Last Outpatient Rx: "_X
+29 KILL BGPUD
+30 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
+31 DO WLASTAP^BGP2CPU
+32 IF BGPQUIT
QUIT
+33 DO ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
+34 DO WALLALG^BGP2CPU
+35 IF BGPQUIT
QUIT
+36 KILL BGPDATA
+37 DO ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
+38 DO WALLALGT^BGP2CPU
+39 KILL BGPDATA
+40 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
+41 DO WIVUD^BGP2CPU
+42 QUIT
AMI1W ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP2CP
IF BGPQUIT
QUIT
DO L1H^BGP2CP
+2 IF $$TRANSIN^BGP2CU(BGPVINP)
DO TRANSIN^BGP2CP3
IF BGPQUIT
QUIT
+3 DO WDOD^BGP2CPU(DFN)
+4 IF BGPQUIT
QUIT
+5 DO WDT^BGP2CPU(BGPVINP)
+6 IF BGPQUIT
QUIT
+7 IF $$TRANS^BGP2CU(BGPVINP)
DO WTT^BGP2CPU(BGPVINP)
+8 IF BGPQUIT
QUIT
+9 IF $$TRANS^BGP2CU(BGPVINP)
IF $$DODA^BGP2CU(BGPVSIT,BGPVINP)
DO TRANSN^BGP2CP2
IF BGPQUIT
QUIT
+10 DO WPPDPOV^BGP2CPU(BGPVSIT)
+11 IF BGPQUIT
QUIT
+12 DO OTHDPOVS^BGP2CPU(BGPVSIT)
+13 IF BGPQUIT
QUIT
+14 SET X=$$COMFORT^BGP2CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+15 DO WCOMFORT^BGP2CPU(X)
+16 IF BGPQUIT
QUIT
+17 SET X=$$ASAALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
SET X=$PIECE(X,U,2,999)
+18 DO WASAALEG^BGP2CPU
+19 IF BGPQUIT
QUIT
+20 KILL BGPDATA
+21 DO WARRX^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-180),$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),1,.BGPDATA)
+22 DO WWARRX^BGP2CPU
+23 IF BGPQUIT
QUIT
+24 KILL BGPDATA,BGPY
+25 DO NMIDRUG^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
+26 DO WNMIASP^BGP2CPU
+27 IF BGPQUIT
QUIT
+28 KILL X
+29 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS")
IF X]""
SET X="Last Outpatient Rx: "_X
+30 KILL BGPUD
+31 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
+32 DO WLASTASP^BGP2CPU
+33 IF BGPQUIT
QUIT
+34 SET X=$$LASTASPC^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30))
+35 DO WASPCPT^BGP2CPU(X)
+36 IF BGPQUIT
QUIT
+37 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS")
IF X]""
SET X="Last Outpatient RX: "_X
+38 KILL BGPUD
+39 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
+40 DO WLASTAP^BGP2CPU
+41 IF BGPQUIT
QUIT
+42 DO ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
+43 DO WALLALG^BGP2CPU
+44 IF BGPQUIT
QUIT
+45 KILL BGPDATA
+46 DO ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
+47 DO WALLALGT^BGP2CPU
+48 IF BGPQUIT
QUIT
+49 KILL BGPDATA
+50 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
+51 DO WIVUD^BGP2CPU
+52 QUIT
AMI2 ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP2CP
IF BGPQUIT
QUIT
DO L1H^BGP2CP
+2 DO WDT^BGP2CPU(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 IF $$TRANS^BGP2CU(BGPVINP)
DO WTT^BGP2CPU(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP2CU(BGPVINP)
DO TRANSN^BGP2CP2
IF BGPQUIT
QUIT
+7 DO WPPDPOV^BGP2CPU(BGPVSIT)
+8 IF BGPQUIT
QUIT
+9 DO OTHDPOVS^BGP2CPU(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 SET X=$$COMFORT^BGP2CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+12 DO WCOMFORT^BGP2CPU(X)
+13 IF BGPQUIT
QUIT
+14 KILL BGPY,BGPDATA
+15 DO NMIDRUG^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
+16 DO WNMIASP^BGP2CPU
+17 IF BGPQUIT
QUIT
+18 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS")
IF X]""
SET X="Last Outpatient Rx: "_X
+19 KILL BGPUD
+20 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
+21 DO WLASTASP^BGP2CPU
+22 IF BGPQUIT
QUIT
+23 SET X=$$LASTASPC^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30))
+24 DO WASPCPT^BGP2CPU(X)
+25 IF BGPQUIT
QUIT
+26 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS")
IF X]""
SET X="Last Outpatient RX: "_X
+27 KILL BGPUD
+28 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
+29 DO WLASTAP^BGP2CPU
+30 IF BGPQUIT
QUIT
+31 DO ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
+32 DO WALLALG^BGP2CPU
+33 IF BGPQUIT
QUIT
+34 KILL BGPDATA
+35 DO ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
+36 DO WALLALGT^BGP2CPU
+37 KILL BGPDATA
+38 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
+39 DO WIVUD^BGP2CPU
+40 QUIT
AMI2W ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP2CP
IF BGPQUIT
QUIT
DO L1H^BGP2CP
+2 DO WDOD^BGP2CPU(DFN)
+3 IF BGPQUIT
QUIT
+4 DO WDT^BGP2CPU(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP2CU(BGPVINP)
DO WTT^BGP2CPU(BGPVINP)
+7 IF BGPQUIT
QUIT
+8 IF $$TRANS^BGP2CU(BGPVINP)
DO TRANSN^BGP2CP2
IF BGPQUIT
QUIT
+9 DO WPPDPOV^BGP2CPU(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 DO OTHDPOVS^BGP2CPU(BGPVSIT)
+12 IF BGPQUIT
QUIT
+13 SET X=$$COMFORT^BGP2CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+14 DO WCOMFORT^BGP2CPU(X)
+15 IF BGPQUIT
QUIT
+16 SET X=$$ASAALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
+17 DO WASAALEG^BGP2CPU
+18 IF BGPQUIT
QUIT
+19 KILL BGPDATA
+20 DO WARRX^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),1,.BGPDATA)
+21 DO WWARRX^BGP2CPU
+22 IF BGPQUIT
QUIT
+23 KILL BGPDATA
+24 DO NMIDRUG^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"DM AUDIT ASPIRIN DRUGS",0)
+25 DO WNMIASP^BGP2CPU
+26 IF BGPQUIT
QUIT
+27 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"DM AUDIT ASPIRIN DRUGS")
IF X]""
SET X="Last Outpatient Rx: "_X
+28 KILL BGPUD
+29 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","DM AUDIT ASPIRIN DRUGS",0)),.BGPUD)
+30 DO WLASTASP^BGP2CPU
+31 IF BGPQUIT
QUIT
+32 SET X=$$LASTASPC^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+33 DO WASPCPT^BGP2CPU(X)
+34 IF BGPQUIT
QUIT
+35 SET X=$$LASTMED^BGP2CU1(DFN,$$FMADD^XLFDT($PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$FMADD^XLFDT($PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),30),"BGP ANTI-PLATELET DRUGS","","BGP CMS ANTI-PLATELET CLASS")
IF X]""
SET X="Last Outpatient RX: "_X
+36 KILL BGPUD
+37 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)),.BGPUD,$ORDER(^ATXAX("B","BGP ANTI-PLATELET DRUGS",0)))
+38 DO WLASTAP^BGP2CPU
+39 IF BGPQUIT
QUIT
+40 DO ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
+41 DO WALLALG^BGP2CPU
+42 IF BGPQUIT
QUIT
+43 KILL BGPDATA
+44 DO ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
+45 DO WALLALGT^BGP2CPU
+46 IF BGPQUIT
QUIT
+47 KILL BGPDATA
+48 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
+49 DO WIVUD^BGP2CPU
+50 QUIT
AMI3 ;EP
+1 IF $Y>(BGPIOSL-3)
DO HDR^BGP2CP
IF BGPQUIT
QUIT
DO L1H^BGP2CP
+2 DO WDT^BGP2CPU(BGPVINP)
+3 IF BGPQUIT
QUIT
+4 IF $$TRANS^BGP2CU(BGPVINP)
DO WTT^BGP2CPU(BGPVINP)
+5 IF BGPQUIT
QUIT
+6 IF $$TRANS^BGP2CU(BGPVINP)
DO TRANSN^BGP2CP2
IF BGPQUIT
QUIT
+7 DO WPPDPOV^BGP2CPU(BGPVSIT)
+8 IF BGPQUIT
QUIT
+9 DO OTHDPOVS^BGP2CPU(BGPVSIT)
+10 IF BGPQUIT
QUIT
+11 KILL BGPDATA
+12 SET BGPC=0
+13 DO LVSD^BGP2CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
+14 DO EJECFRAC^BGP2CU1(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,BGPC)
+15 DO WLVSD^BGP2CPU
+16 IF BGPQUIT
QUIT
+17 KILL BGPDATA
+18 SET X=$$COMFORT^BGP2CU(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."))
+19 DO WCOMFORT^BGP2CPU(X)
+20 IF BGPQUIT
QUIT
+21 KILL BGPDATA,BGPDX
+22 SET BGPXX=0
+23 DO ANGIOED^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
+24 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+25 KILL BGPDATA
DO HYPERKAL^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
+26 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+27 KILL BGPDATA
DO HYPOTEN^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(BGPVINP),.BGPDATA,0)
+28 SET X=0
FOR
SET X=$ORDER(BGPDATA(X))
IF X'=+X
QUIT
SET BGPXX=BGPXX+1
SET BGPDX(BGPXX)=BGPDATA(X)
+29 KILL BGPDATA
DO RENART^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(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 RENAL^BGP2CU6(DFN,$$FMADD^XLFDT($$DSCH^BGP2CU(BGPVINP),-365),$$DSCH^BGP2CU(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 DO WDXS^BGP2CPU
+34 KILL BGPDATA
+35 KILL BGPY
+36 IF BGPQUIT
QUIT
+37 SET X=$$ACEALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
+38 SET Z=$$ARBALLEG^BGP2CU1(DFN,$$DOB^AUPNPAT(DFN),$$DSCH^BGP2CU(BGPVINP))
+39 DO WACEALEG^BGP2CPU
+40 IF BGPQUIT
QUIT
+41 KILL BGPDATA
+42 SET BGPC=0
+43 DO NMIDRUG^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"BGP CMS ACEI MEDS",0)
+44 DO NMIDRUG^BGP2CU1(DFN,$PIECE($PIECE(^AUPNVSIT(BGPVSIT,0),U),"."),$PIECE($PIECE(^AUPNVINP(BGPVINP,0),U),"."),.BGPDATA,"BGP CMS ARB MEDS",BGPC)
+45 DO WNMIACE^BGP2CPU(.BGPDATA)
+46 IF BGPQUIT
QUIT
+47 SET X=$$LASTMED^BGP2CU1(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")
+48 SET Z=$$LASTMED^BGP2CU1(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")
+49 DO WLASTACE^BGP2CPU
+50 IF BGPQUIT
QUIT
+51 DO ALLALG1^BGP2CU1(DFN,DT,$$DSCH^BGP2CU(BGPVINP),.BGPDATA)
+52 DO WALLALG^BGP2CPU
+53 IF BGPQUIT
QUIT
+54 KILL BGPDATA
+55 DO ALLALGA1^BGP2CU1(DFN,DT,.BGPDATA)
+56 DO WALLALGT^BGP2CPU
+57 KILL BGPDATA
+58 DO IVUD^BGP2CU1(DFN,$PIECE($PIECE(BGPVSIT0,U),"."),$$DSCH^BGP2CU(BGPVINP),,.BGPDATA)
+59 DO WIVUD^BGP2CPU
+60 QUIT
+61 ;
AMI3W ;EP
+1 DO AMI3W^BGP2CP11
+2 QUIT