BDMD994 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT ;
;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
;
;
DURDM(P,R,EDATE,F) ;EP
I $G(F)="" S F="E"
NEW DATE
S DATE=""
I $G(R) S DATE=$$CMSFDX^BDMD997(P,R,"ID")
I DATE]"" Q $S(F="I":DATE,1:$$D(DATE))
S DATE=$$PLDMDOO^BDMD997(P,"I")
I DATE]"" Q ($$FMDIFF^XLFDT(EDATE,DATE,1)\365)
;S DATE=$$FRSTDMDX^BDMD997(P,"I")
;I DATE]"" Q $S(F="I":DATE,1:$$D(DATE))
Q ""
D(D) ;
I $G(D)="" Q ""
Q $S($E(D,4,5)="00":"07",1:$E(D,4,5))_"/"_$S($E(D,6,7)="00":"15",1:$E(D,6,7))_"/"_$E(D,2,3)
OB(BDMPD,BMI,D) ;EP obese
I $G(BMI)="" Q ""
NEW S S S=$P(^DPT(BDMPD,0),U,2)
I S="" Q ""
NEW A S A=$$AGE^AUPNPAT(BDMPD,D)
NEW R S R=$O(^BDMBMI("H",S,A)) I R S R=$O(^BDMBMI("H",S,R,""))
I R="" Q ""
I BMI>$P(^BDMBMI(R,0),U,7)!(BMI<$P(^BDMBMI(R,0),U,6)) Q ""
I BMI'<$P(^BDMBMI(R,0),U,5) Q 1
Q ""
OW(BDMPD,BMI,D) ;EP overweight
I $G(BMI)="" Q ""
NEW S S S=$P(^DPT(BDMPD,0),U,2)
I S="" Q ""
NEW A S A=$$AGE^AUPNPAT(BDMPD,D)
NEW R S R=$O(^BDMBMI("H",S,A)) I R S R=$O(^BDMBMI("H",S,R,""))
I R="" Q ""
I BMI>$P(^BDMBMI(R,0),U,7)!(BMI<$P(^BDMBMI(R,0),U,6)) Q ""
I BMI'<$P(^BDMBMI(R,0),U,4) Q 1
Q ""
CUML ;EP
Q:'$D(BDMCUML)
;print aggregate audit
;
;
PRINT ;
S BDMPG=0
S BDMQUIT=0
D HEADER
D PRINT1 ;print each indicator
D EXIT
Q
;
PRINT1 ;
W !!,$P(BDMCUML(10),U),!,?7,"Female",?53,$$C($P(BDMCUML(10),U,3)),?65,$$P($P(BDMCUML(10),U,2),$P(BDMCUML(10),U,3))
W !,?7,"Male",?53,$$C($P(BDMCUML(10),U,4)),?65,$$P($P(BDMCUML(10),U,2),$P(BDMCUML(10),U,4))
I $Y>(IOSL-4) D HEADER Q:BDMQUIT
W !!,"Age" S V=$G(BDMCUML(20))
W !?7,"<15 yrs",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"15-44 yrs",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"45-64 yrs",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"65 yrs and older",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
DMDUR ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(30)) W !!,$P(V,U)
W !?7,"Less than 10 years",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"10 years or more",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Diagnosis date not recorded",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
;weight control
WTCNTL ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(40)) W !!,$P(V,U)
W !?7,"Overweight (BMI>85%ile)",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Obese (BMI>95%ile)",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"BMI could not be calculated",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
BSC ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(50)) W !!,$P(V,U)
W !?7,"HbA1c <7.0",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"HbA1c 7.0-7.9",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"HbA1c 8.0-8.9",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"HbA1c 9.0-9.9",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"HbA1c 10.0-10.9",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?7,"HbA1c 11.0 or higher",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
W !?7,"Undocumented",?53,$$C($P(V,U,9)),?65,$$P($P(V,U,2),$P(V,U,9))
BPC ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(60)) W !!,$P(V,U)
W !?7,"Ideal BP Control (<120/<80)",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Target (120/80-<130/<85)",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Adequate (130/85-<140/,90)",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"Inadequate (140/90-<160/<95)",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"Markedly Poor (160/95 or higher)",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?7,"BP Control Undetermined",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
TBC ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(70)) W !!,$P(V,U)
W !?7,"PPD +,INH treatment complete",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"PPD +, untreated/incomplete or tx unknown",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"PPD -, placed since DM dx",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"PPD -, placed before DM dx",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"Date of DM DX Unknown",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?7,"PPD status unknown",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
TOB ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(80)) W !!,$P(V,U)
W !?7,"Uses Tobacco",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?9,"Counseled - Yes",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,3),$P(V,U,4))
W !?9,"Counseled - No",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,3),$P(V,U,5))
W !?7,"Does not Use tobacco",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"Used tobacco in past",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?7,"Tobacco use not documented",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
TX ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(90)) W !!,$P(V,U)
W !?7,"Diet and Exercise Alone",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Insulin",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Oral Med (monotherapy)"
W !?10,"Sulfonylurea",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?10,"Metformin",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?10,"Acarbose",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?10,"Glitazone",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
W !?7,"Combination of Oral Meds",?53,$$C($P(V,U,9)),?65,$$P($P(V,U,2),$P(V,U,9))
W !?7,"Combination of Oral Meds+Insulin",?53,$$C($P(V,U,10)),?65,$$P($P(V,U,2),$P(V,U,10))
W !?10,"Refused or Undetermined",?53,$$C($P(V,U,11)),?65,$$P($P(V,U,2),$P(V,U,11))
ASPIRIN ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(100)) W !!,$P(V,U)
W !?7,"Yes",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"No",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Undetermined",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
EXAMS ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(120)) W !!,$P(V,U),?68,"(% refused)"
W !?7,"Foot Exam - Neuro & Vasc",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3)),?70,"(",$$P($P(V,U,2),$P(V,U,6)),")"
W !?7,"Eye Exam - Dilated",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Dental Exam",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
EDUC ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(130)) W !!,$P(V,U)
W !?7,"Diet Instruction",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Exercise Instruction",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Other Diabetes Education",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
IMM ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(140)) W !!,$P(V,U)
W !?7,"Flu Vaccine - yearly",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Pneumovax - once",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Tetanus/Diptheria (1 10 years)",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
EKG ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(150)) W !!,$P(V,U)
W !?7,"Performed in past 3 years",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Performed in past 5 years",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Ever performed",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
CREAT ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(170)) W !!,$P(V,U)
W !?7,"Creatinine >= 2.0 mg/dl",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Creatinine < 2.0 mg/dl",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Creatinine not tested/unknown",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"Unable to determine result",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
TOTAL ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(180)) W !!,$P(V,U)
W !?7,"Desirable (<200 mg/dl)",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"Borderline (200-239 mg/dl)",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"High (240 mg/dl or more)",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"Not tested",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"Unable to determine result",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
LDL ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(190)) W !!,$P(V,U)
W !?7,"LDL <100 mg/dl",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"LDL 100-129 mg/dl",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"LDL 130-160 mg/dl",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"LDL >160",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"Not tested",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?7,"Unable to determine result",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
TRIG ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(200)) W !!,$P(V,U)
W !?7,"TG <150 mg/dl",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"TG 150-199 mg/dl",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"TG 200-400 mg/dl",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
W !?7,"TG >400 mg/dl",?53,$$C($P(V,U,6)),?65,$$P($P(V,U,2),$P(V,U,6))
W !?7,"Not tested",?53,$$C($P(V,U,7)),?65,$$P($P(V,U,2),$P(V,U,7))
W !?7,"Unable to determine result",?53,$$C($P(V,U,8)),?65,$$P($P(V,U,2),$P(V,U,8))
SELF ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(210)) W !!,$P(V,U)
W !?7,"Yes",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"No",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Refused",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
SDM ;
I $Y>(IOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(220)) W !!,$P(V,U)
W !?7,"Yes",?53,$$C($P(V,U,3)),?65,$$P($P(V,U,2),$P(V,U,3))
W !?7,"No",?53,$$C($P(V,U,4)),?65,$$P($P(V,U,2),$P(V,U,4))
W !?7,"Undetermined",?53,$$C($P(V,U,5)),?65,$$P($P(V,U,2),$P(V,U,5))
Q
EXIT ;
I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO",DIR("A")="End of report. Press ENTER" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
Q
CALC(N,O) ;ENTRY POINT
;N is new
;O is old
NEW Z
I O=0!(N=0) 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
S Z=(((N-O)/O)*100),Z=$FN(Z,"+,",1)
Q Z
P(D,N) ;return %
I 'D Q ""
I 'N Q " 0%"
NEW X S X=N/D,X=X*100,X=$J(X,3,0)
Q X_"%"
C(X,X2,X3) ;
I '$G(X2) S X2=0
I '$G(X3) S X3=6
D COMMA^%DTC
Q X
G:'BDMPG HEADER1
K DIR I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BDMQUIT=1 Q
W:$D(IOF) @IOF S BDMPG=BDMPG+1
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BDMPG,!
W !,$$CTR("*** HEALTH STATUS OF DIABETIC PATIENTS ***",80),!
W $$CTR($P(^DIC(4,DUZ(2),0),U)),!
S X="Reporting Period: "_$$FMTE^XLFDT(BDMBDAT)_" to "_$$FMTE^XLFDT(BDMADAT) W $$CTR(X,80),!
W !,$TR($J("",80)," ","-")
W !!,$P(BDMCUML(10),U,2)," patients were reviewed"
W ?55," n",?63,"Percent"
Q
CTR(X,Y) ;EP - Center X in a field Y wide.
Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
;----------
EOP ;EP - End of page.
Q:$E(IOST)'="C"
Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
NEW DIR
K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
S DIR(0)="E" D ^DIR
Q
;----------
USR() ;EP - Return name of current user from ^VA(200.
Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
;----------
BDMD994 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT ;
+1 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
+2 ;
+3 ;
DURDM(P,R,EDATE,F) ;EP
+1 IF $GET(F)=""
SET F="E"
+2 NEW DATE
+3 SET DATE=""
+4 IF $GET(R)
SET DATE=$$CMSFDX^BDMD997(P,R,"ID")
+5 IF DATE]""
QUIT $SELECT(F="I":DATE,1:$$D(DATE))
+6 SET DATE=$$PLDMDOO^BDMD997(P,"I")
+7 IF DATE]""
QUIT ($$FMDIFF^XLFDT(EDATE,DATE,1)\365)
+8 ;S DATE=$$FRSTDMDX^BDMD997(P,"I")
+9 ;I DATE]"" Q $S(F="I":DATE,1:$$D(DATE))
+10 QUIT ""
D(D) ;
+1 IF $GET(D)=""
QUIT ""
+2 QUIT $SELECT($EXTRACT(D,4,5)="00":"07",1:$EXTRACT(D,4,5))_"/"_$SELECT($EXTRACT(D,6,7)="00":"15",1:$EXTRACT(D,6,7))_"/"_$EXTRACT(D,2,3)
OB(BDMPD,BMI,D) ;EP obese
+1 IF $GET(BMI)=""
QUIT ""
+2 NEW S
SET S=$PIECE(^DPT(BDMPD,0),U,2)
+3 IF S=""
QUIT ""
+4 NEW A
SET A=$$AGE^AUPNPAT(BDMPD,D)
+5 NEW R
SET R=$ORDER(^BDMBMI("H",S,A))
IF R
SET R=$ORDER(^BDMBMI("H",S,R,""))
+6 IF R=""
QUIT ""
+7 IF BMI>$PIECE(^BDMBMI(R,0),U,7)!(BMI<$PIECE(^BDMBMI(R,0),U,6))
QUIT ""
+8 IF BMI'<$PIECE(^BDMBMI(R,0),U,5)
QUIT 1
+9 QUIT ""
OW(BDMPD,BMI,D) ;EP overweight
+1 IF $GET(BMI)=""
QUIT ""
+2 NEW S
SET S=$PIECE(^DPT(BDMPD,0),U,2)
+3 IF S=""
QUIT ""
+4 NEW A
SET A=$$AGE^AUPNPAT(BDMPD,D)
+5 NEW R
SET R=$ORDER(^BDMBMI("H",S,A))
IF R
SET R=$ORDER(^BDMBMI("H",S,R,""))
+6 IF R=""
QUIT ""
+7 IF BMI>$PIECE(^BDMBMI(R,0),U,7)!(BMI<$PIECE(^BDMBMI(R,0),U,6))
QUIT ""
+8 IF BMI'<$PIECE(^BDMBMI(R,0),U,4)
QUIT 1
+9 QUIT ""
CUML ;EP
+1 IF '$DATA(BDMCUML)
QUIT
+2 ;print aggregate audit
+3 ;
+4 ;
PRINT ;
+1 SET BDMPG=0
+2 SET BDMQUIT=0
+3 DO HEADER
+4 ;print each indicator
DO PRINT1
+5 DO EXIT
+6 QUIT
+7 ;
PRINT1 ;
+1 WRITE !!,$PIECE(BDMCUML(10),U),!,?7,"Female",?53,$$C($PIECE(BDMCUML(10),U,3)),?65,$$P($PIECE(BDMCUML(10),U,2),$PIECE(BDMCUML(10),U,3))
+2 WRITE !,?7,"Male",?53,$$C($PIECE(BDMCUML(10),U,4)),?65,$$P($PIECE(BDMCUML(10),U,2),$PIECE(BDMCUML(10),U,4))
+3 IF $Y>(IOSL-4)
DO HEADER
IF BDMQUIT
QUIT
+4 WRITE !!,"Age"
SET V=$GET(BDMCUML(20))
+5 WRITE !?7,"<15 yrs",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+6 WRITE !?7,"15-44 yrs",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+7 WRITE !?7,"45-64 yrs",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+8 WRITE !?7,"65 yrs and older",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
DMDUR ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(30))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Less than 10 years",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"10 years or more",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Diagnosis date not recorded",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 ;weight control
WTCNTL ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(40))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Overweight (BMI>85%ile)",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Obese (BMI>95%ile)",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"BMI could not be calculated",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
BSC ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(50))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"HbA1c <7.0",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"HbA1c 7.0-7.9",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"HbA1c 8.0-8.9",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"HbA1c 9.0-9.9",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"HbA1c 10.0-10.9",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?7,"HbA1c 11.0 or higher",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
+9 WRITE !?7,"Undocumented",?53,$$C($PIECE(V,U,9)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,9))
BPC ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(60))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Ideal BP Control (<120/<80)",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Target (120/80-<130/<85)",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Adequate (130/85-<140/,90)",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"Inadequate (140/90-<160/<95)",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"Markedly Poor (160/95 or higher)",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?7,"BP Control Undetermined",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
TBC ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(70))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"PPD +,INH treatment complete",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"PPD +, untreated/incomplete or tx unknown",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"PPD -, placed since DM dx",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"PPD -, placed before DM dx",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"Date of DM DX Unknown",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?7,"PPD status unknown",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
TOB ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(80))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Uses Tobacco",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?9,"Counseled - Yes",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,3),$PIECE(V,U,4))
+5 WRITE !?9,"Counseled - No",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,3),$PIECE(V,U,5))
+6 WRITE !?7,"Does not Use tobacco",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"Used tobacco in past",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?7,"Tobacco use not documented",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
TX ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(90))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Diet and Exercise Alone",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Insulin",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Oral Med (monotherapy)"
+6 WRITE !?10,"Sulfonylurea",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+7 WRITE !?10,"Metformin",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+8 WRITE !?10,"Acarbose",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+9 WRITE !?10,"Glitazone",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
+10 WRITE !?7,"Combination of Oral Meds",?53,$$C($PIECE(V,U,9)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,9))
+11 WRITE !?7,"Combination of Oral Meds+Insulin",?53,$$C($PIECE(V,U,10)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,10))
+12 WRITE !?10,"Refused or Undetermined",?53,$$C($PIECE(V,U,11)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,11))
ASPIRIN ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(100))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Yes",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"No",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Undetermined",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
EXAMS ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(120))
WRITE !!,$PIECE(V,U),?68,"(% refused)"
+3 WRITE !?7,"Foot Exam - Neuro & Vasc",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3)),?70,"(",$$P($PIECE(V,U,2),$PIECE(V,U,6)),")"
+4 WRITE !?7,"Eye Exam - Dilated",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Dental Exam",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
EDUC ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(130))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Diet Instruction",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Exercise Instruction",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Other Diabetes Education",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
IMM ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(140))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Flu Vaccine - yearly",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Pneumovax - once",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Tetanus/Diptheria (1 10 years)",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
EKG ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(150))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Performed in past 3 years",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Performed in past 5 years",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Ever performed",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
CREAT ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(170))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Creatinine >= 2.0 mg/dl",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Creatinine < 2.0 mg/dl",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Creatinine not tested/unknown",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"Unable to determine result",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
TOTAL ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(180))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Desirable (<200 mg/dl)",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"Borderline (200-239 mg/dl)",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"High (240 mg/dl or more)",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"Not tested",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"Unable to determine result",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
LDL ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(190))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"LDL <100 mg/dl",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"LDL 100-129 mg/dl",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"LDL 130-160 mg/dl",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"LDL >160",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"Not tested",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?7,"Unable to determine result",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
TRIG ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(200))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"TG <150 mg/dl",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"TG 150-199 mg/dl",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"TG 200-400 mg/dl",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?7,"TG >400 mg/dl",?53,$$C($PIECE(V,U,6)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?7,"Not tested",?53,$$C($PIECE(V,U,7)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?7,"Unable to determine result",?53,$$C($PIECE(V,U,8)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,8))
SELF ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(210))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Yes",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"No",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Refused",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
SDM ;
+1 IF $Y>(IOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(220))
WRITE !!,$PIECE(V,U)
+3 WRITE !?7,"Yes",?53,$$C($PIECE(V,U,3)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?7,"No",?53,$$C($PIECE(V,U,4)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?7,"Undetermined",?53,$$C($PIECE(V,U,5)),?65,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 QUIT
EXIT ;
+1 IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
SET DIR("A")="End of report. Press ENTER"
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+2 QUIT
CALC(N,O) ;ENTRY POINT
+1 ;N is new
+2 ;O is old
+3 NEW Z
+4 IF O=0!(N=0)
QUIT "**"
+5 NEW X,X2,X3
+6 SET X=N
SET X2=1
SET X3=0
DO COMMA^%DTC
SET N=X
+7 SET X=O
SET X2=1
SET X3=0
DO COMMA^%DTC
SET O=X
+8 SET Z=(((N-O)/O)*100)
SET Z=$FNUMBER(Z,"+,",1)
+9 QUIT Z
P(D,N) ;return %
+1 IF 'D
QUIT ""
+2 IF 'N
QUIT " 0%"
+3 NEW X
SET X=N/D
SET X=X*100
SET X=$JUSTIFY(X,3,0)
+4 QUIT X_"%"
C(X,X2,X3) ;
+1 IF '$GET(X2)
SET X2=0
+2 IF '$GET(X3)
SET X3=6
+3 DO COMMA^%DTC
+4 QUIT X
+1 IF 'BDMPG
GOTO HEADER1
+2 KILL DIR
IF $EXTRACT(IOST)="C"
IF IO=IO(0)
WRITE !
SET DIR(0)="EO"
DO ^DIR
KILL DIR
IF Y=0!(Y="^")!($DATA(DTOUT))
SET BDMQUIT=1
QUIT
+1 IF $DATA(IOF)
WRITE @IOF
SET BDMPG=BDMPG+1
+2 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BDMPG,!
+3 WRITE !,$$CTR("*** HEALTH STATUS OF DIABETIC PATIENTS ***",80),!
+4 WRITE $$CTR($PIECE(^DIC(4,DUZ(2),0),U)),!
+5 SET X="Reporting Period: "_$$FMTE^XLFDT(BDMBDAT)_" to "_$$FMTE^XLFDT(BDMADAT)
WRITE $$CTR(X,80),!
+6 WRITE !,$TRANSLATE($JUSTIFY("",80)," ","-")
+7 WRITE !!,$PIECE(BDMCUML(10),U,2)," patients were reviewed"
+8 WRITE ?55," n",?63,"Percent"
+9 QUIT
CTR(X,Y) ;EP - Center X in a field Y wide.
+1 QUIT $JUSTIFY("",$SELECT($DATA(Y):Y,1:IOM)-$LENGTH(X)\2)_X
+2 ;----------
EOP ;EP - End of page.
+1 IF $EXTRACT(IOST)'="C"
QUIT
+2 IF $DATA(ZTQUEUED)!'(IOT="TRM")!$DATA(IO("S"))
QUIT
+3 NEW DIR
+4 KILL DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
+5 SET DIR(0)="E"
DO ^DIR
+6 QUIT
+7 ;----------
USR() ;EP - Return name of current user from ^VA(200.
+1 QUIT $SELECT($GET(DUZ):$SELECT($DATA(^VA(200,DUZ,0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
+2 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
+1 QUIT $SELECT($GET(DUZ(2)):$SELECT($DATA(^DIC(4,DUZ(2),0)):$PIECE(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
+2 ;----------