APCLP711 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;
;
EKG ;need date of last ekg
S:'$D(APCLCUML(150)) APCLCUML(150)="EKG"
S $P(APCLCUML(150),U,2)=$P(APCLCUML(150),U,2)+1
S V=$$EKG^APCLP712(APCLPD,APCLRED,"I")
I V]"" D
.S E=$$FMDIFF^XLFDT(APCLADAT,V)
.I E<(365.25*3) S $P(APCLCUML(150),U,3)=$P(APCLCUML(150),U,3)+1
.I E<(365.25*5) S $P(APCLCUML(150),U,4)=$P(APCLCUML(150),U,4)+1
.S $P(APCLCUML(150),U,5)=$P(APCLCUML(150),U,5)+1
TCHOL ;
S:'$D(APCLCUML(180)) APCLCUML(180)="Total Cholesterol obtained in past 12 months"
S $P(APCLCUML(180),U,2)=$P(APCLCUML(180),U,2)+1
S V=$$CHOL^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
I V="" S $P(APCLCUML(180),U,6)=$P(APCLCUML(180),U,6)+1 G LDL
S V=$P(V,U)
I $E(V)'=+$E(V) S $P(APCLCUML(180),U,7)=$P(APCLCUML(180),U,7)+1 G LDL ;unable to determine result, not a number or is blank
I V<200 S $P(APCLCUML(180),U,3)=$P(APCLCUML(180),U,3)+1
I V<240&(V>199) S $P(APCLCUML(180),U,4)=$P(APCLCUML(180),U,4)+1
I V>239 S $P(APCLCUML(180),U,5)=$P(APCLCUML(180),U,5)+1
LDL ;
S:'$D(APCLCUML(190)) APCLCUML(190)="LDL Cholesterol obtained in the past 12 months"
S $P(APCLCUML(190),U,2)=$P(APCLCUML(190),U,2)+1
S V=$$LDL^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
I V="" S $P(APCLCUML(190),U,7)=$P(APCLCUML(190),U,7)+1 G HDL
S V=$P(V,U)
I $E(V)'=+$E(V) S $P(APCLCUML(190),U,8)=$P(APCLCUML(190),U,8)+1 G HDL ;unable to determine result, not a number or blank
I V<100 S $P(APCLCUML(190),U,3)=$P(APCLCUML(190),U,3)+1
I V<130&(V>99) S $P(APCLCUML(190),U,4)=$P(APCLCUML(190),U,4)+1
I V>129&(V<161) S $P(APCLCUML(190),U,5)=$P(APCLCUML(190),U,5)+1
I V>160 S $P(APCLCUML(190),U,6)=$P(APCLCUML(190),U,6)+1
HDL ;
S:'$D(APCLCUML(195)) APCLCUML(195)="HDL Cholesterol obtained in the past 12 months"
S $P(APCLCUML(195),U,2)=$P(APCLCUML(195),U,2)+1
S V=$$HDL^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
I V="" S $P(APCLCUML(195),U,7)=$P(APCLCUML(195),U,7)+1 G TRIG
S V=$P(V,U)
I $E(V)'=+$E(V) S $P(APCLCUML(195),U,8)=$P(APCLCUML(195),U,8)+1 G TRIG ;unable to determine result, not a number
S V=$P(V,".")
I V<35 S $P(APCLCUML(195),U,3)=$P(APCLCUML(195),U,3)+1
I V<46&(V>34) S $P(APCLCUML(195),U,4)=$P(APCLCUML(195),U,4)+1
I V>45&(V<56) S $P(APCLCUML(195),U,5)=$P(APCLCUML(195),U,5)+1
I V>55 S $P(APCLCUML(195),U,6)=$P(APCLCUML(195),U,6)+1
TRIG ;
S:'$D(APCLCUML(200)) APCLCUML(200)="Triglycerides obtained in past 12 months"
S $P(APCLCUML(200),U,2)=$P(APCLCUML(200),U,2)+1
S V=$$TRIG^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
I V="" S $P(APCLCUML(200),U,7)=$P(APCLCUML(200),U,7)+1 G FAST
S V=$P(V,U)
I $E(V)'=+$E(V) S $P(APCLCUML(200),U,8)=$P(APCLCUML(200),U,8)+1 G FAST ;unable to determine result, not a number
I V<150 S $P(APCLCUML(200),U,3)=$P(APCLCUML(200),U,3)+1
I V<200&(V>149) S $P(APCLCUML(200),U,4)=$P(APCLCUML(200),U,4)+1
I V>199&(V<401) S $P(APCLCUML(200),U,5)=$P(APCLCUML(200),U,5)+1
I V>400 S $P(APCLCUML(200),U,6)=$P(APCLCUML(200),U,6)+1
FAST ;
S:'$D(APCLCUML(600)) APCLCUML(600)="Fasting Glucose obtained ever"
S $P(APCLCUML(600),U,2)=$P(APCLCUML(600),U,2)+1
S V=$$FGLUCOSE^APCLD718(APCLPD,$P(^DPT(APCLPD,0),U,3),APCLADAT,"I")
I V="" S $P(APCLCUML(600),U,7)=$P(APCLCUML(600),U,7)+1 G G75
S V=$P(V,U)
I $E(V)'=+$E(V) S $P(APCLCUML(600),U,8)=$P(APCLCUML(600),U,8)+1 G G75 ;unable to determine result, not a number
S $P(APCLCUML(600),U,3)=$P(APCLCUML(600),U,3)+1
G75 ;
S:'$D(APCLCUML(610)) APCLCUML(610)="75gm 2 hour glucose obtained ever"
S $P(APCLCUML(610),U,2)=$P(APCLCUML(610),U,2)+1
S V=$$G75^APCLD718(APCLPD,$P(^DPT(APCLPD,0),U,3),APCLADAT,"I")
I V="" S $P(APCLCUML(610),U,7)=$P(APCLCUML(610),U,7)+1 G END
S V=$P(V,U)
I $E(V)'=+$E(V) S $P(APCLCUML(610),U,8)=$P(APCLCUML(610),U,8)+1 G END ;unable to determine result, not a number
S $P(APCLCUML(610),U,3)=$P(APCLCUML(610),U,3)+1
END Q
CESS(P,B,D) ;EP - find any cessation hf in 12 months before E
I '$G(P) Q ""
NEW APCL,E,X,G,T
K APCL
S X=P_"^LAST HEALTH [DM AUDIT CESSATION HLTH FACTOR;DURING "_B_"-"_D S E=$$START1^APCLDF(X,"APCL(")
I $D(APCL(1)) Q "Yes-"_$$FMTE^XLFDT($P(APCL(1),U))
S X=P_"^EDUC [DM AUDIT SMOKING CESS EDUC;DURING "_B_"-"_D S E=$$START1^APCLDF(X,"APCL(")
I $D(APCL(1)) Q "Yes-"_$$FMTE^XLFDT($P(APCL(1),U))
NEW T S T=$O(^ATXAX("B","DM AUDIT SMOKING CESS EDUC",0))
I 'T Q "No"
S (X,G)=0 F S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G) I $$REFUSAL^APCLP717(P,9999999.09,$P(^ATXAX(T,21,X,0),U),B,D) S G=1
I G Q "Refused"
Q "No"
;
APCLP711 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;
+3 ;
EKG ;need date of last ekg
+1 IF '$DATA(APCLCUML(150))
SET APCLCUML(150)="EKG"
+2 SET $PIECE(APCLCUML(150),U,2)=$PIECE(APCLCUML(150),U,2)+1
+3 SET V=$$EKG^APCLP712(APCLPD,APCLRED,"I")
+4 IF V]""
Begin DoDot:1
+5 SET E=$$FMDIFF^XLFDT(APCLADAT,V)
+6 IF E<(365.25*3)
SET $PIECE(APCLCUML(150),U,3)=$PIECE(APCLCUML(150),U,3)+1
+7 IF E<(365.25*5)
SET $PIECE(APCLCUML(150),U,4)=$PIECE(APCLCUML(150),U,4)+1
+8 SET $PIECE(APCLCUML(150),U,5)=$PIECE(APCLCUML(150),U,5)+1
End DoDot:1
TCHOL ;
+1 IF '$DATA(APCLCUML(180))
SET APCLCUML(180)="Total Cholesterol obtained in past 12 months"
+2 SET $PIECE(APCLCUML(180),U,2)=$PIECE(APCLCUML(180),U,2)+1
+3 SET V=$$CHOL^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
+4 IF V=""
SET $PIECE(APCLCUML(180),U,6)=$PIECE(APCLCUML(180),U,6)+1
GOTO LDL
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number or is blank
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(APCLCUML(180),U,7)=$PIECE(APCLCUML(180),U,7)+1
GOTO LDL
+7 IF V<200
SET $PIECE(APCLCUML(180),U,3)=$PIECE(APCLCUML(180),U,3)+1
+8 IF V<240&(V>199)
SET $PIECE(APCLCUML(180),U,4)=$PIECE(APCLCUML(180),U,4)+1
+9 IF V>239
SET $PIECE(APCLCUML(180),U,5)=$PIECE(APCLCUML(180),U,5)+1
LDL ;
+1 IF '$DATA(APCLCUML(190))
SET APCLCUML(190)="LDL Cholesterol obtained in the past 12 months"
+2 SET $PIECE(APCLCUML(190),U,2)=$PIECE(APCLCUML(190),U,2)+1
+3 SET V=$$LDL^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
+4 IF V=""
SET $PIECE(APCLCUML(190),U,7)=$PIECE(APCLCUML(190),U,7)+1
GOTO HDL
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number or blank
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(APCLCUML(190),U,8)=$PIECE(APCLCUML(190),U,8)+1
GOTO HDL
+7 IF V<100
SET $PIECE(APCLCUML(190),U,3)=$PIECE(APCLCUML(190),U,3)+1
+8 IF V<130&(V>99)
SET $PIECE(APCLCUML(190),U,4)=$PIECE(APCLCUML(190),U,4)+1
+9 IF V>129&(V<161)
SET $PIECE(APCLCUML(190),U,5)=$PIECE(APCLCUML(190),U,5)+1
+10 IF V>160
SET $PIECE(APCLCUML(190),U,6)=$PIECE(APCLCUML(190),U,6)+1
HDL ;
+1 IF '$DATA(APCLCUML(195))
SET APCLCUML(195)="HDL Cholesterol obtained in the past 12 months"
+2 SET $PIECE(APCLCUML(195),U,2)=$PIECE(APCLCUML(195),U,2)+1
+3 SET V=$$HDL^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
+4 IF V=""
SET $PIECE(APCLCUML(195),U,7)=$PIECE(APCLCUML(195),U,7)+1
GOTO TRIG
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(APCLCUML(195),U,8)=$PIECE(APCLCUML(195),U,8)+1
GOTO TRIG
+7 SET V=$PIECE(V,".")
+8 IF V<35
SET $PIECE(APCLCUML(195),U,3)=$PIECE(APCLCUML(195),U,3)+1
+9 IF V<46&(V>34)
SET $PIECE(APCLCUML(195),U,4)=$PIECE(APCLCUML(195),U,4)+1
+10 IF V>45&(V<56)
SET $PIECE(APCLCUML(195),U,5)=$PIECE(APCLCUML(195),U,5)+1
+11 IF V>55
SET $PIECE(APCLCUML(195),U,6)=$PIECE(APCLCUML(195),U,6)+1
TRIG ;
+1 IF '$DATA(APCLCUML(200))
SET APCLCUML(200)="Triglycerides obtained in past 12 months"
+2 SET $PIECE(APCLCUML(200),U,2)=$PIECE(APCLCUML(200),U,2)+1
+3 SET V=$$TRIG^APCLD718(APCLPD,APCLBDAT,APCLADAT,"I")
+4 IF V=""
SET $PIECE(APCLCUML(200),U,7)=$PIECE(APCLCUML(200),U,7)+1
GOTO FAST
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(APCLCUML(200),U,8)=$PIECE(APCLCUML(200),U,8)+1
GOTO FAST
+7 IF V<150
SET $PIECE(APCLCUML(200),U,3)=$PIECE(APCLCUML(200),U,3)+1
+8 IF V<200&(V>149)
SET $PIECE(APCLCUML(200),U,4)=$PIECE(APCLCUML(200),U,4)+1
+9 IF V>199&(V<401)
SET $PIECE(APCLCUML(200),U,5)=$PIECE(APCLCUML(200),U,5)+1
+10 IF V>400
SET $PIECE(APCLCUML(200),U,6)=$PIECE(APCLCUML(200),U,6)+1
FAST ;
+1 IF '$DATA(APCLCUML(600))
SET APCLCUML(600)="Fasting Glucose obtained ever"
+2 SET $PIECE(APCLCUML(600),U,2)=$PIECE(APCLCUML(600),U,2)+1
+3 SET V=$$FGLUCOSE^APCLD718(APCLPD,$PIECE(^DPT(APCLPD,0),U,3),APCLADAT,"I")
+4 IF V=""
SET $PIECE(APCLCUML(600),U,7)=$PIECE(APCLCUML(600),U,7)+1
GOTO G75
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(APCLCUML(600),U,8)=$PIECE(APCLCUML(600),U,8)+1
GOTO G75
+7 SET $PIECE(APCLCUML(600),U,3)=$PIECE(APCLCUML(600),U,3)+1
G75 ;
+1 IF '$DATA(APCLCUML(610))
SET APCLCUML(610)="75gm 2 hour glucose obtained ever"
+2 SET $PIECE(APCLCUML(610),U,2)=$PIECE(APCLCUML(610),U,2)+1
+3 SET V=$$G75^APCLD718(APCLPD,$PIECE(^DPT(APCLPD,0),U,3),APCLADAT,"I")
+4 IF V=""
SET $PIECE(APCLCUML(610),U,7)=$PIECE(APCLCUML(610),U,7)+1
GOTO END
+5 SET V=$PIECE(V,U)
+6 ;unable to determine result, not a number
IF $EXTRACT(V)'=+$EXTRACT(V)
SET $PIECE(APCLCUML(610),U,8)=$PIECE(APCLCUML(610),U,8)+1
GOTO END
+7 SET $PIECE(APCLCUML(610),U,3)=$PIECE(APCLCUML(610),U,3)+1
END QUIT
CESS(P,B,D) ;EP - find any cessation hf in 12 months before E
+1 IF '$GET(P)
QUIT ""
+2 NEW APCL,E,X,G,T
+3 KILL APCL
+4 SET X=P_"^LAST HEALTH [DM AUDIT CESSATION HLTH FACTOR;DURING "_B_"-"_D
SET E=$$START1^APCLDF(X,"APCL(")
+5 IF $DATA(APCL(1))
QUIT "Yes-"_$$FMTE^XLFDT($PIECE(APCL(1),U))
+6 SET X=P_"^EDUC [DM AUDIT SMOKING CESS EDUC;DURING "_B_"-"_D
SET E=$$START1^APCLDF(X,"APCL(")
+7 IF $DATA(APCL(1))
QUIT "Yes-"_$$FMTE^XLFDT($PIECE(APCL(1),U))
+8 NEW T
SET T=$ORDER(^ATXAX("B","DM AUDIT SMOKING CESS EDUC",0))
+9 IF 'T
QUIT "No"
+10 SET (X,G)=0
FOR
SET X=$ORDER(^ATXAX(T,21,X))
IF X'=+X!(G)
QUIT
IF $$REFUSAL^APCLP717(P,9999999.09,$PIECE(^ATXAX(T,21,X,0),U),B,D)
SET G=1
+11 IF G
QUIT "Refused"
+12 QUIT "No"
+13 ;