source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7VSET.m@ 1361

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

initial load of WorldVistAEHR

File size: 8.7 KB
RevLine 
[613]1LA7VSET ;DALOI/JMC - MENU TO SETUP VISN LABS ; 12/3/1997
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,51,55,46,64**;Sep 27, 1994
3 ;
4 ; Reference to HL LOGICAL LINK file (#870) supported by DBIA #1495, 1496, 2063
5 ; Reference to PROTOCOL file (#101) supported by DBIA #872
6 ; Reference to MAIL GROUP file (#3.8) supported by DBIA #2061
7 ;
8 D CONV
9 ;
10 N LA76248,LA7629,LA7VNVC,PRIMARY,PRSITE,HDR,LAB,HOST,REMOTE,LRY,LRX,LA7VS,NAME
11 ;
12 S LA7VS=$$PRIM^VASITE(DT)
13 I $G(LA7VS)'="" D
14 . S LA7VS=$$SITE^VASITE(DT,LA7VS)
15 . S PRIMARY=$P(LA7VS,U,3),PRSITE=$P(LA7VS,U,2)
16 ;
17 I $G(PRIMARY)="" W !!,"No Primary Site is defined!!!!",!! R !,"Press RETURN to continue: ",X:DTIME Q
18 ;
19 S HDR="LEDI Setup"
20 S HDR(1)="Add/Edit HOST Lab",HDR(2)="Add/Edit COLLECTION Lab"
21 F S LAB=$$MAIN Q:LAB="" D @LAB
22 ;
23 K DIE,DA,DR,DO,DIC
24 ;
25 Q
26 ;
27MAIN() ; Display the main LEDI setup screen
28 N HDRCNT,HDRA
29 W @IOF,! F X=1:1:79 W "-"
30 W !,?((80-$L(HDR))/2),HDR
31 W ! F X=1:1:79 W "-"
32 W !
33 W !,"COLLECTION Labs: Use option #1 to setup HOST labs."
34 W !," HOST Labs : Use option #2 to setup COLLECTION labs."
35 W !!
36 S HDRCNT=0
37 F S HDRCNT=$O(HDR(HDRCNT)) Q:'HDRCNT W !,HDRCNT,".",?5,HDR(HDRCNT)
38 D KDIR
39 W !!
40 S DIR(0)="NO^1:2"
41 D MHLP,^DIR
42 S HDRA=$S(Y=1:"HOST",Y=2:"REMOTE",1:"")
43 D KDIR
44 Q HDRA
45 ;
46 ;
47KDIR ; kill all DIR variables
48 K DIR,DIRUT,DUOUT,DTOUT,DIROUT,X,Y
49 Q
50 ;
51 ;
52HOST ; HOST Lab Setup Menu
53 ;
54 N LA7CNT,LA7,LA7P,SNUM,SNAME,HOST,LA7A
55 ;
56 F D Q:'LA7A
57 . D HOSTBLD,HSTHDR,HOSTLST,KDIR
58 . W !! S DIR(0)="NO^1:"_LA7CNT
59 . D H1HLP,^DIR
60 . I $D(DIRUT) S LA7A=0 Q
61 . S LA7A=Y D AEHOST
62 K SNAME
63 Q
64 ;
65 ;
66HOSTBLD ; Build list of host facilities.
67 ; Identify all HOST labs using LA7 MESSAGE PARAMETER file (#62.48)
68 ;
69 N LA7,LA74,LA76248,LA7629,SNAME,SNUM
70 ;
71 K HOST
72 S LA7CNT=1,(LA7,LA7P)="LA7V HOST "
73 F S LA7=$O(^LAHM(62.48,"B",LA7)) Q:LA7=""!(LA7'[LA7P) D
74 . S SNUM=$P(LA7,"HOST ",2)
75 . S LA74=$$FINDSITE^LA7VHLU2(SNUM,1,1) Q:LA74'>0
76 . S SNAME=$P($$NS^XUAF4(LA74),"^")
77 . S HOST(LA7CNT)=SNUM_U_SNAME_U_LA7_U_LA74,LA7CNT=LA7CNT+1
78 S HOST(LA7CNT)=""
79 ;
80 Q
81 ;
82 ;
83HSTHDR ; HOST setup header
84 S HOST="HOST Lab(s)"
85 W @IOF,! F X=1:1:79 W "-"
86 W !,?((80-$L(HOST))/2),HOST
87 W ! F X=1:1:79 W "-"
88 W !!
89 Q
90 ;
91 ;
92HOSTLST ;
93 S LA7CNT=1,LA7=0
94 F S LA7=$O(HOST(LA7)) Q:'LA7 I HOST(LA7)'="" W !,LA7,".",?5,$P(HOST(LA7),U,2)_" ("_$P(HOST(LA7),U,3)_")" S LA7CNT=LA7CNT+1
95 W !,LA7CNT,".",?5,"Add HOST Lab"
96 Q
97 ;
98AEHOST ;
99 N CHA,UI
100 F S HOST="HOST Lab Setup" D HSTHDR,HSTHDR2,KDIR W !! S DIR(0)="NO^1:"_LA7CNT D H2HLP D ^DIR S CHA=Y D:CHA>0 Q:+CHA'>0
101 . I CHA=1 D HLAB($P(HOST(LA7A),U))
102 . I CHA=2 D HLL
103 . I CHA=3 D LMC
104 . I CHA=4 D CHTST
105 D KDIR
106 Q
107 ;
108 ;
109HSTHDR2 ;
110 N LA7624,LA76248,LA7870,LA7X
111 ;
112 S LA7CNT=1
113 W !!,"1. HOST Lab: ",?15,$P(HOST(LA7A),U,2)
114 W:$P(HOST(LA7A),U,2)'="" " (Uneditable)"
115 ;
116 I $P(HOST(LA7A),U,2)="" Q
117 ;
118 D LINK^HLUTIL3($P(HOST(LA7A),"^",4),.LA7X,"")
119 S LA7870=+$O(LA7X(0))
120 I 'LA7870 D
121 . S LA7870=+$$FIND1^DIC(870,"","OX","LA7V"_$P(HOST(LA7A),U))
122 . I 'LA7870 S LA7870=+$$FIND1^DIC(870,"","OX","LA7V "_$P(HOST(LA7A),U))
123 . I LA7870 S LA7X(LA7870)=$$GET1^DIQ(870,LA7870_",",.01)
124 S LA7CNT=2
125 W !,"2. Logical Link: ",$G(LA7X(LA7870))
126 ;
127 S LA76248=$$FIND1^DIC(62.48,"","OX","LA7V HOST "_$P(HOST(LA7A),U)),LA7CNT=3
128 W !,"3. Message Configuration: ",$$GET1^DIQ(62.48,LA76248_",",.01)
129 ;
130 S LA7624=$$FIND1^DIC(62.4,"","OX","LA7V HOST "_$P(HOST(LA7A),U)),LA7CNT=4
131 W !,"4. Auto Instrument: ",$$GET1^DIQ(62.4,LA7624_",",.01)
132 ;
133 Q
134 ;
135 ;
136LMC ; Edit lab message configuration file.
137 ;
138 N DIC,DA,DR,DIE
139 ;
140 S X="LA7V HOST "_$P(@LAB@(LA7A),U),DIC(0)="EMX",DIC="^LAHM(62.48,"
141 D ^DIC
142 I +Y<0 W !,"You have not entered a "_LAB_" lab." Q
143 ;
144 S DA=+Y,DIE="^LAHM(62.48,",DR="3;4;10;11////10;@20;20;I X'="""" S Y=""@20"""
145 D ^DIE
146 ;
147 Q
148 ;
149 ;
150HLAB(LRI) ;Add Host LAB
151 ;
152 N INST,LA7VNVC,LA7629,LA7VER,LA7X
153 ;
154 I $P(HOST(LA7A),U)'="" D KDIR S DIR("A")="Are you sure you want to update the "_$P(HOST(LA7A),U,2)_" interface",DIR(0)="Y0" D ^DIR Q:+Y'>0
155 ;
156 I $P(HOST(LA7A),U)="" D
157 . N DIC,DA,DO
158 . S DIC="^DIC(4,",DIC(0)="AEMQZ"
159 . S DIC("S")="N LA7X S LA7X=$G(^(99)) I ($L($P(LA7X,U))&$P(LA7X,U,5)=""VA"")!($P(LA7X,U)=""""&$P(LA7X,U,5)'=""VA"")"
160 . D ^DIC Q:Y<1
161 . S INST=+Y
162 . I PRIMARY=INST!(INST=DUZ(2)) D Q
163 . . W !,"To add your Hospital as a HOST site just add COLLECTION sites."
164 . S HOST(LA7A+1)=HOST(LA7A)
165 . S HOST(LA7A)=$$RETFACID^LA7VHLU2(INST,1,1)_U_$P($$NS^XUAF4(INST),"^")_"^^"_INST
166 ;
167 I $P(HOST(LA7A),U)="" S $P(HOST(LA7A),U,2)="" Q
168 ;
169 I PRIMARY'=$P(HOST(LA7A),U) D
170 . S LA7VER=2.3
171 . I $$NVAF^LA7VHLU2($P(HOST(LA7A),"^",4))=1 S LA7VER=2.2
172 . D HOST^LA7VSTP(PRIMARY,PRSITE,$P(HOST(LA7A),U),$P(HOST(LA7A),U,2),LA7VER)
173 ;
174 Q
175 ;
176 ;
177HLL ;add/edit logical link
178 ;
179 N HDR,PR,LA7LL
180 S HDR="Logical Link for transmissions to/from "_$P(HOST(LA7A),U,2)
181 W @IOF,! F X=1:1:79 W "-"
182 W !,?((80-$L(HDR))/2),HDR
183 W ! F X=1:1:79 W "-"
184 W !,?3,"Protocol",?40,"Logical Link",!,?3,"----------",?40,"---------------"
185 W !!
186 S PR=$O(^ORD(101,"B","LA7V Process Results from "_$P(HOST(LA7A),U),0))
187 I PR D GETLL(PR)
188 ;
189 S PR=$O(^ORD(101,"B","LA7V Send Order to "_$P(HOST(LA7A),U),0))
190 I PR D GETLL(PR)
191 ;
192 W !!
193 D KDIR
194 S DIR("A")="Setup/update Logical Link",DIR(0)="YO"
195 D ^DIR
196 I $D(DIRUT) Q
197 I Y=1 D TCP^LA7VLL(HOST(LA7A),LA7VS)
198 ;
199 Q
200 ;
201 ;
202CHTST ;Enter CHEM Test into the AUTO INSTRUMENT file (#62.4)
203 ;
204 N DA,DIC,DIE,DR,AI,LA7624
205 ;
206 S (AI,X)="LA7V HOST "_$P(HOST(LA7A),U)
207 S DIC(0)="QEM",DIC="^LAB(62.4," D ^DIC
208 I +Y<1 Q
209 S LA7624=+Y
210 ;
211 W !!,"AUTOMATED INSTRUMENT: ",$P(^LAB(62.4,LA7624,0),U)
212 ;
213 L +^LAB(62.4,LA7624):1
214 I '$T W !,?5,"Another user is editing this entry." Q
215 ;
216 S DA=LA7624,DIE=DIC,DR="3;10;11;12;18;107"
217 D ^DIE
218 W !,"Add Chem Tests to the "_AI_" Automated Instrument for "_$P(HOST(LA7A),U,2)_".",!!
219 D CHSET
220 ;
221 L -^LAB(62.4,LA7624)
222 ;
223 Q
224 ;
225 ;
226CHSET ; Edit chem test multiple for selected fields
227 ; Entry locked from above.
228 N DA,DO,DIC,DIE,DLAYGO,DR,LA7NLT,LA7Y
229 ;
230 S DA(1)=LA7624,DLAYGO=62.4
231 S DIC="^LAB(62.4,"_DA(1)_",3,",DIC(0)="AELMQZ",DIC("DR")=".01",DIC("P")=$P(^DD(62.4,30,0),U,2)
232 F D Q:LA7Y<1
233 . D ^DIC S LA7Y=Y Q:LA7Y<1
234 . S DIE=DIC
235 . N DA,DIC,DLAYGO ; Protect variables in case changed in DIE call.
236 . S LA7NLT=$$GET1^DIQ(64,+$P($G(^LAB(60,$P(LA7Y,U,2),64)),U,2)_",",1)
237 . S DA=+LA7Y,DA(1)=LA7624
238 . S DR=".01;2;6//"_LA7NLT_";14;16;18//YES;19;22//NO"
239 . D ^DIE
240 . W !
241 Q
242 ;
243 ;
244REMOTE ;COLLECTION Lab Setup Menu
245 ;
246 D COLLECT^LA7VSET1
247 Q
248 ;
249 ;
250MHLP ;Main help
251 S DIR("?")=" "
252 S DIR("?",1)="Option #1 will setup HOST site auto-instruments, HOST site message"
253 S DIR("?",2)="configuration, and HOST and COLLECTION sites HL7 environment."
254 S DIR("?",3)=" "
255 S DIR("?",4)="Option #2 will setup COLLECTION site auto-instruments, COLLECTION site message"
256 S DIR("?",5)="configuration, and COLLECTION and HOST sites HL7 environment."
257 S DIR("?",6)=" "
258 S DIR("?",7)="Option #1 and #2 SHOULD be used by sites that are both a HOST"
259 S DIR("?",8)="and a COLLECTION site."
260 Q
261 ;
262 ;
263H1HLP ;HOST Lab(s) help
264 S DIR("?")="Enter a number between 1 and "_LA7CNT_"."
265 S DIR("?",1)="Enter a '"_LA7CNT_"' to create a new HOST lab."
266 Q
267 ;
268 ;
269H2HLP ;HOST Lab Setup help
270 S DIR("?")=" "
271 S DIR("?",1)="Enter a '1' to create the HL7 environment along with the Auto-Instrument"
272 S DIR("?",2)="and LA7 Message Configuration."
273 S DIR("?",3)="Enter a '2' to create the link between the HOST and COLLECTION labs."
274 S DIR("?",5)="Enter a '3' to configure the LA7 MESSAGE PARAMETER file."
275 S DIR("?",4)="Enter a '4' to identify the list of test you expect back from the HOST lab."
276 Q
277 ;
278 ;
279CONV ;Convert #62.4 and #62.48 from REMOTE to COLLECTION (File #771 will remain REMOTE).
280 N RMT,RMT1,UPDT,IEN
281 K DA,DR,DIE
282 S DIE="^LAB(62.4,"
283 S RMT1="LA7V REMOTE ",RMT=RMT1
284 F S RMT=$O(^LAB(62.4,"B",RMT)) Q:RMT=""!(RMT'[RMT1) D
285 . S IEN=$O(^LAB(62.4,"B",RMT,0))
286 . S NAME="LA7V COLLECTION"_$P($P(^LAB(62.4,IEN,0),U),"REMOTE",2)
287 . S DA=IEN,DR=".01///"_NAME
288 . W !,"Renaming Auto-Instrument "_$P(^LAB(62.4,IEN,0),U)_" to "_NAME
289 . D ^DIE
290 . S UPDT=1
291 K DA,DR,DIE
292 S DIE="^LAHM(62.48,"
293 S RMT1="LA7V REMOTE ",RMT=RMT1
294 F S RMT=$O(^LAHM(62.48,"B",RMT)) Q:RMT=""!(RMT'[RMT1) D
295 . S IEN=$O(^LAHM(62.48,"B",RMT,0))
296 . S NAME="LA7V COLLECTION"_$P($P(^LAHM(62.48,IEN,0),U),"REMOTE",2)
297 . S DA=IEN,DR=".01///"_NAME
298 . W !,"Renaming LA7 Message Configuration "_$P(^LAHM(62.48,IEN,0),U)_" to "_NAME
299 . D ^DIE
300 . S UPDT=1
301 I $G(UPDT)=1 D
302 . N DIR,DIRUT
303 . W !!,"For consistency and clarity the above Auto-Instrument names"
304 . W !,"and Message Configurations have been changed from REMOTE to COLLECTION."
305 . S DIR(0)="E" D ^DIR
306 Q
307 ;
308 ;
309GETLL(LA7X) ; Get Lower Level Protocol information for displaying
310 ; Call with LA7X = ien of file #101 protocol
311 ;
312 ; Called from above and LA7VSET1
313 ;
314 N LA7Y
315 ;
316 D GETS^DIQ(101,LA7X_",",".01;770.7","IE","LA7Y")
317 ;
318 W !,?3,$G(LA7Y(101,LA7X_",",.01,"E"))
319 W ?40,$G(LA7Y(101,LA7X_",",770.7,"E"))
320 I $G(LA7Y(101,LA7X_",",770.7,"I")) W " ("_$$GET1^DIQ(870,+LA7Y(101,LA7X_",",770.7,"I")_",",2)_")"
321 ;
322 Q
Note: See TracBrowser for help on using the repository browser.