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

TIUP146.m

Go to the documentation of this file.
  1. TIUP146 ;SLC/RMO - Post-Install for TIU*1*146 ;9/9/02@09:51:20
  1. ;;1.0;Text Integration Utilities;**146**;Jun 20, 1997
  1. ;
  1. EN ;Entry point to queue a job to identify documents linked to a
  1. ;different patient's visit
  1. N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
  1. ;
  1. W !!,"PATCH TIU*1*146"
  1. W !!,"Search ALL entries in the TIU Document file (#8925) to identify"
  1. W !,"documents linked to a different patient's visit.",!
  1. ;
  1. ;Set variables
  1. S ZTRTN="EN1^TIUP146",ZTIO="",ZTSAVE("DUZ")=""
  1. S ZTDESC="Search TIU Documents - Patch 146"
  1. D ^%ZTLOAD
  1. I $G(ZTSK) D
  1. . W !!,"A task has been queued in the background and a bulletin will be sent"
  1. . W !,"to you upon completion of the task or if the task is stopped."
  1. . W !!,"The task number is "_$G(ZTSK)_"."
  1. Q
  1. ;
  1. EN1 ;Entry point to identify documents pointing to a different patient's
  1. ;visit
  1. ; Input -- None
  1. ; Output -- ^XTMP("TIUP146", Global
  1. N TIUD0,TIUDA,TIUDFN,TIUVSIT,TIURSTDA
  1. ;
  1. ;Initialize re-start if check point exists
  1. I +$G(^XTMP("TIUP146","CHKPT")) D
  1. . S TIURSTDA=+$G(^XTMP("TIUP146","CHKPT"))
  1. ELSE D
  1. . ;Clean-up ^XTMP("TIUP146")
  1. . K ^XTMP("TIUP146")
  1. . ;Initialize ^XTMP("TIUP146" if not re-start
  1. . S ^XTMP("TIUP146",0)=$$FMADD^XLFDT(DT,90)_U_DT
  1. . S ^XTMP("TIUP146","CNT","EX")=0
  1. . S ^XTMP("TIUP146","CNT","TOT")=0
  1. . S ^XTMP("TIUP146","CHKPT")=""
  1. K ^XTMP("TIUP146","STOP")
  1. S ^XTMP("TIUP146","T0")=$$NOW^XLFDT
  1. ;
  1. ;Loop through documents
  1. S TIUDA=$S($G(TIURSTDA):TIURSTDA,1:0)
  1. F S TIUDA=+$O(^TIU(8925,TIUDA)) Q:'TIUDA!($G(ZTSTOP)) I $D(^(TIUDA,0)) S TIUD0=^(0) D
  1. . ;Set variables
  1. . S TIUDFN=$P(TIUD0,U,2)
  1. . S TIUVSIT=$P(TIUD0,U,3)
  1. . ;
  1. . ;Check if document linked to a different patient's visit
  1. . I TIUVSIT>0,TIUDFN>0,+$G(^AUPNVSIT(+TIUVSIT,0)),$P(^(0),U,5)'=TIUDFN D SETXTMP(TIUDA,TIUVSIT)
  1. . S ^XTMP("TIUP146","CNT","TOT")=+$G(^XTMP("TIUP146","CNT","TOT"))+1
  1. . ;
  1. . ;Set check point for Document IEN
  1. . S ^XTMP("TIUP146","CHKPT")=TIUDA
  1. . ;
  1. . ;Check if user requested to stop task
  1. . I $$S^%ZTLOAD S ZTSTOP=1
  1. ;
  1. ;Send bulletin, re-set check point and clean up variables
  1. I $G(ZTSTOP) S ^XTMP("TIUP146","STOP")=$$NOW^XLFDT
  1. S ^XTMP("TIUP146","T1")=$$NOW^XLFDT
  1. ;
  1. D MAIL^TIUP146P
  1. ;
  1. I '$G(ZTSTOP) S ^XTMP("TIUP146","CHKPT")=""
  1. K TIURSTDA
  1. Q
  1. ;
  1. SETXTMP(TIUDA,TIUVSIT) ;Set ^XTMP for entries processed
  1. ; Input -- TIUDA TIU Document file (#8925) IEN
  1. ; TIUVSIT VIsit file (#9000010) IEN
  1. ; Output -- Set ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
  1. S ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
  1. S ^XTMP("TIUP146","CNT","EX")=+$G(^XTMP("TIUP146","CNT","EX"))+1
  1. Q
  1. ;
  1. ENDBI ;Entry point to remove documents pointing to a visit of IEN=1
  1. ;from ^XTMP
  1. N C,TIUDA
  1. W !,"Killing entries in ^XTMP(""TIUP146"",""EX"" that point to Visit IEN=1..."
  1. S (C,TIUDA)=0
  1. F S TIUDA=$O(^XTMP("TIUP146","EX",TIUDA)) Q:'TIUDA I +$G(^(TIUDA))=1 D
  1. . W:'(C#1000) "."
  1. . K ^XTMP("TIUP146","EX",TIUDA)
  1. . S C=C+1
  1. W !?1,C," ",$S(C=1:"entry",1:"entries")," removed."
  1. Q