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

APCLDM3.m

Go to the documentation of this file.
APCLDM3 ; IHS/CMI/LAB -CONTINUATION OF DM AUDIT RETRIEVAL ROUTINE ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;IHS/CMI/LAB - patch 4 new imm package
 ;
EN ; - EP - from ^APCLDM1
 ;
 F APCLI=1:1 Q:$T(@APCLI)=""  K APCLX S APCLY="APCL(" D @APCLI K APCL
 Q
1 ;
EDUC S APCLX=APCLPD_"^EDUC [DM AUDIT DIABETES EDUC TOPICS"_APCLDATE S APCLER=$$START1^APCLDF(APCLX,APCLY)
 I APCLER G X5
 NEW %
 I '$D(APCL(1)) F %=15.1,15.2,15.3 S ^TMP("APCL",$J,%)="NO"
 I '$D(APCL(1)) G X5
 S %=0 F  S %=$O(APCL(%)) Q:'%  S APCLDIET($P(APCL(%),U,3),%)=""
 S %="" F  S %=$O(APCLDIET(%)) Q:%=""!($D(^TMP("APCL",$J,15.3)))  I %'="DM-DIET"&(%'="DM-NUTRITION")&(%'="DM-EXCERCISE") S ^TMP("APCL",$J,15.3)="YES"
 I '$D(^TMP("APCL",$J,15.3)) S ^TMP("APCL",$J,15.3)="NO"
 I $D(APCLDIET("DM-DIET"))!($D(APCLDIET("DM-NUTRITION"))) D  I 1
 . S APCLPCL=$O(^DIC(7,"D",29,""))
 . S APCLL=0 F  S APCLL=$O(^TMP("APCLDM VST",$J,APCLL)) Q:'APCLL!($G(^TMP("APCL",$J,15.1))="RD and OTHER")  S APCLPRD=0 F  S APCLPRD=$O(^AUPNVPRV("AD",APCLL,APCLPRD)) Q:'APCLPRD!($G(^TMP("APCL",$J,15.1))="RD and OTHER")  D
 .. S APCLPRV=$P(^AUPNVPRV(APCLPRD,0),U)
 .. I APCLPCL]"",$S($P(^DD(9000010.06,.01,0),U,2)[200:$$PROVCLS^XBFUNC1(APCLPRV,"I"),1:$P(^DIC(6,APCLPRV,0),U,4))=APCLPCL S ^TMP("APCL",$J,15.1)=$S($G(^TMP("APCL",$J,15.1))="OTHER":"RD and OTHER",1:"RD")
 .. E  S ^TMP("APCL",$J,15.1)="OTHER"
 E  S ^TMP("APCL",$J,15.1)="NO"
 I $D(APCLDIET("DM-EXERCISE")) S ^TMP("APCL",$J,15.2)="YES"
 E  S ^TMP("APCL",$J,15.2)="NO"
X5 I APCLER S ^TMP("APCL",$J,15.1)="*** SCRIPT ERROR IN EDUC^APCLDM3.  CONTACT SITE MANAGER" Q
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,15.1)="NO":0,1:1),APCLSUB=25 D CUML^APCLDM1
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,15.2)="NO":0,1:1),APCLSUB=26 D CUML^APCLDM1
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,15.3)="NO":0,1:1),APCLSUB=27 D CUML^APCLDM1
 K APCLDIET,APCL
 Q
2 ;
THERAPY ;
 S X=APCLEDT,%DT="" D ^%DT S X1=$S(Y>DT:DT,1:Y),X2=-122 D C^%DTC S Y=X D DD^%DT S APCLHTNE=Y
 S APCLX=APCLPD_"^MEDS [DM AUDIT INSULIN DRUGS"_";DURING "_APCLHTNE_"-"_APCLEDT S APCLER=$$START1^APCLDF(APCLX,APCLY)
 I APCLER G X10
 S ^TMP("APCL",$J,30)=$S($D(APCL(1)):"Insulin",1:"") K APCL
 S APCLX=APCLPD_"^MEDS [DM AUDIT ORAL HYPOGLYCEMICS"_";DURING "_APCLHTNE_"-"_APCLEDT S APCLER=$$START1^APCLDF(APCLX,APCLY)
 I APCLER G X10
 S ^(30)=$S($D(APCL(1))&(^TMP("APCL",$J,30)]""):"Oral Agent & Insulin",'$D(APCL(1))&(^(30)]""):^(30),$D(APCL(1))&(^(30)=""):"Oral Agent",1:"Diet Alone")
 I APCLCUML S APCLTX=^TMP("APCL",$J,30) D
 . I APCLTX="Oral Agent & Insulin" S APCLGOT1=1,APCLSUB=6 D CUML^APCLDM1 S APCLGOT1=0 F APCLSUB=3,4,5 D CUML^APCLDM1
 . I APCLTX="Oral Agent" S APCLGOT1=1,APCLSUB=5 D CUML^APCLDM1 S APCLGOT1=0 F APCLSUB=3,4,6 D CUML^APCLDM1
 . I APCLTX="Insulin" S APCLGOT1=1,APCLSUB=4 D CUML^APCLDM1 S APCLGOT1=0 F APCLSUB=3,5,6 D CUML^APCLDM1
 . I APCLTX="Diet Alone" S APCLGOT1=1,APCLSUB=3 D CUML^APCLDM1 S APCLGOT1=0 F APCLSUB=4:1:6 D CUML^APCLDM1
 . K APCLTX
X10 I APCLER S ^TMP("APCL",$J,30)="*** SCRIPT ERROR IN THERAPY^APCLDM3.  CONTACT SITE MANAGER"
 Q
 ;IHS/CMI/LAB - new sub routine for new imm package
BI() ; check to see if running new imm package
 Q $S($O(^AUTTIMM(0))>100:1,1:0)
 ;end new subroutine IHS/CMI/LAB
3 ;
FLU S APCLX=APCLPD_"^LAST IMM "_$S($$BI:88,1:12)_APCLDATE S APCLER=$$START1^APCLDF(APCLX,APCLY) ;IHS/CMI/LAB - changed line for new imm package
 I $D(APCL(1)) S Y=+APCL(1) D DD^%DT
 S ^TMP("APCL",$J,29)=$S($D(APCL(1)):"YES - "_Y,1:"NO")
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,29)="NO":0,1:1),APCLSUB=28 D CUML^APCLDM1
 Q
4 ;
PNEUMOVX S APCLX=APCLPD_"^LAST IMM "_$S($$BI:33,1:19) S APCLER=$$START1^APCLDF(APCLX,APCLY) ;IHS/CMI/LAB - changed line for new imm package
 S ^TMP("APCL",$J,18)=$S($D(APCL(1)):"YES",1:"NO")
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,18)="NO":0,1:1),APCLSUB=29 D CUML^APCLDM1
 Q
5 ;
TD S X=APCLTDTE D ^%DT S X1=Y,X2=-3652 D C^%DTC S Y=X D DD^%DT S APCLTD=";DURING "_Y_"-"_APCLTDTE
 S APCLX=APCLPD_"^LAST IMM "_$S($$BI:9,1:"02")_APCLTD S APCLER=$$START1^APCLDF(APCLX,APCLY) ;IHS/CMI/LAB -changed line for new imm package
 S ^TMP("APCL",$J,19)=$S($D(APCL(1)):"YES",1:"NO")
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,19)="NO":0,1:1),APCLSUB=30 D CUML^APCLDM1
 Q
6 ;
EKG ;
 Q
7 ;ACE INHIBITOR
 S APCLX=APCLPD_"^MEDS [DM AUDIT ACE INHIBITORS"_";DURING "_APCLHTNE_"-"_APCLEDT S APCLER=$$START1^APCLDF(APCLX,APCLY)
 I APCLER G X7
 S APCLGOT=0 D C7
 S ^TMP("APCL",$J,41)=$S('APCLGOT:"Does not currently use/undetermined",1:"Currently uses (is prescribed)")
 I APCLCUML D
 .I APCLGOT S APCLGOT1=1,APCLSUB=80 D CUML^APCLDM1 S APCLGOT1=0,APCLSUB=82 D CUML^APCLDM1
 .I 'APCLGOT S APCLGOT1=0,APCLSUB=80 D CUML^APCLDM1 S APCLGOT1=1,APCLSUB=82 D CUML^APCLDM1
 .Q
X7 ;XIT ACE 7
 I APCLER S ^TMP("APCL",$J,41)="ACE INHIBITOR TAXONOMY MISSING"
 Q
C7 ;check for currently prescribed
 S APCLX=0 F  S APCLX=$O(APCL(APCLX)) Q:APCLX'=+APCLX!(APCLGOT)  D
 .S APCLVMED=+$P(APCL(APCLX),U,4),APCLDAYS=$P(^AUPNVMED(APCLVMED,0),U,7),APCLDP=$P(APCL(APCLX),U)
 .Q:'APCLDAYS
 .S B=$$FMADD^XLFDT(APCLDP,APCLDAYS)
 .I B'<APCLUED S APCLGOT=1
 .Q
 Q