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

BGPD24.m

Go to the documentation of this file.
BGPD24 ; IHS/CMI/LAB - indicator 24 ;
 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
 ;
I24 ;EP ;EP - indicator 24
 S (BGPP,BGPP1)=""
 ;Q:'$D(BGPIND(24))
 I BGPAGEB>64 D
 .D S(BGPRPT,$S(BGPTIME=1:17,BGPTIME=0:47,BGPTIME=8:87,1:999),1,1)
 .S BGPP=$$PNEU(DFN,BGPEDATE) ;pneumovax anytime in lifetime
 .I BGPP]"" D S(BGPRPT,$S(BGPTIME=1:17,BGPTIME=0:47,BGPTIME=8:87,1:999),2,1)
 .;I $D(BGPLIST(24)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",24,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPP
 .S BGPP1=$$FLU(DFN,BGPEDATE)
 .I BGPP1]"" D S(BGPRPT,$S(BGPTIME=1:17,BGPTIME=0:47,BGPTIME=8:87,1:999),3,1)
 .I $D(BGPLIST(24)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",24,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPP_" "_BGPP1
 I $$DM^BGPD1(DFN,BGPEDATE),BGPAGEB>17 D
 .D S(BGPRPT,$S(BGPTIME=1:17,BGPTIME=0:47,BGPTIME=8:87,1:999),5,1)
 .S BGPP=$$PNEU(DFN,BGPEDATE) ;pneumovax anytime in lifetime
 .I BGPP]"" D S(BGPRPT,$S(BGPTIME=1:17,BGPTIME=0:47,BGPTIME=8:87,1:999),6,1)
 .;I $D(BGPLIST(24)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",24,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPP
 .S BGPP1=$$FLU(DFN,BGPEDATE)
 .I BGPP1]"" D S(BGPRPT,$S(BGPTIME=1:17,BGPTIME=0:47,BGPTIME=8:87,1:999),7,1)
 .I $D(BGPLIST(24)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",24,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)="DM "_BGPP_" "_BGPP1
 Q
S(R,N,P,V) ;
 I 'V Q  ;no value to add
 S $P(^BGPD(R,N),U,P)=$P($G(^BGPD(R,N)),U,P)+V
 Q
 ;
FLU(P,ED) ;
 NEW BDATE,EDATE S BDATE=$$FMADD^XLFDT(ED,-365)
 NEW BGPG,X,E
 S EDATE=$$FMTE^XLFDT(ED),BDATE=$$FMTE^XLFDT(BDATE)
 S X=P_"^LAST IMM "_$S($$BI:88,1:12)_";DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)) Q " Flu Vaccine"
 K BGPG S %=P_"^LAST PROCEDURE 99.52;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q " Flu Vaccine"
 K BGPG S %=P_"^LAST DX V04.8;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q " Flu Vaccine"
 K BGPG S %=P_"^LAST DX V06.6;DURING "_BDATE_"-"_EDATE,E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q " Flu Vaccine"
 S T=$O(^ATXAX("B","BGP CPT FLU",0))
 I T D  I X]"" Q " Flu Vaccine"
 .S X=$$CPT^BGPDU(P,,ED,T,4)
 Q ""
PNEU(P,EDATE) ;
 NEW BGPG,X,E
 S EDATE=$$FMTE^XLFDT(EDATE)
 S X=P_"^LAST IMM "_$S($$BI:33,1:19)_";DURING "_$$FMTE^XLFDT($$DOB^AUPNPAT(P))_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)) Q "Pneumovax"
 Q ""
BI() ;
 Q $S($O(^AUTTIMM(0))>100:1,1:0)
 ;