BGPD12 ; IHS/CMI/LAB - indicator 12 ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
I12 ;EP ;EP - indicator 12
;Q:'$D(BGPIND(19))
S BGPP=$$DENT00(DFN,BGPEDATE)
I BGPP]"" D S(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),12,1)
I $D(BGPLIST(19)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",19,$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
;
DENT00(P,EDATE) ;
NEW BGPG,X,%,E,R,V,BDATE
K BGPG
S BDATE=$$FMADD^XLFDT(EDATE,-365)
S %=P_"^LAST ADA 0000;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
I $D(BGPG(1)) Q "Yes - "_$$FMTE^XLFDT($P(BGPG(1),U))
Q ""
BGPD12 ; IHS/CMI/LAB - indicator 12 ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+2 ;
I12 ;EP ;EP - indicator 12
+1 ;Q:'$D(BGPIND(19))
+2 SET BGPP=$$DENT00(DFN,BGPEDATE)
+3 IF BGPP]""
DO S(BGPRPT,$SELECT(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),12,1)
+4 IF $DATA(BGPLIST(19))
IF BGPTIME=1
SET ^XTMP("BGPD",BGPJ,BGPH,"LIST",19,$SELECT($PIECE($GET(^AUPNPAT(DFN,11)),U,18)]"":$PIECE(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$PIECE(^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 ;
DENT00(P,EDATE) ;
+1 NEW BGPG,X,%,E,R,V,BDATE
+2 KILL BGPG
+3 SET BDATE=$$FMADD^XLFDT(EDATE,-365)
+4 SET %=P_"^LAST ADA 0000;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE)
SET E=$$START1^APCLDF(%,"BGPG(")
+5 IF $DATA(BGPG(1))
QUIT "Yes - "_$$FMTE^XLFDT($PIECE(BGPG(1),U))
+6 QUIT ""