BGPD31 ; IHS/CMI/LAB - indicator 31 ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
I31 ;EP ;EP - indicator 31
;Q:'$D(BGPIND(29))
S BGPP=$$HIV(DFN,BGPEDATE)
I BGPP D S(BGPRPT,$S(BGPTIME=1:19,BGPTIME=0:49,BGPTIME=8:89,1:999),10,1)
;I $D(BGPLIST(29)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",29,$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
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
;
HIV(P,EDATE) ;is patient hiv
I $G(P)="" Q ""
;check povs
NEW X,E,BGPG,Y
K BGPG
S Y="BGPG("
S X=P_"^LAST DX [BGP HIV/AIDS DXS;DURING "_$$FMTE^XLFDT($P(^DPT(P,0),U,3))_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
I $D(BGPG(1)) Q 1 ;has a dx
Q 0
;
BGPD31 ; IHS/CMI/LAB - indicator 31 ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+2 ;
I31 ;EP ;EP - indicator 31
+1 ;Q:'$D(BGPIND(29))
+2 SET BGPP=$$HIV(DFN,BGPEDATE)
+3 IF BGPP
DO S(BGPRPT,$SELECT(BGPTIME=1:19,BGPTIME=0:49,BGPTIME=8:89,1:999),10,1)
+4 ;I $D(BGPLIST(29)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",29,$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
+5 QUIT
S(R,N,P,V) ;
+1 ;no value to add
IF 'V
QUIT
+2 SET $PIECE(^BGPD(R,N),U,P)=$PIECE($GET(^BGPD(R,N)),U,P)+V
+3 QUIT
+4 ;
HIV(P,EDATE) ;is patient hiv
+1 IF $GET(P)=""
QUIT ""
+2 ;check povs
+3 NEW X,E,BGPG,Y
+4 KILL BGPG
+5 SET Y="BGPG("
+6 SET X=P_"^LAST DX [BGP HIV/AIDS DXS;DURING "_$$FMTE^XLFDT($PIECE(^DPT(P,0),U,3))_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(X,Y)
+7 ;has a dx
IF $DATA(BGPG(1))
QUIT 1
+8 QUIT 0
+9 ;