source: WorldVistAEHR/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXXGI.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: 8.4 KB
Line 
1LEXXGI ; ISL/KER - Global Import (Needs ^LEXM) ; 02/22/2007
2 ;;2.0;LEXICON UTILITY;**4,25,26,27,28,29,46,49**;Sep 23, 1996;Build 3
3 ;
4 ; NEWed or KILLed Elsewhere
5 ;
6 ; LEXBUILD, LEXFY, LEXIGHF, LEXLREV, LEXPTYPE
7 ; LEXQTR, LEXREQP, LEXSHORT, XPDNM
8 ;
9 ; Global Variables
10 ; ^LEXM
11 ;
12 ; External References
13 ; HOME^%ZIS
14 ; ^DIM
15 ; $$GET1^DIQ
16 ; $$DT^XLFDT
17 ; $$FMTE^XLFDT
18 ; BMES^XPDUTL
19 ; MES^XPDUTL
20 ;
21EN ; Main Entry Point for Installing LEXM in Post-Installs
22 ;
23 ; Requires
24 ;
25 ; LEXBUILD - the name of the patch/build being installed
26 ;
27 ; Uses
28 ;
29 ; LEXMSG - If this variable exist, then an install message
30 ; message will be set to G.LEXICON
31 ;
32 ; LEXSHORT - If this variable exist, the install message
33 ; will be an abbreviated message, without the
34 ; file totals and checksums
35 ;
36 ; Abbreviated Install Message
37 ;
38 ; Date and Time Installed
39 ; Account where the Data was Installed
40 ; Who Installed the Data
41 ; The Name of the Build Installed
42 ; The Name of the Global Host File
43 ; Protocol Invoked
44 ; Date and time Protocol was Invoked
45 ; Install Start Date/Time
46 ; Install Complete Date/Time
47 ; Install Elapsed Time
48 ;
49 ; Long Install Message
50 ;
51 ; All of the elements above plus:
52 ;
53 ; File Versions/Revisions
54 ; File Checksums
55 ; File Record Counts
56 ;
57 ; LEXPTYPE - Patch Type
58 ; LEXLREV - Revision
59 ; LEXREQP - Required Patches/Builds
60 ; LEXIGHF - The patch Export Global Host Filename
61 ; LEXFY - Fiscal Year
62 ; LEXQTR - Quarter
63 ; LEXCRE - Import Global Creation Date
64 ;
65 D IMPORT,KALL^LEXXGI2
66 Q
67IMPORT ; Import Data during a Patch Installation
68 S:$D(ZTQUEUED) ZTREQ="@"
69 S:$L($G(LEXPTYPE)) LEXPTYPE=$G(LEXPTYPE) S:$L($G(LEXLREV)) LEXLREV=$G(LEXLREV) S:$L($G(LEXREQP)) LEXREQP=$G(LEXREQP)
70 S:$L($G(LEXBUILD)) LEXBUILD=$G(LEXBUILD) S:$L($G(LEXIGHF)) LEXIGHF=$G(LEXIGHF) S:$L($G(LEXFY)) LEXFY=$G(LEXFY)
71 S:$L($G(LEXQTR)) LEXQTR=$G(LEXQTR) K LEXSCHG,LEXCHG
72 N LEXB,LEXCD,LEXSTR,LEXLAST,%,%DT,C,D,D0,D1,D2,DG,DIC,DICR,DILOCKTM,DIW,IREC,J,XMDUN,XMZ,ZTSK
73 S U="^",LEXSTR=$G(LEXPTYPE),LEXB=$G(^LEXM(0,"BUILD"))
74 S:$L($G(LEXFY))&($L($G(LEXQTR)))&($L(LEXSTR)) LEXSTR=LEXSTR_" for "_$G(LEXFY)_" "_$G(LEXQTR)_" Quarter"
75 S:$L(LEXB) LEXBLD=LEXB S:'$L(LEXBLD)&($L(LEXBUILD)) LEXBLD=LEXBUILD
76 I '$L(LEXB)!(LEXB'=LEXBUILD) D
77 . N X,LEXBLD I '$L(LEXB) D Q
78 . . S X=" Invalid export global, aborting data install" W:'$D(XPDNM) !!,X D:$D(XPDNM) BMES^XPDUTL(X) W:'$D(XPDNM) ! D:$D(XPDNM) MES^XPDUTL(" ")
79 . I '$L(LEXBUILD) D Q
80 . . S X=" Undefined KIDS Build, aborting data install" W:'$D(XPDNM) !!,X D:$D(XPDNM) BMES^XPDUTL(X) W:'$D(XPDNM) ! D:$D(XPDNM) MES^XPDUTL(" ")
81 I $L(LEXB)&(LEXB=LEXBUILD) D
82 . N LEXFI,LEXID S X="Installing Data for patch "_LEXB W:'$D(XPDNM) !!,X D:$D(XPDNM) BMES^XPDUTL(X) W:'$D(XPDNM) ! D:$D(XPDNM) MES^XPDUTL(" ")
83 . K LEXSCHG S LEXCHG=0,LEXFI=0 F S LEXFI=$O(^LEXM(LEXFI)) Q:+LEXFI'>0 D
84 . . S LEXID=$S(LEXFI=80!(LEXFI=80.1):"ICD",LEXFI=81!(LEXFI=81.1)!(LEXFI=81.2)!(LEXFI=81.3):"CPT",$P(LEXFI,".",1)=757:"LEX",1:"UNK")
85 . . S LEXSCHG(LEXFI,0)=+($G(^LEXM(LEXFI,0))),LEXSCHG("B",LEXFI)="" S LEXSCHG("C",LEXID,LEXFI)=""
86 . S:$D(LEXSCHG("C","CPT"))!($D(LEXSCHG("C","ICD"))) LEXSCHG("D","PRO")="",LEXCHG=1,LEXSCHG(0)=1
87 . D LOAD,NOTIFY^LEXXGI2 I +($G(DUZ))>0,$L($$GET1^DIQ(200,(+($G(DUZ))_","),.01)) D
88 . . D HOME^%ZIS N DIFROM,LEXPRO,LEXPRON,LEXLAST D:$D(LEXMSG) POST^LEXXFI
89 Q
90LOAD ; Load Data from ^LEXM into IC*/LEX Files
91 Q:'$L($G(LEXB)) S:$D(ZTQUEUED) ZTREQ="@"
92 N LEXBEG,LEXELP,LEXEND,LEXMSG,LEXOK,LEXFL
93 D:'$D(^LEXM) NF^LEXXGI2 Q:'$D(^LEXM)
94 S LEXOK=0 S:$O(^LEXM(0))>0 LEXOK=1 D:'LEXOK IG^LEXXGI2 Q:'LEXOK
95 S LEXBEG=$$HACK^LEXXGI2 D FILES S LEXEND=$$HACK^LEXXGI2,LEXELP=$$ELAP^LEXXGI2(LEXBEG,LEXEND)
96 S:LEXELP="" LEXELP="00:00:00"
97 D PB^LEXXGI2(" Data Updated ")
98 D PB^LEXXGI2((" Started: "_$TR($$FMTE^XLFDT(LEXBEG),"@"," ")))
99 D TL^LEXXGI2((" Finished: "_$TR($$FMTE^XLFDT(LEXEND),"@"," ")))
100 D TL^LEXXGI2((" Elapsed: "_LEXELP))
101 Q
102FILES ; Load Data for all files
103 Q:'$L($G(LEXB)) N LEXHDR,LEXBLD,LEXDAT,LEXFI,LEXFIC,LEXHDRS,LEXLOG,LEXINS
104 S (LEXFI,LEXFIC)=0,LEXHDR=0,LEXBLD=LEXB
105 S LEXDAT=$P($G(^LEXM(0,"VRRVDT")),"^",1),LEXINS=1
106 S:+LEXDAT'>0 LEXDAT=$$DT^XLFDT I LEXOK D
107 . N LEXCRE,LEXL1 S LEXL1="" S LEXCRE=$G(^LEXM(0,"CREATED")) S LEXCRE=$S(+LEXCRE>0:($$MIX^LEXXGI2($$FMTE^XLFDT(LEXCRE))),1:"")
108 . S:$L($P(LEXCRE,"@",2)) LEXCRE=$P(LEXCRE,"@",1)_" at "_$P(LEXCRE,"@",2) S LEXL1=" Updating files "
109 . S:$L($G(LEXCRE))&($L($G(LEXL1))) LEXL1=$G(LEXL1)_"using export global created "_$G(LEXCRE)
110 . D PB^LEXXGI2(LEXL1)
111 F S LEXFI=$O(^LEXM(LEXFI)) Q:+LEXFI=0 D FILE
112 Q
113FILE ; Load Data for one file
114 N LEXCF,LEXCHG,LEXCHGS,LEXCNT,LEXFIL,LEXI,LEXID,LEXIEN,LEXL,LEXLC
115 N LEXMUMPS,LEXNM,LEXRT,LEXS,LEXTOT,LEXTXT,LEXIGL,LEXIGI,LEXIGF,LEXIGT
116 N LEXIGD,LEXIGO,LEXBEG,LEXEND,LEXELP,LEXFB
117 S LEXFB=$G(^LEXM(+LEXFI,0,"BUILD")),LEXIGO=0,LEXBEG=$$HACK^LEXXGI2
118 S (LEXCNT,LEXLC,LEXI)=0,LEXL=68,LEXFIC=LEXFIC+1 I LEXOK D
119 . N LEXB,LEXFID,LEXNM,LEXVR,LEXRV,LEXDT,LEXL1,LEXL2 S (LEXL1,LEXL2)="",LEXFID=$P(LEXFI,".",1)
120 . Q:+LEXFID'>0 Q:$D(LEXHDRS(+LEXFID)) S LEXHDRS(LEXFID)="" S:+LEXFI=81!(+LEXFI=81.3) LEXHDRS(81)="",LEXHDRS(81.3)=""
121 . S:LEXFID=80 LEXNM="ICD-9-CM" S:LEXFID=81 LEXNM="CPT-4/HCPSC" S:LEXFID=757 LEXNM="Lexicon" S LEXB=$G(^LEXM(LEXFI,0,"BUILD"))
122 . S LEXVR=$G(^LEXM(LEXFI,0,"VR")),LEXRV=$G(^LEXM(LEXFI,0,"VRRV")),LEXDT=$$MIX^LEXXGI2($$FMTE^XLFDT($P(LEXRV,"^",2))),LEXRV=$P(LEXRV,"^",1)
123 . S LEXL1="Updating "_LEXNM S:$L(LEXB) LEXL1=LEXL1_" with patch/build "_LEXB S:$L(LEXVR) LEXL2=" To version "_LEXVR
124 . S:$L(LEXVR)&($L(LEXRV)) LEXL2=LEXL2_" revision "_LEXRV S:$L(LEXVR)&($L(LEXRV))&($L(LEXDT)) LEXL2=LEXL2_" dated "_LEXDT
125 . S:$L(LEXL1) LEXL1=" "_LEXL1 S:$L(LEXL2) LEXL2=" "_LEXL2 D BL^LEXXGI2 D:$L(LEXL1) TL^LEXXGI2(LEXL1) D:$L(LEXL2) TL^LEXXGI2(LEXL2),BL^LEXXGI2
126 S LEXTOT=+($G(^LEXM(LEXFI,0))) G:LEXTOT=0 FILEQ
127 S LEXNM=$G(^LEXM(LEXFI,0,"NM"))
128 I $L(LEXNM),$$UP^LEXXGI2(LEXNM)'["FILE" S LEXNM=LEXNM_" FILE"
129 S:$L(LEXNM) LEXNM=$$MIX^LEXXGI2(LEXNM) S LEXCHG=$G(^LEXM(LEXFI,0))
130 S LEXTXT=" "_LEXNM,LEXTXT=LEXTXT_$J("",(40-$L(LEXTXT)))_LEXFI
131 D:LEXFIC=1 PB^LEXXGI2(LEXTXT) D:LEXFIC'=1 TL^LEXXGI2(LEXTXT)
132 S LEXS=+(LEXTOT\LEXL) S:LEXS=0 LEXS=1 W:+($O(^LEXM(LEXFI,0)))>0 !," "
133 D UPCHG^LEXXGI2 F S LEXI=$O(^LEXM(LEXFI,LEXI)) Q:+LEXI=0 D
134 . S LEXCNT=LEXCNT+1,LEXMUMPS=$G(^LEXM(LEXFI,LEXI))
135 . I LEXCNT'<LEXS S LEXLC=LEXLC+1 W:LEXLC'>LEXL "." S LEXCNT=0
136 . S LEXRT=$P(LEXMUMPS,"^",2),LEXFIL=""
137 . S:LEXMUMPS["^LEX("!(LEXMUMPS["^LEXT(")!(LEXMUMPS["^LEXC(") LEXFIL=+($P(LEXRT,"(",2)),LEXFL(+($P(LEXRT,"(",2)))=""
138 . S:LEXMUMPS["^ICD9(" LEXFIL=80,LEXFL(80)=""
139 . S:LEXMUMPS["^ICD0(" LEXFIL=80.1,LEXFL(80.1)=""
140 . S:LEXMUMPS["^ICPT(" LEXFIL=81,LEXFL(81)=""
141 . S:LEXMUMPS["^DIC(81.3" LEXFIL=81.3,LEXFL(81.3)=""
142 . S:LEXMUMPS["^DIC(81.2" LEXFIL=81.2,LEXFL(81.2)=""
143 . S:LEXMUMPS["^LEX("!(LEXMUMPS["^LEXT(")!(LEXMUMPS["^LEXC(") LEXFIL=+($P(LEXRT,"(",2))
144 . S:LEXMUMPS["^ICD9(" LEXFIL=80 S:LEXMUMPS["^ICD0(" LEXFIL=80.1
145 . S:LEXMUMPS["^ICPT(" LEXFIL=81 S:LEXMUMPS["^DIC(81.3" LEXFIL=81.3
146 . S:+LEXFIL>0 LEXSCHG(+LEXFIL,0)=""
147 . I $L(LEXMUMPS) D
148 . . N X S X=LEXMUMPS D ^DIM Q:'$D(X) X LEXMUMPS S LEXIGO=1
149 I +($G(LEXIGO))>0 D
150 . S LEXEND=$$HACK^LEXXGI2 S LEXELP=$$ELAP^LEXXGI2(LEXBEG,LEXEND) S:LEXELP="" LEXELP="00:00:00"
151FILEQ ; Load Data for one file - QUIT
152 K ^LEXM(+LEXFI)
153 Q
154 ;
155NOTIFY ; Notify by Protocol - LEXICAL SERVICES UPDATE
156 D NOTIFY^LEXXGI2,KALL^LEXXGI2
157 Q
158SCHG ; Save Change File Changes (for NOTIFY)
159 N FI,ID K LEXSCHG S LEXCHG=0
160 N FI S FI=0 F S FI=$O(^LEXM(FI)) Q:+FI'>0 D
161 . S ID=$S(FI=80!(FI=80.1):"ICD",FI=81!(FI=81.1)!(FI=81.2)!(FI=81.3):"CPT",$P(FI,".",1)=757:"LEX",1:"UNK")
162 . S LEXSCHG(FI,0)=+($G(^LEXM(FI,0))),LEXSCHG("B",FI)="" S LEXSCHG("C",ID,FI)=""
163 S:$D(LEXSCHG("C","CPT"))!($D(LEXSCHG("C","ICD"))) LEXSCHG("D","PRO")=""
164 S:$D(^LEXM(80))!($D(^LEXM(80.1)))!($D(^LEXM(81)))!($D(^LEXM(81.2)))!($D(^LEXM(81.3)))!($D(LEXSCHG("D","PRO"))) LEXCHG=1,LEXSCHG(0)=1
165 Q
166ZTQ ; Taskman Quit
167 K ZTDESC,ZTDTH,ZTIO,ZTQUEUED,ZTREQ,ZTRTN,ZTSAVE,ZTSK
168 Q
Note: See TracBrowser for help on using the repository browser.