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

ADEGRL6.m

Go to the documentation of this file.
ADEGRL6 ; IHS/HQT/MJL - FILE DENTAL VISIT DATA ;10:12 PM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;**12,26**;APRIL 1999;Build 13
 ;;IHS/OIT/GAB 10.2014 Modified for 2015 Code Updates - PATCH 26
 K DIC
 ;S J="" F  S J=$O(ADEV(J)) Q:'J  W !,"ADEV(",J,")=",ADEV(J)
 ;R X ;IHS/HMW 5-12-90 REMOVE AFTER TESTING
 I ADENOUPD G END
 I ADENEWVS,'$D(ADEV) G END
 ;------->QUEUE WRITES IF BACKGROUND ENABLED, TASKMAN RUNNING
 G ZTM ;IHS/SET/HMW 2-6-2003 **12** Background writes disabled
 G:$P(^ADEPARAM(+^AUTTSITE(1,0),0),U,4)'="y" ZTM
 I $S($D(^%ZTSCH("RUN"))[0:1,^("RUN")-$H:1,1:$P($H,",",2)-150>$P(^("RUN"),",",2)) W *7,!,"TASK MANAGER NOT RUNNING -- BACKGROUND WRITES DISABLED",!,"PLEASE WAIT WHILE I UPDATE THE DENTAL FILE",! G ZTM
 D ^ADEQUE
 ; ^ADEUTL is a transient, non-fileman working global
 I '$D(^ADEUTL("ADEDQUE")) S ^ADEUTL("ADEDQUE")=1,ZTRTN="^ADEDQUE",ZTDTH=$H,ZTDESC="DENTAL DISC WRITES",ZTIO="" D ^%ZTLOAD
 G END1
ZTM ;------->IF NEW VISIT CREATE ENTRY IN ADEPCD (ENTRY POINT FOR ^ADEDQUE)
 I ADENEWVS D NEWVS
 ;------->IF MODIFICATION OF EXISTING VISIT DELETE OLD SVCS DATA
 I 'ADENEWVS D SDEL
 ;------->NEW LOCATION AND PROVIDER DATA INTO ADEPCD
 K DIE,DA,DR D STUFA
 ;------->NEW SERVICE DATA INTO ADEPCD
 K DIE,DA,DR D STUFB
 ;------->FAILED APPT & FOLLOWUP PROCESSING
 ;/IHS/OIT/GAB 11.2014 Patch #26 modified below line to add 2015 codes 9986 & 9987 (do not remove old codes yet)
 ;I ADENEWVS,($D(ADEV("9130"))!$D(ADEV("9140"))) D FAIL,FOL G END
 I ADENEWVS,($D(ADEV("9130"))!$D(ADEV("9140"))!$D(ADEV("9986"))!$D(ADEV("9987"))) D FAIL,FOL G END
 ;------->UPDATE PCC FILES
 D ^ADEAPC
END K ^ADEUTL("ADELOCK",ADEPAT)
END1 K ADEFLG,ADENOTE,ADEVDATE,ADENOUPD,ADENEWVS,ADEPAT,ADERDNM,ADERDNMD,ADELOE,ADELOED,ADEPVNM,ADEPVNMD,ADEV,ADEDES,ADEPNM,ADEHRN,ADEDENT,ADETITL,ADECOD,ADEDEL,ADEOP,ADECNT,ADEQTY,ADEDEF,ADEI,ADETCH,ADETCHF,ADETFE
 K ADEHXC,ADEHXO,ADEHXF
 Q
 ;
NEWVS S DIC="^ADEPCD(",DIC(0)="LZ",X=ADEPAT,DIC("DR")="1///"_ADEVDATE K DD,DO D FILE^DICN S ADEDFN=$P(Y,U)
 Q
 ;
SDEL ;
 S DIE="^ADEPCD(",DA=ADEDFN,DR(2,9002007.01)=".01///@",ADESVC=0
SDEL1 S ADESVC=$O(^ADEPCD(ADEDFN,"ADA",ADESVC))
 I ADESVC="" K ADESVC,DR,DIE,DA Q
 S DR="100///`"_ADESVC D ^DIE G SDEL1
STUFA S DA=ADEDFN,DR="2///`"_ADELOED_";"_$S(ADEPVNMD]"":"4///`"_ADEPVNMD_";",1:"")_$S(ADENOTE]"":"6///^S X=ADENOTE;",1:"")_$S(ADECON:"7///"_ADETCH_";8///c;",1:"8///d;")_"3///`"_ADERDNMD,DIE="^ADEPCD(" D ^DIE Q
STUFB S DA(1)=ADEDFN
 S DIE="^ADEPCD(DA(1),""ADA"",",^ADEPCD(DA(1),"ADA",0)="^9002007.01IPA^^",ADEJ=0,DA=0
ROLL S ADEJ=$O(ADEV(ADEJ)) G:ADEJ="" RO1 S ADEI=$O(^AUTTADA("B",ADEJ,0))
RO1A S ADECNT=0 F DA=DA+1:1:DA+$P(ADEV(ADEJ),U) S ADECNT=ADECNT+1,DR=".01///`"_ADEI D RO1B S:ADECON DR=DR_";3///"_$P(ADEV(ADEJ),U,3) D ^DIE ;IHS/HMW 5-12-90
 G ROLL
RO1B I $P($P(ADEV(ADEJ),U,2),",",ADECNT)]"" S DR=DR_";2///`"_$P($P(ADEV(ADEJ),U,2),",",ADECNT)
 I $P($P(ADEV(ADEJ),U,4),",",ADECNT)]"" S DR=DR_";4///"_$P($P(ADEV(ADEJ),U,4),",",ADECNT)
 I $P($P(ADEV(ADEJ),U,5),",",ADECNT)]"" S DR=DR_";5///y"
 Q
RO1 S $P(^ADEPCD(ADEDFN,"ADA",0),U,3)=DA S $P(^(0),U,4)=DA
 Q
FAIL ;
 K DIC,DIE,DA,DR,X,Y
 I '$D(^ADEPAT(ADEPAT)) S DIC="^ADEPAT(",DIC(0)="LZ",X=ADEPAT,DINUM=X K DD,DO D FILE^DICN
 S DA(1)=ADEPAT
 S DIE="^ADEPAT(DA(1),""FA"","
 I $D(^ADEPAT(ADEPAT,"FA",0)) S DA=$P(^ADEPAT(ADEPAT,"FA",0),U,3)+1
 E  S ^ADEPAT(ADEPAT,"FA",0)="^9002010.22DA^^",DA=1
 ;/IHS/OIT/GAB 11.2014 Patch #26 Removed below and added the next line to include new code 9986 (do not remove old codes yet)
 ;S DR=".01///"_ADEVDATE_";1///"_$S($D(ADEV("9130")):"b",1:"c")
 S DR=".01///"_ADEVDATE_";1///"_$S($D(ADEV("9130")):"b",$D(ADEV("9986")):"b",1:"c")
 D ^DIE
 S $P(^ADEPAT(ADEPAT,"FA",0),U,3)=DA,$P(^ADEPAT(ADEPAT,"FA",0),U,4)=$P(^ADEPAT(ADEPAT,"FA",0),U,4)+1
 Q
FOL ;IF FAILED APPT SEND MESSG IF ON URGENT RECALL
 Q:'$D(^ADEFOL("TYPE",ADEPAT,"rc"))
 S ADETYP=0 F ADEQ=0:0 S ADETYP=$O(^ADEFOL("TYPE",ADEPAT,"rc",ADETYP)) Q:'+ADETYP  S ADEMDFN=0 F ADER=0:0 S ADEMDFN=$O(^ADEFOL("TYPE",ADEPAT,"rc",ADETYP,ADEMDFN)) Q:'+ADEMDFN  D MSG
 K ADETYP,ADEMDFN,ADEQ,ADER,XMB Q
MSG Q:'$D(^ADEFOL(ADEMDFN,0))
 K XMB
 I $P(^ADEFOL(ADEMDFN,0),U,5)="u" S XMB(1)=$P(^DPT(ADEPAT,0),U),XMB(2)=ADEVDATE I $P(^ADEFOL(ADEMDFN,0),U,7)]"",$D(^DIC(16,$P(^ADEFOL(ADEMDFN,0),U,7),0)) S XMB(3)=$P(^DIC(16,$P(^ADEFOL(ADEMDFN,0),U,7),0),U)
 I $D(XMB) D
 . S XMB="ADECALL"
 . S XMDUZ="DENTAL RECALL SYSTEM"
 . D ^XMB
 . K XMB
 Q