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

BDMDM2.m

Go to the documentation of this file.
BDMDM2 ; IHS/CMI/LAB -IHS -CONTINUATION OF ROUTINE TO FETCH DATA ;
 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2**;JUN 14, 2007
 ;IHS/CMI/LAB - patch 4 y2k and mammography screening
EN ; - EP - from CLINICAL^BDMDM1
 ;
 F BDMI=1:1 Q:$T(@BDMI)=""  K BDMX S BDMY="BDM(" D @BDMI K BDM
 ;
 Q
1 ;
 S BDMX=BDMPD_"^LAST EXAM DIABETIC FOOT EXAM"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY) S ^TMP("BDM",$J,11)=$S($D(BDM(1)):"YES",1:"NO")
 ;
X1 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,11)="YES":1,1:0),BDMSUB=19 D CUML^BDMDM1
 Q
2 ;
EYE ;
 S BDMX=BDMPD_"^LAST EXAM DIABETIC EYE EXAM"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY)  S ^TMP("BDM",$J,12)=$S($D(BDM(1)):"YES",1:"NO")
 ;
X5 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,12)="YES":1,1:0),BDMSUB=20 D CUML^BDMDM1
 Q
3 ;
DENTAL S BDMX=BDMPD_"^LAST ADA [DM AUDIT DENTAL EXAM ADA CODES"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY)
 I BDMER S ^TMP("BDM",$J,13)="*** SCRIPT ERROR IN DENTAL^BDMDM2.  CONTACT SITE MANAGER" G X11
 S ^TMP("BDM",$J,13)=$S($D(BDM(1)):"YES",1:"NO")
 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,13)="YES":1,1:0),BDMSUB=21 D CUML^BDMDM1
X11 Q
4 ;
RECTAL I ^TMP("BDM",$J,503)<40 S ^TMP("BDM",$J,14)="N/A" G X ; age <40
 E  S BDMX=BDMPD_"^LAST EXAM RECTAL"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY) S ^TMP("BDM",$J,14)=$S($D(BDM(1)):"YES",1:"NO")
 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,14)="YES":1,1:0),BDMSUB=22 D CUML^BDMDM1
X Q
5 ;
PAP I ^TMP("BDM",$J,502)="M" S ^TMP("BDM",$J,28)="N/A" G X2
 S BDMX=BDMPD_"^LAST LAB [DM AUDIT PAP SMEAR TAX"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY) S ^TMP("BDM",$J,28)=$S($D(BDM(1)):"YES",1:"NO")
 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,28)="YES":1,1:0),BDMSUB=23 D CUML^BDMDM1
X2 Q
6 ;
BREAST I ^TMP("BDM",$J,502)="M" S ^TMP("BDM",$J,16)="N/A" G X3
 S BDMX=BDMPD_"^LAST EXAM BREAST"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY) S ^TMP("BDM",$J,16)=$S($D(BDM(1)):"YES",1:"NO")
 I BDMCUML S BDMGOT1=$S(^TMP("BDM",$J,16)="YES":1,1:0),BDMSUB=41 D CUML^BDMDM1
X3 Q
7 ;
MAMMOG  ;IHS/CMI/LAB - patch 4 added mammogram screening
 S BDMMAM="",BDMMAMD="" I ^TMP("BDM",$J,502)="M"!(^(503)<40) S ^TMP("BDM",$J,17)="N/A" G X4
 S BDMX=BDMPD_"^LAST RAD MAMMOGRAM BILAT"_";DURING JAN 01,1901-"_BDMEDT
 ;begin Y2K
 ;S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X4  I $D(BDM(1)) S ^TMP("BDM",$J,17)="YES",(BDMMAM,BDMMAMD)=$P(BDM(1),U),^TMP("BDM",$J,17.1)=$E(BDMMAM,4,5)_"/"_$E(BDMMAM,6,7)_"/"_$E(BDMMAM,2,3) ;Y2000
 S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X4  I $D(BDM(1)) S ^TMP("BDM",$J,17)="YES",(BDMMAM,BDMMAMD)=$P(BDM(1),U),^TMP("BDM",$J,17.1)=$E(BDMMAM,4,5)_"/"_$E(BDMMAM,6,7)_"/"_(1700+($E(BDMMAM,1,3))) ;Y2000
 ;end Y2K
 S BDMX=BDMPD_"^LAST RAD MAMMOGRAM UNILAT"_";DURING JAN 01,1901-"_BDMEDT
 ;begin Y2k
 ;S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X4  I $D(BDM(1)) S ^TMP("BDM",$J,17)="YES",BDMMAM=$P(BDM(1),U) I BDMMAM>BDMMAMD S ^TMP("BDM",$J,17.1)=$E(BDMMAM,4,5)_"/"_$E(BDMMAM,6,7)_"/"_$E(BDMMAM,2,3),BDMMAMD=BDMMAM ;Y2000
 S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X4  I $D(BDM(1)) S ^TMP("BDM",$J,17)="YES",BDMMAM=$P(BDM(1),U) I BDMMAM>BDMMAMD S ^TMP("BDM",$J,17.1)=$E(BDMMAM,4,5)_"/"_$E(BDMMAM,6,7)_"/"_(1700+($E(BDMMAM,1,3))),BDMMAMD=BDMMAM ;Y2000
 ;end Y2K
 S BDMX=BDMPD_"^LAST RAD SCREENING MAMMOGRAM"_";DURING JAN 01,1901-"_BDMEDT
 ;begin Y2K
 ;S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X4
 ;S ^TMP("BDM",$J,17)=$S($D(BDM(1)):"YES",1:"NO") I $D(BDM(1)) S BDMMAM=$P(BDM(1),U) I BDMMAM>BDMMAMD S ^TMP("BDM",$J,17.1)=$E(BDMMAM,4,5)_"/"_$E(BDMMAM,6,7)_"/"_$E(BDMMAM,2,3),BDMMAMD=BDMMAM
 S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X4 ;Y2000
 S ^TMP("BDM",$J,17)=$S($D(BDM(1)):"YES",1:"NO") I $D(BDM(1)) S BDMMAM=$P(BDM(1),U) I BDMMAM>BDMMAMD S ^TMP("BDM",$J,17.1)=$E(BDMMAM,4,5)_"/"_$E(BDMMAM,6,7)_"/"_(1700+($E(BDMMAM,1,3))),BDMMAMD=BDMMAM ;Y2000
 ;end Y2K
RCUM  D
 .S BDMMAM=BDMMAMD
 .I BDMCUML,BDMMAM]"" S BDMGOT1=1,BDMSUB=83 D CUML^BDMDM1
 .I BDMCUML,BDMMAM="" S BDMGOT1=0,BDMSUB=83 D CUML^BDMDM1
 .S D=$$FMDIFF^XLFDT(BDMED,BDMMAM),M=D/30.44
 .S A=^TMP("BDM",$J,503)
 .I M<25&(A>39)&(A<50)!(M<13&(A>49)) S ^TMP("BDM",$J,17.2)="YES" Q:'BDMCUML  S BDMGOT1=1,BDMSUB=24 D CUML^BDMDM1 Q
 .S ^TMP("BDM",$J,17.2)="NO" I BDMCUML S BDMGOT1=0,BDMSUB=24 D CUML^BDMDM1
 .Q
X4 I BDMER S ^TMP("BDM",$J,502)="***SCRIPT ERROR IN MAMMOG^BDMDM2.  CONTACT SITE MANAGER"
 Q
 ;