BDMDM4 ; IHS/CMI/LAB -CONTINUATION OF DM AUDIT RETRIEVAL ROUTINE ;
;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
;IHS/CMI/LAB - fixed EKG
;
;
EN ; - EP - from ^BDMDM1
;
F BDMII=1:1 Q:$T(@BDMII)="" K BDMX S BDMY="BDM(" D @BDMII K BDM
K BDMII
Q
1 ;
URINE ;urinalysis done?
S BDMX=BDMPD_"^LAST LAB [DM AUDIT URINALYSIS TAX"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY)
I '$D(BDM(1)) S ^TMP("BDM",$J,23)="NO",^TMP("BDM",$J,24.1)="-" G UPRO
S ^TMP("BDM",$J,23)="YES"
UPRO ;
S BDMX=BDMPD_"^LAST LAB [DM AUDIT URINE PROTEIN TAX"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY)
I '$D(BDM(1)) S ^TMP("BDM",$J,24.1)="-" G X7
S %A=$P(BDM(1),U,2) S ^TMP("BDM",$J,24.1)=$S(%A]"":$P(BDM(1),U,2),1:"-")
I BDMCUML F %=24.1 I ^TMP("BDM",$J,%)["+" S BDMPOS=1 Q
I BDMCUML S BDMGOT1=$S($G(BDMPOS):1,1:0),BDMSUB=35 D CUML^BDMDM1
S ^TMP("BDM",$J,31)=$S($G(BDMPOS):"YES",1:"NO")
X7 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,23)="YES":1,1:0),BDMSUB=34 D CUML^BDMDM1
K BDMPOS
Q
2 ;
CRTININE S BDMX=BDMPD_"^LAST DX V42.0" S BDMER=$$START1^APCLDF(BDMX,BDMY) I $D(BDM(1)) S BDMD1=+BDM(1) K BDM
S BDMX=BDMPD_"^LAST DX V56.0" S BDMER=$$START1^APCLDF(BDMX,BDMY) I $D(BDM(1)) D I $D(^TMP("BDM",$J,25)) G CUM
. I $D(BDMD1) S:BDMD1<+BDM(1) ^TMP("BDM",$J,25)="ON DIALYSIS"
. I '$D(BDMD1) S ^TMP("BDM",$J,25)="ON DIALYSIS"
K BDM
S BDMX=BDMPD_"^LAST LAB [DM AUDIT CREATININE TAX"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY) D
. S ^TMP("BDM",$J,25)=$S($D(BDM(1)):"YES - "_$P(BDM(1),U,2),1:"NO") ;***
CUM I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,25)["YES":1,1:0),BDMSUB=36 D CUML^BDMDM1
I BDMCUML,BDMGOT1 S BDMGOT1=$S(+($P(^TMP("BDM",$J,25)," ",3))>2:1,1:0),BDMSUB=37 D CUML^BDMDM1
X9 K BDMD1 Q ;***
3 ;
CHOLES S BDMX=BDMPD_"^LAST LAB [DM AUDIT CHOLESTEROL TAX"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY)
S ^TMP("BDM",$J,26)=$S($D(BDM(1)):"YES - "_$P(BDM(1),U,2),1:"NO") ;***
I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,26)["YES":1,1:0),BDMSUB=38 D CUML^BDMDM1
I BDMCUML,BDMGOT1 S BDMGOT1=$S(+($P(^TMP("BDM",$J,26)," ",3))>240:1,1:0),BDMSUB=39 D CUML^BDMDM1
Q
4 ;
TRIGLYC S BDMX=BDMPD_"^LAST LAB [DM AUDIT TRIGLYCERIDE TAX"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY)
S ^TMP("BDM",$J,27)=$S($D(BDM(1)):"YES - "_$P(BDM(1),U,2),1:"NO") ;***
I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,27)["YES":1,1:0),BDMSUB=40 D CUML^BDMDM1
Q
;
5 ;
D PPD^BDMDM8
Q
6 ;ECG SUMMARY
S BDMX=BDMPD_"^LAST DIAGNOSTIC ECG SUMMARY" S BDMER=$$START1^APCLDF(BDMX,BDMY) S ^TMP("BDM",$J,39)=$S($D(BDM(1)):"YES",1:"NO") ;IHS/CMI/LAB
S BDMSUB=55,BDMGOT1=$S($D(BDM(1)):1,1:0) D CUML^BDMDM1
;S BDMSUB=55,BDMGOT1=1 D CUML^BDMDM1
K BDMSUB,BDMX,BDMGOT1
Q
BDMDM4 ; IHS/CMI/LAB -CONTINUATION OF DM AUDIT RETRIEVAL ROUTINE ;
+1 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
+2 ;IHS/CMI/LAB - fixed EKG
+3 ;
+4 ;
EN ; - EP - from ^BDMDM1
+1 ;
+2 FOR BDMII=1:1
IF $TEXT(@BDMII)=""
QUIT
KILL BDMX
SET BDMY="BDM("
DO @BDMII
KILL BDM
+3 KILL BDMII
+4 QUIT
1 ;
URINE ;urinalysis done?
+1 SET BDMX=BDMPD_"^LAST LAB [DM AUDIT URINALYSIS TAX"_BDMDATE
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
+2 IF '$DATA(BDM(1))
SET ^TMP("BDM",$JOB,23)="NO"
SET ^TMP("BDM",$JOB,24.1)="-"
GOTO UPRO
+3 SET ^TMP("BDM",$JOB,23)="YES"
UPRO ;
+1 SET BDMX=BDMPD_"^LAST LAB [DM AUDIT URINE PROTEIN TAX"_BDMDATE
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
+2 IF '$DATA(BDM(1))
SET ^TMP("BDM",$JOB,24.1)="-"
GOTO X7
+3 SET %A=$PIECE(BDM(1),U,2)
SET ^TMP("BDM",$JOB,24.1)=$SELECT(%A]"":$PIECE(BDM(1),U,2),1:"-")
+4 IF BDMCUML
FOR %=24.1
IF ^TMP("BDM",$JOB,%)["+"
SET BDMPOS=1
QUIT
+5 IF BDMCUML
SET BDMGOT1=$SELECT($GET(BDMPOS):1,1:0)
SET BDMSUB=35
DO CUML^BDMDM1
+6 SET ^TMP("BDM",$JOB,31)=$SELECT($GET(BDMPOS):"YES",1:"NO")
X7 IF BDMCUML
SET BDMGOT1=$SELECT(^TMP("BDM",$JOB,23)="YES":1,1:0)
SET BDMSUB=34
DO CUML^BDMDM1
+1 KILL BDMPOS
+2 QUIT
2 ;
CRTININE SET BDMX=BDMPD_"^LAST DX V42.0"
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
IF $DATA(BDM(1))
SET BDMD1=+BDM(1)
KILL BDM
+1 SET BDMX=BDMPD_"^LAST DX V56.0"
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
IF $DATA(BDM(1))
Begin DoDot:1
+2 IF $DATA(BDMD1)
IF BDMD1<+BDM(1)
SET ^TMP("BDM",$JOB,25)="ON DIALYSIS"
+3 IF '$DATA(BDMD1)
SET ^TMP("BDM",$JOB,25)="ON DIALYSIS"
End DoDot:1
IF $DATA(^TMP("BDM",$JOB,25))
GOTO CUM
+4 KILL BDM
+5 SET BDMX=BDMPD_"^LAST LAB [DM AUDIT CREATININE TAX"_BDMDATE
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
Begin DoDot:1
+6 ;***
SET ^TMP("BDM",$JOB,25)=$SELECT($DATA(BDM(1)):"YES - "_$PIECE(BDM(1),U,2),1:"NO")
End DoDot:1
CUM IF BDMCUML
SET BDMGOT1=$SELECT(^TMP("BDM",$JOB,25)["YES":1,1:0)
SET BDMSUB=36
DO CUML^BDMDM1
+1 IF BDMCUML
IF BDMGOT1
SET BDMGOT1=$SELECT(+($PIECE(^TMP("BDM",$JOB,25)," ",3))>2:1,1:0)
SET BDMSUB=37
DO CUML^BDMDM1
X9 ;***
KILL BDMD1
QUIT
3 ;
CHOLES SET BDMX=BDMPD_"^LAST LAB [DM AUDIT CHOLESTEROL TAX"_BDMDATE
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
+1 ;***
SET ^TMP("BDM",$JOB,26)=$SELECT($DATA(BDM(1)):"YES - "_$PIECE(BDM(1),U,2),1:"NO")
+2 IF BDMCUML
SET BDMGOT1=$SELECT(^TMP("BDM",$JOB,26)["YES":1,1:0)
SET BDMSUB=38
DO CUML^BDMDM1
+3 IF BDMCUML
IF BDMGOT1
SET BDMGOT1=$SELECT(+($PIECE(^TMP("BDM",$JOB,26)," ",3))>240:1,1:0)
SET BDMSUB=39
DO CUML^BDMDM1
+4 QUIT
4 ;
TRIGLYC SET BDMX=BDMPD_"^LAST LAB [DM AUDIT TRIGLYCERIDE TAX"_BDMDATE
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
+1 ;***
SET ^TMP("BDM",$JOB,27)=$SELECT($DATA(BDM(1)):"YES - "_$PIECE(BDM(1),U,2),1:"NO")
+2 IF BDMCUML
SET BDMGOT1=$SELECT(^TMP("BDM",$JOB,27)["YES":1,1:0)
SET BDMSUB=40
DO CUML^BDMDM1
+3 QUIT
+4 ;
5 ;
+1 DO PPD^BDMDM8
+2 QUIT
6 ;ECG SUMMARY
+1 ;IHS/CMI/LAB
SET BDMX=BDMPD_"^LAST DIAGNOSTIC ECG SUMMARY"
SET BDMER=$$START1^APCLDF(BDMX,BDMY)
SET ^TMP("BDM",$JOB,39)=$SELECT($DATA(BDM(1)):"YES",1:"NO")
+2 SET BDMSUB=55
SET BDMGOT1=$SELECT($DATA(BDM(1)):1,1:0)
DO CUML^BDMDM1
+3 ;S BDMSUB=55,BDMGOT1=1 D CUML^BDMDM1
+4 KILL BDMSUB,BDMX,BDMGOT1
+5 QUIT