source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7VSTP.m@ 1714

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

initial load of WorldVistAEHR

File size: 5.6 KB
RevLine 
[613]1LA7VSTP ;DALOI/JMC - HL7 environment setup routine ; 12/3/1997
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,44,51,46,64**;Sep 27, 1994
3 ; This routine will create LEDI and UNIVERSAL INTERFACE HL7 v1.6 file setups.
4 ;
5 ; Reference to PROTOCOL file (#101) supported by DBIA #872
6 ;
7HOST(PRIMARY,PRSITE,LRI,SITE,LA7VER) ;
8 ;
9 N LA7Y,LAREMOTE,LAHOST,LASERV,LACLNT,LRS,PROT,ORU
10 ;
11 I $G(LRI)="" D EXIT Q
12 ;
13 W !,"Setting up the following Host Labs for "_PRSITE
14 W !," Updating HL7 APPLICATION PARAMETER file (#771)."
15 ;
16 S LA7VER=$S($G(LA7VER)]"":LA7VER,1:2.3)
17 S LAREMOTE="LA7V REMOTE "_PRIMARY
18 S $P(LAREMOTE,"^",2)=$$SETAPP(LAREMOTE,PRIMARY)
19 ;
20 S LAHOST="LA7V HOST "_LRI
21 S $P(LAHOST,"^",2)=$$SETAPP(LAHOST,LRI)
22 ;
23 W !," Updating PROTOCOL file (#101)."
24 ;
25 ; Setup protocols to receive and process result (ORU) messages.
26 ; Create event & subscriber protocols.
27 K LASERV
28 S LASERV="LA7V Receive Results from "_LRI
29 S LASERV(4)="E"
30 S LASERV(770.1)=$P(LAHOST,"^")
31 S LASERV(770.3)="ORU"
32 S LASERV(770.4)="R01"
33 S LASERV(770.95)=LA7VER
34 D SETPRO(.LASERV)
35 ;
36 K LACLNT
37 S LACLNT="LA7V Process Results from "_LRI
38 S LACLNT(4)="S"
39 S LACLNT(770.2)=$P(LAREMOTE,"^")
40 S LACLNT(770.3)="@"
41 S LACLNT(770.4)="R01"
42 S LACLNT(770.11)="ACK"
43 S LACLNT(770.95)=LA7VER
44 S LACLNT(771)="D ORU^LA7VHL"
45 F I=773.1,773.2,773.4 S LACLNT(I)=1
46 D SETPRO(.LACLNT)
47 ;
48 ; Add subscriber to event.
49 D ADDSUB(LASERV,LACLNT)
50 ;
51 ; Setup protocols to build and send order (ORM) messages.
52 ; Create event & subscriber protocols.
53 K LASERV
54 S LASERV="LA7V Order to "_LRI
55 S LASERV(4)="E"
56 S LASERV(770.1)=$P(LAREMOTE,"^")
57 S LASERV(770.3)="ORM"
58 S LASERV(770.4)="O01"
59 F I=770.2,770.11 S LASERV(I)="@"
60 F I=770.8,770.9 S LASERV(I)="AL"
61 S LASERV(770.95)=LA7VER
62 S LASERV(772)="D ORR^LA7VHL"
63 D SETPRO(.LASERV)
64 ;
65 K LACLNT
66 S LACLNT="LA7V Send Order to "_LRI
67 S LACLNT(4)="S"
68 S LACLNT(770.2)=$P(LAHOST,"^")
69 S LACLNT(770.4)="O02"
70 S LACLNT(770.11)="ORR"
71 S LACLNT(770.95)=LA7VER
72 F I=770.1,770.3 S LACLNT(I)="@"
73 F I=773.1,773.2,773.4 S LACLNT(I)=1
74 D SETPRO(.LACLNT)
75 ;
76 ; Add subscriber to event.
77 D ADDSUB(LASERV,LACLNT)
78 ;
79 D HOST^LA7VSTP1
80 D EXIT
81 ;
82 Q
83 ;
84 ;
85REMOTE(PRIMARY,PRSITE,LRI,SITE,LA7VER) ;
86 N LA7Y,LAREMOTE,LAHOST,LASERV,LACLNT,LRS,PROT,ORU
87 ;
88 I $G(LRI)="" D EXIT Q
89 ;
90 W !,"Setting up the REMOTE Lab, "_SITE_" and HOST Lab "_PRSITE
91 W !," Updating HL7 APPLICATION PARAMETER file (#771)."
92 ;
93 S LA7VER=$S($G(LA7VER)]"":LA7VER,1:2.3)
94 S LAHOST="LA7V HOST "_PRIMARY
95 S $P(LAHOST,"^",2)=$$SETAPP(LAHOST,PRIMARY)
96 ;
97 S LAREMOTE="LA7V REMOTE "_LRI
98 S $P(LAREMOTE,"^",2)=$$SETAPP(LAREMOTE,LRI)
99 ;
100 W !," Updating PROTOCOL file (#101)."
101 ;
102 ; Setup protocols to build and send results (ORU) message back.
103 ; Create event & subscriber protocols.
104 K LASERV
105 S LASERV="LA7V Results Reporting to "_LRI
106 S LASERV(4)="E"
107 S LASERV(770.1)=$P(LAHOST,"^")
108 S LASERV(770.3)="ORU"
109 S LASERV(770.4)="R01"
110 S LASERV(770.95)=LA7VER
111 F I=770.8,770.9 S LASERV(I)="AL"
112 S LASERV(772)="D ACK^LA7VHL"
113 D SETPRO(.LASERV)
114 ;
115 K LACLNT
116 S LACLNT="LA7V Send Results to "_LRI
117 S LACLNT(4)="S"
118 S LACLNT(770.2)=$P(LAREMOTE,"^")
119 S LACLNT(770.3)="@"
120 S LACLNT(770.4)="R01"
121 S LACLNT(770.11)="ACK"
122 S LACLNT(770.95)=LA7VER
123 F I=773.1,773.2,773.4 S LACLNT(I)=1
124 D SETPRO(.LACLNT)
125 ;
126 ; Add subscriber to event.
127 D ADDSUB(LASERV,LACLNT)
128 ;
129 ; Setup protocols to receive and process order (ORM) messages.
130 ; Create event & subscriber protocols.
131 K LASERV
132 S LASERV="LA7V Receive Order from "_LRI
133 S LASERV(4)="E"
134 S LASERV(770.1)=$P(LAREMOTE,"^")
135 S LASERV(770.3)="ORM"
136 S LASERV(770.4)="O01"
137 S LASERV(770.95)=LA7VER
138 F I=770.2,770.11 S LASERV(I)="@"
139 D SETPRO(.LASERV)
140 ;
141 K LACLNT
142 S LACLNT="LA7V Process Order from "_LRI
143 S LACLNT(4)="S"
144 S LACLNT(770.2)=$P(LAHOST,"^")
145 S LACLNT(770.4)="O02"
146 S LACLNT(770.11)="ORR"
147 F I=770.1,770.3 S LACLNT(I)="@"
148 F I=773.1,773.2,773.4 S LACLNT(I)=1
149 S LACLNT(770.95)=LA7VER
150 S LACLNT(771)="D IN^LA7VORM"
151 D SETPRO(.LACLNT)
152 ;
153 ; Add subscriber to event.
154 D ADDSUB(LASERV,LACLNT)
155 ;
156 D REMOTE^LA7VSTP1
157 D EXIT
158 ;
159 Q
160 ;
161 ;
162EXIT ; Exit with message
163 W !!,"HL7 v1.6 Environment setup is complete!!"
164 S LASERV(770.95)=LA7VER
165 K DIR
166 S DIR(0)="E" D ^DIR
167 Q
168 ;
169 ;
170SETAPP(LA7X,LA7FAC) ;sets up the HL7 APPLICATION PARAMETER file #771
171 ;
172 ; Call with LA7X = value of .01 field to add to file #771
173 ; LA7FAC = facility name
174 ;
175 N DIC,DIE,DLAYGO,DR,LA7Y
176 ;
177 S X=LA7X
178 S DIC="^HL(771,",DLAYGO=771,DIC(0)="L"
179 D ^DIC
180 S LA7Y=Y
181 W:$P(LA7Y,"^",3) !," Adding "_LA7X
182 I +LA7Y<1 Q
183 ;
184 S DA=+LA7Y,DIE="^HL(771,",DR="2////a;3////"_LA7FAC
185 D ^DIE
186 Q $P(LA7Y,"^")
187 ;
188 ;
189SETPRO(FIELDS) ;sets up the PROTOCOL file #101
190 ; Call with LA7X = Protocol name
191 ; FIELDS = FileMan fields array
192 ;
193 N DA,DIC,FDA,I,LA7DIE,LA7IENS
194 ;
195 S X=FIELDS,DIC="^ORD(101,",DIC(0)="L",DLAYGO=101
196 D ^DIC
197 I '$G(LA7QUIET) W !,FIELDS W:$P(Y,U,3) !," Adding "_X
198 S DA=+Y
199 I DA<0 Q
200 ;
201 S I=0,LA7IENS=DA_","
202 F S I=$O(FIELDS(I)) Q:'I S FDA(1,101,LA7IENS,I)=FIELDS(I)
203 S FDA(1,101,LA7IENS,770.6)="@"
204 D FILE^DIE("E","FDA(1)","LA7DIE(1)")
205 S FDA(2,101,LA7IENS,5)=DUZ
206 D FILE^DIE("","FDA(2)","LA7DIE(2)")
207 D CLEAN^DILF
208 Q
209 ;
210 ;
211ADDSUB(LA7EVNT,LA7SUB) ; Add subscriber to event protocol
212 ; Call with LA7EVNT = name of event protocol
213 ; LA7SUB = name of subscriber protocol
214 ;
215 N DIC,DA,DR,D0,DLAYGO,LA7101E,LA7101S,X,Y
216 ;
217 I '$D(^ORD(101,"B",LA7SUB)) Q
218 I '$D(^ORD(101,"B",LA7EVNT)) Q
219 ;
220 ; Get ien for event and subscriber protocols
221 S LA7101E=$O(^ORD(101,"B",LA7EVNT,0))
222 S LA7101S=$O(^ORD(101,"B",LA7SUB,0))
223 ;
224 ; Already listed as a subscriber to this event
225 I $D(^ORD(101,LA7101E,775,"B",LA7101S)) Q
226 ;
227 S X=LA7SUB,DA(1)=LA7101E,DIC="^ORD(101,"_DA(1)_",775,"
228 S DLAYGO=101.01,DIC(0)="QEL",DIC("P")=$P(^DD(101,775,0),U,2)
229 D ^DIC
230 ;
231 Q
Note: See TracBrowser for help on using the repository browser.