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