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

BGP3C11.m

Go to the documentation of this file.
  1. BGP3C11 ; IHS/CMI/LAB - calc CMS measures 02 Jul 2010 8:31 AM ;
  1. ;;13.0;IHS CLINICAL REPORTING;;NOV 20, 2012;Build 81
  1. ;
  1. EN ;EP
  1. K BGPDATA,BGPDATA
  1. LVSD ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,7,"EF and/or LVSD?")=""
  1. K BGPDATA
  1. D LVSD1(DFN,$$DSCH(BGPVINP),.BGPDATA)
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,7,"EF and/or LVSD?",X)=BGPDATA(X)
  1. ACEIALG ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,10,"ACEI or ARB Allergy?")=""
  1. K BGPDATA
  1. D ACEIALG1(DFN,$$DSCH(BGPVINP),.BGPDATA) ;return text of ACEI allergy if found
  1. I $D(BGPDATA) S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,10,"ACEI or ARB Allergy?")=""
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,10,"ACEI or ARB Allergy?",X)=BGPDATA(X)
  1. ACEICONT ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,11,"Other ACEI or ARB Exclusion?")=""
  1. K BGPDATA
  1. D ACEICON1^BGP3C13(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH(BGPVINP),BGPVSIT,.BGPDATA)
  1. I $D(BGPDATA) S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,11,"Other ACEI or ARB Exclusion?")=""
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,11,"Other ACEI or ARB Exclusion?",X)=BGPDATA(X)
  1. ACEIRX ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,12,"ACEI or ARB Rx Status?")=""
  1. K BGPDATA
  1. D ACEIRX1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH(BGPVINP),.BGPDATA)
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,12,"ACEI or ARB Rx Status?",X)=BGPDATA(X)
  1. BETAALG ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,13,"Beta Blocker Allergy?")=""
  1. K BGPDATA
  1. D BETAALG1(DFN,$$DSCH(BGPVINP),.BGPDATA)
  1. I $D(BGPDATA) S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,13,"Beta Blocker Allergy?")=""
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,13,"Beta Blocker Allergy?",X)=BGPDATA(X)
  1. BETACONT ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,15,"Other Beta Blocker Exclusion?")=""
  1. K BGPDATA
  1. D BETACON1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH(BGPVINP),BGPVSIT,.BGPDATA)
  1. I $D(BGPDATA) S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,15,"Other Beta Blocker Exclusion?")=""
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,15,"Other Beta Blocker Exclusion?",X)=BGPDATA(X)
  1. BETARX ;
  1. S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,16,"Beta Blocker Rx Status:")=""
  1. K BGPDATA
  1. D BETARX1(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH(BGPVINP),.BGPDATA)
  1. S X=0 F S X=$O(BGPDATA(X)) Q:X'=+X D
  1. .S ^XTMP("BGP3C1",BGPJ,BGPH,BGPORDER,BGPIND,"LIST 2",$P(^DPT(DFN,0),U),DFN,BGPVSIT,16,"Beta Blocker Rx Status:",X)=BGPDATA(X)
  1. D ^BGP3C12
  1. Q
  1. LVSD1(P,BGPD,BGPY) ;
  1. NEW ED,BD,BGPG,BGPC,X,Y,Z,N,I,T
  1. S BGPC=0 K BGPY
  1. LVSDPOV ;
  1. S X=0 F S X=$O(^AUPNVPOV("AC",P,X)) Q:X'=+X D
  1. .Q:'$D(^AUPNVPOV(X,0))
  1. .S I=$P($G(^AUPNVPOV(X,0)),U) Q:'I
  1. .S Y=$P($$ICDDX^ICDCODE(I),U,2)
  1. .S T=$O(^ATXAX("B","BGP CMS LVSD DXS",0))
  1. .Q:'$$ICD^ATXCHK(I,T,9)
  1. .S V=$P(^AUPNVPOV(X,0),U,3)
  1. .S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. .I V>BGPD Q
  1. .S BGPC=BGPC+1,BGPY(BGPC)="POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04)
  1. CEFMEAS ;
  1. K BGPG S Y="BGPG(",X=P_"^ALL MEAS CEF;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(DFN))_"-"_$$FMTE^XLFDT(BGPD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(BGPG(X)) Q:X'=+X S Y=+$P(BGPG(X),U,4) D
  1. .Q:$P($G(^AUPNVMSR(Y,2)),U,1)
  1. .S N=$P(^AUPNVMSR(Y,0),U,4)
  1. .S BGPC=BGPC+1,BGPY(BGPC)="MEASUREMENT CEF: "_$$DATE^BGP3UTL($P(BGPG(X),U))_" value: "_N
  1. .Q
  1. CEFPROC ;
  1. S X=0 F S X=$O(^AUPNVPRC("AC",P,X)) Q:X'=+X D
  1. .Q:'$D(^AUPNVPRC(X,0))
  1. .S I=$P($G(^AUPNVPRC(X,0)),U) Q:'I
  1. .S Y=$P($$ICDOP^ICDCODE(I),U,2)
  1. .S T="",T=$O(^ATXAX("B","BGP CMS EJECTION FRACTION PROC",0))
  1. .I $$ICD^ATXCHK(I,T,0) D
  1. ..S V=$P(^AUPNVPRC(X,0),U,3)
  1. ..S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. ..I V>BGPD Q
  1. ..S BGPC=BGPC+1,BGPY(BGPC)="CEF PROCEDURE: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.08,X,.04)
  1. CEFCPT ;
  1. S X=0 F S X=$O(^AUPNVCPT("AC",P,X)) Q:X'=+X D
  1. .Q:'$D(^AUPNVCPT(X,0))
  1. .S I=$P($G(^AUPNVCPT(X,0)),U) Q:'I
  1. .S Y=$P($$CPT^ICPTCOD(I),U,2)
  1. .S T="",T=$O(^ATXAX("B","BGP CMS EJECTION FRACTION CPTS",0))
  1. .I $$ICD^ATXCHK(I,T,1) D
  1. ..S V=$P(^AUPNVCPT(X,0),U,3)
  1. ..S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. ..I V>BGPD Q
  1. ..S BGPC=BGPC+1,BGPY(BGPC)="CEF CPT: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$P($$CPT^ICPTCOD(I,V),U,3)
  1. S X=0 F S X=$O(^AUPNVTC("AC",P,X)) Q:X'=+X D
  1. .Q:'$D(^AUPNVTC(X,0))
  1. .S I=$P($G(^AUPNVTC(X,0)),U,7) Q:'I
  1. .S Y=$P($$CPT^ICPTCOD(I),U,2)
  1. .Q:Y=""
  1. .S T="",T=$O(^ATXAX("B","BGP CMS EJECTION FRACTION CPTS",0))
  1. .I $$ICD^ATXCHK(I,T,1) D
  1. ..S V=$P(^AUPNVTC(X,0),U,3)
  1. ..S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. ..I V>BGPD Q
  1. ..S BGPC=BGPC+1,BGPY(BGPC)="CEF TRAN CODE: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$P($$CPT^ICPTCOD(I,V),U,3)
  1. Q
  1. ACEIALG1(P,BGPD,BGPY) ;EP
  1. NEW ED,BD,BGPG,BGPC,X,Y,Z,N
  1. S:$G(BGPC)="" BGPC=0
  1. S ED=$$FMADD^XLFDT(BGPD,-365)
  1. ACEIPOV ;
  1. K BGPG S Y="BGPG(",X=P_"^ALL DX [BGP ASA ALLERGY 995.0-995.3;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(P))_"-"_$$FMTE^XLFDT(BGPD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(BGPG(X)) Q:X'=+X S Y=+$P(BGPG(X),U,4) D
  1. .S N=$$VAL^XBDIQ1(9000010.07,Y,.04) S N=$$UP^XLFSTR(N)
  1. .I N["ACEI"!(N["ACE I") S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(BGPG(X),U))_" POV "_$P(BGPG(X),U,2) Q
  1. .S T=$O(^ATXAX("B","BGP ADV EFF ANTIHYPERTEN AGT",0))
  1. .S Z=$P(^AUPNVPOV(Y,0),U,9) I Z]"",$$ICD^ATXCHK(Z,T,9) S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(BGPG(X),U))_" ADR POV ["_$P(BGPG(X),U,2)_" + "_$P($$ICDDX^ICDCODE(Z),U,2)_"]" Q
  1. .S Z=$P(^AUPNVPOV(Y,0),U,18) I Z]"",$$ICD^ATXCHK(Z,T,9) S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(BGPG(X),U))_" ADR POV ["_$P(BGPG(X),U,2)_" + "_$P($$ICDDX^ICDCODE(Z),U,2)_"]" Q
  1. .S Z=$P(^AUPNVPOV(Y,0),U,19) I Z]"",$$ICD^ATXCHK(Z,T,9) S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(BGPG(X),U))_" ADR POV ["_$P(BGPG(X),U,2)_" + "_$P($$ICDDX^ICDCODE(Z),U,2)_"]" Q
  1. .Q
  1. K BGPG S Y="BGPG(",X=P_"^ALL DX [BGP HX DRUG ALLERGY NEC;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(DFN))_"-"_$$FMTE^XLFDT(BGPD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(BGPG(X)) Q:X'=+X S Y=+$P(BGPG(X),U,4) D
  1. .S N=$$VAL^XBDIQ1(9000010.07,Y,.04),N=$$UP^XLFSTR(N)
  1. .I N["ACEI"!(N["ACE I") S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(BGPG(X),U))_" ADR POV "_$P(BGPG(X),U,2)
  1. S T="",T=$O(^ATXAX("B","BGP ASA ALLERGY 995.0-995.3",0))
  1. S X=0 F S X=$O(^AUPNPROB("AC",P,X)) Q:X'=+X D
  1. .S I=$P($G(^AUPNPROB(X,0)),U),Y=$P($$ICDDX^ICDCODE(I),U,2)
  1. .S N=$$VAL^XBDIQ1(9000011,X,.05),N=$$UP^XLFSTR(N)
  1. .Q:$P(^AUPNPROB(X,0),U,8)>BGPD
  1. .I $$ICD^ATXCHK(I,$O(^ATXAX("B","BGP HX DRUG ALLERGY NEC",0)),9)!($$ICD^ATXCHK(I,T,9)),N["ACEI"!(N["ACE I") S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(^AUPNPROB(X,0),U,8))_" ADR Problem List "_Y_" "_N
  1. .Q
  1. S X=0 F S X=$O(^GMR(120.8,"B",P,X)) Q:X'=+X D
  1. .Q:$P($P($G(^GMR(120.8,X,0)),U,4),".")>BGPD
  1. .S N=$P($G(^GMR(120.8,X,0)),U,2),N=$$UP^XLFSTR(N)
  1. .I N["ACEI"!(N["ACE INHIBITOR") S BGPC=BGPC+1,BGPY(BGPC)=$$DATE^BGP3UTL($P(^GMR(120.8,X,0),U,4))_" ADR ALLERGY TRACKING "
  1. D ARBALG1^BGP3C13
  1. Q
  1. ACEIRX1(P,BGPA,BGPD,BGPY) ;EP
  1. NEW BGPG,BGPC,X,Y,Z,E,BD,ED
  1. S BGPC=0
  1. S ED=$$FMADD^XLFDT(BGPA,-1)
  1. S BD=$$FMADD^XLFDT(BGPA,-365)
  1. D GETMEDS^BGP3CU(P,BD,ED,"BGP CMS ACEI MEDS","BGP CMS ACEI MEDS NDC","BGP CMS ACEI MEDS CLASS")
  1. S BD=BGPA
  1. S ED=$$FMADD^XLFDT(BGPD,30)
  1. D GETMEDS^BGP3CU(P,BD,ED,"BGP CMS ACEI MEDS","BGP CMS ACEI MEDS NDC","BGP CMS ACEI MEDS CLASS")
  1. K BGPG
  1. D ARBRX1^BGP3C13
  1. Q
  1. DSCH(H) ;
  1. Q $P($P(^AUPNVINP(H,0),U),".")
  1. BETAALG1(P,BGPD,BGPY) ;have an ACEI allergy
  1. NEW ED,BD,BGPG,BGPC,X,Y,Z,N
  1. S BGPC=0
  1. S ED=$$FMADD^XLFDT(BGPD,-365)
  1. BETAPOV ;
  1. K BGPG S Y="BGPG(",X=P_"^ALL DX [BGP ASA ALLERGY 995.0-995.3;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(P))_"-"_$$FMTE^XLFDT(BGPD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(BGPG(X)) Q:X'=+X S Y=+$P(BGPG(X),U,4) D
  1. .S N=$$VAL^XBDIQ1(9000010.07,Y,.04) S N=$$UP^XLFSTR(N)
  1. .I N["BETA BLOCK"!(N["BBLOCK")!(N["B BLOCK") S BGPC=BGPC+1,BGPY(BGPC)="POV: "_$$DATE^BGP3UTL($P(BGPG(X),U))_" ["_$P(BGPG(X),U,2)_"] "_N Q
  1. .S T=$O(^ATXAX("B","BGP ADV EFF CARD RHYTH",0))
  1. .S Z=$P(^AUPNVPOV(Y,0),U,9) I Z]"",$$ICD^ATXCHK(Z,T,9) S G=1_U_"POV: "_$$DATE^BGP3UTL($P(BGPG(X),U))_" ["_$P(BGPG(X),U,2)_" + "_$P($$ICDDX^ICDCODE(Z),U,2)_"] "_N Q
  1. .S Z=$P(^AUPNVPOV(Y,0),U,18) I Z]"",$$ICD^ATXCHK(Z,T,9) S G=1_U_"POV: "_$$DATE^BGP3UTL($P(BGPG(X),U))_" ["_$P(BGPG(X),U,2)_" + "_$P($$ICDDX^ICDCODE(Z),U,2)_"] "_N Q
  1. .S Z=$P(^AUPNVPOV(Y,0),U,19) I Z]"",$$ICD^ATXCHK(Z,T,9) S G=1_U_"POV: "_$$DATE^BGP3UTL($P(BGPG(X),U))_" ["_$P(BGPG(X),U,2)_" + "_$P($$ICDDX^ICDCODE(Z),U,2)_"] "_N Q
  1. K BGPG S Y="BGPG(",X=P_"^ALL DX [BGP HX DRUG ALLERGY NEC;DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(DFN))_"-"_$$FMTE^XLFDT(BGPD) S E=$$START1^APCLDF(X,Y)
  1. S X=0 F S X=$O(BGPG(X)) Q:X'=+X S Y=+$P(BGPG(X),U,4) D
  1. .S N=$$VAL^XBDIQ1(9000010.07,Y,.04),N=$$UP^XLFSTR(N)
  1. .I N["BETA BLOCK"!(N["BBLOCK")!(N["B BLOCK") S BGPC=BGPC+1,BGPY(BGPC)="POV: "_$$DATE^BGP3UTL($P(BGPG(X),U))_" ["_$P(BGPG(X),U,2)_"] "_N
  1. S T="",T=$O(^ATXAX("B","BGP ASA ALLERGY 995.0-995.3",0))
  1. S X=0 F S X=$O(^AUPNPROB("AC",P,X)) Q:X'=+X D
  1. .S I=$P($G(^AUPNPROB(X,0)),U),Y=$P($$ICDDX^ICDCODE(I),U,2)
  1. .S N=$$VAL^XBDIQ1(9000011,X,.05),N=$$UP^XLFSTR(N)
  1. .Q:$P(^AUPNPROB(X,0),U,8)>BGPD ;added after discharge date
  1. .I $$ICD^ATXCHK(I,$O(^ATXAX("B","BGP HX DRUG ALLERGY NEC",0)),9)!($$ICD^ATXCHK(I,T,9)),N["BETA BLOCK"!(N["BBLOCK")!(N["B BLOCK") S BGPC=BGPC+1,BGPY(BGPC)="PROBLEM LIST: "_$$DATE^BGP3UTL($P(^AUPNPROB(X,0),U,8))_" ["_Y_"] "_N
  1. .Q
  1. S X=0 F S X=$O(^GMR(120.8,"B",P,X)) Q:X'=+X D
  1. .Q:$P($P($G(^GMR(120.8,X,0)),U,4),".")>BGPD ;entered after discharge date
  1. .S N=$P($G(^GMR(120.8,X,0)),U,2),N=$$UP^XLFSTR(N)
  1. .I N["BETA BLOCK" S BGPC=BGPC+1,BGPY(BGPC)="ALLERGY TRACKING: "_$$DATE^BGP3UTL($P(^GMR(120.8,X,0),U,4))_" "_N
  1. Q
  1. BETABPS1(P,BGPV,BGPY) ;
  1. K BGPY S BGPC=0
  1. S X=0 F S X=$O(^AUPNVMSR("AD",BGPV,X)) Q:X'=+X D
  1. .S Y=$P($G(^AUPNVMSR(X,0)),U)
  1. .Q:'Y
  1. .S Z=$P($G(^AUTTMSR(Y,0)),U)
  1. .Q:Z=""
  1. .Q:Z'="BP"
  1. .Q:$P($G(^AUPNVSMR(X,2)),U,1)
  1. .S N=$P(^AUPNVMSR(X,0),U,4)
  1. .S V=$P(^AUPNVMSR(X,0),U,3)
  1. .S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. .S BGPC=BGPC+1,BGPY(BGPC)="BP: "_N_" "_$$DATE^BGP3UTL(V)
  1. .Q
  1. S Z=0 F S Z=$O(^AUPNVSIT("AD",BGPV,Z)) Q:Z'=+Z D
  1. .S X=0 F S X=$O(^AUPNVMSR("AD",Z,X)) Q:X'=+X D
  1. ..S Y=$P($G(^AUPNVMSR(X,0)),U)
  1. ..Q:'Y
  1. ..S Y=$P($G(^AUTTMSR(Y,0)),U)
  1. ..Q:Y=""
  1. ..Q:Y'="BP"
  1. ..Q:$P($G(^AUPNVMSR(X,2)),U,1)
  1. ..S N=$P(^AUPNVMSR(X,0),U,4)
  1. ..S V=$P(^AUPNVMSR(X,0),U,3)
  1. ..S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. ..S BGPC=BGPC+1,BGPY(BGPC)="BP: "_N_" "_$$DATE^BGP3UTL(V)
  1. .Q
  1. Q
  1. BETACON1(P,BGPD,BGPDDT,BGPV,BGPY) ;have an ACEI allergy
  1. NEW ED,BD,BGPG,BGPC,X,Y,Z,N,E
  1. S BGPC=0 K BGPY
  1. S BD=$$FMADD^XLFDT(BGPD,-365)
  1. S T=$O(^ATXAX("B","BGP CMS BRADYCARDIA DXS",0))
  1. S T1=$O(^ATXAX("B","BGP CMS 2/3 HEART BLOCK DXS",0))
  1. S T2=$O(^ATXAX("B","BGP CMS CIRCULATORY SHOCK DXS",0))
  1. S T3=$O(^ATXAX("B","BGP CMS HEART FAILURE DXS",0))
  1. S X=0 F S X=$O(^AUPNVPOV("AD",BGPV,X)) Q:X'=+X D
  1. .Q:'$D(^AUPNVPOV(X,0))
  1. .S I=$P($G(^AUPNVPOV(X,0)),U) Q:'I
  1. .S Y=$P($$ICDDX^ICDCODE(I),U,2)
  1. .S V=$P(^AUPNVPOV(X,0),U,3)
  1. .S V=$P($P($G(^AUPNVSIT(V,0)),U),".")
  1. .I $$ICD^ATXCHK(I,T,9) S BGPC=BGPC+1,BGPY(BGPC)="BRADYCARDIA POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04) Q
  1. .I $$ICD^ATXCHK(I,T1,9) S BGPC=BGPC+1,BGPY(BGPC)="2ND OR 3RD DEGREE HEART BLOCK POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04) Q
  1. .I $$ICD^ATXCHK(I,T2,9) S BGPC=BGPC+1,BGPY(BGPC)="CIRCULATORY SHOCK POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04) Q
  1. .I $$ICD^ATXCHK(I,T3,9) S BGPC=BGPC+1,BGPY(BGPC)="HEART FAILURE POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04) Q
  1. .Q
  1. ;
  1. S Z=0 F S Z=$O(^AUPNVSIT("AD",BGPV,Z)) Q:Z'=+Z D
  1. .S X=0 F S X=$O(^AUPNVPOV("AD",Z,X)) Q:X'=+X D
  1. ..S I=$P($G(^AUPNVPOV(X,0)),U) Q:'I
  1. ..S Y=$P($$ICDDX^ICDCODE(I),U,2)
  1. ..S V=$P($P($G(^AUPNVSIT(Z,0)),U),".")
  1. ..I $$ICD^ATXCHK(I,T,9) S BGPC=BGPC+1,BGPY(BGPC)="BRADYCARDIA POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04) Q
  1. ..I $$ICD^ATXCHK(I,T1,9) S BGPC=BGPC+1,BGPY(BGPC)="2ND OR 3RD DEGREE HEART BLOCK POV: "_$$DATE^BGP3UTL(V)_" ["_Y_"] "_$$VAL^XBDIQ1(9000010.07,X,.04) Q
  1. .Q
  1. ;
  1. S T=$O(^ATXAX("B","BGP CMS BETA BLOCKER MEDS",0))
  1. S Z=$$FMADD^XLFDT(BGPDDT,-365)
  1. S X=0 F S X=$O(^AUPNPREF("AA",P,50,X)) Q:X'=+X D
  1. .Q:'$D(^ATXAX(T,21,"B",X)) ;not an ACEI
  1. .S D=0 F S D=$O(^AUPNPREF("AA",P,50,X,D)) Q:D'=+D D
  1. ..S Y=9999999-D I Y<Z Q ;documented more than 1 year before discharge
  1. ..I Y>BGPDDT Q ;documented after discharge
  1. ..S N=0 F S N=$O(^AUPNPREF("AA",P,50,X,D,N)) Q:N'=+N D
  1. ...Q:$P($G(^AUPNPREF(N,0)),U,7)'="N"
  1. ...S BGPC=BGPC+1,BGPY(BGPC)="NMI BETA BLOCKER: "_$$VAL^XBDIQ1(9000022,N,.04)_" "_$$DATE^BGP3UTL($P(^AUPNPREF(N,0),U,3))_" "_$$VAL^XBDIQ1(9000022,X,1101)
  1. ..Q
  1. .Q
  1. S X=$$CPTI^BGP3DU(P,BGPD,BGPDDT,+$$CODEN^ICPTCOD("G8011"))
  1. I X S BGPC=BGPC+1,BGPY(BGPC)="CPT code G8011: "_$$DATE^BGP3UTL($P(X,U,2))
  1. S X=$$TRANI^BGP3DU(P,BGPD,BGPDDT,+$$CODEN^ICPTCOD("G8011"))
  1. I X S BGPC=BGPC+1,BGPY(BGPC)="TRAN code G8011: "_$$DATE^BGP3UTL($P(X,U,2))
  1. K BGPG
  1. Q
  1. BETARX1(P,BGPA,BGPD,BGPY) ;
  1. NEW BGPG,BGPC,X,Y,Z,E,BD,ED
  1. S BGPC=0
  1. S ED=$$FMADD^XLFDT(BGPA,-1)
  1. S BD=$$FMADD^XLFDT(BGPA,-365)
  1. D GETMEDS^BGP3CU(P,BD,ED,"BGP CMS BETA BLOCKER MEDS","BGP CMS BETA BLOCKER NDC","BGP CMS BETA BLOCKER CLASS")
  1. S X=$$CPTI^BGP3DU(P,BD,ED,+$$CODEN^ICPTCOD("G8009"))
  1. I X S BGPC=BGPC+1,BGPY(BGPC)="CPT code G8009: "_$$DATE^BGP3UTL($P(X,U,2))
  1. S X=$$TRANI^BGP3DU(P,BD,ED,+$$CODEN^ICPTCOD("G8009"))
  1. I X S BGPC=BGPC+1,BGPY(BGPC)="TRAN code G8009: "_$$DATE^BGP3UTL($P(X,U,2))
  1. K BGPG
  1. S BD=BGPA
  1. S ED=$$FMADD^XLFDT(BGPD,30)
  1. D GETMEDS^BGP3CU(P,BD,ED,"BGP CMS BETA BLOCKER MEDS","BGP CMS BETA BLOCKER NDC","BGP CMS BETA BLOCKER CLASS")
  1. S X=$$CPTI^BGP3DU(P,BD,ED,+$$CODEN^ICPTCOD("G8009"))
  1. I X S BGPC=BGPC+1,BGPY(BGPC)="CPT code G8009: "_$$DATE^BGP3UTL($P(X,U,2))
  1. S X=$$TRANI^BGP3DU(P,BD,ED,+$$CODEN^ICPTCOD("G8009"))
  1. I X S BGPC=BGPC+1,BGPY(BGPC)="TRANBG code G8009: "_$$DATE^BGP3UTL($P(X,U,2))
  1. K BGPG
  1. Q