source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7VOBX.m@ 1123

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

initial load of FOIAVistA 6/30/08 version

File size: 7.6 KB
Line 
1LA7VOBX ;DALOI/JMC - LAB OBX Segment message builder ; Feb 19, 2004
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,64**;Sep 27, 1994
3 ;
4OBX(LRDFN,LRSS,LRIDT,LRSB,LA7ARRAY,LA7OBXSN,LA7FS,LA7ECH,LA7NVAF) ; Observation/Result segment for Lab Results.
5 ; Call with LRDFN = ien of entry in file #63
6 ; LRSS = file #63 subscript
7 ; LRIDT = inverse date/time of specimen
8 ; LRSB = ien of dataname if "CH" subscript or global subscript for others
9 ; LA7ARRAY = array to return OBX segment, pass by reference
10 ; LA7OBXSN = OBX segment sequence number, pass by reference
11 ; LA7FS = HL field separator
12 ; LA7ECH = HL encoding characters
13 ; LA7NVAF = flag indicating type of receiving facility (see NVAF^LA7VHLU2)
14 ;
15 ; Returns LA7OBXSN = current OBX segment sequence number
16 ; LA7ARRAY = array containing OBX segment
17 ;
18 N LA7OBX,LA7VAL,LA7X
19 ;
20 ; No subscript/patient/specimen
21 I $G(LRSS)=""!('$G(LRDFN))!('$G(LRIDT)) Q
22 ;
23 S LA7NVAF=$G(LA7NVAF)
24 ;
25 ; "CH" subscript
26 I LRSS="CH" D CH^LA7VOBX1 Q
27 ;
28 ; "MI" subscript
29 I LRSS="MI" D MI^LA7VOBX3 Q
30 ;
31 ; "SP" subscrpt
32 I LRSS="SP" D AP^LA7VOBX2 Q
33 ;
34 ; "CY" subscrpt
35 I LRSS="CY" D AP^LA7VOBX2 Q
36 ;
37 ; "EM" subscrpt
38 I LRSS="EM" D AP^LA7VOBX2 Q
39 ;
40 Q
41 ;
42 ;
43OBX1(LA7OBXSN) ; Build OBX-1 sequence - Set ID (sequence number)
44 ; Call with LA7OBXSN = sequence number (pass by reference)
45 ;
46 N LA7Y
47 ;
48 ; increment sequence number
49 S (LA7OBXSN,LA7Y)=$G(LA7OBXSN)+1
50 ;
51 Q LA7Y
52 ;
53 ;
54OBX2(LA7FILE,LA7FIELD) ; Build OBX-2 sequence - Value type
55 ; Call with LA7FILE = FileMan DD file/subfield number
56 ; LA7FIELD = Fileman DD field number
57 ;
58 ; Returns LA7VAL = value type (HL7 table 0125)
59 ;
60 N LA7ERR,LA7TYP,LA7VAL
61 ;
62 D OBX2^LA7VOBXA
63 ;
64 Q LA7VAL
65 ;
66 ;
67OBX3(LA7NLT,LA7953,LA7ALT,LA7FS,LA7ECH) ; Build OBX-3 sequence - Observation identifier field
68 ; Call with LA7NLT = NLT code.
69 ; LA7953 = LOINC code
70 ; LA7ALT = alternate code - local/non-VA (code^text^system)
71 ; LA7FS = HL field separator
72 ; LA7ECH = HL encoding characters
73 ;
74 N LA764,LA7J,LA7LN,LA7X,LA7Y
75 ;
76 D OBX3^LA7VOBXA
77 ;
78 Q LA7Y
79 ;
80 ;
81OBX4(LA7VAL,LA7FS,LA7ECH) ; Build OBX-4 sequence - Observation sub-ID
82 ; Call with LA7VAL = value of the observation
83 ; LA7FS = HL field separator
84 ; LA7ECH = HL encoding characters
85 ;
86 ; Returns LA7Y = Observation sub-ID checked for escape encoding
87 ;
88 N LA7Y
89 ;
90 S LA7Y=$$CHKDATA^LA7VHLU3(LA7VAL,LA7FS_LA7ECH)
91 ;
92 Q LA7Y
93 ;
94 ;
95OBX5(LA7VAL,LA7OBX2,LA7FS,LA7ECH) ; Build OBX-5 sequence - Observation value
96 ; Call with LA7VAL = value of the observation
97 ; LA7OBX2 = value type
98 ; LA7FS = HL field separator
99 ; LA7ECH = HL encoding characters
100 ;
101 N LA7Y
102 ;
103 D OBX5^LA7VOBXA
104 ;
105 Q LA7Y
106 ;
107 ;
108OBX5M(LA7FN,LA7IENS,LA7FLD,LA7WP,LA7FS,LA7ECH) ; Build OBX-5 sequence - Observation value - multi-line textual result
109 ; Call with LA7FN = File number or subfile
110 ; LA7IENS = Standard FileMan IENS indicating internal entry numbers
111 ; LA7FLD = Field number
112 ; LA7WP = array passed by reference to return text
113 ; LA7FS = HL field separator
114 ; LA7ECH = HL encoding characters
115 ;
116 ; Returns LA7WP = subscripted array containing text of results
117 ; LA7WP(0), LA7WP(1), LA7WP(2),...
118 ;
119 N LA7ERR,LA7I,LA7J,LA7TYPE,LA7X,LA7Y
120 ;
121 D OBX5M^LA7VOBXA
122 ;
123 Q
124 ;
125 ;
126OBX5R(LA7VAL,LA7OBX2,LA7FS,LA7ECH) ; Build OBX-5 sequence with repetition - Observation value
127 ; Call with LA7VAL = array passed by reference
128 ; LA7OBX2 = value type
129 ; LA7FS = HL field separator
130 ; LA7ECH = HL encoding characters
131 ;
132 N LA7I,LA7Y
133 ;
134 D OBX5R^LA7VOBXA
135 ;
136 Q LA7Y
137 ;
138 ;
139OBX6(LA7VAL,LA764061,LA7FS,LA7ECH) ; Build OBX-6 sequence - Units
140 ; Call with LA7VAL = Units if in external format
141 ; LA764061 = ien of units in #64.061
142 ; LA7FS = HL field separator
143 ; LA7ECH = HL encoding characters
144 ; Returns units
145 ;
146 N LA7Y
147 ;
148 D OBX6^LA7VOBXA
149 ;
150 Q LA7Y
151 ;
152 ;
153OBX7(LA7LOW,LA7HIGH,LA7FS,LA7ECH) ; Build OBX-7 sequence - Reference range
154 ; Call with LA7LOW = lower limit
155 ; LA7HIGH = upper limit
156 ; LA7FS = HL field separator
157 ; LA7ECH = HL encoding characters
158 ; Returns reference range
159 ;
160 N LA7Y
161 ;
162 D OBX7^LA7VOBXA
163 ;
164 Q LA7Y
165 ;
166 ;
167OBX8(LA7FLAG) ; Build OBX-8 sequence - Abnormal flags
168 ; Call with LA7FLAG = DHCP Lab normalcy flag
169 ; Returns abnormal flags based on HL7 table 0078
170 ;
171 N LA7Y
172 ;
173 S LA7Y=$TR(LA7FLAG,"*",$E(LA7FLAG,1)) ; abnormal flag
174 Q LA7Y
175 ;
176 ;
177OBX11(LA7FLAG) ; Build OBX-11 sequence - Observation result status
178 ; Call with LA7FLAG = DHCP Lab status flag
179 ; Returns result status based on HL7 table 0085
180 ;
181 N LA7Y
182 ;
183 S LA7Y=""
184 ;
185 I LA7FLAG="canc" S LA7Y="X"
186 I LA7FLAG="comment" S LA7Y="F"
187 I LA7FLAG="pending" S LA7Y="I"
188 I LA7FLAG="F" S LA7Y="F"
189 I LA7FLAG="P" S LA7Y="P"
190 I LA7FLAG="A" S LA7Y="C"
191 I LA7FLAG="C" S LA7Y="C"
192 ;
193 Q LA7Y
194 ;
195 ;
196OBX13(LA7VAL,LA7SRC,LA7FS,LA7ECH) ; Build OBX-13 sequence - User defined access checks
197 ; Call with LA7VAL = access screen to expand
198 ; LA7SRC = source of access screen
199 ; LA7FS = HL field separator
200 ; LA7ECH = HL encoding characters
201 ;
202 ; Returns LA7Y = access screen text
203 ;
204 N LA7Y
205 S LA7Y=""
206 ;
207 ; Expanding antibiotic susceptibility display screen
208 I LA7SRC="MIS" D
209 . S LA7Y=$S(LA7VAL="A":"ALWAYS DISPLAY",LA7VAL="N":"NEVER DISPLAY",LA7VAL="R":"RESTRICT DISPLAY",1:"")
210 ;
211 S LA7Y=$$CHKDATA^LA7VHLU3(LA7Y,LA7FS_LA7ECH)
212 ;
213 Q LA7Y
214 ;
215 ;
216OBX14(LA7DT) ; Build OBX-14 sequence - date/time of observation
217 ; Call with LA7DT = FileMan date/time
218 ; Returns OBX-14 sequence
219 ;
220 S LA7DT=$$CHKDT^LA7VHLU1(LA7DT)
221 Q $$FMTHL7^XLFDT(LA7DT)
222 ;
223 ;
224OBX15(LA74,LA7FS,LA7ECH) ; Build OBX-15 sequence - Producer's ID field
225 ; Call with LA74 = ien of institution in file #4
226 ; if null/undefined then use Kernel Site file.
227 ; LA7FS = HL field separator
228 ; LA7ECH = HL encoding characters
229 ;
230 ; Returns facility that performed the testing (ID^text^99VA4)
231 ;
232 Q $$INST^LA7VHLU4(LA74,LA7FS,LA7ECH)
233 ;
234 ;
235OBX16(LA7DUZ,LA7DIV,LA7FS,LA7ECH) ; Build OBX-16 sequence - Responsible observer field
236 ; Call with LA7DUZ = DUZ of verifying user
237 ; LA7DIV = Institution of user
238 ; LA7FS = HL field separator
239 ; LA7ECH = HL encoding characters
240 ;
241 ; Returns OBX-16 sequence
242 ;
243 Q $$XCN^LA7VHLU4(LA7DUZ,LA7DIV,LA7FS,LA7ECH)
244 ;
245 ;
246OBX17(LA7VAL,LA7FS,LA7ECH) ; Build OBX-17 sequence - Observation method field
247 ; Call with LA7VAL = WKLD SUFFIX CODES #64.2 with leading decimal
248 ; LA7FS = HL field separator
249 ; LA7ECH = HL encoding characters
250 ;
251 ; Returns LA7Y = OBX-17 sequence
252 ;
253 N LA7X,LA7Y
254 ;
255 ; method suffix code maybe stored without leading decimal,
256 ; add "." back for lookup, also add trailing space for lookup in x-ref.
257 I LA7VAL>1 S LA7VAL="."_LA7VAL
258 S LA7X=$O(^LAB(64.2,"C",LA7VAL_" ",0)),LA7Y=""
259 I LA7X D
260 . S LA7X(.01)=$$GET1^DIQ(64.2,LA7X_",",.01)
261 . S LA7X(.01)=$$CHKDATA^LA7VHLU3(LA7X(.01),LA7FS_LA7ECH)
262 . S LA7Y=LA7VAL_$E(LA7ECH)_LA7X(.01)_$E(LA7ECH)_"99VA64_2"
263 ;
264 Q LA7Y
265 ;
266 ;
267OBX18(LA7VAL,LA7FS,LA7ECH) ; Build OBX-18 sequence - Equipment entity identifier field
268 ; Call with LA7VAL = Equipment entity identifier
269 ; LA7FS = HL field separator
270 ; LA7ECH = HL encoding characters
271 ;
272 ; Returns LA7X = OBX-18 sequence
273 ;
274 N LA7I,LA7J,LA7X,LA7Y
275 ;
276 S LA7X="",LA7J=$L(LA7VAL,"!")
277 F LA7I=1:1:LA7J D
278 . S LA7Y=$P(LA7VAL,"!",LA7I)
279 . I LA7Y="" Q
280 . S $P(LA7X,$E(LA7ECH,1),LA7I)=$$CHKDATA^LA7VHLU3(LA7Y,LA7FS_LA7ECH)
281 ;
282 Q LA7X
Note: See TracBrowser for help on using the repository browser.