BGP8DCHI ; IHS/CMI/LAB - calculate HEDIS measures ;
;;8.0;IHS CLINICAL REPORTING;**2**;MAR 12, 2008
;
CALCIND ;EP
S BGPIC=0 F S BGPIC=$O(BGPIND(BGPIC)) Q:BGPIC'=+BGPIC D
.K BGPSTOP,BGPVAL,BGPVALUE,BGPG,BGPC,BGPALLED,BGPV,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
.I $D(^BGPHEIE(BGPIC,1)) X ^BGPHEIE(BGPIC,1)
.K BGPG,BGPC,BGPALLED
.K BGPVAL,BGPG,BGPC,BGPALLED,BGPV,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
.I $D(BGPSTOP) Q ;no need to set since no num/denom
.;loop each individual to set numerator and denominator
.S BGPI=0 F S BGPI=$O(^BGPHEIIE("B",BGPIC,BGPI)) Q:BGPI'=+BGPI D
..S (BGPNUM,BGPDEN)=0
..X ^BGPHEIIE(BGPI,1)
..X ^BGPHEIIE(BGPI,2) ;denominator 1 or 0
..;set field counter
..S BGPNF=$P(^BGPHEIIE(BGPI,0),U,9)
..S BGPN=$P(^DD(90534.03,BGPNF,0),U,4),N=$P(BGPN,";"),P=$P(BGPN,";",2)
..D S(BGPRPT,BGPGBL,N,P,BGPNUM)
..S BGPDF=$P(^BGPHEIIE(BGPI,0),U,8)
..S BGPN=$P(^DD(90534.03,BGPDF,0),U,4),N=$P(BGPN,";"),P=$P(BGPN,";",2)
..I BGPDEN'="NO" D S(BGPRPT,BGPGBL,N,P,BGPDEN)
.I $D(BGPLIST(BGPIC)) D STMP^BGP8HUTL
Q
;
S(R,G,N,P,V) ;
I 'V Q ;no value to add
S $P(@(G_R_","_N_")"),U,P)=$P($G(@(G_R_","_N_")")),U,P)+V
Q
D(D) ;
I D="" Q ""
Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_(1700+$E(D,1,3))
BGP8DCHI ; IHS/CMI/LAB - calculate HEDIS measures ;
+1 ;;8.0;IHS CLINICAL REPORTING;**2**;MAR 12, 2008
+2 ;
CALCIND ;EP
+1 SET BGPIC=0
FOR
SET BGPIC=$ORDER(BGPIND(BGPIC))
IF BGPIC'=+BGPIC
QUIT
Begin DoDot:1
+2 KILL BGPSTOP,BGPVAL,BGPVALUE,BGPG,BGPC,BGPALLED,BGPV,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
+3 IF $DATA(^BGPHEIE(BGPIC,1))
XECUTE ^BGPHEIE(BGPIC,1)
+4 KILL BGPG,BGPC,BGPALLED
+5 KILL BGPVAL,BGPG,BGPC,BGPALLED,BGPV,A,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
+6 ;no need to set since no num/denom
IF $DATA(BGPSTOP)
QUIT
+7 ;loop each individual to set numerator and denominator
+8 SET BGPI=0
FOR
SET BGPI=$ORDER(^BGPHEIIE("B",BGPIC,BGPI))
IF BGPI'=+BGPI
QUIT
Begin DoDot:2
+9 SET (BGPNUM,BGPDEN)=0
+10 XECUTE ^BGPHEIIE(BGPI,1)
+11 ;denominator 1 or 0
XECUTE ^BGPHEIIE(BGPI,2)
+12 ;set field counter
+13 SET BGPNF=$PIECE(^BGPHEIIE(BGPI,0),U,9)
+14 SET BGPN=$PIECE(^DD(90534.03,BGPNF,0),U,4)
SET N=$PIECE(BGPN,";")
SET P=$PIECE(BGPN,";",2)
+15 DO S(BGPRPT,BGPGBL,N,P,BGPNUM)
+16 SET BGPDF=$PIECE(^BGPHEIIE(BGPI,0),U,8)
+17 SET BGPN=$PIECE(^DD(90534.03,BGPDF,0),U,4)
SET N=$PIECE(BGPN,";")
SET P=$PIECE(BGPN,";",2)
+18 IF BGPDEN'="NO"
DO S(BGPRPT,BGPGBL,N,P,BGPDEN)
End DoDot:2
+19 IF $DATA(BGPLIST(BGPIC))
DO STMP^BGP8HUTL
End DoDot:1
+20 QUIT
+21 ;
S(R,G,N,P,V) ;
+1 ;no value to add
IF 'V
QUIT
+2 SET $PIECE(@(G_R_","_N_")"),U,P)=$PIECE($GET(@(G_R_","_N_")")),U,P)+V
+3 QUIT
D(D) ;
+1 IF D=""
QUIT ""
+2 QUIT $EXTRACT(D,4,5)_"/"_$EXTRACT(D,6,7)_"/"_(1700+$EXTRACT(D,1,3))