source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUP146.m@ 1078

Last change on this file since 1078 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1TIUP146 ;SLC/RMO - Post-Install for TIU*1*146 ;9/9/02@09:51:20
2 ;;1.0;Text Integration Utilities;**146**;Jun 20, 1997
3 ;
4EN ;Entry point to queue a job to identify documents linked to a
5 ;different patient's visit
6 N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
7 ;
8 W !!,"PATCH TIU*1*146"
9 W !!,"Search ALL entries in the TIU Document file (#8925) to identify"
10 W !,"documents linked to a different patient's visit.",!
11 ;
12 ;Set variables
13 S ZTRTN="EN1^TIUP146",ZTIO="",ZTSAVE("DUZ")=""
14 S ZTDESC="Search TIU Documents - Patch 146"
15 D ^%ZTLOAD
16 I $G(ZTSK) D
17 . W !!,"A task has been queued in the background and a bulletin will be sent"
18 . W !,"to you upon completion of the task or if the task is stopped."
19 . W !!,"The task number is "_$G(ZTSK)_"."
20 Q
21 ;
22EN1 ;Entry point to identify documents pointing to a different patient's
23 ;visit
24 ; Input -- None
25 ; Output -- ^XTMP("TIUP146", Global
26 N TIUD0,TIUDA,TIUDFN,TIUVSIT,TIURSTDA
27 ;
28 ;Initialize re-start if check point exists
29 I +$G(^XTMP("TIUP146","CHKPT")) D
30 . S TIURSTDA=+$G(^XTMP("TIUP146","CHKPT"))
31 ELSE D
32 . ;Clean-up ^XTMP("TIUP146")
33 . K ^XTMP("TIUP146")
34 . ;Initialize ^XTMP("TIUP146" if not re-start
35 . S ^XTMP("TIUP146",0)=$$FMADD^XLFDT(DT,90)_U_DT
36 . S ^XTMP("TIUP146","CNT","EX")=0
37 . S ^XTMP("TIUP146","CNT","TOT")=0
38 . S ^XTMP("TIUP146","CHKPT")=""
39 K ^XTMP("TIUP146","STOP")
40 S ^XTMP("TIUP146","T0")=$$NOW^XLFDT
41 ;
42 ;Loop through documents
43 S TIUDA=$S($G(TIURSTDA):TIURSTDA,1:0)
44 F S TIUDA=+$O(^TIU(8925,TIUDA)) Q:'TIUDA!($G(ZTSTOP)) I $D(^(TIUDA,0)) S TIUD0=^(0) D
45 . ;Set variables
46 . S TIUDFN=$P(TIUD0,U,2)
47 . S TIUVSIT=$P(TIUD0,U,3)
48 . ;
49 . ;Check if document linked to a different patient's visit
50 . I TIUVSIT>0,TIUDFN>0,+$G(^AUPNVSIT(+TIUVSIT,0)),$P(^(0),U,5)'=TIUDFN D SETXTMP(TIUDA,TIUVSIT)
51 . S ^XTMP("TIUP146","CNT","TOT")=+$G(^XTMP("TIUP146","CNT","TOT"))+1
52 . ;
53 . ;Set check point for Document IEN
54 . S ^XTMP("TIUP146","CHKPT")=TIUDA
55 . ;
56 . ;Check if user requested to stop task
57 . I $$S^%ZTLOAD S ZTSTOP=1
58 ;
59 ;Send bulletin, re-set check point and clean up variables
60 I $G(ZTSTOP) S ^XTMP("TIUP146","STOP")=$$NOW^XLFDT
61 S ^XTMP("TIUP146","T1")=$$NOW^XLFDT
62 ;
63 D MAIL^TIUP146P
64 ;
65 I '$G(ZTSTOP) S ^XTMP("TIUP146","CHKPT")=""
66 K TIURSTDA
67 Q
68 ;
69SETXTMP(TIUDA,TIUVSIT) ;Set ^XTMP for entries processed
70 ; Input -- TIUDA TIU Document file (#8925) IEN
71 ; TIUVSIT VIsit file (#9000010) IEN
72 ; Output -- Set ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
73 S ^XTMP("TIUP146","EX",TIUDA)=TIUVSIT
74 S ^XTMP("TIUP146","CNT","EX")=+$G(^XTMP("TIUP146","CNT","EX"))+1
75 Q
76 ;
77ENDBI ;Entry point to remove documents pointing to a visit of IEN=1
78 ;from ^XTMP
79 N C,TIUDA
80 W !,"Killing entries in ^XTMP(""TIUP146"",""EX"" that point to Visit IEN=1..."
81 S (C,TIUDA)=0
82 F S TIUDA=$O(^XTMP("TIUP146","EX",TIUDA)) Q:'TIUDA I +$G(^(TIUDA))=1 D
83 . W:'(C#1000) "."
84 . K ^XTMP("TIUP146","EX",TIUDA)
85 . S C=C+1
86 W !?1,C," ",$S(C=1:"entry",1:"entries")," removed."
87 Q
Note: See TracBrowser for help on using the repository browser.