BGP6DCHI ; IHS/CMI/LAB - calculate HEDIS measures ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
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(^BGPHEIS(BGPIC,1)) X ^BGPHEIS(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(^BGPHEIIS("B",BGPIC,BGPI)) Q:BGPI'=+BGPI D
..S (BGPNUM,BGPDEN)=0
..X ^BGPHEIIS(BGPI,1)
..X ^BGPHEIIS(BGPI,2) ;denominator 1 or 0
..;set field counter
..S BGPNF=$P(^BGPHEIIS(BGPI,0),U,9)
..S BGPN=$P(^DD(90375.03,BGPNF,0),U,4),N=$P(BGPN,";"),P=$P(BGPN,";",2)
..D S(BGPRPT,BGPGBL,N,P,BGPNUM)
..S BGPDF=$P(^BGPHEIIS(BGPI,0),U,8)
..S BGPN=$P(^DD(90375.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^BGP6HUTL
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))
BGP6DCHI ; IHS/CMI/LAB - calculate HEDIS measures ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+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(^BGPHEIS(BGPIC,1))
XECUTE ^BGPHEIS(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(^BGPHEIIS("B",BGPIC,BGPI))
IF BGPI'=+BGPI
QUIT
Begin DoDot:2
+9 SET (BGPNUM,BGPDEN)=0
+10 XECUTE ^BGPHEIIS(BGPI,1)
+11 ;denominator 1 or 0
XECUTE ^BGPHEIIS(BGPI,2)
+12 ;set field counter
+13 SET BGPNF=$PIECE(^BGPHEIIS(BGPI,0),U,9)
+14 SET BGPN=$PIECE(^DD(90375.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(^BGPHEIIS(BGPI,0),U,8)
+17 SET BGPN=$PIECE(^DD(90375.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^BGP6HUTL
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))