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

BGP5D3B.m

Go to the documentation of this file.
BGP5D3B ; IHS/CMI/LAB - PNEUMO REMINDER ; 27 Feb 2015  7:52 AM
 ;;15.1;IHS CLINICAL REPORTING;;MAY 06, 2015;Build 143
 ;
I13 ;EP - PN
 NEW BGPTDAP,BGPTD,BGPFLU,BGPZOST,BGPPNEU,BGPPNEUD
 S (BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPN7,BGPN8,BGPN9,BGPN10,BGPN11,BGPN12,BGPD1,BGPD2,BGPD3,BGPD4,BGPD5,BGPD6,BGPD7,BGPD8,BGPD9,BGPD10,BGPD11,BGPD12,BGPD13)=0
 S (BGPN13,BGPN14,BGPN15,BGPN16,BGPN17,BGPN18,BGPN19,BGPN20,BGPN21,BGPN22,BGPN23,BGPN24,BGPN25,BGPN26,BGPN27,BGPN28,BGPN29,BGPN30,BGPN31,BGPN32,BGPN33,BGPN34,BGPN35,BGPN36,BGPN37,BGPN38)=0
 I BGPAGEB>64,BGPACTUP S BGPD3=1
 I BGPDMD2 S BGPD2=1
 I BGPAGEB>64,BGPACTCL S BGPD1=1
 I BGPAGEB>17,BGPAGEB<65,BGPACTCL,$$HIGHRP^BGP5D3A(DFN,BGPEDATE) S BGPD4=1
 I BGPAGEB>17,BGPAGEB<65,BGPACTUP,$$HIGHRP^BGP5D3A(DFN,BGPEDATE) S BGPD5=1
 I BGPAGEB>17,BGPAGEB<65,BGPACTCL S BGPD6=1
 I BGPAGEB>17,BGPAGEB<65,BGPACTUP S BGPD7=1
 I BGPAGEB>17,BGPACTCL S BGPD8=1
 I BGPAGEB>17,BGPACTUP S BGPD9=1
 I BGPAGEB>18,BGPAGEB<60,BGPACTCL S BGPD10=1
 I BGPAGEB>18,BGPAGEB<60,BGPACTUP S BGPD11=1
 I BGPAGEB>59,BGPAGEB<65,BGPACTCL S BGPD12=1
 I BGPAGEB>59,BGPAGEB<65,BGPACTUP S BGPD13=1
 I '(BGPD1+BGPD2+BGPD3+BGPD4+BGPD5+BGPD6+BGPD7+BGPD8+BGPD9+BGPD10+BGPD11+BGPD12+BGPD13) S BGPSTOP=1 Q
 S BGPVALUE="",BGPVALUD="",BGPPLPNU=""
PN ;EP - called from elder
 S BGPVALUE=$$PNEU^BGP5D31(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE) ;set to date of PNEU shot
 I $P(BGPVALUE,U,3)=1!($P(BGPVALUE,U,3)=3) S BGPN1=1 ; ALL USERS HAD 1 EVER - 
 I $P(BGPVALUE,U,3)=3 S BGPN3=1  ;NMI EVER
 S BGPVAL=$$PNEU^BGP5D31(DFN,$$FMADD^XLFDT(BGPEDATE,-(5*365)),BGPEDATE)
 I $P(BGPVAL,U,3)=1!($P(BGPVAL,U,3)=3) S BGPN4=1  ;HAD IN PAST 5 YEARS SO "UP TO DATE"
 I $P(BGPVAL,U,3)=3 S BGPN6=1  ;NMI PAST 5 YRS
 ;65TH DOB DATE
 S B=$$DOB^AUPNPAT(DFN)
 S BGPA65BD=$E(B,1,3)+65_$E(B,4,7)
 S BGPN7=0,BGPA65="" I BGPAGEB>64 S BGPA65=$$PNEU^BGP5D31(DFN,BGPA65BD,BGPEDATE) I $P(BGPA65,U,3)=1!($P(BGPA65,U,3)=3) S BGPN4=1,BGPN7=1 ;65+ HAD AFTER 65TH DOB  BGPN4 IS UPTODATE
 I BGPAGEB<65,BGPN1 S BGPN4=1  ;anyone under and had 1 ever  ;BGPN4 IS UP TO DATE
 ;NATIONAL GPRA
 S BGPN8=0
 I BGPAGEB<65,BGPN1 S BGPN8=1  ;GPRA DEV UP TO DATE
 I BGPAGEB>64,BGPN1,(BGPN4+BGPN7) S BGPN8=1  ;IF 65+ HAD ONE IN PAST 5 YEARS OR AFTER AGE 65
 ;GPRA DEV V15.0
 D
 .S B=$$DOB^AUPNPAT(DFN)
 .S BGPA65BD=$E(B,1,3)+65_$E(B,4,7),BGPPNA65=""
 .I BGPAGEB>64 S BGPPNA65=$$PNEUD(DFN,BGPA65BD,BGPEDATE)
 .I BGPAGEB>64 I $P(BGPPNA65,U,3)=1!($P(BGPPNA65,U,3)=3) S BGPN37=1 ;HAD PNEUMO AFTER 65TH DOB UPTODATE
 .S (BGPPNEU,BGPPLPNU)=$$PNEUD(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE) ;set to date of PNEU shot EVER
 .I $P(BGPPNEU,U,3)=1!($P(BGPPNEU,U,3)=3) S BGPN23=1 ; ALL USERS HAD 1 EVER - 
 .I $P(BGPPNEU,U,3)=3 S BGPN24=1  ;NMI
 .S BGPPNEUD=$$PNEUD(DFN,$$FMADD^XLFDT(BGPEDATE,-(5*365)),BGPEDATE)
 .I $P(BGPPNEUD,U,3)=1!($P(BGPPNEUD,U,3)=3) S BGPN25=1,BGPN37=1  ;HAD IN PAST 5 YEARS SO "UP TO DATE"
 .I $P(BGPPNEUD,U,3)=3 S BGPN26=1  ;NMI PAST 5 YRS
 .S BGPN27=0,BGPA65="" I BGPAGEB>64 S BGPA65=$$PNEUD(DFN,BGPA65BD,BGPEDATE) I $P(BGPA65,U,3)=1!($P(BGPA65,U,3)=3) S BGPN25=1,BGPN27=1 ;over 65 and had one after 65
 .I BGPAGEB<65,BGPN23 S BGPN25=1,BGPN37=1  ;anyone under and had 1 ever  ;BGPN4 IS UP TO DATE
 .I 'BGPN37 S (BGPPNCON,BGPPLPNU)=$$PNEUCONJ(DFN,BGPBDATE,BGPEDATE) I $P(BGPPNCON,U,3)=1!($P(BGPPNCON,U,3)=3) S BGPN36=1,BGPN37=1
 ;GPRA DEV
 S BGPN28=0
 I BGPAGEB<65,BGPN23 S BGPN28=1  ;GPRA DEV UP TO DATE
 I BGPAGEB>64,BGPN23,(BGPN25+BGPN27) S BGPN28=1  ;IF UNDER 66 HAD 1 EVER, IF OVER 65 HAD ONE IN PAST 5 YEARS OR AFTER AGE 65
 ;I BGPAGEB>65,BGPN23,(BGPN25+BGPN27+BGPN36) S BGPN37=1  ;IF UNDER 66 HAD 1 EVER, IF OVER 65 HAD ONE IN PAST 5 YEARS OR AFTER AGE 65
 S BGPDV=""
 I BGPRTYPE=1 S BGPDV="" D
 .I BGPD1 S BGPDV=BGPDV_$S(BGPDV]"":",AC",1:"AC")
 .I BGPD2 S BGPDV=BGPDV_$S(BGPDV]"":",AD",1:"AD")
 .I BGPN1 S BGPVALH=BGPVALUE,BGPVALUE=BGPDV_"|||" I BGPVALH]"" S BGPVALUE=BGPVALUE_"Pneumo: "_$$DATE^BGP5UTL($P(BGPVALH,U,1))_" "_$P(BGPVALH,U,2)_$S(BGPVALH]"":" (ever)",1:"")_" "_$S(BGPN8:" (up-to-date)",1:"") Q
 .S BGPVALUE=BGPDV_"|||"
 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")
 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")
 D
 .I BGPRTYPE'=1 S BGPVALH=BGPVALUE,BGPVALUE=BGPDV_"|||" I BGPVALH]"" S BGPVALUE=BGPVALUE_"Pneumo: "_$$DATE^BGP5UTL($P(BGPVALH,U,1))_" "_$P(BGPVALH,U,2)_$S(BGPVALH]"":" (ever)",1:"")_" "_$S(BGPN8:" (up-to-date)",1:"")
 .S BGPVALUD="AC"_"|||"
 .I BGPN23!(BGPN37) S BGPVALUD=BGPVALUD_"Pneumo: "_$$DATE^BGP5UTL($P(BGPPLPNU,U,1))_" "_$P(BGPPLPNU,U,2)_$S(BGPPLPNU]"":" (ever)",1:"")_" "
 .I BGPN28!(BGPN37&('BGPN36)) S BGPVALUD=BGPVALUD_"(up-to-date)" ;_$S((BGPN28!(BGPN37)),'BGPN36:"(up-to-date)",1:"")
TD ;new tdap and td stuff for v11.1
 S BGPTDAP=$$DTAP^BGP5D3A(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPTDAP S BGPN9=1
 I $P(BGPTDAP,U,1)=2 S BGPN12=1
 S BGPTD=$$DTAPTD^BGP5D3A(DFN,$$FMADD^XLFDT(BGPEDATE,-(10*365)),BGPEDATE)
 I BGPTD S BGPN10=1
 I $P(BGPTD,U,1)=2 S BGPN11=1
 I BGPRTYPE=5 G TDE
 ;FLU - 14.1
 S BGPFLU=$$FLU^BGP5D3(DFN,,BGPEDATE)
 I $P(BGPFLU,U,3)=1!($P(BGPFLU,U,3)=3) S BGPN13=1
 I $P(BGPFLU,U,3)=3 S BGPN14=1
 I BGPN9,BGPN10,BGPN13 S BGPN15=1
 I BGPN9,BGPN10 S BGPN30=1  ;TD 10 YRS/TDAP EVER
 I BGPN11!(BGPN12)!(BGPN14) S BGPN16=1
 I BGPN11!(BGPN12) S BGPN31=1 ;1:1 CONTRA
 S BGPZOST=$$IZOSTER(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I $P(BGPZOST,U,3)=1!($P(BGPZOST,U,3)=3) S BGPN17=1
 I $P(BGPZOST,U,3)=3 S BGPN18=1
 I BGPN9,BGPN10,BGPN13,BGPN17 S BGPN19=1
 I BGPN9,BGPN10,BGPN17 S BGPN32=1  ;1:1:1: TD/TDAP/ZOSTER
 I BGPN11!(BGPN12)!(BGPN14)!(BGPN18) S BGPN20=1
 I BGPN11!(BGPN12)!(BGPN18) S BGPN33=1  ;1:1:1 TD/TDAP/ZOSTER CONTRA
 I BGPN9,BGPN10,BGPN13,BGPN17,BGPN8 S BGPN21=1
 I BGPN9,BGPN10,BGPN17,BGPN8 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,BGPN28 S BGPN29=1
 I BGPN9,BGPN10,BGPN17,BGPN37 S BGPN38=1
 I BGPTDAP S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:""),BGPVALUE=BGPVALUE_"TDAP: "_$P(BGPTDAP,U,2)_" (ever)"
 I BGPTD S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:""),BGPVALUE=BGPVALUE_"TDAP/TD: "_$P(BGPTD,U,2)_" (past 10 yrs)"
 I BGPFLU S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:""),BGPVALUE=BGPVALUE_"FLU: "_$P(BGPFLU,U,2)_" (past yr)"
 I BGPZOST S BGPVALUE=BGPVALUE_$S($P(BGPVALUE,"|||",2)]"":"; ",1:""),BGPVALUE=BGPVALUE_"ZOSTER: "_$P(BGPZOST,U,2)_" (ever)"
 I BGPTDAP S BGPVALUD=BGPVALUD_$S($P(BGPVALUD,"|||",2)]"":"; ",1:""),BGPVALUD=BGPVALUD_"TDAP: "_$P(BGPTDAP,U,2)_" (ever)"
 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)"
 I BGPZOST S BGPVALUD=BGPVALUD_$S($P(BGPVALUD,"|||",2)]"":"; ",1:""),BGPVALUD=BGPVALUD_"ZOSTER: "_$P(BGPZOST,U,2)_" (ever)"
TDE K BGPLPNU,BGPVAL,BGPA65,BGPVALH,BGPTD,BGPTDAP,BGPFLU
 Q
IZOSTER(P,BDATE,EDATE,FORE) ;EP
 NEW BGPLPNU,BGPG,X,E,R,BD,ED,G,%
 S BGPLPNU=""
 S BD=BDATE
 S ED=EDATE
 S EDATE=$$FMTE^XLFDT(EDATE)
 S BDATE=$$FMTE^XLFDT(BDATE)
 S X=P_"^LAST IMM 121;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 121"
 S %=$$CPT^BGP5DU(P,BD,ED,$O(^ATXAX("B","BGP ZOSTER IZ CPTS",0)),5)
 I $P(BGPLPNU,U,1)<$P(%,U,1) S BGPLPNU=$P(%,U,1)_U_"CPT "_$P(%,U,2)
 S %=$$TRAN^BGP5DU(P,BD,ED,$O(^ATXAX("B","BGP ZOSTER IZ CPTS",0)),5)
 I $P(BGPLPNU,U,1)<$P(%,U,1) S BGPLPNU=$P(%,U,1)_U_"CPT "_$P(%,U,2)
 I BGPLPNU]"" Q BGPLPNU_U_1
 ;NOW CHECK FOR CONTRAINDICATION (NEW IN 8.0)
 F BGPZ=121 S X=$$ANIMCONT^BGP5D31(P,BGPZ,ED)
 I X]"" Q X_U_3
 ;NMI Refusal
 S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",121,0)),$$DOB^AUPNPAT(P),ED)
 I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 S R=$$CPTREFT^BGP5UTL1(P,$$DOB^AUPNPAT(P),ED,$O(^ATXAX("B","BGP ZOSTER IZ CPTS",0)),"N")
 I R Q $P(R,U,2)_U_"NMI Refusal "_$P(R,U,4)_U_3
 Q ""
 ;
PNEUD(P,BDATE,EDATE,FORE) ;EP
 K BGPG
 S BGPLPNU=""
 S BD=BDATE
 S ED=EDATE
 S EDATE=$$FMTE^XLFDT(EDATE)
 S BDATE=$$FMTE^XLFDT(BDATE)
 S X=P_"^LAST IMM "_$S($$BI^BGP5D31:33,1:19)_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)) S BGPLPNU=$P(BGPG(1),U)_U_"Imm 33"
 ;S X=P_"^LAST IMM 100;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 ;I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 100"
 S X=P_"^LAST IMM 109;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 109"
 ;S X=P_"^LAST IMM 133;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 ;I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 133"
 ;S X=P_"^LAST IMM 152;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 ;I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 152"
 K BGPG S %=P_"^LAST DX V03.82;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"POV "_$P(BGPG(1),U,2)
 S %=$$CPT^BGP5DU(P,BD,ED,$O(^ATXAX("B","BGP PNEUMO IZ CPT DEV",0)),5)
 I $P(BGPLPNU,U,1)<$P(%,U,1) S BGPLPNU=$P(%,U,1)_U_"CPT "_$P(%,U,2)
 S %=$$TRAN^BGP5DU(P,BD,ED,$O(^ATXAX("B","BGP PNEUMO IZ CPT DEV",0)),5)
 I $P(BGPLPNU,U,1)<$P(%,U,1) S BGPLPNU=$P(%,U,1)_U_"CPT "_$P(%,U,2)
 I BGPLPNU]"" Q BGPLPNU_U_1
 ;NOW CHECK FOR CONTRAINDICATION (NEW IN 8.0)
 F BGPZ=33,109 S X=$$ANCONT^BGP5D31(P,BGPZ,ED) Q:X]""
 I X]"" Q X_U_3
 ;NMI Refusal
 S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",33,0)),$$DOB^AUPNPAT(P),ED)
 I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 ;S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",100,0)),$$DOB^AUPNPAT(P),ED)
 ;I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",109,0)),$$DOB^AUPNPAT(P),ED)
 I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 ;S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",133,0)),$$DOB^AUPNPAT(P),ED)
 ;I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 S R=$$CPTREFT^BGP5UTL1(P,$$DOB^AUPNPAT(P),ED,$O(^ATXAX("B","BGP PNEUMO IZ CPT DEV",0)),"N")
 I R Q $P(R,U,2)_U_"NMI Refusal "_$P(R,U,4)_U_3
 Q ""
 ;
PNEUCONJ(P,BDATE,EDATE,FORE) ;EP
 K BGPG
 S BGPLPNU=""
 S BD=BDATE
 S ED=EDATE
 S EDATE=$$FMTE^XLFDT(EDATE)
 S BDATE=$$FMTE^XLFDT(BDATE)
 S X=P_"^LAST IMM 100;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 100 (conj)"
 S X=P_"^LAST IMM 133;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 133 (conj)"
 S X=P_"^LAST IMM 152;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)),$P(BGPLPNU,U,1)<$P(BGPG(1),U) S BGPLPNU=$P(BGPG(1),U,1)_U_"Imm 152 (conj)"
 S %=$$CPT^BGP5DU(P,BD,ED,$O(^ATXAX("B","BGP PNEUMO CONJUGATE CPTS",0)),5)
 I $P(BGPLPNU,U,1)<$P(%,U,1) S BGPLPNU=$P(%,U,1)_U_"CPT "_$P(%,U,2)_" (conj)"
 S %=$$TRAN^BGP5DU(P,BD,ED,$O(^ATXAX("B","BGP PNEUMO CONJUGATE CPTS",0)),5)
 I $P(BGPLPNU,U,1)<$P(%,U,1) S BGPLPNU=$P(%,U,1)_U_"CPT "_$P(%,U,2)_" (conj)"
 I BGPLPNU]"" Q BGPLPNU_U_1
 ;NOW CHECK FOR CONTRAINDICATION (NEW IN 8.0)
 F BGPZ=100,133,152 S X=$$ANCONT^BGP5D31(P,BGPZ,ED) Q:X]""
 I X]"" Q X_U_3
 ;NMI Refusal
 S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",100,0)),$$DOB^AUPNPAT(P),ED)
 I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",133,0)),$$DOB^AUPNPAT(P),ED)
 I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 S G=$$NMIREF^BGP5UTL1(P,9999999.14,$O(^AUTTIMM("C",152,0)),$$DOB^AUPNPAT(P),ED)
 I $P(G,U)=1 Q $P(G,U,2)_U_"NMI Refusal"_U_3
 S R=$$CPTREFT^BGP5UTL1(P,$$DOB^AUPNPAT(P),ED,$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 ""
OPTOM ;
 S (BGPD1,BGPN1)=0
 I 'BGPACTCL S BGPSTOP=1 Q  ;must be active clinical
 I BGPAGEB<18 S BGPSTOP=1 Q  ;18 and older only
 I '$$GLAUCOMA(DFN,BGPBDATE,BGPEDATE) S BGPSTOP=1 Q  ;MUST HAVE HAD GLAUCOMA DX EVER BEFORE END OF TIME PERIOD
 S BGPD1=1
 S %=$$CPT^BGP5DU(DFN,BGPBDATE,BGPEDATE,$O(^ATXAX("B","BGP OPTIC NERVE HEAD EVAL CPT",0)),6)
 ;S %="",E=+$$CODEN^ICPTCOD("2027F"),%=$$CPTI^BGP5DU(DFN,BGPBDATE,BGPEDATE,E)
 I % S BGPN1=1
 S BGPVALUE="AC|||"_$$DATE^BGP5UTL($P(%,U,2))_" "_$P(%,U,3)
 Q
GLAUCOMA(P,BDATE,EDATE) ;EP
 Q $$LASTDX^BGP5UTL1(P,"BGP OPEN ANGLE GLAUCOMA DXS",BDATE,EDATE)