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

BGP8PC5.m

Go to the documentation of this file.
BGP8PC5 ; IHS/CMI/LAB - measure I2 ; 02 Feb 2018  11:25 AM
 ;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
 ;
AIZ ;EP
 I 'BGPIPCUP S BGPSTOP=1 Q  ;must be ipc up
 I BGPAGEB<19 S BGPSTOP=1 Q  ;must be 19 or older
 ;
 S (BGP1959,BGP6064,BGP65,BGPD1,BGPN1,BGPTDAP,BGPTD,BGPTDCOM,BGPZOST,BGPZOC,BGPN46,BGPN47,BGPN48,BGPPNCON,BGPPPSEV,BGPPCVEV,BGPPP65,BGPPC65,BGPPP5Y,BGPPC5Y,BGPPC1Y,BGPPC19,BGPPP1Y,BGPPPCON,BGPPCCON)=0
 S BGPD1=1
 S BGPVALUE=""
 I BGPAGEB>64 S BGP65=1
 I BGPAGEB>18,BGPAGEB<60 S BGP1959=1
 I BGPAGEB>59,BGPAGEB<65 S BGP6064=1
 ;
 ;AGE 19-59 FIRST
 S BGPTDAP=$$DTAP^BGP8D3A(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 S BGPTD=$$DTAPTD^BGP8D3A(DFN,$$FMADD^XLFDT(BGPEDATE,-(10*365)),BGPEDATE)
 I BGPTD,BGPTDAP S BGPTDCOM=1                                                         ;026.N.1 1 Tdap/Td in past 10 years  BGPN10
 I BGPTDCOM,BGP1959 S BGPN1=1 G SV
 I BGP1959 G SV
 ;age 60-64 add in zoster
 S BGPZOST=$$IZOSTER^BGP8D3C(DFN,$$DOB^AUPNPAT(DFN),BGPEDATE)
 I $P(BGPZOST,U,3)=1!($P(BGPZOST,U,3)=3) S BGPZOC=1
 I BGP6064,BGPZOC,BGPTD,BGPTDAP S BGPN1=1 G SV
 I BGP6064 G SV
 ;AGE 65+
 ;I BGPAGEB<65 G N1
 S BGPPPCON=$$PPCONT^BGP8D3B(DFN,BGPEDATE) ;I BGPPPCON S (BGPPPSEV,BGPPP5Y,BGPPP1Y,BGPPP65)=BGPPPCON G N1  ;did they have a contraindication
 S BGPPCCON=$$PCCONT^BGP8D3B(DFN,BGPEDATE) ;I BGPPCCON S (BGPPCVEV,BGPPC5Y,BGPPC1Y,BGPPC19)=BGPPCCON G N1  ;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)
N1 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 BGPPPCON!(BGPPCCON) S BGPN46=1
 I BGPN47,BGPN48 S BGPN46=1  ;UP TO DATE
 I BGPN46,BGPZOC,BGPTDAP,BGPTD S BGPN1=1
 ;
SV ;
 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 BGPZOST S BGPVALUE=BGPVALUE_$S(BGPVALUE]"":"; ",1:""),BGPVALUE=BGPVALUE_"ZOSTER: "_$P(BGPZOST,U,2)_" (ever)"
 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="IPCUP|||"_$S(BGPN1:"*** ",1:"")_BGPVALUE
 ;I BGPN1 S BGPVALUE=$BGPVALUE_" **"
 K BGP1959,BGPPNEU,BGP6064,BGP65,BGPTDAP,BGPA19BD,BGPA65BD,BGPTD,BGPZOST,BGPZOC,BGPN46,BGPN47,BGPN48,BGPTDCOM,BGPPNCON,BGPPPSEV,BGPPCVEV,BGPPP65,BGPPC65,BGPPP5Y,BGPPC5Y,BGPPC1Y,BGPPC19,BGPPP1Y,BGPPPCON,BGPPCCON
 Q