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

APCLDM1.m

Go to the documentation of this file.
APCLDM1 ; IHS/CMI/LAB -IHS -GETS DATA FOR DIABETES QA REPORT ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
EN ; - ENTRY POINT - from ^APCLASK
 S APCLER=0
 D EN^APCLDM5 ;header and patient ident
 D CLINICAL
 D CLEAN^APCLDM5
XIT Q
 ;
 ;
CUML ; - ENTRY POINT - Set cumulative nodes
 I '$D(^TMP("APCLCUML",$J,APCLSUB)) S ^TMP("APCLCUML",$J,APCLSUB)=APCLGOT1_"/"_1
 E  S ^(APCLSUB)=$S(APCLGOT1:$P(^TMP("APCLCUML",$J,APCLSUB),"/")+1,1:$P(^TMP("APCLCUML",$J,APCLSUB),"/"))_"/"_($P(^(APCLSUB),"/",2)+1)
 Q
 ;
CLINICAL ; Get clinical data
 D DMVISITS
 G:APCLER X
 D VISITS
 F APCLI=1:1 Q:$T(@APCLI)=""  K APCLX S APCLY="APCL(" D @APCLI K APCL
 D ^APCLDM1A
 D ^APCLDM2
 D ^APCLDM3
 D ^APCLDM4
X K APCLY Q
 ;
DMVISITS ; Gets all visits where dx was DM for indicated time period
 K ^TMP("APCLDM FETCH",$J) ;IHS/CMI/LAB - ADDED
 S APCLX=APCLPD_"^DX [SURVEILLANCE DIABETES"_APCLDATE,APCLY="^TMP(""APCLDM FETCH"",$J," S APCLER=$$START1^APCLDF(APCLX,APCLY)
 I APCLER W !,"*** SCRIPT ERROR IN DMVISITS^APCLDM1.  CONTACT SITE MANAGER" G X1
 K ^TMP("APCLDM V",$J) S APCLC=0 F APCLL=1:1 Q:'$D(^TMP("APCLDM FETCH",$J,APCLL))  D
 .S V=$P(^TMP("APCLDM FETCH",$J,APCLL),U,5) Q:$D(^TMP("APCLDM V",$J,V))  S ^TMP("APCLDM V",$J,V)="",C=$$CLINIC^APCLV(V,"C")
 .I C'="06"&(C'="01")&(C'="28") Q
 .I "TC"[$P(^AUPNVSIT(V,0),U,7) Q  ;IHS/CMI/LAB - no tele,cr
 .S APCLC=APCLC+1,^TMP("APCLDM DXVS",$J,APCLC)=$P(^TMP("APCLDM FETCH",$J,APCLL),U,5)
 S APCLTOT=APCLC K ^TMP("APCLDM V",$J),APCLC
 I 'APCLTOT S APCLTOT=1
 K APCLDX,APCL,^TMP("APCLDM FETCH",$J)
X1 Q
 ;
VISITS ; Get all visits for indicated time period
 S APCLX=APCLPD_"^VISIT"_APCLDATE,APCLY="^TMP(""APCLDM FETCH"",$J," S APCLER=$$START1^APCLDF(APCLX,APCLY)
 F APCLL=1:1 Q:'$D(^TMP("APCLDM FETCH",$J,APCLL))  S ^TMP("APCLDM VST",$J,$P(^TMP("APCLDM FETCH",$J,APCLL),U,5))=""
 K APCL
 Q
 ;
1 ;
TOBACCO ;
 D TOBACCO^APCLDM6
 Q
2 ;
FIRSTDX ;
 K APCL
 S APCLX=APCLPD_"^FIRST DX [SURVEILLANCE DIABETES" S APCLER=$$START1^APCLDF(APCLX,APCLY) S Y=$P($G(APCL(1)),U) I Y]"" D DD^%DT
 S ^TMP("APCL",$J,2)=Y
X2 ;
 S:APCLER ^TMP("APCL",$J,2)="*** SCRIPT ERROR IN FIRSTDX^APCLDM1.  CONTACT SITE MANAGER"
 K APCL
 Q
4 ;DATE OF ONSET
 D CMSFDX I $D(^TMP("APCL",$J,37)) G 41
 D PLFDX I $D(^TMP("APCL",$J,37)) G 41
 S ^TMP("APCL",$J,37)="Date of Onset not recorded"
41 ;
 I ^TMP("APCL",$J,37)="Date of Onset not recorded" D  G X4
 . S APCLGOT1=1,APCLSUB=47 D CUML
 . F APCLSUB=45,46 S APCLGOT1=0 D CUML
 . Q
 S X=^TMP("APCL",$J,37),%DT="" D ^%DT S X1=DT,X2=Y D ^%DTC S APCLGOT1=1,APCLSUB=$S(X'<3652.5:46,1:45) D CUML S APCLSUB=$S(APCLSUB=46:45,1:46),APCLGOT1=0 D CUML S APCLSUB=47,APCLGOT1=0 D CUML
X4 ;
 K APCL,APCLSUB,APCLGOT1
 Q
CMSFDX ;get first dm dx from case management
 K APCLFDX
 Q:'$G(APCLDMRG)
 S APCLX=0 F  S APCLX=$O(^ACM(44,"C",APCLPD,APCLX)) Q:APCLX'=+APCLX!($D(APCLFDX))  I $P(^ACM(44,APCLX,0),U,4)=APCLDMRG D
 .S APCLFDX=$P($G(^ACM(44,APCLX,"SV")),U,2)
 .Q:APCLFDX=""
 .S APCL(1)=APCLFDX,Y=APCLFDX D DD^%DT S ^TMP("APCL",$J,37)=Y,^TMP("APCL",$J,40)="CMS"
 .Q
 Q
PLFDX ;get first dm dx from problem list
 S APCLX=APCLPD_"^PROBLEM [DM AUDIT PROBLEM DIABETES DX" S APCLER=$$START1^APCLDF(APCLX,APCLY) G:APCLER PLFDXX I $D(APCL(1)) D
 .S APCL(1)=$P(^AUPNPROB(+$P(APCL(1),U,4),0),U,13) I APCL(1)="" K APCL(1) Q
 .S Y=APCL(1) D DD^%DT S ^TMP("APCL",$J,37)=Y,^TMP("APCL",$J,40)="PCC Problem List"
 .Q
PLFDXX Q
3 ;
LASTHT S APCLX=APCLPD_"^LAST MEAS HT" S APCLER=$$START1^APCLDF(APCLX,APCLY) S (APCLHT,APCLHTKI)=$P($G(APCL(1)),U,2) I APCLHT]"" S APCLHT=(APCLHT\12)_" feet "_(APCLHT#12)_" inches"
 S ^TMP("APCL",$J,3)=APCLHT
 I APCLCUML S APCLGOT1=$S(^TMP("APCL",$J,3)]"":1,1:0),APCLSUB=9 D CUML
 Q
 ;