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

BGP8DPA2.m

Go to the documentation of this file.
BGP8DPA2 ;IHS/CMI/LAB - FORECAST;
 ;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
 ;
I017 ;EP - colorectal cancer
 ;
 K BGPFOB,BGPSIG,BGPBE,BGPCOLO,BGPIN,BGPIN1,BGPIN2,BGPIN3
 I BGPAGEB<50 S BGPSKIP=1 Q
 I BGPAGEB>75 S BGPSKIP=1 Q
 I $$CRC^BGP8D62(DFN,BGPEDATE) S BGPSKIP=1 Q
 I 'BGPACTUP S BGPSKIP=1 Q
 S (BGPIN,BGPIN1,BGPIN2,BGPIN3)=""
 S BGPLAST=""
 S BGPFOB=$$FOB^BGP8D62(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)  ;last FOB test
 S D=$P(BGPFOB,U,2)
 I D]"",$$FMDIFF^XLFDT(DT,D)<365 S BGPIN=1
 I D>BGPLAST S BGPLAST=D
 S BGPSIG=$$SIG^BGP8D62(DFN,BGPEDATE,$$DOB^AUPNPAT(DFN))  ;last SIG test
 S D=$P(BGPSIG,U,3)
 I D]"",$$FMDIFF^XLFDT(DT,D)<365 S BGPIN1=1
 I D>BGPLAST S BGPLAST=D
 S BGPCOLO=$$COLO^BGP8D62(DFN,BGPEDATE,$$DOB^AUPNPAT(DFN))  ;last COLO test
 ;S D=$P(BGPCOLO,U,3),BGPNCOLO=$S($P(BGPCOLO,U,3):$$FMADD^XLFDT(D,(10*365)),1:BGPBDATE) I BGPNCOLO'>BGPED S BGPIN2=1
 ;I D>BGPLAST S BGPLAST=D_U_BGPNCOLO
 S D=$P(BGPCOLO,U,3)
 I D]"",$$FMDIFF^XLFDT(DT,D)<365 S BGPIN2=1
 I D>BGPLAST S BGPLAST=D
 I BGPLAST]"",(BGPIN!(BGPIN1)!(BGPIN2)!(BGPIN3)) S BGPSKIP=1 Q  ;met at least one of above
 S BGPN1=0
 S BGPISSV=$$TITLE(BGPGPRAI)
 S BGPX=""
 I BGPCOLO]"" S BGPX="Last Colonoscopy: "_$P(BGPCOLO,U,2)
 I BGPSIG]"" S BGPX=BGPX_$S(BGPX]"":"|",1:"") S BGPX=BGPX_"Last Flex Sig: "_$P(BGPSIG,U,2)
 ;
 I BGPFOB]"" S BGPX=BGPX_$S(BGPX]"":"|",1:"") S BGPX=BGPX_"Last FOB: "_$$DATE^BGP8UTL($P(BGPFOB,U,2))
 I BGPX="" S BGPX="No Colonoscopy, Flex Sig, FOBT or DCBE documented."
 S BGPX=BGPX_"|May be overdue as of: "_$S(BGPLAST]"":$$DATE^BGP8UTL($$FMADD^XLFDT(BGPLAST,365)),1:$$DATE^BGP8UTL(BGPBD))
 S BGPISSV=BGPISSV_U_BGPX
 K BGPREF,BGPOTH,BGPN1,BGPFOB,BGPNFOB,BGPBE,BGPF,BGPBE,BGPNBE,BGPSIG,BGPNSIG,BGPCOLO,BGPNCOLO,BGPIN,BGPIN1,BGPIN2,BGPIN3
 Q
 ;
I019 ;EP - tobacco cessation
 S BGPINFO=1  ;IN FORECASTER
 D I91^BGP8D71
 K BGPINFO
 I 'BGPTU S BGPSKIP=1 G I019X  ;not a tobacco user
 I BGPQ S BGPSKIP=1 G I019X  ;quit, nothing needed
 I $P(BGPTC1,U,1)]"" S BGPSKIP=1 G I019X  ;had educ so don't display
 S BGPTC1=$$PED^BGP8D711(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,1)
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Intervention: "_$S(BGPTC1="":"<Never>",1:$$DATE^BGP8UTL($P(BGPTC1,U,1))_"|Overdue as of: "_$$DATE^BGP8UTL(BGPBDATE))
I019X ;
 K BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPD1,BGPD2,BGPD3,BGPD4,BGPD5,BGPD6,BGPD7,BGPD8,BGPD9
 K BGPTOB,BGPSDX,BGP1320,BGPTC,BGPTQ,BPGNTS,BGPN,BGPT,BGPIN1,BGPIN
 K BGPQ,X,Y,Z,%,A,B,C,D,E,H,BDATE,EDATE,P,V,S,F,T,BGPQ,BGPALLED,BGPTQ,BGPTC
 K BGPTC1,BGPTOB,BGPSDX,BGP1320,BGPTOM,BGPTOBS,BGPTUHF,BGPTU,BGPTUC,BGPTUQ,BGPTOBD,BGPREM
 Q
I020 ;EP - Alcohol Screening
 I 'BGPACTUP S BGPSKIP=1 Q
 ;I BGPSEX'="F" S BGPSKIP=1 Q
 I BGPAGEB<9 S BGPSKIP=1 Q
 I BGPAGEB>75 S BGPSKIP=1 Q
 S (BGPD,BGPN,BGPN1,BGPREF,BGPNS,BGPV)=""
 K BGPALL
 D ALSCRN^BGP8D55(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,.BGPALL)
 I $D(BGPALL) S BGPN1=1 S D=$O(BGPALL(0)),C=$O(BGPALL(D,0)) S BGPD=9999999-D,BGPV=$P(BGPALL(D,C),U,2)
 ;S BGPN1=$$ALHF^BGP8D5(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 ;S BGPD=$P(BGPN1,U,4),BGPV=$P(BGPN1,U,2)
 S BGPN1=$$ALDX^BGP8D5A(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPD<$P(BGPN1,U,4) S BGPD=$P(BGPN1,U,4),BGPV=$P(BGPN1,U,2)
 S BGPN1=$$ALPED^BGP8D5(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPD<$P(BGPN1,U,4) S BGPD=$P(BGPN1,U,4),BGPV=$P(BGPN1,U,2)
 S BGPNS=$S(BGPD:$$FMADD^XLFDT(BGPD,365),1:"")
 I BGPD="" S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Alcohol Screen: Never|Overdue as of: "_$$DATE^BGP8UTL(BGPBD) D I020X Q
 I BGPNS>BGPED S BGPSKIP=1 Q  ;not due
 S BGPISSV=$$TITLE(BGPGPRAI)
 I BGPV]"" S $P(BGPISSV,U,2)="Last Alcohol Screen: "_$$DATE^BGP8UTL(BGPD)
 I BGPV="" S $P(BGPISSV,U,2)="Alcohol Screening not documented",$P(BGPISSV,U,3)="Alcohol Screening Overdue" D I020X Q
 I BGPREF]"" S $P(BGPISSV,U,2)=$P(BGPISSV,U,2)_"|"_$S(BGPREF]"":"Patient Refused Alcohol Screening on "_$P(BGPREF,U,3),1:"")
 S $P(BGPISSV,U,2)=$P(BGPISSV,U,2)_"|"_$S(BGPNS'>BGPED:"Alcohol Screening Overdue as of: ",1:"Alcohol Screening next due: ")_$$DATE^BGP8UTL(BGPNS)
I020X ;
 K BGPD,BGPN,BGPN1,BGPREF,BGPNS
 Q
IAA ;EP
 I BGPAGEB<12 S BGPSKIP=1 Q
 I BGPAGEB>17 S BGPSKIP=1 Q
 S (BGPD,BGPN,BGPN1,BGPREF,BGPNS)=""
 S BGPN1=$$DEP^BGP8D25(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPN1 NEW X S X=$P(BGPN1,U,4) S BGPD=X,BGPV="2 Mood Disorder DXs "
 S BGPN1=$$DEPSCR^BGP8D25(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPN1,BGPD<$P(BGPN1,U,4) S BGPD=$P(BGPN1,U,4),BGPV=$P(BGPN1,U,2)
 S BGPN1=$$DEPEDU^BGP8D25(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPN1,BGPD<$P(BGPN1,U,4) S BGPD=$P(BGPN1,U,4),BGPV=$P(BGPN1,U,2)
 I BGPD="" S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Depression Screen: Never|Overdue as of: "_$$DATE^BGP8UTL(BGPBD) D IAAX Q
 S BGPNS=$S(BGPD:$$FMADD^XLFDT(BGPD,365),1:"")
 I BGPNS>BGPED S BGPSKIP=1 D IAAX Q
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Depression Screen: "_$$DATE^BGP8UTL(BGPD)_"|Overdue as of: "_$$DATE^BGP8UTL(BGPNS)
 ;
IAAX ;
 K BGPD,BGPN,BGPN1,BGPREF,BGPNS
 Q
I014 ;EP
 I BGPAGEB<2 S BGPSKIP=1 Q
 I BGPAGEB>15 S BGPSKIP=1 Q
 S BGPLDS=$$SEAL(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE) ;I 'BGPLDS S BGPSKIP=1 Q  ;never had a sealant
 S D=$P($$DENTSRV^BGP8D21(DFN,$$DOB^AUPNPAT(DFN),BGPED,1),U,2)
 ;S D=$P($$DENTSRV(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE),U,1)
 S BGPS=""
 I D]"",$$FMDIFF^XLFDT(BGPEDATE,D)<180 S BGPSKIP=1 Q  ;dental exam less than 6 months ago
 I D]"",$$FMDIFF^XLFDT(BGPEDATE,D)>180 S BGPS="May be overdue:  Patient is overdue for dental|exam and assessment for additional sealants.|Refer to Dental Program."
 I D="" S BGPS="May be overdue:  Patient is overdue for dental|exam and assessment for additional sealants.|Refer to Dental Program."
 I 'BGPLDS S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Dental Sealant: Never"_"|"_BGPS Q
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Dental Sealant: "_$$DATE^BGP8UTL(BGPLDS)_"|"_BGPS
 Q
SEAL(P,BDATE,EDATE) ;
 NEW A,%,X,Y,BGPC,BGPG,BGPX,G,T,S,V,LAST
 K BGPG,BGPX
 K ^TMP($J,"A")
 S A="^TMP($J,""A"","
 S BGPC=0,LAST=""
 S %=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,A)
 S X=0,Y=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X  S V=$P(^TMP($J,"A",X),U,5) D
 .S Y=0,G=0 F  S Y=$O(^AUPNVDEN("AD",V,Y)) Q:Y'=+Y  D
 ..S A=$P($G(^AUPNVDEN(Y,0)),U) I A S A=$P($G(^AUTTADA(A,0)),U) D
 ...I A'=1351,A'=1352,A'=1353 Q
 ...S G=1
 ...S T=$P($G(^AUPNVDEN(Y,0)),U,4) S:T=""!(T=0) T=1
 ...S S=$P(^AUPNVDEN(Y,0),U,5)
 ...I S]"" S BGPX(S)=$G(BGPX(S))+T
 ...I S="" S BGPX("NO OS")=$G(BGPX("NO OS"))+T
 ...S LAST=$P(^TMP($J,"A",X),U,1)
 ...Q
 .Q:G  ;had ADA codes so skip cpts
 .S Y=0,G=0 F  S Y=$O(^AUPNVCPT("AD",V,Y)) Q:Y'=+Y  D
 ..S A=$P($G(^AUPNVCPT(Y,0)),U)
 ..Q:'A
 ..S A=$P($$CPT^ICPTCOD(A),U,2) I A="D1351"!(A="D1352")!(A="D1353") D
 ...S T=$P($G(^AUPNVCPT(Y,0)),U,16) S:T=""!(T=0) T=1
 ...S BGPX("CPT")=$G(BGPX("CPT"))+T
 ...S LAST=$P(^TMP($J,"A",X),U,1)
 S X="" F  S X=$O(BGPX(X)) Q:X=""  I X'="CPT" S BGPC=BGPC+$S(BGPX(X)>2:2,1:BGPX(X))
 S BGPC=BGPC+$G(BGPX("CPT"))
 Q LAST
DENTSRV(P,BDATE,EDATE) ;EP
 K BGPG
 S BGPC="",%=P_"^LAST ADA 0000;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) S BGPC=$P(BGPG(1),U)_"^"_"ADA "_$P(BGPG(1),U,2)
 K BGPG
 S %=P_"^LAST ADA 0190;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)),$P(BGPG(1),U)>$P(BGPC,U) S BGPC=$P(BGPG(1),U)_"^"_"ADA "_$P(BGPG(1),U,2)
 K BGPG S %=P_"^LAST EXAM DENTAL;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)),$P(BGPG(1),U)>$P(BGPC,U) S BGPC=$P(BGPG(1),U)_"^"_$P(BGPG(1),U,3)
 K BGPG
 S BGPG=$$LASTDX^BGP8UTL1(P,"BGP DENTAL EXAM DXS",BDATE,EDATE)
 I BGPG,$P(BGPG,U,3)>$P(BGPC,U,1) S BGPC=$P(BGPG,U,3)_"^"_$P(BGPG,U,2)
 K BGPG S G="" S %=P_"^ALL ADA;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG) D  I G]"" Q G
 .S X=0 F  S X=$O(BGPG(X)) Q:X'=+X!(G]"")  S V=$P(BGPG(X),U,5) D
 ..I $P($G(^AUPNVSIT(V,0)),U,3)="C",$$VD^APCLV(V)>$P(BGPC,U,1) S BGPC=$P(BGPG(X),U)_"^CHS VISIT ADA "_$P(BGPG(X),U,2)
 Q BGPC
 ;
I016 ;EP
 I BGPAGEB<1 S BGPSKIP=1 Q
 I BGPAGEB>15 S BGPSKIP=1 Q
 S BGPLDS=$$TF(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE) ;I 'BGPLDS S BGPSKIP=1 Q  ;never had a TF
 S BGPS=""
 I BGPLDS]"",BGPLDS'<BGPBDATE S BGPSKIP=1 Q  ;fluoride during report period
 I BGPLDS]"",BGPLDS<BGPBDATE S BGPS="May be overdue:  Apply topical fluoride or refer|to Dental Program for assessment."
 I BGPLDS="" S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Topical Fluoride: Never|May be overdue:  Apply topical fluoride or refer|to Dental Program for assessment." Q
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Topical Fluoride: "_$$DATE^BGP8UTL(BGPLDS)_"|"_BGPS
 Q
TF(P,BDATE,EDATE) ;
 NEW T,A,%,X,Y,T,Z,G,BGPZ,BGPJ,R,BJPC
 K BGPG,BGPZ S BGPC=""
 K ^TMP($J,"A")
 S A="^TMP($J,""A"","
 S Z=$O(^ATXAX("B","BGP TOPICAL FLUORIDE ADA CODES",0))
 S %=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,A)
 ;reorder by visit date
 S X=0,Y=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X  S V=$P(^TMP($J,"A",X),U,5) D
 .S Y=0,G=0 F  S Y=$O(^AUPNVDEN("AD",V,Y)) Q:Y'=+Y  D
 ..S A=$P($G(^AUPNVDEN(Y,0)),U) D
 ...I $D(^ATXAX(Z,21,"B",A)) S T=$P($G(^AUPNVDEN(Y,0)),U,4) S:T=""!(T=0) T=1 I $$VD^APCLV(V)>BGPC S BGPC=$$VD^APCLV(V)
 ...Q
 .Q:G
 .S Y=0,G=0 F  S Y=$O(^AUPNVCPT("AD",V,Y)) Q:Y'=+Y  D
 ..S A=$P($G(^AUPNVCPT(Y,0)),U)
 ..Q:'A
 ..I $$ICD^BGP8UTL2(A,$O(^ATXAX("B","BGP CPT TOPICAL FLUORIDE",0)),1) S T=$P($G(^AUPNVCPT(Y,0)),U,16) S:T=""!(T=0) T=1 I $$VD^APCLV(V)>BGPC S BGPC=$$VD^APCLV(V)
 .Q:G  ;one per visit
 .S Y=0,G=0 F  S Y=$O(^AUPNVPOV("AD",V,Y)) Q:Y'=+Y  D
 ..S A=$P($G(^AUPNVPOV(Y,0)),U) I A S A=$P($$ICDDX^BGP8UTL2(A),U,2) D
 ...I A="V07.31" I $$VD^APCLV(V)>BGPC S BGPC=$$VD^APCLV(V)
 ...Q
 Q BGPC
I021 ;EP
 I 'BGPACTUP S BGPSKIP=1 Q
 I BGPSEX'="F" S BGPSKIP=1 Q
 I BGPAGEB<13 S BGPSKIP=1 Q
 I BGPAGEB>46 S BGPSKIP=1 Q
 S (BGPD,BGPN,BGPN1,BGPREF,BGPNS,BGPVA)=""
 S BGPN1=$$DVEX^BGP8D5(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 S BGPD=$P(BGPN1,U,2),BGPVA=$P(BGPN1,U,3)
 S BGPN1=$$DVDX^BGP8D5(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPD<$P(BGPN1,U,2) S BGPD=$P(BGPN1,U,2),BGPVA=$P(BGPN1,U,3)
 S BGPN1=$$DVPED^BGP8D5(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I BGPD<$P(BGPN1,U,2) S BGPD=$P(BGPN1,U,2),BGPVA=$P(BGPN1,U,3)
 S BGPNS=$S(BGPD:$$FMADD^XLFDT(BGPD,365),1:"")
 I BGPNS="" S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last DV Screen: Never|Overdue as of: "_$$DATE^BGP8UTL(BGPBD) D I021X Q
 I BGPNS>BGPED S BGPSKIP=1 D I021X Q
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last DV Screen: "_$$DATE^BGP8UTL(BGPD)_"|Overdue as of: "_$$DATE^BGP8UTL(BGPNS)
I021X ;
 K BGPD,BGPN,BGPN1,BGPREF,BGPNS
 Q
IE2 ;EP
 K BGPSTOP
 S BGPISSO=1
 D IE2^BGP8D8
 I $D(BGPSTOP) S BGPSKIP=1 Q
 S BGPISSV=""
 I BGPN16 S BGPSKIP=1 Q
 I 'BGPD2 S BGPSKIP=1 Q  ;13-64 WITH NO HIV
 S BGPISSV=BGPISSV_$$TITLE(BGPGPRAI)
 I 'BGPN1 S $P(BGPISSV,U,2)="Overdue as of: "_$$DATE^BGP8UTL(BGPBD)
 K BGPHIV,BGPN1,X,Y,Z,%,A,B,C,D,E,H,BDATE,EDATE,P,V,S,F,T,BGPEDUC,BGPHIV
 K BGPN1,BGPN2,BGPN3,BGPN4,BGPN5,BGPN6,BGPD1,BGPD2,BGPD3,BGPD4,BGPD5,BGPD6,BGPD7,BGPD8,BGPD9
 Q
I031A ;EP
 S BGPSKIP=""
 K BGPSTOP
 I BGPAGEB<2 S BGPSKIP=1 Q
 I BGPAGEB>5 S BGPSKIP=1 Q
 I BGPAGEE>5 S BGPSKIP=1 Q
 ;I 'BGPACTCL S BGPSKIP=1 Q
 S BGPD1=1,BGPN1=0,BGPN2=0,BGPIN1=0
 S BGPBMI=$$BMIOR^BGP8D6(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE,BGPAGEE)
 I $P(BGPBMI,U)="" S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last BMI: Never|Overdue as of: "_$$DATE^BGP8UTL(BGPBD) D I031AX Q
 I $$FMADD^XLFDT($P(BGPBMI,U,2),365)<BGPED S BGPIN1=1
 S BGPOW=$$OW^BGP8D6(DFN,$P(BGPBMI,U),$$AGE^AUPNPAT(DFN,$P(BGPBMI,U,2))) I BGPOW S BGPN1=1
 S BGPOB=$$OB^BGP8D6(DFN,$P(BGPBMI,U),$$AGE^AUPNPAT(DFN,$P(BGPBMI,U,2))) I BGPOB S BGPN2=1
 S A=$$AGE^AUPNPAT(DFN,$P(BGPBMI,U,2))
 I 'BGPIN1,'BGPOB S BGPSKIP=1 D I031AX Q
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last BMI: "_$P(BGPBMI,U)_":"_$$DATE^BGP8UTL($P(BGPBMI,U,2))_" Age at BMI: "_A_$S(BGPOW:" At Risk 85-94%",BGPOB:" OW 95%",1:"")
 I BGPIN1 S BGPISSV=BGPISSV_"|Overdue as of: "_$$DATE^BGP8UTL($$FMADD^XLFDT($P(BGPBMI,U,2),365))
I031AX ; 
 K BGPBMIH,BGPBMI,BGPOW,BGPOB,BGPD1
 Q
TITLE(I) ;EP
 Q $P($G(^BGPINDRC(I,12)),U,9)
BFR ;EP
 S BGPSKIP=""
 K BGPSTOP,BGPBFR
 S BGPADAY=$$FMDIFF^XLFDT(BGPBDATE,$P(^DPT(DFN,0),U,3))  ;LORI CHANGE AFTER TESTING TO DT
 I BGPADAY<45 S BGPSKIP=1 Q
 I BGPADAY>394 S BGPSKIP=1 Q
 D GETIFC(DFN,BGPBDATE,BGPEDATE,.BGPBFR)
 I '$D(BGPBFR) S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Infant Feeding Choice Screening: Never" D BFRX Q   ;|Overdue as of: "_$$DATE^BGP8UTL(DT) D BFRX Q
 ;GET LASTEST (highest days old)
 S X="",Y="" F  S X=$O(BGPBFR(X)) Q:X=""  S Y=X
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Infant Feeding Choice Screening: "_$$DATE^BGP8UTL($P(BGPBFR(Y),U,2))  ;_"|Overdue as of: "_$$DATE^BGP8UTL(DT)
 ;
BFRX ;
 K BGPADAY,BGPBFR
 Q
GETIFC(P,BDATE,EDATE,BGPRET) ;EP
 K BGPRET,BGPG,C,X
 S X=0 F  S X=$O(^AUPNVIF("AC",P,X)) Q:X'=+X  D
 .Q:'$D(^AUPNVIF(X))
 .S V=$P(^AUPNVIF(X,0),U,3),C=$P(^AUPNVIF(X,0),U,1)
 .Q:V=""
 .Q:'$D(^AUPNVSIT(V,0))
 .S V=$P($P(^AUPNVSIT(V,0),U),".")
 .S BGPRET($$FMDIFF^XLFDT(V,$P(^DPT(P,0),U,3)))=C_U_V
 .Q
 Q
MH ;EP
 K BGPSTOP
 NEW BGPBP,BGPN1
 S BGPN1=0
 I BGPAGEE<18 S BGPSKIP=1 Q
 I BGPAGEE>85 S BGPSKIP=1 Q
 I $$ESRD^BGP8D211(DFN,$P(^DPT(DFN,0),U,3),BGPEDATE) S BGPSKIP=1 Q  ;esrd anytime before end date
 S X=$$PREG^BGP8D7(DFN,BGPBDATE,BGPEDATE,1,1,,BGPBDATE,BGPEDATE) I X S BGPSKIP=1 Q  ;V17.1 CMI/LAB ADDED DATES FOR CURRENTLY PREGNANT
 I '$$MHHTN^BGP8D9(DFN,BGPBDATE,BGPEDATE) S BGPSKIP=1 Q  ;no htn per definition
 S BGPBP=$$LASTBP^BGP8D9(DFN,BGPBDATE,BGPEDATE)
 I BGPBP]"" D
 .S X=BGPBP
 .I $P(X,"/",1)<140,$P(X,"/",2)<90 S BGPN1=1
 NEW BGPV,BGPD,BGPND
 S (BGPISSV,BGPIN)=""
 K BGPISSV
 ;
 I BGPBP="" S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Mean BPs: 2 BPs not documented "_$$DATE^BGP8UTL(BGPBD)_"-"_$$DATE^BGP8UTL(BGPED)_"|Overdue as of: "_$$DATE^BGP8UTL(BGPBD) Q
 I BGPN1 S BGPSKIP=1 Q  ;in control BP in report period, do not display
 S BGPISSV=$$TITLE(BGPGPRAI)_U_"Last Mean BPs: "_$P(BGPBP,U)
 I 'BGPN1 S BGPISSV=BGPISSV_" - Not Controlled BP"
 Q