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

BGP8D3B.m

Go to the documentation of this file.
BGP8D3B ; IHS/CMI/LAB - PNEUMO REMINDER 27 Feb 2015 7:52 AM ;
 ;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
 ;
I13 ;EP - PN
 NEW BGPTDAP,BGPTD,BGPFLU,BGPZOST,BGPPNEU,BGPPNEUD,BGPDTAPP,BGPPPSEV,BGPPCVEV,BGPPP65,BGPPC65,BGPPP5Y,BGPPC5Y,BGPPC1Y,BGPPC19,BGPPP1Y
 S (BGPPNCON,BGPPPSEV,BGPPCVEV,BGPPP65,BGPPC65,BGPPP5Y,BGPPC5Y,BGPPC1Y,BGPPC19,BGPPP1Y,BGPPPCON,BGPPCCON)=""
 F X=1:1:17 S Y="BGPD"_X S @Y=""
 F X=1:1:55 S Y="BGPN"_X S @Y=""
 I BGPAGEB>64,BGPACTUP S BGPD3=1  ;UP 65+
 I BGPDMD2 S BGPD2=1  ;ACT DM
 I BGPAGEB>64,BGPACTCL S BGPD1=1  ;AC 65+
 I BGPAGEB>17,BGPAGEB<65,BGPACTCL,$$HIGHRP^BGP8D3A(DFN,BGPEDATE) S BGPD4=1  ;18-64 AC HIGH RISK
 I BGPAGEB>17,BGPAGEB<65,BGPACTUP,$$HIGHRP^BGP8D3A(DFN,BGPEDATE) S BGPD5=1  ;18-64 UP HIGH RISK
 I BGPAGEB>17,BGPAGEB<65,BGPACTCL S BGPD6=1  ;18-64 AC
 I BGPAGEB>17,BGPAGEB<65,BGPACTUP S BGPD7=1  ;18-64 UP
 I BGPAGEB>17,BGPACTCL S BGPD8=1
 I BGPAGEB>17,BGPACTUP S BGPD9=1
 I BGPAGEB>18,BGPAGEB<60,BGPACTCL S BGPD10=1  ;AC 19-59 026.N.1
 I BGPAGEB>18,BGPAGEB<60,BGPACTUP S BGPD11=1
 I BGPAGEB>59,BGPAGEB<65,BGPACTCL S BGPD12=1  ;AC 60-64 026.QO
 I BGPAGEB>59,BGPAGEB<65,BGPACTUP S BGPD13=1
 I BGPSEX="F" S X=$$PREG(DFN,BGPBDATE,BGPEDATE) I X S BGPD14=1  ;pregnant
 I BGPACTCL,BGPAGEB>18 S BGPD15=1  ;GPRA DEV V17 AC 19+
 I BGPACTUP,BGPAGEB>18 S BGPD17=1  ;V18 USER OP 19+
 I '(BGPD1+BGPD2+BGPD3+BGPD4+BGPD5+BGPD6+BGPD7+BGPD8+BGPD9+BGPD10+BGPD11+BGPD12+BGPD13+BGPD14+BGPD15+BGPD16+BGPD17) S BGPSTOP=1 Q
 S BGPVALUE="",BGPVALUD="",BGPPLPNU="",BGPDTAPP="",BGPTDAP=""
PN ;EP - called from elder
 ;NEW PNEUMO AGE 65+ ONLY
 ;I BGPAGEB<65 G N1
 S BGPPPCON=$$PPCONT(DFN,BGPEDATE) ;I BGPPPCON S (BGPPPSEV,BGPPP5Y,BGPPP1Y,BGPPP65)=BGPPPCON ;did they have a contraindication
 S BGPPCCON=$$PCCONT(DFN,BGPEDATE) ;I BGPPCCON S (BGPPCVEV,BGPPC5Y,BGPPC1Y,BGPPC19)=BGPPCCON ;did they have a contraindication
 ;I BGPPCON S (BGPN1,BGPN8,BGPN37,BGPN46,BGPN47,BGPN48,BGPN49,BGPN50,BGPN51,BGPN52)=1 G N1
 S BGPPPSEV=$$PPSV23^BGP8D3C(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)  ;PPSV23 EVER
 S BGPPCVEV=$$PCV13^BGP8D3C(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)   ;PCV13 EVER
 S BGPPP5Y=$$PPSV23^BGP8D3C(DFN,$$FMADD^XLFDT(BGPEDATE,-(5*365)),BGPEDATE)  ;PPSV23 LAST 5 YEARS
 S BGPPC5Y=$$PCV13^BGP8D3C(DFN,$$FMADD^XLFDT(BGPEDATE,-(5*365)),BGPEDATE)  ;PCV13 LAST 5 YEARS
 S BGPPC1Y=$$PCV13^BGP8D3C(DFN,BGPBDATE,BGPEDATE)  ;PCV13 PAST YEAR
 S BGPPP1Y=$$PPSV23^BGP8D3C(DFN,BGPBDATE,BGPEDATE)  ;PPSV23 PAST YEAR
 S B=$$DOB^AUPNPAT(DFN)
 S BGPA65BD=$E(B,1,3)+65_$E(B,4,7)
 I BGPAGEB>64 S BGPPP65=$$PPSV23^BGP8D3C(DFN,BGPA65BD,BGPEDATE),BGPPC65=$$PCV13^BGP8D3C(DFN,BGPA65BD,BGPEDATE)
 S BGPA19BD=$E(B,1,3)+19_$E(B,4,7)
 S BGPPC19=$$PCV13^BGP8D3C(DFN,BGPA19BD,BGPEDATE)
 I BGPPPSEV!(BGPPCVEV)!(BGPPCCON)!(BGPPPCON) S BGPN1=1
 ;BGPN8 - V18 026.C.5
 S BGPN8=0
 ;I BGPAGEB<65,(BGPPPSEV!(BGPPCVEV)) S BGPN8=1  ;UNDER 65 HAD PPSV23 OR PCV13 EVER PNEUMO ONLY 65+
 I (BGPPPSEV!(BGPPCVEV)),(BGPPP65!(BGPPC65)!(BGPPP5Y)!(BGPPC5Y)) S BGPN8=1 ;026.C.5  BGPN8
 I BGPPPCON!(BGPPCCON) S BGPN8=1
 S BGPN47=0  ;026.C.26
 I BGPPC19!(BGPPP1Y) S BGPN47=1
 I BGPPCCON S BGPN47=1
 S BGPN48=0  ;026.C.27
 I BGPPPCON!(BGPPC1Y) S BGPN48=1
 I BGPPP5Y!(BGPPP65) S BGPN48=1
 S BGPN46=0  ;026.C.25 UP TO DATE
 I BGPN47,BGPN48 S BGPN46=1  ;UP TO DATE
 S BGPN49=0  ;026.C.28
 I BGPPP65!(BGPPPCON),BGPPC65!(BGPPCCON) S BGPN49=1
 S BGPN50=0  ;026.C.29
 I BGPPP65!(BGPPPCON) S BGPN50=1
 S BGPN51=0  ;026.C.30
 I BGPPC65!(BGPPCCON) S BGPN51=1
 ;BGPN52 026.D.1
 S BGPN52=0
 I BGPAGEB>64,BGPPPSEV,(BGPPP65!(BGPPP5Y)) S BGPN52=1
 I BGPAGEB<65,BGPPPSEV S BGPN52=1
 I BGPPPCON S BGPN52=1
N1 S BGPDV=""
 ;
TD ;new tdap and td stuff for v11.1
 I BGPRTYPE=5 G P1
 S BGPTDAP=$$DTAP^BGP8D3A(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPTDAP S BGPN9=1                                                        ;026.N.3 TDAP/TD EVER    BGPN9
 S BGPTD=$$DTAPTD^BGP8D3A(DFN,$$FMADD^XLFDT(BGPEDATE,-(10*365)),BGPEDATE)
 I BGPTD S BGPN10=1                                                         ;026.N.1 1 Tdap/Td in past 10 years  BGPN10
 I BGPN9,BGPN10 S BGPN30=1                                                  ;026.N.9 TD 10 YRS/TDAP EVER 1:1 19-59   BGPN30
 ;FLU
 S BGPFLU=$$FLU^BGP8D3(DFN,BGPBDATE,BGPEDATE)
 I $P(BGPFLU,U,3)=1!($P(BGPFLU,U,3)=3) S BGPN13=1                            ;026.O.5 FLU DURING RP   BGPN13
 I BGPN9,BGPN10,BGPN13 S BGPN15=1                                           ;022=6.N.7 1:1:1  19-59        BGPN15
 ;I BGPN11!(BGPN12)!(BGPN14) S BGPN16=1
 S BGPZOST=$$IZOSTER^BGP8D3C(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I $P(BGPZOST,U,3)=1!($P(BGPZOST,U,3)=3) S BGPN17=1  ;026.O.7
 I BGPN9,BGPN10,BGPN13,BGPN17 S BGPN19=1  ;026.O.9 60-64 1:1:1:1
 I BGPN9,BGPN10,BGPN17 S BGPN32=1  ;1:1:1: TD/TDAP/ZOSTER O26.O.11
 I BGPN9,BGPN10,BGPN13,BGPN17,BGPN46 S BGPN21=1  ;026.C.14
 I BGPN9,BGPN10,BGPN17,BGPN46 S BGPN34=1
 I BGPN11!(BGPN12)!(BGPN14)!(BGPN18)!(BGPN3) S BGPN22=1
 I BGPN11!(BGPN12)!(BGPN18)!(BGPN3) S BGPN35=1
 I BGPN9,BGPN10,BGPN13,BGPN17,BGPN48 S BGPN29=1  ;026.C.17
 I BGPN9,BGPN10,BGPN17,BGPN48 S BGPN38=1
 ;
 S BGPTRIM=""
 I BGPD14 D
 .S BGPVALUD="AC PREG|||"
 .S BGPFPRDX=$$FIRSTPDX^BGP8D3C(DFN,$$FMADD^XLFDT(BGPEDATE,-608),BGPEDATE) I BGPFPRDX="" S BGPFPRDX=$P($G(^AUPNREP(DFN,11)),U,2)
 .;GET EDD
 .S BGPEDD=$$EDD^BGP8UTL2(DFN,BGPBDATE,BGPEDATE)
 .K BGPTDAPP
 .S D=BGPEDATE
 .I BGPEDD]"",BGPEDD<BGPEDATE S D=BGPEDD
 .S BGPTDAPP=$$LASTTDAP(DFN,BGPFPRDX,D)
 .I $E(BGPTDAPP) S BGPN39=1  ;A SHOT OR AN NMI
 .I $E(BGPTDAPP)=2 S BGPN40=1  ;NMI
 .;I 'BGPN39 Q
 .;TRIMESTER
 .I BGPEDD D  Q
 ..;FIGURE OUT TRIMESTER FOR ALL TDAPS, IF ANY ARE 3RD USE IT, THEN DO 2ND, THEN DO 1ST
 ..;FIRST DAY OF PREG IS 280 DAYS BEFORE EDD
 ..NEW FB,FE,SB,SE,TB,TE
 ..;
 ..S G=""
 ..;I $E(BGPTDAPP)=2 G UNK
 ..S TB=$$FMADD^XLFDT(BGPEDD,-91)
 ..S TE=BGPEDD
 ..S BGPD16=$$LASTVD^BGP8D3C(DFN,TB,TE)
 ..S SB=$$FMADD^XLFDT(BGPEDD,-182)
 ..S SE=$$FMADD^XLFDT(TB,-1)
 ..S FB=$$FMADD^XLFDT(BGPEDD,-280)
 ..S FE=$$FMADD^XLFDT(SB,-1)
 ..S X=$P(BGPTDAPP,U,2)  ;DATE OF DTAP
 ..I X="" Q
 ..I $E(BGPTDAPP)=2 G UNK
 ..I X'<TB,X'>TE S G=G_3
 ..I X'>SE,X'<SB S G=G_2
 ..I X>FB S G=G_1
 ..I G[3 S BGPN43=1,BGPTRIM="3rd Trimester" Q
 ..I G[2 S BGPN42=1,BGPTRIM="2nd Trimester" Q
 ..I G[1 S BGPN41=1,BGPTRIM="1st Trimester" Q
UNK ..I G="" S BGPN44=1,BGPTRIM="unk Trimester"
 .I BGPEDD="" D  ;try to find icd codes
 ..;get all dxs tri, sec, 1st
 ..S G=""
 ..S BGPD16=$$LASTDX^BGP8UTL1(DFN,"BGP PREGNANCY TRI 3 DXS",BGPBDATE,BGPEDATE)
 ..S X=$P(BGPTDAPP,U,2) ;DATE OF TDAP
 ..I X="" Q
 ..I $E(BGPTDAPP)=2 G UNK1
 ..S Y=$$LASTDX^BGP8UTL1(DFN,"BGP PREGNANCY TRI 3 DXS",$$FMADD^XLFDT(X,-7),$$FMADD^XLFDT(X,7))
 ..I Y S G=G_3,BGPD16=1
 ..S Y=$$LASTDX^BGP8UTL1(DFN,"BGP PREGNANCY TRI 2 DXS",$$FMADD^XLFDT(X,-7),$$FMADD^XLFDT(X,7))
 ..I Y S G=G_2
 ..S Y=$$LASTDX^BGP8UTL1(DFN,"BGP PREGNANCY TRI 1 DXS",$$FMADD^XLFDT(X,-7),$$FMADD^XLFDT(X,7))
 ..I Y S G=G_1
 ..I G[3 S BGPN43=1,BGPTRIM="3rd Trimester" Q
 ..I G[2 S BGPN42=1,BGPTRIM="2nd Trimester" Q
 ..I G[1 S BGPN41=1,BGPTRIM="1st Trimester" Q
UNK1 ..I G="" S BGPN44=1,BGPTRIM="unk Trimester"
N ;
 ;GPRA DEV PREG BGPVALUD
 I BGPD16 S BGPVALUD=$P(BGPVALUD,"|||")_",PREGVTTM|||"_$P(BGPVALUD,"|||",2)
 I BGPD14!(BGPD16) D
 .I BGPTDAP S BGPVALUD=BGPVALUD_$S($P(BGPVALUD,"|||",2)]"":"; ",1:""),BGPVALUD=BGPVALUD_"TDAP: "_$S($P(BGPDTAPP,U,3)]"":$P(BGPDTAPP,U,3),1:$P(BGPTDAP,U,2))_" (ever) "_$S(BGPTRIM]"":"("_BGPTRIM_")",1:"")
 .I BGPTD S BGPVALUD=BGPVALUD_$S($P(BGPVALUD,"|||",2)]"":"; ",1:""),BGPVALUD=BGPVALUD_"TDAP/TD: "_$P(BGPTD,U,2)_" (past 10 yrs)"
 .I BGPFLU S BGPVALUD=BGPVALUD_$S($P(BGPVALUD,"|||",2)]"":"; ",1:""),BGPVALUD=BGPVALUD_"FLU: "_$P(BGPFLU,U,2)_" (past yr)"
 ;ONM DENOMINATOR LIST VALUE
 S BGPDV=""
 I BGPRTYPE=7 S BGPDV=$S(BGPD6:"AC",BGPD8:"AC",1:"") S:BGPD4 BGPDV=BGPDV_$S(BGPDV]"":",HR",1:"HR") S:BGPD2 BGPDV=BGPDV_$S(BGPDV]"":",AD",1:"AD")
 ;SELECTED DENOMINATOR LIST VALUE
 I BGPRTYPE=4 D
 .S BGPDV="UP"
 .I BGPD6!(BGPD1)!(BGPD8) S BGPDV=BGPDV_$S(BGPDV]"":",AC",1:"AC")
 .I BGPD4!(BGPD5) S BGPDV=BGPDV_$S(BGPDV]"":",HR",1:"HR")
 .I BGPD2 S BGPDV=BGPDV_$S(BGPDV]"":",AD",1:"AD")
 ;NATL GPRA DENOMINATOR LIST VALUE
 I BGPRTYPE=1 D
 .S BGPDV="UP"
 .I BGPD6!(BGPD1)!(BGPD8) S BGPDV=BGPDV_$S(BGPDV]"":",AC",1:"AC")
 I BGPD10!(BGPD11),BGPN30 S BGPN45=1 ;19-59
 I BGPD12!(BGPD13),BGPN32 S BGPN45=1  ;60-64
 I BGPD1!(BGPD3),BGPN34 S BGPN45=1 ;65+
 S BGPVALUE=""
 I BGPTDAP S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:""),BGPVALUE=BGPVALUE_"TDAP: "_$P(BGPTDAP,U,2)_" (ever)"
 I BGPTD S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:""),BGPVALUE=BGPVALUE_"TDAP/TD: "_$P(BGPTD,U,2)_" (past 10 yrs)"
 I BGPFLU S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:""),BGPVALUE=BGPVALUE_"FLU: "_$P(BGPFLU,U,2)_" (past yr)"
 I BGPZOST]"" S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:""),BGPVALUE=BGPVALUE_"ZOSTER: "_$P(BGPZOST,U,2)_" (ever)"
P1 I BGPPPCON S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:"")_"PPSV23: "_$$DATE^BGP8UTL($P(BGPPPCON,U,1))_" "_$P(BGPPPCON,U,2)
 I BGPPCCON S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:"")_"PCV13: "_$$DATE^BGP8UTL($P(BGPPCCON,U,1))_" "_$P(BGPPCCON,U,2)
 ;PPSV23
 I BGPPPSEV D
 .S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:"")_"PPSV23: "_$$DATE^BGP8UTL($P(BGPPPSEV,U,1))_" "_$P(BGPPPSEV,U,2)_" (ever)"
 .S:BGPPP5Y BGPVALUE=BGPVALUE_" (past 5 yrs)" S:BGPPP1Y BGPVALUE=BGPVALUE_" (past 1 yr)" S:BGPPP65 BGPVALUE=BGPVALUE_" (after 65)" I BGPN46 S BGPVALUE=BGPVALUE_" (up-to-date)"
 I BGPPCVEV D
 .S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:"")_"PCV13: "_$$DATE^BGP8UTL($P(BGPPCVEV,U,1))_" "_$P(BGPPCVEV,U,2)_" (ever)"
 .S:BGPPC5Y BGPVALUE=BGPVALUE_" (past 5 yrs)" S:BGPPC1Y BGPVALUE=BGPVALUE_" (past 1 yr)" S:BGPPC65 BGPVALUE=BGPVALUE_" (after 65)" S:BGPPC19 BGPVALUE=BGPVALUE_" (after 19)" I BGPN46 S BGPVALUE=BGPVALUE_" (up-to-date)"
 S BGPVALUE=BGPDV_"|||"_BGPVALUE
 ;S BGPVALUE=BGPVALUE_"  MET: "_BGPLORI
TDE K BGPLPNU,BGPVAL,BGPA65,BGPVALH,BGPTD,BGPTDAP,BGPFLU,BGPTDAPP,BGPPNCON,BGPA65BD,BGPA19BD,BGPPNCON
 Q
OPTOM ;EP
 G OPTOM^BGP8D213
LASTTDAP(P,BDATE,EDATE) ;EP
 NEW C,D,BGPX,X,Y,G,B,R,ID,BGPZ
 S BGPX=""
 S C=$O(^AUTTIMM("C",115,0))
 S D=0 F  S D=$O(^AUPNVIMM("AA",P,C,D)) Q:D'=+D!(BGPX)  D
 .S X=0 F  S X=$O(^AUPNVIMM("AA",P,C,D,X)) Q:X'=+X  D
 ..S ID=$P($P($G(^AUPNVIMM(X,12)),U),".")
 ..I ID="" Q:$P(^AUPNVIMM(X,0),U,3)=""
 ..I ID="" S ID=$$VD^APCLV($P(^AUPNVIMM(X,0),U,3))
 ..Q:ID<BDATE
 ..Q:ID>EDATE
 ..S BGPX=ID_U_$$DATE^BGP8UTL(ID)_" Imm 115"
 .Q
 ;now add in cpt
 S C=+$$CODEN^ICPTCOD(90715)
 S D=$$CPTI^BGP8DU(P,BDATE,EDATE,C)
 I $P(D,U,2)>$P(BGPX,U,1) S BGPX=$P(D,U,2)_U_$$DATE^BGP8UTL(D)_" CPT 90715"
 I BGPX Q 1_U_BGPX
 ;contra/nmi
 F BGPZ=115 S X=$$ANCONT^BGP8D31(P,BGPZ,EDATE)
 I X]"" S BGPX=2_U_$P(X,U,1)_U_$$DATE^BGP8UTL($P(X,U,1))_" "_$P(X,U,2) Q BGPX
 ;Refusals
 S B=$$DOB^AUPNPAT(P),E=EDATE,BGPNMI="",R=""
 F BGPIMM=115  D
 .S I=$O(^AUTTIMM("C",BGPIMM,0)) Q:'I
 .S X=0 F  S X=$O(^AUPNPREF("AA",P,9999999.14,I,X)) Q:X'=+X  S Y=0 F  S Y=$O(^AUPNPREF("AA",P,9999999.14,I,X,Y)) Q:Y'=+Y  S D=$P(^AUPNPREF(Y,0),U,3) I D'<B&(D'>E) D
 ..Q:$P(^AUPNPREF(Y,0),U,7)'="N"
 ..S R=D
 I R S BGPX=2_U_R_U_$$DATE^BGP8UTL(R)_" "_"NMI Dtap" Q BGPX
 S R="",B=+$$CODEN^ICPTCOD(90715)
 S G=$$NMIREF^BGP8UTL1(P,81,B,$$DOB^AUPNPAT(P),EDATE)
 I G S BGPX=2_U_$P(G,U,2)_U_$$DATE^BGP8UTL($P(G,U,2))_" "_"NMI Dtap 90715" Q G
 Q ""
PREG(P,BDATE,EDATE) ;
 I '$$PREG^BGP8D7(DFN,$$FMADD^XLFDT(EDATE,-608),EDATE,1,1,,BDATE,EDATE) Q ""    ;V17.1 CMI/LAB ADDED DATES FOR CURRENTLY PREGNANT
 Q 1
PPCONT(P,EDATE) ;contraindicated
 ;NOW CHECK FOR CONTRAINDICATION pps23
 NEW X,TA,BGPZ,G,R
 S X=""
 S T1=$O(^ATXAX("B","BGP PPSV23 CVX CODES",0))
 S BGPZ=0 F  S BGPZ=$O(^ATXAX(T1,21,"B",BGPZ)) Q:BGPZ'=+BGPZ!(X]"")  S X=$$ANCONT^BGP8D31(P,BGPZ,EDATE)
 I X]"" Q X_U_3
 ;NMI Refusal
 S BGPZ=0,G="" F  S BGPZ=$O(^ATXAX(T1,21,"B",BGPZ)) Q:BGPZ'=+BGPZ!(G)  D
 .S G=$$NMIREF^BGP8UTL1(P,9999999.14,$O(^AUTTIMM("C",BGPZ,0)),$$DOB^AUPNPAT(P),EDATE)
 .I $P(G,U)=1 S G=$P(G,U,2)_U_"NMI Refusal"_U_3
 I G]"" Q G
 S R=$$CPTREFT^BGP8UTL1(P,$$DOB^AUPNPAT(P),EDATE,$O(^ATXAX("B","BGP PPSV23 CPT CODES",0)),"N")
 I R Q $P(R,U,2)_U_"NMI Refusal "_$P(R,U,4)_U_3
 Q ""
PCCONT(P,EDATE) ;
 ;NOW CHECK FOR CONTRAINDICATION (NEW IN 8.0)
 S X=""
 S T1=$O(^ATXAX("B","BGP PCV13 CVX CODES",0))
 S BGPZ=0 F  S BGPZ=$O(^ATXAX(T1,21,"B",BGPZ)) Q:BGPZ'=+BGPZ!(X]"")  S X=$$ANCONT^BGP8D31(P,BGPZ,EDATE)
 I X]"" Q X_U_3
 ;NMI Refusal pcv13
 S BGPZ=0,G="" F  S BGPZ=$O(^ATXAX(T1,21,"B",BGPZ)) Q:BGPZ'=+BGPZ!(G)  D
 .S G=$$NMIREF^BGP8UTL1(P,9999999.14,$O(^AUTTIMM("C",BGPZ,0)),$$DOB^AUPNPAT(P),EDATE)
 .I $P(G,U)=1 S G=$P(G,U,2)_U_"NMI Refusal"_U_3
 I G]"" Q G
 S R=$$CPTREFT^BGP8UTL1(P,$$DOB^AUPNPAT(P),EDATE,$O(^ATXAX("B","BGP PNEUMO CONJUGATE CPTS",0)),"N")
 I R Q $P(R,U,2)_U_"NMI Refusal "_$P(R,U,4)_U_3
 Q ""