source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIURENDX.m@ 1154

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

initial load of WorldVistAEHR

File size: 3.0 KB
Line 
1TIURENDX ; slc/mli - reindex TIU x-refs ;9/21/98@11:59:22
2 ;;1.0;TEXT INTEGRATION UTILITIES;**26**;Jun 20, 1997
3 ;
4 ; This routine will re-index the set logic only of the ACLPT, ACLAU,
5 ; ACLEC, and ACLSB cross-references on file 8925 (TIU DOCUMENT).
6 ; This will fix a problem with discharge summaries showing in TIU,
7 ; but not in CPRS.
8 ;
9EN ; -- allow process to be queued
10 S ZTDESC="Re-index TIU x-refs",ZTIO="",ZTRTN="DQ^TIURENDX"
11 D ^%ZTLOAD
12 K ZTDESC,ZTIO,ZTRTN,ZTSK
13 Q
14 ;
15DQ ; -- dequeue process
16 N TIUDA,TIUX,X
17 ; Initialize ^XTMP("TIURENDX")
18 K ^XTMP("TIURENDX")
19 S ^XTMP("TIURENDX",0)=$$FMADD^XLFDT(DT,90)_U_DT
20 S ^XTMP("TIURENDX","T0")=$$NOW^XLFDT
21 S (^XTMP("TIURENDX","COUNT"),^("ACLPT"),^("ACLSB"),^("ACLAU"),^("ACLEC"))=0
22 ; first, remove the ACL* x-refs, which may be corrupted
23 K ^TIU(8925,"ACLAU"),^TIU(8925,"ACLEC")
24 K ^TIU(8925,"ACLSB"),^TIU(8925,"ACLPT")
25 ; next, rebuild 'em
26 S TIUDA=0
27 F S TIUDA=$O(^TIU(8925,TIUDA)) Q:'TIUDA D
28 . N TIUSTAT,DA,TIUD0
29 . S TIUD0=$G(^TIU(8925,TIUDA,0))
30 . S TIUX=$P(TIUD0,U)
31 . I TIUX']"" Q
32 . I +$$ISCOMP(TIUD0) Q ; Don't process components
33 . S TIUSTAT=+$P($G(^TIU(8925,TIUDA,0)),U,5) Q:TIUSTAT'>0
34 . S DA=TIUDA
35 . ; Include UNSIGNED documents in the ACLAU x-ref
36 . I TIUSTAT=5 D SACLAU^TIUDD0(.01,TIUX),SACLAU1^TIUDD0(.01,TIUX) S ^XTMP("TIURENDX","ACLAU")=^XTMP("TIURENDX","ACLAU")+1,^XTMP("TIURENDX","COUNT")=^XTMP("TIURENDX","COUNT")+1
37 . ; Include UNCOSIGNED documents in the ACLEC & ACLPT x-refs
38 . I TIUSTAT=6 D SACLEC^TIUDD0(.01,TIUX),SACLPT^TIUDD0(.01,TIUX) S ^XTMP("TIURENDX","ACLEC")=^XTMP("TIURENDX","ACLEC")+1,^XTMP("TIURENDX","ACLPT")=^XTMP("TIURENDX","ACLPT")+1,^XTMP("TIURENDX","COUNT")=^XTMP("TIURENDX","COUNT")+1
39 . ; Include ALL COMPLETED documents in the ACLPT & ACLSB x-refs
40 . I TIUSTAT>6 D SACLPT^TIUDD0(.01,TIUX),SACLSB^TIUDD0(.01,TIUX) S ^XTMP("TIURENDX","ACLPT")=^XTMP("TIURENDX","ACLPT")+1,^XTMP("TIURENDX","ACLSB")=^XTMP("TIURENDX","ACLSB")+1,^XTMP("TIURENDX","COUNT")=^XTMP("TIURENDX","COUNT")+1
41 . S ^XTMP("TIURENDX",+$P(TIUD0,U,5))=+$G(^XTMP("TIURENDX",+$P(TIUD0,U,5)))+1
42 S ^XTMP("TIURENDX","T1")=$$NOW^XLFDT
43 D BULLETIN
44 Q
45ISCOMP(TIUD0) ; Is this record a component?
46 Q $S($P($G(^TIU(8925.1,+TIUD0,0)),U,4)="CO":1,1:0)
47BULLETIN ; Send Bulletins on completion
48 N TIUCNT,TIUBDT,TIUDIFF,TIUETM,TIUEDT,TIURPS,TIURAU,TIUREC,TIURPT
49 N TIURSB,XMY,XMB,XMDUZ
50 S TIUCNT=+$G(^XTMP("TIURENDX","COUNT"))
51 S TIUBDT=$$DATE^TIULS(+^XTMP("TIURENDX","T0"),"MM/DD/YY HR:MIN")
52 S TIUEDT=$$DATE^TIULS(+^XTMP("TIURENDX","T1"),"MM/DD/YY HR:MIN")
53 S TIURAU=^XTMP("TIURENDX","ACLAU")
54 S TIUREC=^XTMP("TIURENDX","ACLEC")
55 S TIURPT=^XTMP("TIURENDX","ACLPT")
56 S TIURSB=^XTMP("TIURENDX","ACLSB")
57 S TIUDIFF=$$FMDIFF^XLFDT(+^XTMP("TIURENDX","T1"),+^XTMP("TIURENDX","T0"),2)
58 S TIUETM=$$FMDIFF^XLFDT(+^XTMP("TIURENDX","T1"),+^XTMP("TIURENDX","T0"),3)
59 S TIURPS=$J(TIUCNT/TIUDIFF,5,2)
60 S XMY(+$G(DUZ))=""
61 S XMB="TIU RE-INDEX DOCUMENT FILE"
62 S XMDUZ="TIU RE-INDEX DOCUMENT FILE"
63 S XMB(1)=TIUBDT,XMB(2)=TIUEDT,XMB(3)=TIURPT,XMB(4)=TIURSB
64 S XMB(5)=TIURAU,XMB(6)=TIUREC,XMB(7)=TIUCNT,XMB(8)=TIUETM
65 S XMB(9)=TIURPS
66 D ^XMB,KILL^XM
67 Q
Note: See TracBrowser for help on using the repository browser.