BDMDG11 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT 10 Oct 2014 9:50 AM ;
;;2.0;DIABETES MANAGEMENT SYSTEM;**12**;JUN 14, 2007;Build 51
;
IMM ;
S:'$D(BDMCUML(140)) BDMCUML(140)="IMMUNIZATIONS"
S $P(BDMCUML(140),U,2)=$P(BDMCUML(140),U,2)+1
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,64))
I $E(V)="1" S $P(BDMCUML(140),U,3)=$P(BDMCUML(140),U,3)+1
I $E(V)="3" S $P(BDMCUML(140),U,6)=$P(BDMCUML(140),U,6)+1
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,66))
I $E(V)="1" S $P(BDMCUML(140),U,4)=$P(BDMCUML(140),U,4)+1
I $E(V)="3" S $P(BDMCUML(140),U,7)=$P(BDMCUML(140),U,7)+1
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,68))
I $E(V)="1" S $P(BDMCUML(140),U,5)=$P(BDMCUML(140),U,5)+1
I $E(V)="3" S $P(BDMCUML(140),U,8)=$P(BDMCUML(140),U,8)+1
;HEP B
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,115))
I $E(V)="1" S $P(BDMCUML(140),U,9)=$P(BDMCUML(140),U,9)+1
I $E(V)="3" S $P(BDMCUML(140),U,10)=$P(BDMCUML(140),U,10)+1
I $E(V)="4" S $P(BDMCUML(140),U,11)=$P(BDMCUML(140),U,11)+1
;TDAP EVER
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,216))
I $E(V)="1" S $P(BDMCUML(140),U,12)=$P(BDMCUML(140),U,12)+1
I $E(V)="3" S $P(BDMCUML(140),U,13)=$P(BDMCUML(140),U,13)+1
;
QUAN ;
;145
;title^total pts^total YES^NO^REF^UACR^UPCR^24HR^MICRO STRIP^MICRO ONLY^DIPSTICK
K BDMOFLG
S BDMOFLG=0
S:'$D(BDMCUML(145)) BDMCUML(145)="LABORATORY EXAMS"
S $P(BDMCUML(145),U,2)=$P(BDMCUML(145),U,2)+1 ;TOTAL # of patients
S Q=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))
S V=$E($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))) ;test done?
;S T=$P($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92)),U,5) ;type of test
S R=$S($P(Q,U,6)]"":$P(Q,U,6),1:$P(Q,U,2)) ;value/result
;CONVERT RESULT LIKE IN WEB EXPORT
S S=$$AS^BDMDG18(R),S=$$STV^BDMDG18(S,8)
I S="" S V=0 ;X=$E(X,1,5)
I V'=1 S $P(BDMCUML(145),U,4)=$P(BDMCUML(145),U,4)+1 ;no UACR
I V=1 D
.S $P(BDMCUML(145),U,3)=$P(BDMCUML(145),U,3)+1 ;TOTAL WITH UACR
.I R[">" S $P(BDMCUML(145),U,14)=$P(BDMCUML(145),U,14)+1 Q
.;I $$UP^XLFSTR(R)["COMMENT" S $P(BDMCUML(145),U,12)=$P(BDMCUML(145),U,12)+1 Q
.S R=$$STV^BDMDG18(R,8)
.I R="" S $P(BDMCUML(145),U,15)=$P(BDMCUML(145),U,15)+1 Q ;NO RESULT
.S R=+R
.I R<30 S $P(BDMCUML(145),U,12)=$P(BDMCUML(145),U,12)+1,BDMUACRV="<30" Q ;NORMAL UACR
.I R<300.9999 S $P(BDMCUML(145),U,13)=$P(BDMCUML(145),U,13)+1,BDMCKD=1,BDMUACRV=">30" Q ;INREASCED 30-300
.S $P(BDMCUML(145),U,14)=$P(BDMCUML(145),U,14)+1,BDMCKD=1,BDMUACRV=">30" ;INCREASED >300
S G=$P($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,79)),U,2) ;egfr value
S H=0
I $$AGE^AUPNPAT(BDMPD,BDMADAT)>17 D
.S G=$$AS^BDMDG18(G)
.S G=$$STV^BDMDG18(G,5,1)
.I G="" Q
.I +G>29 S $P(BDMCUML(145),U,20)=$P(BDMCUML(145),U,20)+1 I V=1 S $P(BDMCUML(145),U,21)=$P(BDMCUML(145),U,21)+1
;
GFR ;
G:$$AGE^AUPNPAT(BDMPD,BDMADAT)<18 TCHOL
S:'$D(BDMCUML(175)) BDMCUML(175)="e-GFR to assess kidney function obtained during audit period"
S $P(BDMCUML(175),U,2)=$P(BDMCUML(175),U,2)+1 ;total pts over 18
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,79))
;I $E(V)=1 S $P(BDMCUML(175),U,5)=$P(BDMCUML(175),U,5)+1 ;EGFR DONE
S V=$P(V,U,2) ;EGFR VALUE
I $E(V)=">" S $P(BDMCUML(175),U,6)=$P(BDMCUML(175),U,6)+1 S BDMEGFRV="61" S $P(BDMCUML(175),U,5)=$P(BDMCUML(175),U,5)+1 G TCHOL ;>60
S V=$$STV^BDMDG18(V,5,1)
I V="" S $P(BDMCUML(175),U,10)=$P(BDMCUML(175),U,10)+1 G TCHOL
S $P(BDMCUML(175),U,5)=$P(BDMCUML(175),U,5)+1 ;EGFR DONE
S BDMEGFRV=+V
I +V<60 S BDMCKD=1
I +V>59 S $P(BDMCUML(175),U,6)=$P(BDMCUML(175),U,6)+1 G TCHOL
I +V<15 S $P(BDMCUML(175),U,9)=$P(BDMCUML(175),U,9)+1 G TCHOL
I +V>29,+V<60 S $P(BDMCUML(175),U,7)=$P(BDMCUML(175),U,7)+1 G TCHOL
I +V>14,+V<30 S $P(BDMCUML(175),U,8)=$P(BDMCUML(175),U,8)+1 G TCHOL
;
TCHOL ;
S:'$D(BDMCUML(180)) BDMCUML(180)="Total Cholesterol obtained in past 12 months"
S $P(BDMCUML(180),U,2)=$P(BDMCUML(180),U,2)+1
S V=$$CHOL^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
I V="" S $P(BDMCUML(180),U,6)=$P(BDMCUML(180),U,6)+1 G NONHDL
S V=$P(V,U)
S V=$$STV^BDMDG18(V,5,1)
I V="" S $P(BDMCUML(180),U,7)=$P(BDMCUML(180),U,7)+1 G NONHDL
I $E(V)'=+$E(V)!(+V=0) S $P(BDMCUML(180),U,7)=$P(BDMCUML(180),U,7)+1 G NONHDL
I V<200 S $P(BDMCUML(180),U,3)=$P(BDMCUML(180),U,3)+1 G NONHDL
I V<240 S $P(BDMCUML(180),U,4)=$P(BDMCUML(180),U,4)+1 G NONHDL
S $P(BDMCUML(180),U,5)=$P(BDMCUML(180),U,5)+1
NONHDL ;
LDL ;
S:'$D(BDMCUML(190)) BDMCUML(190)="LDL Cholesterol obtained during audit period"
S $P(BDMCUML(190),U,2)=$P(BDMCUML(190),U,2)+1
S V=$$LDL^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
I V="" S $P(BDMCUML(190),U,7)=$P(BDMCUML(190),U,7)+1 G HDL
S V=$P(V,U)
;S V=$$STV^BDMDG18(V,4)
S V=$$STV^BDMDG18(V,5,1) I $E(V)'=+$E(V)!(+V=0) S $P(BDMCUML(190),U,8)=$P(BDMCUML(190),U,8)+1 G HDL
I V<100 S $P(BDMCUML(190),U,3)=$P(BDMCUML(190),U,3)+1 G HDL
I V<190 S $P(BDMCUML(190),U,4)=$P(BDMCUML(190),U,4)+1 G HDL
;I V<189.1 S $P(BDMCUML(190),U,5)=$P(BDMCUML(190),U,5)+1 G HDL
S $P(BDMCUML(190),U,6)=$P(BDMCUML(190),U,6)+1
HDL ;
S:'$D(BDMCUML(195)) BDMCUML(195)="HDL Cholesterol obtained during audit period"
S V=$$HDL^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
S S=$P(^DPT(BDMPD,0),U,2) ;GENDER
I S="F" D
.S $P(BDMCUML(195),U,2)=$P(BDMCUML(195),U,2)+1
.I V="" S $P(BDMCUML(195),U,5)=$P(BDMCUML(195),U,5)+1 Q
.S V=$P(V,U)
.S V=$$STV^BDMDG18(V,5,1) I $E(V)'=+$E(V)!(+V=0) S $P(BDMCUML(195),U,5)=$P(BDMCUML(195),U,5)+1 Q
.S V=$P(V,"."),V=$$STV^BDMDG18(V,5,1)
.I $E(V)'=+$E(V)!(+V=0)!(V="") S $P(BDMCUML(195),U,5)=$P(BDMCUML(195),U,5)+1 Q
.I V<50 S $P(BDMCUML(195),U,3)=$P(BDMCUML(195),U,3)+1 Q
.S $P(BDMCUML(195),U,4)=$P(BDMCUML(195),U,4)+1 Q
I S="M" D
.S $P(BDMCUML(195),U,6)=$P(BDMCUML(195),U,6)+1
.I V="" S $P(BDMCUML(195),U,9)=$P(BDMCUML(195),U,9)+1 Q
.S V=$P(V,U)
.S V=$$STV^BDMDG18(V,5,1) I $E(V)'=+$E(V)!(+V=0) S $P(BDMCUML(195),U,9)=$P(BDMCUML(195),U,9)+1 Q ;unable to determine result, not a number
.S V=$P(V,"."),V=$$STV^BDMDG18(V,5,1)
.I $E(V)'=+$E(V)!(+V=0)!(V="") S $P(BDMCUML(195),U,9)=$P(BDMCUML(195),U,9)+1 Q ;unable to determine result, not a number
.I V<40 S $P(BDMCUML(195),U,7)=$P(BDMCUML(195),U,7)+1 Q
.S $P(BDMCUML(195),U,8)=$P(BDMCUML(195),U,8)+1 Q
TRIG ;
S:'$D(BDMCUML(200)) BDMCUML(200)="Triglycerides obtained in past 12 months"
S $P(BDMCUML(200),U,2)=$P(BDMCUML(200),U,2)+1
S V=$$TRIG^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
I V="" S $P(BDMCUML(200),U,7)=$P(BDMCUML(200),U,7)+1 G ACE
S V=$P(V,U)
S V=$$STV^BDMDG18(V,5,1) I $E(V)'=+$E(V) S $P(BDMCUML(200),U,5)=$P(BDMCUML(200),U,5)+1 G ACE ;unable to determine result, not a number
I V<150 S $P(BDMCUML(200),U,3)=$P(BDMCUML(200),U,3)+1 G ACE
I V<500 S $P(BDMCUML(200),U,8)=$P(BDMCUML(200),U,8)+1 G ACE
I V<1000 S $P(BDMCUML(200),U,9)=$P(BDMCUML(200),U,9)+1 G ACE
S $P(BDMCUML(200),U,4)=$P(BDMCUML(200),U,4)+1
;
ACE ;110 title^total pts^total pts with protein^# of those on ace^# with htn^# of those on ace"
S $P(BDMCUML(110),U,2)=$P(BDMCUML(110),U,2)+1
;set 3rd piece with # with proteinuria
S P=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92)) ;URINE PROTEIN VALUE
S H=$E($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,34)))
S A=$E($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,60)))
I A S $P(BDMCUML(110),U,3)=$P(BDMCUML(110),U,3)+1 ;TOTAL ACE
I $E(H)=1 S $P(BDMCUML(110),U,5)=$P(BDMCUML(110),U,5)+1 I A=1 S $P(BDMCUML(110),U,7)=$P(BDMCUML(110),U,7)+1 ;TOTAL HTN
I BDMCKD,$$AGE^AUPNPAT(BDMPD)>17 S $P(BDMCUML(110),U,4)=$P(BDMCUML(110),U,4)+1 I A=1 S $P(BDMCUML(110),U,8)=$P(BDMCUML(110),U,8)+1 ;TOTAL CKD
CVD ;USE 250
S:'$D(BDMCUML(250)) BDMCUML(250)="Cardiovascular Disease"
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,116))
I $E(V)=1 S $P(BDMCUML(250),U,3)=$P(BDMCUML(250),U,3)+1
S $P(BDMCUML(250),U,2)=$P(BDMCUML(250),U,2)+1
EGFRQUP ;
S:'$D(BDMCUML(270)) BDMCUML(270)="eGFR and QUANTITATIVE URINARY PROTEIN ASSESSMENT"
G:$$AGE^AUPNPAT(BDMPD,BDMADAT)<18 COMBINED
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,79)),V=$$STV^BDMDG18($P(V,U,2),5)
S T=$P($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92)),U,5) ;type of test
S Q=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))
S $P(BDMCUML(270),U,2)=$P(BDMCUML(270),U,2)+1
S R=$S($P(Q,U,6)]"":$P(Q,U,6),1:$P(Q,U,2)) ;value/result
;CONVERT RESULT LIKE IN WEB EXPORT
S S=$$AS^BDMDG18(R),S=$$STV^BDMDG18(S,8)
;I S="" S V=0 ;X=$E(X,1,5)
I V]"",T=1,S]"" S $P(BDMCUML(270),U,3)=$P(BDMCUML(270),U,3)+1,BDMEGFRU=1
COMBINED ;USE 260
S:'$D(BDMCUML(260)) BDMCUML(260)="Combined Outcome Measure"
;ONLY 40 AND OLDER
G:$$AGE^AUPNPAT(BDMPD,BDMADAT)<40 E
I $E($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,300)))=3 G E ;statin allergy
S V=$G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,118))
I $E(V)=1 S $P(BDMCUML(260),U,3)=$P(BDMCUML(260),U,3)+1
S $P(BDMCUML(260),U,2)=$P(BDMCUML(260),U,2)+1
E G CUML^BDMDG1J
;
CESS(P,BDATE,EDATE) ;EP - find any cessation hf in 12 months before E
G CESS^BDMDG1B
BDMDG11 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT 10 Oct 2014 9:50 AM ;
+1 ;;2.0;DIABETES MANAGEMENT SYSTEM;**12**;JUN 14, 2007;Build 51
+2 ;
IMM ;
+1 IF '$DATA(BDMCUML(140))
SET BDMCUML(140)="IMMUNIZATIONS"
+2 SET $PIECE(BDMCUML(140),U,2)=$PIECE(BDMCUML(140),U,2)+1
+3 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,64))
+4 IF $EXTRACT(V)="1"
SET $PIECE(BDMCUML(140),U,3)=$PIECE(BDMCUML(140),U,3)+1
+5 IF $EXTRACT(V)="3"
SET $PIECE(BDMCUML(140),U,6)=$PIECE(BDMCUML(140),U,6)+1
+6 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,66))
+7 IF $EXTRACT(V)="1"
SET $PIECE(BDMCUML(140),U,4)=$PIECE(BDMCUML(140),U,4)+1
+8 IF $EXTRACT(V)="3"
SET $PIECE(BDMCUML(140),U,7)=$PIECE(BDMCUML(140),U,7)+1
+9 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,68))
+10 IF $EXTRACT(V)="1"
SET $PIECE(BDMCUML(140),U,5)=$PIECE(BDMCUML(140),U,5)+1
+11 IF $EXTRACT(V)="3"
SET $PIECE(BDMCUML(140),U,8)=$PIECE(BDMCUML(140),U,8)+1
+12 ;HEP B
+13 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,115))
+14 IF $EXTRACT(V)="1"
SET $PIECE(BDMCUML(140),U,9)=$PIECE(BDMCUML(140),U,9)+1
+15 IF $EXTRACT(V)="3"
SET $PIECE(BDMCUML(140),U,10)=$PIECE(BDMCUML(140),U,10)+1
+16 IF $EXTRACT(V)="4"
SET $PIECE(BDMCUML(140),U,11)=$PIECE(BDMCUML(140),U,11)+1
+17 ;TDAP EVER
+18 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,216))
+19 IF $EXTRACT(V)="1"
SET $PIECE(BDMCUML(140),U,12)=$PIECE(BDMCUML(140),U,12)+1
+20 IF $EXTRACT(V)="3"
SET $PIECE(BDMCUML(140),U,13)=$PIECE(BDMCUML(140),U,13)+1
+21 ;
QUAN ;
+1 ;145
+2 ;title^total pts^total YES^NO^REF^UACR^UPCR^24HR^MICRO STRIP^MICRO ONLY^DIPSTICK
+3 KILL BDMOFLG
+4 SET BDMOFLG=0
+5 IF '$DATA(BDMCUML(145))
SET BDMCUML(145)="LABORATORY EXAMS"
+6 ;TOTAL # of patients
SET $PIECE(BDMCUML(145),U,2)=$PIECE(BDMCUML(145),U,2)+1
+7 SET Q=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))
+8 ;test done?
SET V=$EXTRACT($GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92)))
+9 ;S T=$P($G(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92)),U,5) ;type of test
+10 ;value/result
SET R=$SELECT($PIECE(Q,U,6)]"":$PIECE(Q,U,6),1:$PIECE(Q,U,2))
+11 ;CONVERT RESULT LIKE IN WEB EXPORT
+12 SET S=$$AS^BDMDG18(R)
SET S=$$STV^BDMDG18(S,8)
+13 ;X=$E(X,1,5)
IF S=""
SET V=0
+14 ;no UACR
IF V'=1
SET $PIECE(BDMCUML(145),U,4)=$PIECE(BDMCUML(145),U,4)+1
+15 IF V=1
Begin DoDot:1
+16 ;TOTAL WITH UACR
SET $PIECE(BDMCUML(145),U,3)=$PIECE(BDMCUML(145),U,3)+1
+17 IF R[">"
SET $PIECE(BDMCUML(145),U,14)=$PIECE(BDMCUML(145),U,14)+1
QUIT
+18 ;I $$UP^XLFSTR(R)["COMMENT" S $P(BDMCUML(145),U,12)=$P(BDMCUML(145),U,12)+1 Q
+19 SET R=$$STV^BDMDG18(R,8)
+20 ;NO RESULT
IF R=""
SET $PIECE(BDMCUML(145),U,15)=$PIECE(BDMCUML(145),U,15)+1
QUIT
+21 SET R=+R
+22 ;NORMAL UACR
IF R<30
SET $PIECE(BDMCUML(145),U,12)=$PIECE(BDMCUML(145),U,12)+1
SET BDMUACRV="<30"
QUIT
+23 ;INREASCED 30-300
IF R<300.9999
SET $PIECE(BDMCUML(145),U,13)=$PIECE(BDMCUML(145),U,13)+1
SET BDMCKD=1
SET BDMUACRV=">30"
QUIT
+24 ;INCREASED >300
SET $PIECE(BDMCUML(145),U,14)=$PIECE(BDMCUML(145),U,14)+1
SET BDMCKD=1
SET BDMUACRV=">30"
End DoDot:1
+25 ;egfr value
SET G=$PIECE($GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,79)),U,2)
+26 SET H=0
+27 IF $$AGE^AUPNPAT(BDMPD,BDMADAT)>17
Begin DoDot:1
+28 SET G=$$AS^BDMDG18(G)
+29 SET G=$$STV^BDMDG18(G,5,1)
+30 IF G=""
QUIT
+31 IF +G>29
SET $PIECE(BDMCUML(145),U,20)=$PIECE(BDMCUML(145),U,20)+1
IF V=1
SET $PIECE(BDMCUML(145),U,21)=$PIECE(BDMCUML(145),U,21)+1
End DoDot:1
+32 ;
GFR ;
+1 IF $$AGE^AUPNPAT(BDMPD,BDMADAT)<18
GOTO TCHOL
+2 IF '$DATA(BDMCUML(175))
SET BDMCUML(175)="e-GFR to assess kidney function obtained during audit period"
+3 ;total pts over 18
SET $PIECE(BDMCUML(175),U,2)=$PIECE(BDMCUML(175),U,2)+1
+4 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,79))
+5 ;I $E(V)=1 S $P(BDMCUML(175),U,5)=$P(BDMCUML(175),U,5)+1 ;EGFR DONE
+6 ;EGFR VALUE
SET V=$PIECE(V,U,2)
+7 ;>60
IF $EXTRACT(V)=">"
SET $PIECE(BDMCUML(175),U,6)=$PIECE(BDMCUML(175),U,6)+1
SET BDMEGFRV="61"
SET $PIECE(BDMCUML(175),U,5)=$PIECE(BDMCUML(175),U,5)+1
GOTO TCHOL
+8 SET V=$$STV^BDMDG18(V,5,1)
+9 IF V=""
SET $PIECE(BDMCUML(175),U,10)=$PIECE(BDMCUML(175),U,10)+1
GOTO TCHOL
+10 ;EGFR DONE
SET $PIECE(BDMCUML(175),U,5)=$PIECE(BDMCUML(175),U,5)+1
+11 SET BDMEGFRV=+V
+12 IF +V<60
SET BDMCKD=1
+13 IF +V>59
SET $PIECE(BDMCUML(175),U,6)=$PIECE(BDMCUML(175),U,6)+1
GOTO TCHOL
+14 IF +V<15
SET $PIECE(BDMCUML(175),U,9)=$PIECE(BDMCUML(175),U,9)+1
GOTO TCHOL
+15 IF +V>29
IF +V<60
SET $PIECE(BDMCUML(175),U,7)=$PIECE(BDMCUML(175),U,7)+1
GOTO TCHOL
+16 IF +V>14
IF +V<30
SET $PIECE(BDMCUML(175),U,8)=$PIECE(BDMCUML(175),U,8)+1
GOTO TCHOL
+17 ;
TCHOL ;
+1 IF '$DATA(BDMCUML(180))
SET BDMCUML(180)="Total Cholesterol obtained in past 12 months"
+2 SET $PIECE(BDMCUML(180),U,2)=$PIECE(BDMCUML(180),U,2)+1
+3 SET V=$$CHOL^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
+4 IF V=""
SET $PIECE(BDMCUML(180),U,6)=$PIECE(BDMCUML(180),U,6)+1
GOTO NONHDL
+5 SET V=$PIECE(V,U)
+6 SET V=$$STV^BDMDG18(V,5,1)
+7 IF V=""
SET $PIECE(BDMCUML(180),U,7)=$PIECE(BDMCUML(180),U,7)+1
GOTO NONHDL
+8 IF $EXTRACT(V)'=+$EXTRACT(V)!(+V=0)
SET $PIECE(BDMCUML(180),U,7)=$PIECE(BDMCUML(180),U,7)+1
GOTO NONHDL
+9 IF V<200
SET $PIECE(BDMCUML(180),U,3)=$PIECE(BDMCUML(180),U,3)+1
GOTO NONHDL
+10 IF V<240
SET $PIECE(BDMCUML(180),U,4)=$PIECE(BDMCUML(180),U,4)+1
GOTO NONHDL
+11 SET $PIECE(BDMCUML(180),U,5)=$PIECE(BDMCUML(180),U,5)+1
NONHDL ;
LDL ;
+1 IF '$DATA(BDMCUML(190))
SET BDMCUML(190)="LDL Cholesterol obtained during audit period"
+2 SET $PIECE(BDMCUML(190),U,2)=$PIECE(BDMCUML(190),U,2)+1
+3 SET V=$$LDL^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
+4 IF V=""
SET $PIECE(BDMCUML(190),U,7)=$PIECE(BDMCUML(190),U,7)+1
GOTO HDL
+5 SET V=$PIECE(V,U)
+6 ;S V=$$STV^BDMDG18(V,4)
+7 SET V=$$STV^BDMDG18(V,5,1)
IF $EXTRACT(V)'=+$EXTRACT(V)!(+V=0)
SET $PIECE(BDMCUML(190),U,8)=$PIECE(BDMCUML(190),U,8)+1
GOTO HDL
+8 IF V<100
SET $PIECE(BDMCUML(190),U,3)=$PIECE(BDMCUML(190),U,3)+1
GOTO HDL
+9 IF V<190
SET $PIECE(BDMCUML(190),U,4)=$PIECE(BDMCUML(190),U,4)+1
GOTO HDL
+10 ;I V<189.1 S $P(BDMCUML(190),U,5)=$P(BDMCUML(190),U,5)+1 G HDL
+11 SET $PIECE(BDMCUML(190),U,6)=$PIECE(BDMCUML(190),U,6)+1
HDL ;
+1 IF '$DATA(BDMCUML(195))
SET BDMCUML(195)="HDL Cholesterol obtained during audit period"
+2 SET V=$$HDL^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
+3 ;GENDER
SET S=$PIECE(^DPT(BDMPD,0),U,2)
+4 IF S="F"
Begin DoDot:1
+5 SET $PIECE(BDMCUML(195),U,2)=$PIECE(BDMCUML(195),U,2)+1
+6 IF V=""
SET $PIECE(BDMCUML(195),U,5)=$PIECE(BDMCUML(195),U,5)+1
QUIT
+7 SET V=$PIECE(V,U)
+8 SET V=$$STV^BDMDG18(V,5,1)
IF $EXTRACT(V)'=+$EXTRACT(V)!(+V=0)
SET $PIECE(BDMCUML(195),U,5)=$PIECE(BDMCUML(195),U,5)+1
QUIT
+9 SET V=$PIECE(V,".")
SET V=$$STV^BDMDG18(V,5,1)
+10 IF $EXTRACT(V)'=+$EXTRACT(V)!(+V=0)!(V="")
SET $PIECE(BDMCUML(195),U,5)=$PIECE(BDMCUML(195),U,5)+1
QUIT
+11 IF V<50
SET $PIECE(BDMCUML(195),U,3)=$PIECE(BDMCUML(195),U,3)+1
QUIT
+12 SET $PIECE(BDMCUML(195),U,4)=$PIECE(BDMCUML(195),U,4)+1
QUIT
End DoDot:1
+13 IF S="M"
Begin DoDot:1
+14 SET $PIECE(BDMCUML(195),U,6)=$PIECE(BDMCUML(195),U,6)+1
+15 IF V=""
SET $PIECE(BDMCUML(195),U,9)=$PIECE(BDMCUML(195),U,9)+1
QUIT
+16 SET V=$PIECE(V,U)
+17 ;unable to determine result, not a number
SET V=$$STV^BDMDG18(V,5,1)
IF $EXTRACT(V)'=+$EXTRACT(V)!(+V=0)
SET $PIECE(BDMCUML(195),U,9)=$PIECE(BDMCUML(195),U,9)+1
QUIT
+18 SET V=$PIECE(V,".")
SET V=$$STV^BDMDG18(V,5,1)
+19 ;unable to determine result, not a number
IF $EXTRACT(V)'=+$EXTRACT(V)!(+V=0)!(V="")
SET $PIECE(BDMCUML(195),U,9)=$PIECE(BDMCUML(195),U,9)+1
QUIT
+20 IF V<40
SET $PIECE(BDMCUML(195),U,7)=$PIECE(BDMCUML(195),U,7)+1
QUIT
+21 SET $PIECE(BDMCUML(195),U,8)=$PIECE(BDMCUML(195),U,8)+1
QUIT
End DoDot:1
TRIG ;
+1 IF '$DATA(BDMCUML(200))
SET BDMCUML(200)="Triglycerides obtained in past 12 months"
+2 SET $PIECE(BDMCUML(200),U,2)=$PIECE(BDMCUML(200),U,2)+1
+3 SET V=$$TRIG^BDMDG18(BDMPD,BDMBDAT,BDMADAT,"I")
+4 IF V=""
SET $PIECE(BDMCUML(200),U,7)=$PIECE(BDMCUML(200),U,7)+1
GOTO ACE
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number
SET V=$$STV^BDMDG18(V,5,1)
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(BDMCUML(200),U,5)=$PIECE(BDMCUML(200),U,5)+1
GOTO ACE
+7 IF V<150
SET $PIECE(BDMCUML(200),U,3)=$PIECE(BDMCUML(200),U,3)+1
GOTO ACE
+8 IF V<500
SET $PIECE(BDMCUML(200),U,8)=$PIECE(BDMCUML(200),U,8)+1
GOTO ACE
+9 IF V<1000
SET $PIECE(BDMCUML(200),U,9)=$PIECE(BDMCUML(200),U,9)+1
GOTO ACE
+10 SET $PIECE(BDMCUML(200),U,4)=$PIECE(BDMCUML(200),U,4)+1
+11 ;
ACE ;110 title^total pts^total pts with protein^# of those on ace^# with htn^# of those on ace"
+1 SET $PIECE(BDMCUML(110),U,2)=$PIECE(BDMCUML(110),U,2)+1
+2 ;set 3rd piece with # with proteinuria
+3 ;URINE PROTEIN VALUE
SET P=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))
+4 SET H=$EXTRACT($GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,34)))
+5 SET A=$EXTRACT($GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,60)))
+6 ;TOTAL ACE
IF A
SET $PIECE(BDMCUML(110),U,3)=$PIECE(BDMCUML(110),U,3)+1
+7 ;TOTAL HTN
IF $EXTRACT(H)=1
SET $PIECE(BDMCUML(110),U,5)=$PIECE(BDMCUML(110),U,5)+1
IF A=1
SET $PIECE(BDMCUML(110),U,7)=$PIECE(BDMCUML(110),U,7)+1
+8 ;TOTAL CKD
IF BDMCKD
IF $$AGE^AUPNPAT(BDMPD)>17
SET $PIECE(BDMCUML(110),U,4)=$PIECE(BDMCUML(110),U,4)+1
IF A=1
SET $PIECE(BDMCUML(110),U,8)=$PIECE(BDMCUML(110),U,8)+1
CVD ;USE 250
+1 IF '$DATA(BDMCUML(250))
SET BDMCUML(250)="Cardiovascular Disease"
+2 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,116))
+3 IF $EXTRACT(V)=1
SET $PIECE(BDMCUML(250),U,3)=$PIECE(BDMCUML(250),U,3)+1
+4 SET $PIECE(BDMCUML(250),U,2)=$PIECE(BDMCUML(250),U,2)+1
EGFRQUP ;
+1 IF '$DATA(BDMCUML(270))
SET BDMCUML(270)="eGFR and QUANTITATIVE URINARY PROTEIN ASSESSMENT"
+2 IF $$AGE^AUPNPAT(BDMPD,BDMADAT)<18
GOTO COMBINED
+3 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,79))
SET V=$$STV^BDMDG18($PIECE(V,U,2),5)
+4 ;type of test
SET T=$PIECE($GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92)),U,5)
+5 SET Q=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))
+6 SET $PIECE(BDMCUML(270),U,2)=$PIECE(BDMCUML(270),U,2)+1
+7 ;value/result
SET R=$SELECT($PIECE(Q,U,6)]"":$PIECE(Q,U,6),1:$PIECE(Q,U,2))
+8 ;CONVERT RESULT LIKE IN WEB EXPORT
+9 SET S=$$AS^BDMDG18(R)
SET S=$$STV^BDMDG18(S,8)
+10 ;I S="" S V=0 ;X=$E(X,1,5)
+11 IF V]""
IF T=1
IF S]""
SET $PIECE(BDMCUML(270),U,3)=$PIECE(BDMCUML(270),U,3)+1
SET BDMEGFRU=1
COMBINED ;USE 260
+1 IF '$DATA(BDMCUML(260))
SET BDMCUML(260)="Combined Outcome Measure"
+2 ;ONLY 40 AND OLDER
+3 IF $$AGE^AUPNPAT(BDMPD,BDMADAT)<40
GOTO E
+4 ;statin allergy
IF $EXTRACT($GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,300)))=3
GOTO E
+5 SET V=$GET(^XTMP("BDMDM19",BDMJOB,BDMBTH,"AUDIT",BDMPD,118))
+6 IF $EXTRACT(V)=1
SET $PIECE(BDMCUML(260),U,3)=$PIECE(BDMCUML(260),U,3)+1
+7 SET $PIECE(BDMCUML(260),U,2)=$PIECE(BDMCUML(260),U,2)+1
E GOTO CUML^BDMDG1J
+1 ;
CESS(P,BDATE,EDATE) ;EP - find any cessation hf in 12 months before E
+1 GOTO CESS^BDMDG1B