BGPDP2 ; IHS/CMI/LAB - print ind 2 ;
;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
;
;
I2A ;EP ;
;Q:'$D(BGPIND(3))
D HEADER^BGPDPH
W !,"Indicator 2A: Diabetes-Reduce Diabetic Complications - Glycemic Control"
W !,"Denominator is all patients with a DM diagnosis ever."
W !,"Continue the trend of improved glycemic control in the proportion of I/T/U"
W !,"clients with diagnosed diabetes.",!
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT
D H1^BGPDPH
S BGPCYD=$P($$V(BGPRPT,10,10),"!",1)+$P($$V(BGPRPT,10,10),"!",2),BGPCYN=$$V(BGPRPT,12,2),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98D=$P($$V(BGPRPT,80,10),"!",1)+$P($$V(BGPRPT,80,10),"!",2),BGP98N=$$V(BGPRPT,82,2),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRD=$P($$V(BGPRPT,40,10),"!",1)+$P($$V(BGPRPT,40,10),"!",2),BGPPRN=$$V(BGPRPT,42,2),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
W !,"# diagnosed w/diabetes",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
W !!,"# w/HgbA1c <=7 or",!?2," glucose <=150",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT W !,"Glycemic Control",! D H1^BGPDPH
I2A3 ;ideal control
S BGPP2=3 D SET22
W !!,"# w/HgbA1c >=9.5 or",!?2," glucose >=225",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I2A4 ;
S BGPP2=4 D SET22
W !!,"# w/HgbA1c or Glucose",!?2," undetermined in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I2A1 ; ;
S BGPP2=1 D SET22
W !!,"# w/HgbA1c done w/ or",!?2," w/o result",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
Q
I2B ;EP ;
;Q:'$D(BGPIND(4))
D HEADER^BGPDPH
W !,"Indicator 2B: Diabetes-Reduce Diabetic Complications - Glycemic Control"
W !,"Denominator is all patients with a DM diagnosis ever, with at least",!,"2 visits in the year prior to the end of the time period and the first",!,"ever recorded diagnosis of Diabetes > 1year prior to the end of the time period."
W !,"Continue the trend of improved glycemic control in the proportion of I/T/U"
W !,"clients with diagnosed diabetes.",!
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT
D H1^BGPDPH
S BGPCYD=$$V(BGPRPT,12,5),BGPCYN=$$V(BGPRPT,12,7),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98D=$$V(BGPRPT,82,5),BGP98N=$$V(BGPRPT,82,7),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRD=$$V(BGPRPT,42,5),BGPPRN=$$V(BGPRPT,42,7),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
W !,"# in denominator",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
W !!,"# w/HgbA1c <=7 or",!?2," glucose <=150",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT W !,"Glycemic Control",! D H1^BGPDPH
I2B3 ;ideal control
S BGPP2=8 D SET22
W !!,"# w/HgbA1c >=9.5 or",!?2," glucose >=225",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I2B4 ;
S BGPP2=9 D SET22
W !!,"# w/HgbA1c or Glucose",!?2," undetermined in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I2B1 ; ;
S BGPP2=6 D SET22
W !!,"# w/HgbA1c done w/ or",!?2," w/o result",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
Q
I2C ;EP ;
;Q:'$D(BGPIND(5))
D HEADER^BGPDPH
W !,"Indicator 2C: Diabetes-Reduce Diabetic Complications - Glycemic Control"
W !,"Denominator is all patients with a DM diagnosis ever, who are 19 or older",!,"who had at least 2 diabetes related encounters ever, at least one",!,"encounter in a primary clinic with a primary provider for diabetes,"
W !,"and an absence of a creatinine value of 5.0 or greater."
W !!,"Continue the trend of improved glycemic control in the proportion of I/T/U"
W !,"clients with diagnosed diabetes.",!
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT
D H1^BGPDPH
S BGPCYD=$$V(BGPRPT,12,10),BGPCYN=$$V(BGPRPT,12,12),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98D=$$V(BGPRPT,82,10),BGP98N=$$V(BGPRPT,82,12),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRD=$$V(BGPRPT,42,10),BGPPRN=$$V(BGPRPT,42,12),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
W !,"# diagnosed w/diabetes",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
W !!,"# w/HgbA1c <=7 or",!?2," glucose <=150",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I $Y>(IOSL-5) D HEADER^BGPDPH Q:BGPQUIT W !,"Glycemic Control",! D H1^BGPDPH
I2C3 ;ideal control
S BGPP2=13 D SET22
W !!,"# w/HgbA1c >=9.5 or",!?2," glucose >=225",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I2C4 ;
S BGPP2=14 D SET22
W !!,"# w/HgbA1c or Glucose",!?2," undetermined in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
I2C1 ; ;
S BGPP2=11 D SET22
W !!,"# w/HgbA1c done w/ or",!?2," w/o result",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
D H2^BGPDPH
Q
SET22 ;
S BGPCYN=$$V(BGPRPT,12,BGPP2),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
S BGP98N=$$V(BGPRPT,82,BGPP2),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
S BGPPRN=$$V(BGPRPT,42,BGPP2),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
Q
CALC(N,O) ;ENTRY POINT
NEW Z
I O=0!(N=0)!(O="")!(N="") Q "**"
NEW X,X2,X3
S X=N,X2=1,X3=0 D COMMA^%DTC S N=X
S X=O,X2=1,X3=0 D COMMA^%DTC S O=X
I +O=0 Q "**"
S Z=(((N-O)/O)*100),Z=$FN(Z,"+,",1)
Q Z
Q
V(R,N,P) ;
NEW Y
I $G(BGPAREAA),'$G(BGPSUMR) G VA
Q $P($G(^BGPD(R,N)),U,P)
VA ;
NEW X,C,V,MT,FT,M,F,B S X=0,C="" F S X=$O(BGPSUL(X)) Q:X'=+X D
.S V=$P($G(^BGPD(X,N)),U,P)
.I C="" S C=V Q
.S MT=$P(C,"!"),FT=$P(C,"!",2),M=$P(V,"!"),F=$P(V,"!",2)
.F B=1:1:6 S $P(MT,"~",B)=$P(MT,"~",B)+$P(M,"~",B)
.F B=1:1:6 S $P(FT,"~",B)=$P(FT,"~",B)+$P(F,"~",B)
.S C=MT_"!"_FT
.Q
Q C
C(X,X2,X3) ;
D COMMA^%DTC
Q X
BGPDP2 ; IHS/CMI/LAB - print ind 2 ;
+1 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
+2 ;
+3 ;
I2A ;EP ;
+1 ;Q:'$D(BGPIND(3))
+2 DO HEADER^BGPDPH
+3 WRITE !,"Indicator 2A: Diabetes-Reduce Diabetic Complications - Glycemic Control"
+4 WRITE !,"Denominator is all patients with a DM diagnosis ever."
+5 WRITE !,"Continue the trend of improved glycemic control in the proportion of I/T/U"
+6 WRITE !,"clients with diagnosed diabetes.",!
+7 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
+8 DO H1^BGPDPH
+9 SET BGPCYD=$PIECE($$V(BGPRPT,10,10),"!",1)+$PIECE($$V(BGPRPT,10,10),"!",2)
SET BGPCYN=$$V(BGPRPT,12,2)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+10 SET BGP98D=$PIECE($$V(BGPRPT,80,10),"!",1)+$PIECE($$V(BGPRPT,80,10),"!",2)
SET BGP98N=$$V(BGPRPT,82,2)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+11 SET BGPPRD=$PIECE($$V(BGPRPT,40,10),"!",1)+$PIECE($$V(BGPRPT,40,10),"!",2)
SET BGPPRN=$$V(BGPRPT,42,2)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+12 WRITE !,"# diagnosed w/diabetes",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
+13 WRITE !!,"# w/HgbA1c <=7 or",!?2," glucose <=150",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+14 DO H2^BGPDPH
+15 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
WRITE !,"Glycemic Control",!
DO H1^BGPDPH
I2A3 ;ideal control
+1 SET BGPP2=3
DO SET22
+2 WRITE !!,"# w/HgbA1c >=9.5 or",!?2," glucose >=225",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
I2A4 ;
+1 SET BGPP2=4
DO SET22
+2 WRITE !!,"# w/HgbA1c or Glucose",!?2," undetermined in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
I2A1 ; ;
+1 SET BGPP2=1
DO SET22
+2 WRITE !!,"# w/HgbA1c done w/ or",!?2," w/o result",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
+4 QUIT
I2B ;EP ;
+1 ;Q:'$D(BGPIND(4))
+2 DO HEADER^BGPDPH
+3 WRITE !,"Indicator 2B: Diabetes-Reduce Diabetic Complications - Glycemic Control"
+4 WRITE !,"Denominator is all patients with a DM diagnosis ever, with at least",!,"2 visits in the year prior to the end of the time period and the first",!,"ever recorded diagnosis of Diabetes > 1year prior to the end of the time period."
+5 WRITE !,"Continue the trend of improved glycemic control in the proportion of I/T/U"
+6 WRITE !,"clients with diagnosed diabetes.",!
+7 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
+8 DO H1^BGPDPH
+9 SET BGPCYD=$$V(BGPRPT,12,5)
SET BGPCYN=$$V(BGPRPT,12,7)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+10 SET BGP98D=$$V(BGPRPT,82,5)
SET BGP98N=$$V(BGPRPT,82,7)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+11 SET BGPPRD=$$V(BGPRPT,42,5)
SET BGPPRN=$$V(BGPRPT,42,7)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+12 WRITE !,"# in denominator",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
+13 WRITE !!,"# w/HgbA1c <=7 or",!?2," glucose <=150",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+14 DO H2^BGPDPH
+15 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
WRITE !,"Glycemic Control",!
DO H1^BGPDPH
I2B3 ;ideal control
+1 SET BGPP2=8
DO SET22
+2 WRITE !!,"# w/HgbA1c >=9.5 or",!?2," glucose >=225",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
I2B4 ;
+1 SET BGPP2=9
DO SET22
+2 WRITE !!,"# w/HgbA1c or Glucose",!?2," undetermined in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
I2B1 ; ;
+1 SET BGPP2=6
DO SET22
+2 WRITE !!,"# w/HgbA1c done w/ or",!?2," w/o result",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
+4 QUIT
I2C ;EP ;
+1 ;Q:'$D(BGPIND(5))
+2 DO HEADER^BGPDPH
+3 WRITE !,"Indicator 2C: Diabetes-Reduce Diabetic Complications - Glycemic Control"
+4 WRITE !,"Denominator is all patients with a DM diagnosis ever, who are 19 or older",!,"who had at least 2 diabetes related encounters ever, at least one",!,"encounter in a primary clinic with a primary provider for diabetes,"
+5 WRITE !,"and an absence of a creatinine value of 5.0 or greater."
+6 WRITE !!,"Continue the trend of improved glycemic control in the proportion of I/T/U"
+7 WRITE !,"clients with diagnosed diabetes.",!
+8 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
+9 DO H1^BGPDPH
+10 SET BGPCYD=$$V(BGPRPT,12,10)
SET BGPCYN=$$V(BGPRPT,12,12)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+11 SET BGP98D=$$V(BGPRPT,82,10)
SET BGP98N=$$V(BGPRPT,82,12)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+12 SET BGPPRD=$$V(BGPRPT,42,10)
SET BGPPRN=$$V(BGPRPT,42,12)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+13 WRITE !,"# diagnosed w/diabetes",?22,$$C(BGP98D,0,8),?37,$$C(BGPPRD,0,8),?52,$$C(BGPCYD,0,8)
+14 WRITE !!,"# w/HgbA1c <=7 or",!?2," glucose <=150",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+15 DO H2^BGPDPH
+16 IF $Y>(IOSL-5)
DO HEADER^BGPDPH
IF BGPQUIT
QUIT
WRITE !,"Glycemic Control",!
DO H1^BGPDPH
I2C3 ;ideal control
+1 SET BGPP2=13
DO SET22
+2 WRITE !!,"# w/HgbA1c >=9.5 or",!?2," glucose >=225",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
I2C4 ;
+1 SET BGPP2=14
DO SET22
+2 WRITE !!,"# w/HgbA1c or Glucose",!?2," undetermined in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
I2C1 ; ;
+1 SET BGPP2=11
DO SET22
+2 WRITE !!,"# w/HgbA1c done w/ or",!?2," w/o result",!?2,"recorded w/in 1 yr of",!?2,"end of time period"
+3 DO H2^BGPDPH
+4 QUIT
SET22 ;
+1 SET BGPCYN=$$V(BGPRPT,12,BGPP2)
SET BGPCYP=$SELECT(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
+2 SET BGP98N=$$V(BGPRPT,82,BGPP2)
SET BGP98P=$SELECT(BGP98D:((BGP98N/BGP98D)*100),1:"")
+3 SET BGPPRN=$$V(BGPRPT,42,BGPP2)
SET BGPPRP=$SELECT(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
+4 QUIT
CALC(N,O) ;ENTRY POINT
+1 NEW Z
+2 IF O=0!(N=0)!(O="")!(N="")
QUIT "**"
+3 NEW X,X2,X3
+4 SET X=N
SET X2=1
SET X3=0
DO COMMA^%DTC
SET N=X
+5 SET X=O
SET X2=1
SET X3=0
DO COMMA^%DTC
SET O=X
+6 IF +O=0
QUIT "**"
+7 SET Z=(((N-O)/O)*100)
SET Z=$FNUMBER(Z,"+,",1)
+8 QUIT Z
+9 QUIT
V(R,N,P) ;
+1 NEW Y
+2 IF $GET(BGPAREAA)
IF '$GET(BGPSUMR)
GOTO VA
+3 QUIT $PIECE($GET(^BGPD(R,N)),U,P)
VA ;
+1 NEW X,C,V,MT,FT,M,F,B
SET X=0
SET C=""
FOR
SET X=$ORDER(BGPSUL(X))
IF X'=+X
QUIT
Begin DoDot:1
+2 SET V=$PIECE($GET(^BGPD(X,N)),U,P)
+3 IF C=""
SET C=V
QUIT
+4 SET MT=$PIECE(C,"!")
SET FT=$PIECE(C,"!",2)
SET M=$PIECE(V,"!")
SET F=$PIECE(V,"!",2)
+5 FOR B=1:1:6
SET $PIECE(MT,"~",B)=$PIECE(MT,"~",B)+$PIECE(M,"~",B)
+6 FOR B=1:1:6
SET $PIECE(FT,"~",B)=$PIECE(FT,"~",B)+$PIECE(F,"~",B)
+7 SET C=MT_"!"_FT
+8 QUIT
End DoDot:1
+9 QUIT C
C(X,X2,X3) ;
+1 DO COMMA^%DTC
+2 QUIT X