Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BDMD711

BDMD711.m

Go to the documentation of this file.
BDMD711 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT ;
 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
 ;
 ;
IMM ;
 S:'$D(BDMCUML(140)) BDMCUML(140)="IMMUNIZATIONS"
 S $P(BDMCUML(140),U,2)=$P(BDMCUML(140),U,2)+1
 S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,64))
 I $E(V)="Y" S $P(BDMCUML(140),U,3)=$P(BDMCUML(140),U,3)+1
 I $E(V)="R" S $P(BDMCUML(140),U,6)=$P(BDMCUML(140),U,6)+1
 S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,66))
 I $E(V)="Y" S $P(BDMCUML(140),U,4)=$P(BDMCUML(140),U,4)+1
 I $E(V)="R" S $P(BDMCUML(140),U,7)=$P(BDMCUML(140),U,7)+1
 S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,68))
 I $E(V)="Y" S $P(BDMCUML(140),U,5)=$P(BDMCUML(140),U,5)+1
 I $E(V)="R" S $P(BDMCUML(140),U,8)=$P(BDMCUML(140),U,8)+1
URIN ;
 ;title^total^total with urinalysis^protein present^protein absent^protein not done^micro present^micro absent^micro not done
 ;145
 S:'$D(BDMCUML(145)) BDMCUML(145)="URINALYSIS"
 S $P(BDMCUML(145),U,2)=$P(BDMCUML(145),U,2)+1
 S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,92))
 S A=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,94))
 I $E(V)="Y" S $P(BDMCUML(145),U,3)=$P(BDMCUML(145),U,3)+1
 I $E(A)="Y" S $P(BDMCUML(145),U,4)=$P(BDMCUML(145),U,4)+1
 I A["No result" S $P(BDMCUML(145),U,6)=$P(BDMCUML(145),U,6)+1 G EKG
 I $E(A)="N" S $P(BDMCUML(145),U,5)=$P(BDMCUML(145),U,5)+1 D
 .S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,96))
 .I $E(V,1,3)="Pos" S $P(BDMCUML(145),U,7)=$P(BDMCUML(145),U,7)+1 Q
 .I $E(V,1,3)="Neg" S $P(BDMCUML(145),U,8)=$P(BDMCUML(145),U,8)+1 Q
 .S $P(BDMCUML(145),U,9)=$P(BDMCUML(145),U,9)+1
 .Q
EKG ;need date of last ekg
 S:'$D(BDMCUML(150)) BDMCUML(150)="EKG"
 G:$$AGE^AUPNPAT(BDMPD,BDMADAT)<30 CREAT
 S $P(BDMCUML(150),U,2)=$P(BDMCUML(150),U,2)+1
 S V=$$EKG^BDMD712(BDMPD,BDMRED,"I")
 I V]"" D
 .S E=$$FMDIFF^XLFDT(BDMADAT,V)
 .I E<(365.25*3) S $P(BDMCUML(150),U,3)=$P(BDMCUML(150),U,3)+1
 .I E<(365.25*5) S $P(BDMCUML(150),U,4)=$P(BDMCUML(150),U,4)+1
 .S $P(BDMCUML(150),U,5)=$P(BDMCUML(150),U,5)+1
CREAT ;
 S:'$D(BDMCUML(170)) BDMCUML(170)="Creatinine obtained in the past 12 months"
 S $P(BDMCUML(170),U,2)=$P(BDMCUML(170),U,2)+1
 S V=$$CREAT^BDMD718(BDMPD,BDMBDAT,BDMADAT,"I")
 I V="" S $P(BDMCUML(170),U,5)=$P(BDMCUML(170),U,5)+1 G TCHOL
 S V=$P(V,U)
 I $E(V)'=+$E(V),$E(V)'="." S $P(BDMCUML(170),U,6)=$P(BDMCUML(170),U,6)+1 G TCHOL ;unable to determine result, not a number
 I V>1.9 S $P(BDMCUML(170),U,3)=$P(BDMCUML(170),U,3)+1
 I V<2.0 S $P(BDMCUML(170),U,4)=$P(BDMCUML(170),U,4)+1
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^BDMD718(BDMPD,BDMBDAT,BDMADAT,"I")
 I V="" S $P(BDMCUML(180),U,6)=$P(BDMCUML(180),U,6)+1 G LDL
 S V=$P(V,U)
 I $E(V)'=+$E(V) S $P(BDMCUML(180),U,7)=$P(BDMCUML(180),U,7)+1 G LDL ;unable to determine result, not a number or is blank
 I V<200 S $P(BDMCUML(180),U,3)=$P(BDMCUML(180),U,3)+1 G LDL
 I V<240 S $P(BDMCUML(180),U,4)=$P(BDMCUML(180),U,4)+1 G LDL
 S $P(BDMCUML(180),U,5)=$P(BDMCUML(180),U,5)+1
LDL ;
 S:'$D(BDMCUML(190)) BDMCUML(190)="LDL Cholesterol obtained in the past 12 months"
 S $P(BDMCUML(190),U,2)=$P(BDMCUML(190),U,2)+1
 S V=$$LDL^BDMD718(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)
 I $E(V)'=+$E(V) S $P(BDMCUML(190),U,8)=$P(BDMCUML(190),U,8)+1 G HDL ;unable to determine result, not a number or blank
 I V<100 S $P(BDMCUML(190),U,3)=$P(BDMCUML(190),U,3)+1 G HDL
 I V<130 S $P(BDMCUML(190),U,4)=$P(BDMCUML(190),U,4)+1 G HDL
 I V<160.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 in the past 12 months"
 S $P(BDMCUML(195),U,2)=$P(BDMCUML(195),U,2)+1
 S V=$$HDL^BDMD718(BDMPD,BDMBDAT,BDMADAT,"I")
 I V="" S $P(BDMCUML(195),U,7)=$P(BDMCUML(195),U,7)+1 G TRIG
 S V=$P(V,U)
 I $E(V)'=+$E(V) S $P(BDMCUML(195),U,8)=$P(BDMCUML(195),U,8)+1 G TRIG ;unable to determine result, not a number
 S V=$P(V,".")
 I V<35 S $P(BDMCUML(195),U,3)=$P(BDMCUML(195),U,3)+1 G TRIG
 I V<46 S $P(BDMCUML(195),U,4)=$P(BDMCUML(195),U,4)+1 G TRIG
 I V<55.1 S $P(BDMCUML(195),U,5)=$P(BDMCUML(195),U,5)+1 G TRIG
 S $P(BDMCUML(195),U,6)=$P(BDMCUML(195),U,6)+1
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^BDMD718(BDMPD,BDMBDAT,BDMADAT,"I")
 I V="" S $P(BDMCUML(200),U,7)=$P(BDMCUML(200),U,7)+1 G SELF
 S V=$P(V,U)
 I $E(V)'=+$E(V) S $P(BDMCUML(200),U,8)=$P(BDMCUML(200),U,8)+1 G SELF ;unable to determine result, not a number
 I V<150 S $P(BDMCUML(200),U,3)=$P(BDMCUML(200),U,3)+1 G SELF
 I V<200 S $P(BDMCUML(200),U,4)=$P(BDMCUML(200),U,4)+1 G SELF
 I V<401 S $P(BDMCUML(200),U,5)=$P(BDMCUML(200),U,5)+1 G SELF
 S $P(BDMCUML(200),U,6)=$P(BDMCUML(200),U,6)+1
SELF ;
 ;S:'$D(BDMCUML(210)) BDMCUML(210)="Self monitoring of blood glucose documented"
 ;S $P(BDMCUML(210),U,2)=$P(BDMCUML(210),U,2)+1
 ;S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,98))
 ;S P=$S($E(V)="Y":3,$E(V)="N":4,$E(V)="R":5,1:6)
 ;S $P(BDMCUML(210),U,P)=$P(BDMCUML(210),U,P)+1
SDM  ;
 ;Q  ;NOT IN 2007
 ;S:'$D(BDMCUML(220)) BDMCUML(220)="Participating in SDM"
 ;S $P(BDMCUML(220),U,2)=$P(BDMCUML(220),U,2)+1
 ;S V=$G(^XTMP("BDMDM71",BDMJOB,BDMBTH,"AUDIT",BDMPD,100))
 ;S P=$S($E(V)="Y":3,1:4)
 ;S $P(BDMCUML(220),U,P)=$P(BDMCUML(220),U,P)+1
 Q
PED(P,BDATE,EDATE) ;EP
 K BDMALED
 NEW Y,B,D,T,A,G,Z,V,X
 S Y="BDMALED("
 S X=P_"^ALL EDUC;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,Y)
 I $D(BDMALED(1)) S %="" D  I %]"" Q %
 .S (X,D)=0,%="",T="" F  S X=$O(BDMALED(X)) Q:X'=+X!(%]"")  D
 ..S T=$P(^AUPNVPED(+$P(BDMALED(X),U,4),0),U)
 ..Q:'T
 ..Q:'$D(^AUTTEDT(T,0))
 ..S T=$P(^AUTTEDT(T,0),U,2)
 ..I $E(T,1,4)="TO-Q" S %="Yes-"_T_" "_$$FMTE^XLFDT($P(BDMALED(X),U),5) Q
 ..I T="TO-LA" S %="Yes-"_T_" "_$$FMTE^XLFDT($P(BDMALED(X),U),5) Q
 K ^TMP($J,"A")
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q ""
 S X=0,G="" F  S X=$O(^TMP($J,"A",X)) Q:X'=+X!(G]"")  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .S B=$$CLINIC^APCLV(V,"C")
 .I B=94 S G="Yes-"_$$FMTE^XLFDT($P($P(^AUPNVSIT(V,0),U),"."),5)_" CL 94" Q
 .S Z=0 F  S Z=$O(^AUPNVDEN("AD",V,Z)) Q:Z'=+Z!(G)  S B=$P($G(^AUPNVDEN(Z,0)),U) I B S B=$P($G(^AUTTADA(B,0)),U) I B=1320 S G="Yes-"_$$FMTE^XLFDT($P($P(^AUPNVSIT(V,0),U),"."),5)_" ADA 1320" Q
 .Q
 Q G
CESS(P,B,D) ;EP - find any cessation hf in 12 months before E
 I '$G(P) Q ""
 NEW BDM,E,X,G,T
 K BDM
 S X=P_"^LAST HEALTH [DM AUDIT CESSATION HLTH FACTOR;DURING "_B_"-"_D S E=$$START1^APCLDF(X,"BDM(")
 I $D(BDM(1)) Q "Yes-"_$$FMTE^XLFDT($P(BDM(1),U),5)
 S X=P_"^EDUC [DM AUDIT SMOKING CESS EDUC;DURING "_B_"-"_D S E=$$START1^APCLDF(X,"BDM(")
 I $D(BDM(1)) Q "Yes-"_$$FMTE^XLFDT($P(BDM(1),U),5)
 S BDM=$$PED(P,B,D)
 I BDM]"" Q BDM
 NEW T S T=$O(^ATXAX("B","DM AUDIT SMOKING CESS EDUC",0))
 ;I 'T Q "No"
 S (X,G)=0
 I T F  S X=$O(^ATXAX(T,21,X)) Q:X'=+X!(G)  I $$REFUSAL^BDMD717(P,9999999.09,$P(^ATXAX(T,21,X,0),U),B,D) S G=1
 I G Q "Refused"
 S X=$O(^AUTTEDT("C","TO-Q",0))
 I X,$$REFUSAL^BDMD717(P,9999999.09,X,B,D) Q "Refused"
 S X=$O(^AUTTEDT("C","TO-LA",0))
 I X,$$REFUSAL^BDMD717(P,9999999.09,X,B,D) Q "Refused"
 S X=$O(^AUTTEDT("C","TO-QT",0))
 I X,$$REFUSAL^BDMD717(P,9999999.09,X,B,D) Q "Refused"
 S X=$O(^AUTTEDT("C","TO-QU",0))
 I X,$$REFUSAL^BDMD717(P,9999999.09,X,B,D) Q "Refused"
 Q "No"
 ;