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

ACDFUL2.m

Go to the documentation of this file.
ACDFUL2 ;IHS/ADC/EDE/KML - IHS-SMBD/MLQ FU EXTRACT; 
 ;;4.1;CHEMICAL DEPENDENCY MIS;**1**;MAY 11, 1998
INIT ;
 S ACDHREC=""
 D GETDFN1 G:ACDHREC="" NOFUD
 D KILLVAR
 Q
GETDFN1 ;
 S ACDA=ACD6MO,ACDFLG="6" F ACDIX=0:0 S ACDA=$O(^ACDVIS("B",ACDA)) Q:ACDA=""!(ACDA>ACD6MOE)  D GETDFN2
 S ACDA=ACD12MO,ACDFLG="12" F ACDIX=0:0 S ACDA=$O(^ACDVIS("B",ACDA)) Q:ACDA=""!(ACDA>ACD12MOE)  D GETDFN2
 S ACDA=ACD18MO,ACDFLG="18" F ACDIX=0:0 S ACDA=$O(^ACDVIS("B",ACDA)) Q:ACDA=""!(ACDA>ACD18MOE)  D GETDFN2
 S ACDA=ACD24MO,ACDFLG="24" F ACDIX=0:0 S ACDA=$O(^ACDVIS("B",ACDA)) Q:ACDA=""!(ACDA>ACD24MOE)  D GETDFN2
 Q
GETDFN2 S ACDB=0 F ACDIX=0:0 S ACDB=$O(^ACDVIS("B",ACDA,ACDB)) Q:'+ACDB  D GETDFN3
 Q
GETDFN3 S ACDHREC=^ACDVIS(ACDB,0)
 S ACDT=$P(ACDHREC,"^",4)
 Q:$P(ACDHREC,"^",4)'="TD"
 ;D CHKTDC ; Q:T/D/C IS MOVED OR DIED
 S ACDPDFN=$P(ACDHREC,U,5)
 Q:$O(^ACDTDC("ALT",ACDPDFN,"A"),-1)>ACDA  ; quit if later TD
 Q:$$DOD^AUPNPAT(ACDPDFN)]""  ;       quit if patient deceased
 ; Start of patch, IHS/ASDST/JGH ACD*4.1*1 12/18/1998
 ; S ACDPRG=$P(^ACDVIS(ACDB,"BWP"),U) Q:ACDPRG'=DUZ(2) S ACDPRG=$P(^DIC(4,ACDPRG,0),U)
 S ACDPRG=$P(^ACDVIS(ACDB,"BWP"),U)  ; IHS/ASDST/JGH 12/18/1998
 ; The following line allows follow up due to view only local case.
 Q:ACDPRG'=DUZ(2)  ; IHS/ASDST/JGH ACD*4.1*1 12/18/1998
 S ACDPRG=$P(^DIC(4,ACDPRG,0),U)  ; IHS/ASDST/JGH 12/18/1998
 ; End of patch, IHS/ASDST/JGH ACD*4.1*1 12/18/1998 
 S ACDDT=$P(ACDHREC,U) S ACDDOS=$E(ACDDT,4,5)_"/"_$E(ACDDT,6,7)_"/"_$E(ACDDT,2,3) K ACDDT
 S ACDCMP=$P(ACDHREC,U,2),ACDCMP=$P(^ACDCOMP(ACDCMP,0),U,2)
 S ACDCMP2=$P(ACDHREC,U,7),ACDCMP=ACDCMP_ACDCMP2 K ACDCMP2
 ;S ACDPRV=$P(ACDHREC,U,3) S:ACDPRV ACDPRV=$P($G(^DIC(16,ACDPRV,0)),U)
 S ACDPRV=$P(ACDHREC,U,3) S:ACDPRV ACDPRV=$P($G(^VA(200,ACDPRV,0)),U)
 S ACDCID=$P(^AUPNPAT(ACDPDFN,0),U,6)
 S ACDNAME=$P(^DPT(ACDPDFN,0),U)
 S ACDDT=$P(^DPT(ACDPDFN,0),U,3) S ACDDOB=$E(ACDDT,4,5)_"/"_$E(ACDDT,6,7)_"/"_$E(ACDDT,2,3) K ACDDT
 K ACDPDD
 S DIC=9000001,DR="1602.2:1606.2",DA=ACDPDFN,DIQ="ACDPDD(" D DIQ1^ACDFMC
 S DIC="^ACDWORK(",DIC(0)="L",X=ACDNAME
 S DIC("DR")="1////"_ACDPRG_";2////"_ACDCMP_";3////"_ACDDOS_";4////"_ACDPRV_";5////"_ACDCID_";6////"_ACDDOB_";7////"_ACDFLG
 S DIC("DR")=DIC("DR")_";1101////"_ACDPDD(9000001,ACDPDFN,1602.2)_";1102////"_ACDPDD(9000001,ACDPDFN,1603.2)_";1103////"_ACDPDD(9000001,ACDPDFN,1604.2)_";1104////"_ACDPDD(9000001,ACDPDFN,1605.2)_";1105////"_ACDPDD(9000001,ACDPDFN,1606.2)
 K ACDPDD
 D FILE^ACDFMC
 K ACDHLD,ACDC
 Q
KILLVAR K ACDA,ACDB,ACDBEGDT,ACDC,ACDCID,ACDCMP
 K ACDDOB,ACDDOS,ACDFLG,ACDHREC,ACDIX,ACDNAME
 K ACDPDFN,ACDPRG,ACDPRV,ACDT,X,Y
 K ACD12MO,ACD12MOE,ACD18MO,ACD18MOE,ACD6MO,ACD6MOE,ACD24MO,ACD24MOE
 Q
NOFUD W !!,"No Follow Ups Appointments are Due for this month."
 D PAUSE^ACDDEU
 D KILLVAR
 Q