- TIUP146 ;SLC/RMO - Post-Install for TIU*1*146 ;9/9/02@09:51:20
- ;;1.0;Text Integration Utilities;**146**;Jun 20, 1997
- ;
- EN ;Entry point to queue a job to identify documents linked to a
- ;different patient's visit
- N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
- ;
- W !!,"PATCH TIU*1*146"
- W !!,"Search ALL entries in the TIU Document file (#8925) to identify"
- W !,"documents linked to a different patient's visit.",!
- ;
- ;Set variables
- S ZTRTN="EN1^TIUP146",ZTIO="",ZTSAVE("DUZ")=""
- S ZTDESC="Search TIU Documents - Patch 146"
- D ^%ZTLOAD
- I $G(ZTSK) D
- . W !!,"A task has been queued in the background and a bulletin will be sent"
- . W !,"to you upon completion of the task or if the task is stopped."
- . W !!,"The task number is "_$G(ZTSK)_"."
- Q
- ;
- EN1 ;Entry point to identify documents pointing to a different patient's
- ;visit
- ; Input -- None
- ; Output -- ^XTMP("TIUP146", Global
- N TIUD0,TIUDA,TIUDFN,TIUVSIT,TIURSTDA
- ;
- ;Initialize re-start if check point exists
- I +$G(^XTMP("TIUP146","CHKPT")) D
- . S TIURSTDA=+$G(^XTMP("TIUP146","CHKPT"))
- ELSE D
- . ;Clean-up ^XTMP("TIUP146")
- . K ^XTMP("TIUP146")
- . ;Initialize ^XTMP("TIUP146" if not re-start
- . S ^XTMP("TIUP146",0)=$$FMADD^XLFDT(DT,90)_U_DT
- . S ^XTMP("TIUP146","CNT","EX")=0
- . S ^XTMP("TIUP146","CNT","TOT")=0
- . S ^XTMP("TIUP146","CHKPT")=""
- K ^XTMP("TIUP146","STOP")
- S ^XTMP("TIUP146","T0")=$$NOW^XLFDT
- ;
- ;Loop through documents
- S TIUDA=$S($G(TIURSTDA):TIURSTDA,1:0)
- F S TIUDA=+$O(^TIU(8925,TIUDA)) Q:'TIUDA!($G(ZTSTOP)) I $D(^(TIUDA,0)) S TIUD0=^(0) D
- . ;Set variables
- . S TIUDFN=$P(TIUD0,U,2)
- . S TIUVSIT=$P(TIUD0,U,3)
- . ;
- . ;Check if document linked to a different patient's visit
- . I TIUVSIT>0,TIUDFN>0,+$G(^AUPNVSIT(+TIUVSIT,0)),$P(^(0),U,5)'=TIUDFN D SETXTMP(TIUDA,TIUVSIT)
- . S ^XTMP("TIUP146","CNT","TOT")=+$G(^XTMP("TIUP146","CNT","TOT"))+1
- . ;
- . ;Set check point for Document IEN
- . S ^XTMP("TIUP146","CHKPT")=TIUDA
- . ;
- . ;Check if user requested to stop task
- . I $$S^%ZTLOAD S ZTSTOP=1
- ;
- ;Send bulletin, re-set check point and clean up variables
- I $G(ZTSTOP) S ^XTMP("TIUP146","STOP")=$$NOW^XLFDT
- S ^XTMP("TIUP146","T1")=$$NOW^XLFDT
- ;
- D MAIL^TIUP146P
- ;
- I '$G(ZTSTOP) S ^XTMP("TIUP146","CHKPT")=""
- K TIURSTDA
- Q
- ;
- SETXTMP(TIUDA,TIUVSIT) ;Set ^XTMP for entries processed
- ; Input -- TIUDA TIU Document file (#8925) IEN
- ; TIUVSIT VIsit file (#9000010) IEN
- ; Output -- Set ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
- S ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
- S ^XTMP("TIUP146","CNT","EX")=+$G(^XTMP("TIUP146","CNT","EX"))+1
- Q
- ;
- ENDBI ;Entry point to remove documents pointing to a visit of IEN=1
- ;from ^XTMP
- N C,TIUDA
- W !,"Killing entries in ^XTMP(""TIUP146"",""EX"" that point to Visit IEN=1..."
- S (C,TIUDA)=0
- F S TIUDA=$O(^XTMP("TIUP146","EX",TIUDA)) Q:'TIUDA I +$G(^(TIUDA))=1 D
- . W:'(C#1000) "."
- . K ^XTMP("TIUP146","EX",TIUDA)
- . S C=C+1
- W !?1,C," ",$S(C=1:"entry",1:"entries")," removed."
- Q
- 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
- +2 ;
- EN ;Entry point to queue a job to identify documents linked to a
- +1 ;different patient's visit
- +2 NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
- +3 ;
- +4 WRITE !!,"PATCH TIU*1*146"
- +5 WRITE !!,"Search ALL entries in the TIU Document file (#8925) to identify"
- +6 WRITE !,"documents linked to a different patient's visit.",!
- +7 ;
- +8 ;Set variables
- +9 SET ZTRTN="EN1^TIUP146"
- SET ZTIO=""
- SET ZTSAVE("DUZ")=""
- +10 SET ZTDESC="Search TIU Documents - Patch 146"
- +11 DO ^%ZTLOAD
- +12 IF $GET(ZTSK)
- Begin DoDot:1
- +13 WRITE !!,"A task has been queued in the background and a bulletin will be sent"
- +14 WRITE !,"to you upon completion of the task or if the task is stopped."
- +15 WRITE !!,"The task number is "_$GET(ZTSK)_"."
- End DoDot:1
- +16 QUIT
- +17 ;
- EN1 ;Entry point to identify documents pointing to a different patient's
- +1 ;visit
- +2 ; Input -- None
- +3 ; Output -- ^XTMP("TIUP146", Global
- +4 NEW TIUD0,TIUDA,TIUDFN,TIUVSIT,TIURSTDA
- +5 ;
- +6 ;Initialize re-start if check point exists
- +7 IF +$GET(^XTMP("TIUP146","CHKPT"))
- Begin DoDot:1
- +8 SET TIURSTDA=+$GET(^XTMP("TIUP146","CHKPT"))
- End DoDot:1
- +9 IF '$TEST
- Begin DoDot:1
- +10 ;Clean-up ^XTMP("TIUP146")
- +11 KILL ^XTMP("TIUP146")
- +12 ;Initialize ^XTMP("TIUP146" if not re-start
- +13 SET ^XTMP("TIUP146",0)=$$FMADD^XLFDT(DT,90)_U_DT
- +14 SET ^XTMP("TIUP146","CNT","EX")=0
- +15 SET ^XTMP("TIUP146","CNT","TOT")=0
- +16 SET ^XTMP("TIUP146","CHKPT")=""
- End DoDot:1
- +17 KILL ^XTMP("TIUP146","STOP")
- +18 SET ^XTMP("TIUP146","T0")=$$NOW^XLFDT
- +19 ;
- +20 ;Loop through documents
- +21 SET TIUDA=$SELECT($GET(TIURSTDA):TIURSTDA,1:0)
- +22 FOR
- SET TIUDA=+$ORDER(^TIU(8925,TIUDA))
- IF 'TIUDA!($GET(ZTSTOP))
- QUIT
- IF $DATA(^(TIUDA,0))
- SET TIUD0=^(0)
- Begin DoDot:1
- +23 ;Set variables
- +24 SET TIUDFN=$PIECE(TIUD0,U,2)
- +25 SET TIUVSIT=$PIECE(TIUD0,U,3)
- +26 ;
- +27 ;Check if document linked to a different patient's visit
- +28 IF TIUVSIT>0
- IF TIUDFN>0
- IF +$GET(^AUPNVSIT(+TIUVSIT,0))
- IF $PIECE(^(0),U,5)'=TIUDFN
- DO SETXTMP(TIUDA,TIUVSIT)
- +29 SET ^XTMP("TIUP146","CNT","TOT")=+$GET(^XTMP("TIUP146","CNT","TOT"))+1
- +30 ;
- +31 ;Set check point for Document IEN
- +32 SET ^XTMP("TIUP146","CHKPT")=TIUDA
- +33 ;
- +34 ;Check if user requested to stop task
- +35 IF $$S^%ZTLOAD
- SET ZTSTOP=1
- End DoDot:1
- +36 ;
- +37 ;Send bulletin, re-set check point and clean up variables
- +38 IF $GET(ZTSTOP)
- SET ^XTMP("TIUP146","STOP")=$$NOW^XLFDT
- +39 SET ^XTMP("TIUP146","T1")=$$NOW^XLFDT
- +40 ;
- +41 DO MAIL^TIUP146P
- +42 ;
- +43 IF '$GET(ZTSTOP)
- SET ^XTMP("TIUP146","CHKPT")=""
- +44 KILL TIURSTDA
- +45 QUIT
- +46 ;
- SETXTMP(TIUDA,TIUVSIT) ;Set ^XTMP for entries processed
- +1 ; Input -- TIUDA TIU Document file (#8925) IEN
- +2 ; TIUVSIT VIsit file (#9000010) IEN
- +3 ; Output -- Set ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
- +4 SET ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
- +5 SET ^XTMP("TIUP146","CNT","EX")=+$GET(^XTMP("TIUP146","CNT","EX"))+1
- +6 QUIT
- +7 ;
- ENDBI ;Entry point to remove documents pointing to a visit of IEN=1
- +1 ;from ^XTMP
- +2 NEW C,TIUDA
- +3 WRITE !,"Killing entries in ^XTMP(""TIUP146"",""EX"" that point to Visit IEN=1..."
- +4 SET (C,TIUDA)=0
- +5 FOR
- SET TIUDA=$ORDER(^XTMP("TIUP146","EX",TIUDA))
- IF 'TIUDA
- QUIT
- IF +$GET(^(TIUDA))=1
- Begin DoDot:1
- +6 IF '(C#1000)
- WRITE "."
- +7 KILL ^XTMP("TIUP146","EX",TIUDA)
- +8 SET C=C+1
- End DoDot:1
- +9 WRITE !?1,C," ",$SELECT(C=1:"entry",1:"entries")," removed."
- +10 QUIT