BDMDG14 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT 14 Oct 2014 9:54 AM ;
;;2.0;DIABETES MANAGEMENT SYSTEM;**12**;JUN 14, 2007;Build 51
;
;
DURDM(P,R,EDATE) ;EP
NEW DATE,EARLY
S DATE="",EARLY=9999999
I $G(R) S DATE=$$CMSFDX^BDMDC13(P,R,"ID")
I DATE S EARLY=DATE ;Q ($$FMDIFF^XLFDT(EDATE,DATE,1)\365)
S DATE=$$PLDMDOO^BDMDC13(P,"I")
I DATE,DATE<EARLY S EARLY=DATE
I EARLY=9999999 S EARLY=""
;I EARLY>EDATE S EARLY=""
I EARLY="" Q ""
I 'EARLY Q ""
S EARLY=$$DI^BDMDC16(EARLY)
;W !,$$HRN^AUPNPAT(P,$S($G(BDMDUZ2):BDMDUZ2,1:DUZ(2))),"^",EARLY,"^",$$D(EARLY),"^",($$FMDIFF^XLFDT(EDATE,EARLY,1)\365)
Q ($$FMDIFF^XLFDT(EDATE,EARLY,1)\365.25)
D(D) ;EP
I $G(D)="" Q ""
Q $S($E(D,4,5)="00":"07",1:$E(D,4,5))_"/"_$S($E(D,6,7)="00":"01",1:$E(D,6,7))_"/"_$E(D,2,3)
DI(D) ;EP
I $G(D)="" Q ""
Q $E(D,1,3)_$S($E(D,4,5)="00":"07",1:$E(D,4,5))_$S($E(D,6,7)="00":"01",1:$E(D,6,7))
;
SOB(BDMPD,BMI,D) ;EP severly obese
I $G(BMI)="" Q ""
I +BMI'<40 Q 1
Q 0
OB(BDMPD,BMI,D) ;EP obese
I $G(BMI)="" Q ""
I +BMI'<30 Q 1
Q 0
OW(BDMPD,BMI,D) ;EP overweight
I $G(BMI)="" Q ""
I $G(BMI)<25 Q ""
I BMI<30 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 ;
I BDMNOGO D
.W !!,"*** NOTE: ",BDMNOGO," Patients were not included in this report because their",!,"date of onset was after the Audit period end date.",!
W !,$P(BDMCUML(10),U),!?3,"Male",?49,$$C($P(BDMCUML(10),U,4)),?61,$$C($P(BDMCUML(10),U,2)),?73,$$P($P(BDMCUML(10),U,2),$P(BDMCUML(10),U,4))
W !?3,"Female",?49,$$C($P(BDMCUML(10),U,3)),?61,$$C($P(BDMCUML(10),U,2)),?73,$$P($P(BDMCUML(10),U,2),$P(BDMCUML(10),U,3))
;W !?3,"Unknown",?49,$$C($P(BDMCUML(10),U,5)),?61,$$C($P(BDMCUML(10),U,2)),?73,$$P($P(BDMCUML(10),U,2),$P(BDMCUML(10),U,5))
I $Y>(BDMIOSL-7) D HEADER Q:BDMQUIT
W !!,"Age" S V=$G(BDMCUML(20))
;S V="^4567^1234^345^987^12000"
W !?3,"<20 years",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?3,"20-44 years",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
W !?3,"45-64 years",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,5))
W !?3,">=65 years",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6))
TYPE ;
I $Y>(BDMIOSL-6) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(25))
W !!,$P(V,U)
W !?3,"Type 1",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?3,"Type 2",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
DMDUR ;
I $Y>(BDMIOSL-6) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(30)) W !!,$P(V,U)
W !?3,"<1 year",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6))
W !?3,"<10 years",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?3,">=10 years",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
W !?3,"Diagnosis date not recorded",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,5))
;weight control
WTCNTL ;
I $Y>(BDMIOSL-8) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(40)) W !!,$P(V,U)
W !?3,"Normal (BMI<25.0)",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6))
W !?3,"Overweight (BMI 25.0-29.9)",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?3,"Obese (BMI >=30.0)",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
W !?3,"Height or weight missing",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,5))
W !?3,"----------------------------------"
W !?3,"Severely obese (BMI >=40.0)",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7))
BSC ;
I $Y>(BDMIOSL-10) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(50)) W !!,$P(V,U)
W !?3,"A1C <7.0",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?3,"A1C 7.0-7.9",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
W !?3,"A1C 8.0-8.9",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,5))
W !?3,"A1C 9.0-9.9",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6))
W !?3,"A1C 10.0-10.9",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7))
W !?3,"A1C >=11.0",?49,$$C($P(V,U,8)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,8))
W !!?3,"Not tested or no valid result",?49,$$C($P(V,U,9)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,9))
W !?3,"----------------------------------"
W !?3,"A1C <8.0",?49,$$C($P(V,U,11)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,11))
W !?3,"A1C >9.0",?49,$$C($P(V,U,12)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,12))
BPC ;
I $Y>(BDMIOSL-9) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(60)) W !!,$P(V,U)
S T=$P(V,U,5)+$P(V,U,4)+$P(V,U,3)
W !?3,"<140/<90",?49,$$C(T),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),T)
W !?3,"140/90 - <160/<100",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6))
W !?3,"160/100 or higher",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7))
W !?3,"BP category undetermined",?49,$$C($P(V,U,8)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,8))
W !?3,"----------------------------------"
W !?3,"If age >=60 years, <150/<90",?49,$$C($P(V,U,10)),?61,$$C($P(V,U,9)),?73,$$P($P(V,U,9),$P(V,U,10))
;
HTN ;
I $Y>(BDMIOSL-7) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(410))
W !!,"Hypertension"
W !?3,"Diagnosed ever",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?6,"Diagnosed hypertension and mean BP <140/<90",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,3)),?73,$$P($P(V,U,3),$P(V,U,4))
W !?6,"Diagnosed hypertension and ACE inhibitor",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,3)),?73,$$P($P(V,U,3),$P(V,U,5))
W !?9,"or ARB prescribed."
TOBSCR ;
I $Y>(BDMIOSL-9) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(65)) W !!,"Tobacco and Nicotine Use",!?3,$P(V,U)
W !?6,"Screened",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?6,"Not screened",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
TOB ;
I $Y>(BDMIOSL-9) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(80)) W !!?3,$P(V,U)
W !?6,"Current tobacco user",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?9,"In current users, counseled?"
W !?12,"Yes",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,3)),?73,$$P($P(V,U,3),$P(V,U,4))
W !?12,"No",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,3)),?73,$$P($P(V,U,3),$P(V,U,5))
W !?6,"Not a current tobacco user",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7))
W !?6,"Tobacco use not documented",?49,$$C($P(V,U,8)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,8))
ENDS ;
I $Y>(BDMIOSL-7) D HEADER Q:BDMQUIT
S V=BDMCUML(69)
W !!,"Electronic nicotine delivery system (ENDS) "
W !,"use screening during Audit period"
W !?6,"Screened",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?6,"Not screened",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
W !,"ENDS use status"
W !?6,"Current ENDS user",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,5))
W !?6,"Not a current ENDS user",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6))
W !?6,"ENDS use not documented",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7))
W !,"----------------------------------"
W !,"Current user of both tobacco and ENDS",?49,$$C($P(V,U,8)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,8))
W !,"Current user of tobacco and/or ENDS",?49,$$C($P(V,U,9)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,9))
TX ;
I $Y>(BDMIOSL-30) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(90)) W !!,$P(V,U)
NUMMEDS ;
I $Y>(BDMIOSL-10) D HEADER Q:BDMQUIT
W !!?3,"Number of diabetes meds currently prescribed"
W !?6,"None",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3))
W !?6,"One medication",?49,$$C($P(V,U,17)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,17))
W !?6,"Two medications",?49,$$C($P(V,U,18)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,18))
W !?6,"Three medications",?49,$$C($P(V,U,19)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,19))
W !?6,"Four or more medications",?49,$$C($P(V,U,20)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,20))
;
W !!?3,"Diabetes meds currently prescribed, alone or in combination"
W !!?6,"Insulin",?49,$$C($P(V,U,4)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,4))
W !!?6,"Metformin [Glucophage, others]",?49,$$C($P(V,U,5)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,5))
W !!?6,"Sulfonylurea [glyburide, glipizide, ",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,6)),!?6,"others]"
W !!?6,"DPP4 inhibitor [Sitagliptin (Januvia),",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7)),!?6,"Saxagliptin (Onglyza), Linagliptin ",!?6,"(Tradjenta), Alogliptin (Nesina)]"
W !!?6,"GLP-1 agonist [Exenatide (Byetta, ",?49,$$C($P(V,U,8)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,8)),!?6,"Bydureon), Liraglutide (Victoza), Albiglutide",!?6,"(Tanzeum), Dulaglutide (Trulicity), "
W !?6,"Lixisenatide (Adlyxin), Semaglutide (Ozempic)]"
W !!?6,"SGLT-2 inhibitor [Canagliflozin,",?49,$$C($P(V,U,9)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,9)),!?6,"(Invokana), Dapagliflozin (Farxiga),",!?6,"Empagliflozin (Jardiance), ",!?6,"Ertugliflozin (Steglatro)]"
W !!?6,"Pioglitazone [Actos] or rosiglitazone",?49,$$C($P(V,U,10)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,10)),!?6,"[Avandia]"
W !!?6,"Acarbose [Precose] or miglitol [Glyset]",?49,$$C($P(V,U,11)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,11))
W !!?6,"Repaglinide [Prandin] or Nateglinide ",?49,$$C($P(V,U,12)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,12)),!?6,"[Starlix]"
W !!?6,"Amylin analog [Symlin]",?49,$$C($P(V,U,14)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,14))
W !!?6,"Bromocriptine [Cycloset]",?49,$$C($P(V,U,15)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,15))
W !!?6,"Colesevelam [Welchol]",?49,$$C($P(V,U,16)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,16))
STATIN ;
I $Y>(BDMIOSL-18) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(115)) W !!,$P(V,U)
W !?3,"Yes*",?49,$$C($P(V,U,6)),?61,$$C($P(V,U,4)),?73,$$P($P(V,U,4),$P(V,U,6))
W !?3,"Allergy, intolerance, or contraindication",?49,$$C($P(V,U,7)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,7))
W !!?3,"In patients with diagnosed CVD "
W !?6,"Yes*",?49,$$C($P(V,U,22)),?61,$$C($P(V,U,21)),?73,$$P($P(V,U,21),$P(V,U,22))
W !?6,"Allergy, intolerance, or contraindication",?49,$$C($P(V,U,17)),?61,$$C($P(V,U,16)),?73,$$P($P(V,U,16),$P(V,U,17))
W !!?3,"In patients age 40-75 years "
W !?6,"Yes*",?49,$$C($P(V,U,19)),?61,$$C($P(V,U,8)),?73,$$P($P(V,U,8),$P(V,U,19))
W !?6,"Allergy, intolerance, or contraindication",?49,$$C($P(V,U,20)),?61,$$C($P(V,U,23)),?73,$$P($P(V,U,23),$P(V,U,20))
W !!?3,"In patients with diagnosed CVD and/or age 40-75 years"
W !?6,"Yes*",?49,$$C($P(V,U,26)),?61,$$C($P(V,U,25)),?73,$$P($P(V,U,25),$P(V,U,26))
W !?6,"Allergy, intolerance, or contraindication",?49,$$C($P(V,U,27)),?61,$$C($P(V,U,24)),?73,$$P($P(V,U,24),$P(V,U,27))
W !!?2,"*Excludes patients with an allergy, intolerance, or contraindication."
CVD ;
I $Y>(BDMIOSL-10) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(400))
W !!,"Cardiovascular Disease (CVD)"
W !?3,"CVD diagnosed ever",?49,$$C($P(V,U,8)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,8))
W !?6,"CVD and mean BP <140/<90",?49,$$C($P(V,U,9)),?61,$$C($P(V,U,8)),?73,$$P($P(V,U,8),$P(V,U,9))
W !?6,"CVD and not current tobacco user",?49,$$C($P(V,U,10)),?61,$$C($P(V,U,8)),?73,$$P($P(V,U,8),$P(V,U,10))
W !?6,"CVD and aspirin or other",?49,$$C($P(V,U,12)),?61,$$C($P(V,U,8)),?73,$$P($P(V,U,8),$P(V,U,12)),!?9,"antiplatelet/anticoagulant therapy prescribed"
W !?6,"CVD and statin prescribed*",?49,$$C($P(V,U,11)),?61,$$C($P(V,U,34)),?73,$$P($P(V,U,34),$P(V,U,11))
W !?6,"*Excludes patients with an allergy, intolerance, or contraindication"
RETIN ;
I $Y>(BDMIOSL-5) D HEADER Q:BDMQUIT
S V=BDMCUML(400)
W !!,"Retinopathy"
W !?3,"Diagnosed ever",?49,$$C($P(V,U,38)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,38))
LEAMP ;
I $Y>(BDMIOSL-5) D HEADER Q:BDMQUIT
S V=$G(BDMCUML(117))
W !!,$P(BDMCUML(117),U,1)
W !?3,"Any type ever (e.g., toe, partial",?49,$$C($P(V,U,3)),?61,$$C($P(V,U,2)),?73,$$P($P(V,U,2),$P(V,U,3)),!?3,"foot, above or below knee)"
D ^BDMDG1A
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
W !
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
I $G(BDMGUI),BDMPG'=1 W !,"ZZZZZZZ"
I $G(BDMGUI) W !!
W !?3,$P(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BDMPG,!
W !,$$CTR("IHS Diabetes Care and Outcomes Audit - RPMS Audit",80),!
N BDMDHDR
S BDMDHDR="Audit Report for 2019 (Audit Period "_$$DATE^BDMS9B1(BDMBDAT)_" to "_$$DATE^BDMS9B1(BDMADAT)_")"
W $$CTR(BDMDHDR,80),!
;W $$CTR("AUDIT REPORT FOR 2019 (Audit Period "_$$DATE^BDMS9B1(BDMBDAT)_" to "_$$DATE^BDMS9B1(BDMADAT)_")"),!
S X="Facility: "_$P(^DIC(4,$S($G(BDMDUZ2):BDMDUZ2,1:DUZ(2)),0),U) W $$CTR(X,80),!
W $$CTR("Annual Audit",80),!
S X=$P(BDMCUML(10),U,2)_" patients were audited" W $$CTR(X),!
W $TR($J("",80)," ","-"),!
W ?45,"# of ",?57,"#",?70,"Percent",!
W ?45,"Patients",?57,"Considered",!
W ?45,"(Numerator)",?57,"(Denominator)",!
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")
;----------
BDMDG14 ; IHS/CMI/LAB -IHS -CUMULATIVE REPORT 14 Oct 2014 9:54 AM ;
+1 ;;2.0;DIABETES MANAGEMENT SYSTEM;**12**;JUN 14, 2007;Build 51
+2 ;
+3 ;
DURDM(P,R,EDATE) ;EP
+1 NEW DATE,EARLY
+2 SET DATE=""
SET EARLY=9999999
+3 IF $GET(R)
SET DATE=$$CMSFDX^BDMDC13(P,R,"ID")
+4 ;Q ($$FMDIFF^XLFDT(EDATE,DATE,1)\365)
IF DATE
SET EARLY=DATE
+5 SET DATE=$$PLDMDOO^BDMDC13(P,"I")
+6 IF DATE
IF DATE<EARLY
SET EARLY=DATE
+7 IF EARLY=9999999
SET EARLY=""
+8 ;I EARLY>EDATE S EARLY=""
+9 IF EARLY=""
QUIT ""
+10 IF 'EARLY
QUIT ""
+11 SET EARLY=$$DI^BDMDC16(EARLY)
+12 ;W !,$$HRN^AUPNPAT(P,$S($G(BDMDUZ2):BDMDUZ2,1:DUZ(2))),"^",EARLY,"^",$$D(EARLY),"^",($$FMDIFF^XLFDT(EDATE,EARLY,1)\365)
+13 QUIT ($$FMDIFF^XLFDT(EDATE,EARLY,1)\365.25)
D(D) ;EP
+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":"01",1:$EXTRACT(D,6,7))_"/"_$EXTRACT(D,2,3)
DI(D) ;EP
+1 IF $GET(D)=""
QUIT ""
+2 QUIT $EXTRACT(D,1,3)_$SELECT($EXTRACT(D,4,5)="00":"07",1:$EXTRACT(D,4,5))_$SELECT($EXTRACT(D,6,7)="00":"01",1:$EXTRACT(D,6,7))
+3 ;
SOB(BDMPD,BMI,D) ;EP severly obese
+1 IF $GET(BMI)=""
QUIT ""
+2 IF +BMI'<40
QUIT 1
+3 QUIT 0
OB(BDMPD,BMI,D) ;EP obese
+1 IF $GET(BMI)=""
QUIT ""
+2 IF +BMI'<30
QUIT 1
+3 QUIT 0
OW(BDMPD,BMI,D) ;EP overweight
+1 IF $GET(BMI)=""
QUIT ""
+2 IF $GET(BMI)<25
QUIT ""
+3 IF BMI<30
QUIT 1
+4 QUIT ""
CUML ;EP
+1 IF '$DATA(BDMCUML)
QUIT
+2 ;print aggregate audit
+3 ;
+4 ;
PRINT ;
+1 ;S BDMPG=0
+2 SET BDMQUIT=0
+3 DO HEADER
+4 ;print each indicator
DO PRINT1
+5 DO EXIT
+6 QUIT
+7 ;
PRINT1 ;
+1 IF BDMNOGO
Begin DoDot:1
+2 WRITE !!,"*** NOTE: ",BDMNOGO," Patients were not included in this report because their",!,"date of onset was after the Audit period end date.",!
End DoDot:1
+3 WRITE !,$PIECE(BDMCUML(10),U),!?3,"Male",?49,$$C($PIECE(BDMCUML(10),U,4)),?61,$$C($PIECE(BDMCUML(10),U,2)),?73,$$P($PIECE(BDMCUML(10),U,2),$PIECE(BDMCUML(10),U,4))
+4 WRITE !?3,"Female",?49,$$C($PIECE(BDMCUML(10),U,3)),?61,$$C($PIECE(BDMCUML(10),U,2)),?73,$$P($PIECE(BDMCUML(10),U,2),$PIECE(BDMCUML(10),U,3))
+5 ;W !?3,"Unknown",?49,$$C($P(BDMCUML(10),U,5)),?61,$$C($P(BDMCUML(10),U,2)),?73,$$P($P(BDMCUML(10),U,2),$P(BDMCUML(10),U,5))
+6 IF $Y>(BDMIOSL-7)
DO HEADER
IF BDMQUIT
QUIT
+7 WRITE !!,"Age"
SET V=$GET(BDMCUML(20))
+8 ;S V="^4567^1234^345^987^12000"
+9 WRITE !?3,"<20 years",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+10 WRITE !?3,"20-44 years",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+11 WRITE !?3,"45-64 years",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+12 WRITE !?3,">=65 years",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6))
TYPE ;
+1 IF $Y>(BDMIOSL-6)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(25))
+3 WRITE !!,$PIECE(V,U)
+4 WRITE !?3,"Type 1",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+5 WRITE !?3,"Type 2",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
DMDUR ;
+1 IF $Y>(BDMIOSL-6)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(30))
WRITE !!,$PIECE(V,U)
+3 WRITE !?3,"<1 year",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+4 WRITE !?3,"<10 years",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+5 WRITE !?3,">=10 years",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+6 WRITE !?3,"Diagnosis date not recorded",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+7 ;weight control
WTCNTL ;
+1 IF $Y>(BDMIOSL-8)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(40))
WRITE !!,$PIECE(V,U)
+3 WRITE !?3,"Normal (BMI<25.0)",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+4 WRITE !?3,"Overweight (BMI 25.0-29.9)",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+5 WRITE !?3,"Obese (BMI >=30.0)",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+6 WRITE !?3,"Height or weight missing",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+7 WRITE !?3,"----------------------------------"
+8 WRITE !?3,"Severely obese (BMI >=40.0)",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7))
BSC ;
+1 IF $Y>(BDMIOSL-10)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(50))
WRITE !!,$PIECE(V,U)
+3 WRITE !?3,"A1C <7.0",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?3,"A1C 7.0-7.9",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+5 WRITE !?3,"A1C 8.0-8.9",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+6 WRITE !?3,"A1C 9.0-9.9",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+7 WRITE !?3,"A1C 10.0-10.9",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?3,"A1C >=11.0",?49,$$C($PIECE(V,U,8)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,8))
+9 WRITE !!?3,"Not tested or no valid result",?49,$$C($PIECE(V,U,9)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,9))
+10 WRITE !?3,"----------------------------------"
+11 WRITE !?3,"A1C <8.0",?49,$$C($PIECE(V,U,11)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,11))
+12 WRITE !?3,"A1C >9.0",?49,$$C($PIECE(V,U,12)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,12))
BPC ;
+1 IF $Y>(BDMIOSL-9)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(60))
WRITE !!,$PIECE(V,U)
+3 SET T=$PIECE(V,U,5)+$PIECE(V,U,4)+$PIECE(V,U,3)
+4 WRITE !?3,"<140/<90",?49,$$C(T),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),T)
+5 WRITE !?3,"140/90 - <160/<100",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+6 WRITE !?3,"160/100 or higher",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+7 WRITE !?3,"BP category undetermined",?49,$$C($PIECE(V,U,8)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,8))
+8 WRITE !?3,"----------------------------------"
+9 WRITE !?3,"If age >=60 years, <150/<90",?49,$$C($PIECE(V,U,10)),?61,$$C($PIECE(V,U,9)),?73,$$P($PIECE(V,U,9),$PIECE(V,U,10))
+10 ;
HTN ;
+1 IF $Y>(BDMIOSL-7)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(410))
+3 WRITE !!,"Hypertension"
+4 WRITE !?3,"Diagnosed ever",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+5 WRITE !?6,"Diagnosed hypertension and mean BP <140/<90",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,3)),?73,$$P($PIECE(V,U,3),$PIECE(V,U,4))
+6 WRITE !?6,"Diagnosed hypertension and ACE inhibitor",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,3)),?73,$$P($PIECE(V,U,3),$PIECE(V,U,5))
+7 WRITE !?9,"or ARB prescribed."
TOBSCR ;
+1 IF $Y>(BDMIOSL-9)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(65))
WRITE !!,"Tobacco and Nicotine Use",!?3,$PIECE(V,U)
+3 WRITE !?6,"Screened",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?6,"Not screened",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
TOB ;
+1 IF $Y>(BDMIOSL-9)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(80))
WRITE !!?3,$PIECE(V,U)
+3 WRITE !?6,"Current tobacco user",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?9,"In current users, counseled?"
+5 WRITE !?12,"Yes",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,3)),?73,$$P($PIECE(V,U,3),$PIECE(V,U,4))
+6 WRITE !?12,"No",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,3)),?73,$$P($PIECE(V,U,3),$PIECE(V,U,5))
+7 WRITE !?6,"Not a current tobacco user",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+8 WRITE !?6,"Tobacco use not documented",?49,$$C($PIECE(V,U,8)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,8))
ENDS ;
+1 IF $Y>(BDMIOSL-7)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=BDMCUML(69)
+3 WRITE !!,"Electronic nicotine delivery system (ENDS) "
+4 WRITE !,"use screening during Audit period"
+5 WRITE !?6,"Screened",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+6 WRITE !?6,"Not screened",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+7 WRITE !,"ENDS use status"
+8 WRITE !?6,"Current ENDS user",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+9 WRITE !?6,"Not a current ENDS user",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6))
+10 WRITE !?6,"ENDS use not documented",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+11 WRITE !,"----------------------------------"
+12 WRITE !,"Current user of both tobacco and ENDS",?49,$$C($PIECE(V,U,8)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,8))
+13 WRITE !,"Current user of tobacco and/or ENDS",?49,$$C($PIECE(V,U,9)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,9))
TX ;
+1 IF $Y>(BDMIOSL-30)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(90))
WRITE !!,$PIECE(V,U)
NUMMEDS ;
+1 IF $Y>(BDMIOSL-10)
DO HEADER
IF BDMQUIT
QUIT
+2 WRITE !!?3,"Number of diabetes meds currently prescribed"
+3 WRITE !?6,"None",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3))
+4 WRITE !?6,"One medication",?49,$$C($PIECE(V,U,17)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,17))
+5 WRITE !?6,"Two medications",?49,$$C($PIECE(V,U,18)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,18))
+6 WRITE !?6,"Three medications",?49,$$C($PIECE(V,U,19)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,19))
+7 WRITE !?6,"Four or more medications",?49,$$C($PIECE(V,U,20)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,20))
+8 ;
+9 WRITE !!?3,"Diabetes meds currently prescribed, alone or in combination"
+10 WRITE !!?6,"Insulin",?49,$$C($PIECE(V,U,4)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,4))
+11 WRITE !!?6,"Metformin [Glucophage, others]",?49,$$C($PIECE(V,U,5)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,5))
+12 WRITE !!?6,"Sulfonylurea [glyburide, glipizide, ",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,6)),!?6,"others]"
+13 WRITE !!?6,"DPP4 inhibitor [Sitagliptin (Januvia),",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7)),!?6,"Saxagliptin (Onglyza), Linagliptin ",!?6,"(Tradjenta), Alogliptin (Nesina)]"
+14 WRITE !!?6,"GLP-1 agonist [Exenatide (Byetta, ",?49,$$C($PIECE(V,U,8)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,8)),!?6,"Bydureon), Liraglutide (Victoza), Albiglutide",!?6,"(Tanzeum), Dulaglutide (Trulicity), "
+15 WRITE !?6,"Lixisenatide (Adlyxin), Semaglutide (Ozempic)]"
+16 WRITE !!?6,"SGLT-2 inhibitor [Canagliflozin,",?49,$$C($PIECE(V,U,9)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,9)),!?6,"(Invokana), Dapagliflozin (Farxiga),",!?6,"Empagliflozin (Jardiance), ",!?6,"Ertugliflozin (Steglatro)]"
+17 WRITE !!?6,"Pioglitazone [Actos] or rosiglitazone",?49,$$C($PIECE(V,U,10)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,10)),!?6,"[Avandia]"
+18 WRITE !!?6,"Acarbose [Precose] or miglitol [Glyset]",?49,$$C($PIECE(V,U,11)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,11))
+19 WRITE !!?6,"Repaglinide [Prandin] or Nateglinide ",?49,$$C($PIECE(V,U,12)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,12)),!?6,"[Starlix]"
+20 WRITE !!?6,"Amylin analog [Symlin]",?49,$$C($PIECE(V,U,14)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,14))
+21 WRITE !!?6,"Bromocriptine [Cycloset]",?49,$$C($PIECE(V,U,15)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,15))
+22 WRITE !!?6,"Colesevelam [Welchol]",?49,$$C($PIECE(V,U,16)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,16))
STATIN ;
+1 IF $Y>(BDMIOSL-18)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(115))
WRITE !!,$PIECE(V,U)
+3 WRITE !?3,"Yes*",?49,$$C($PIECE(V,U,6)),?61,$$C($PIECE(V,U,4)),?73,$$P($PIECE(V,U,4),$PIECE(V,U,6))
+4 WRITE !?3,"Allergy, intolerance, or contraindication",?49,$$C($PIECE(V,U,7)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,7))
+5 WRITE !!?3,"In patients with diagnosed CVD "
+6 WRITE !?6,"Yes*",?49,$$C($PIECE(V,U,22)),?61,$$C($PIECE(V,U,21)),?73,$$P($PIECE(V,U,21),$PIECE(V,U,22))
+7 WRITE !?6,"Allergy, intolerance, or contraindication",?49,$$C($PIECE(V,U,17)),?61,$$C($PIECE(V,U,16)),?73,$$P($PIECE(V,U,16),$PIECE(V,U,17))
+8 WRITE !!?3,"In patients age 40-75 years "
+9 WRITE !?6,"Yes*",?49,$$C($PIECE(V,U,19)),?61,$$C($PIECE(V,U,8)),?73,$$P($PIECE(V,U,8),$PIECE(V,U,19))
+10 WRITE !?6,"Allergy, intolerance, or contraindication",?49,$$C($PIECE(V,U,20)),?61,$$C($PIECE(V,U,23)),?73,$$P($PIECE(V,U,23),$PIECE(V,U,20))
+11 WRITE !!?3,"In patients with diagnosed CVD and/or age 40-75 years"
+12 WRITE !?6,"Yes*",?49,$$C($PIECE(V,U,26)),?61,$$C($PIECE(V,U,25)),?73,$$P($PIECE(V,U,25),$PIECE(V,U,26))
+13 WRITE !?6,"Allergy, intolerance, or contraindication",?49,$$C($PIECE(V,U,27)),?61,$$C($PIECE(V,U,24)),?73,$$P($PIECE(V,U,24),$PIECE(V,U,27))
+14 WRITE !!?2,"*Excludes patients with an allergy, intolerance, or contraindication."
CVD ;
+1 IF $Y>(BDMIOSL-10)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(400))
+3 WRITE !!,"Cardiovascular Disease (CVD)"
+4 WRITE !?3,"CVD diagnosed ever",?49,$$C($PIECE(V,U,8)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,8))
+5 WRITE !?6,"CVD and mean BP <140/<90",?49,$$C($PIECE(V,U,9)),?61,$$C($PIECE(V,U,8)),?73,$$P($PIECE(V,U,8),$PIECE(V,U,9))
+6 WRITE !?6,"CVD and not current tobacco user",?49,$$C($PIECE(V,U,10)),?61,$$C($PIECE(V,U,8)),?73,$$P($PIECE(V,U,8),$PIECE(V,U,10))
+7 WRITE !?6,"CVD and aspirin or other",?49,$$C($PIECE(V,U,12)),?61,$$C($PIECE(V,U,8)),?73,$$P($PIECE(V,U,8),$PIECE(V,U,12)),!?9,"antiplatelet/anticoagulant therapy prescribed"
+8 WRITE !?6,"CVD and statin prescribed*",?49,$$C($PIECE(V,U,11)),?61,$$C($PIECE(V,U,34)),?73,$$P($PIECE(V,U,34),$PIECE(V,U,11))
+9 WRITE !?6,"*Excludes patients with an allergy, intolerance, or contraindication"
RETIN ;
+1 IF $Y>(BDMIOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=BDMCUML(400)
+3 WRITE !!,"Retinopathy"
+4 WRITE !?3,"Diagnosed ever",?49,$$C($PIECE(V,U,38)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,38))
LEAMP ;
+1 IF $Y>(BDMIOSL-5)
DO HEADER
IF BDMQUIT
QUIT
+2 SET V=$GET(BDMCUML(117))
+3 WRITE !!,$PIECE(BDMCUML(117),U,1)
+4 WRITE !?3,"Any type ever (e.g., toe, partial",?49,$$C($PIECE(V,U,3)),?61,$$C($PIECE(V,U,2)),?73,$$P($PIECE(V,U,2),$PIECE(V,U,3)),!?3,"foot, above or below knee)"
+5 DO ^BDMDG1A
+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 WRITE !
+3 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 IF $GET(BDMGUI)
IF BDMPG'=1
WRITE !,"ZZZZZZZ"
+3 IF $GET(BDMGUI)
WRITE !!
+4 WRITE !?3,$PIECE(^VA(200,DUZ,0),U,2),?35,$$FMTE^XLFDT(DT),?70,"Page ",BDMPG,!
+5 WRITE !,$$CTR("IHS Diabetes Care and Outcomes Audit - RPMS Audit",80),!
+6 NEW BDMDHDR
+7 SET BDMDHDR="Audit Report for 2019 (Audit Period "_$$DATE^BDMS9B1(BDMBDAT)_" to "_$$DATE^BDMS9B1(BDMADAT)_")"
+8 WRITE $$CTR(BDMDHDR,80),!
+9 ;W $$CTR("AUDIT REPORT FOR 2019 (Audit Period "_$$DATE^BDMS9B1(BDMBDAT)_" to "_$$DATE^BDMS9B1(BDMADAT)_")"),!
+10 SET X="Facility: "_$PIECE(^DIC(4,$SELECT($GET(BDMDUZ2):BDMDUZ2,1:DUZ(2)),0),U)
WRITE $$CTR(X,80),!
+11 WRITE $$CTR("Annual Audit",80),!
+12 SET X=$PIECE(BDMCUML(10),U,2)_" patients were audited"
WRITE $$CTR(X),!
+13 WRITE $TRANSLATE($JUSTIFY("",80)," ","-"),!
+14 WRITE ?45,"# of ",?57,"#",?70,"Percent",!
+15 WRITE ?45,"Patients",?57,"Considered",!
+16 WRITE ?45,"(Numerator)",?57,"(Denominator)",!
+17 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 ;----------