| 1 | LA7VOBR ;DALOI/JMC - LAB OBR segment builder ; 11-17-98 | 
|---|
| 2 | ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,64**;Sep 27, 1994 | 
|---|
| 3 | ; | 
|---|
| 4 | Q | 
|---|
| 5 | ; | 
|---|
| 6 | ; | 
|---|
| 7 | OBR1(LA7OBRSN) ; Build OBR-1 sequence - set segment id | 
|---|
| 8 | ; Call with LA7OBRSN = segment id (pass by reference) | 
|---|
| 9 | ; | 
|---|
| 10 | S LA7OBRSN=$G(LA7OBRSN)+1 | 
|---|
| 11 | ; | 
|---|
| 12 | Q LA7OBRSN | 
|---|
| 13 | ; | 
|---|
| 14 | OBR2(LA7ID,LA7FS,LA7ECH) ; Build OBR-2 sequence - placer's specimen id | 
|---|
| 15 | ; Call with LA7ID = placer's specimen id (accn number/UID) | 
|---|
| 16 | ;           LA7FS = HL7 field separator | 
|---|
| 17 | ;          LA7ECH = HL encoding characters | 
|---|
| 18 | ; | 
|---|
| 19 | N LA7Y | 
|---|
| 20 | ; | 
|---|
| 21 | S LA7ID=$$CHKDATA^LA7VHLU3(LA7ID,LA7FS_LA7ECH) | 
|---|
| 22 | S $P(LA7Y,$E(LA7ECH,1),1)=LA7ID | 
|---|
| 23 | ; | 
|---|
| 24 | Q LA7Y | 
|---|
| 25 | ; | 
|---|
| 26 | ; | 
|---|
| 27 | OBR3(LA7ID,LA7FS,LA7ECH) ; Build OBR-3 sequence - filler's specimen id | 
|---|
| 28 | ; Call with LA7ID = filler's specimen id (accn number/UID) | 
|---|
| 29 | ;           LA7FS = HL7 field separator | 
|---|
| 30 | ;          LA7ECH = HL encoding characters | 
|---|
| 31 | ; | 
|---|
| 32 | N LA7Y | 
|---|
| 33 | ; | 
|---|
| 34 | S LA7ID=$$CHKDATA^LA7VHLU3(LA7ID,LA7FS_LA7ECH) | 
|---|
| 35 | S $P(LA7Y,$E(LA7ECH,1),1)=LA7ID | 
|---|
| 36 | ; | 
|---|
| 37 | Q LA7Y | 
|---|
| 38 | ; | 
|---|
| 39 | ; | 
|---|
| 40 | OBR4(LA7NLT,LA760,LA7ALT,LA7FS,LA7ECH) ; Build OBR-4 sequence - Universal service ID | 
|---|
| 41 | ; Call with LA7NLT = NLT test code | 
|---|
| 42 | ;            LA760 = file #60 ien if known | 
|---|
| 43 | ;           LA7ALT = alternate order code and system in form | 
|---|
| 44 | ;                     test code^test name^coding system | 
|---|
| 45 | ;            LA7FS = HL7 field separator | 
|---|
| 46 | ;           LA7ECH = HL encoding characters | 
|---|
| 47 | ; | 
|---|
| 48 | ; Returns     LA7Y = OBR-4 sequence | 
|---|
| 49 | ; | 
|---|
| 50 | N LA764,LA7COMP,LA7ERR,LA7TN,LA7X,LA7Y,LA7Z | 
|---|
| 51 | ; | 
|---|
| 52 | D OBR4^LA7VOBRA | 
|---|
| 53 | ; | 
|---|
| 54 | Q LA7Y | 
|---|
| 55 | ; | 
|---|
| 56 | ; | 
|---|
| 57 | OBR7(LA7DT) ; Build OBR-7 sequence - collection date/time | 
|---|
| 58 | ; Call with LA7DT = FileMan date/time | 
|---|
| 59 | ; Returns OBR-7 sequence | 
|---|
| 60 | ; | 
|---|
| 61 | S LA7DT=$$CHKDT^LA7VHLU1(LA7DT) | 
|---|
| 62 | Q $$FMTHL7^XLFDT(LA7DT) | 
|---|
| 63 | ; | 
|---|
| 64 | ; | 
|---|
| 65 | OBR8(LA7DT) ; Build OBR-8 sequence - collection end date/time | 
|---|
| 66 | ; Call with LA7DT = FileMan date/time | 
|---|
| 67 | ; Returns OBR-8 sequence | 
|---|
| 68 | ; | 
|---|
| 69 | S LA7DT=$$CHKDT^LA7VHLU1(LA7DT) | 
|---|
| 70 | Q $$FMTHL7^XLFDT(LA7DT) | 
|---|
| 71 | ; | 
|---|
| 72 | ; | 
|---|
| 73 | OBR9(LA7VOL,LA764061,LA7FS,LA7ECH) ; Build OBR-9 sequence - collection volume | 
|---|
| 74 | ; Call with    LA7VOL = collection volume | 
|---|
| 75 | ;            LA764061 = units (pointer to #64.061) | 
|---|
| 76 | ;               LA7FS = HL7 field separator | 
|---|
| 77 | ;              LA7ECH = HL encoding characters | 
|---|
| 78 | ; Returns OBR-9 sequence | 
|---|
| 79 | ; | 
|---|
| 80 | N LA7IENS,LA7X,LA7Y | 
|---|
| 81 | ; | 
|---|
| 82 | D OBR9^LA7VOBRA | 
|---|
| 83 | ; | 
|---|
| 84 | Q LA7Y | 
|---|
| 85 | ; | 
|---|
| 86 | ; | 
|---|
| 87 | OBR11(LA7X) ; Build OBR-11 sequence - speciman action code | 
|---|
| 88 | ; Call with LA7X = HL7 Table 0065 entry | 
|---|
| 89 | ; Returns OBR-11 sequence | 
|---|
| 90 | ; | 
|---|
| 91 | ; JMC-12/09/99 Need to expand this function to determine based on collection status | 
|---|
| 92 | ; | 
|---|
| 93 | Q LA7X | 
|---|
| 94 | ; | 
|---|
| 95 | ; | 
|---|
| 96 | OBR12(LRDFN,LA7FS,LA7ECH) ; Build OBR-12 sequence - patient info | 
|---|
| 97 | ; Call with  LRDFN = ien of patient in #63 | 
|---|
| 98 | ;            LA7FS = HL7 field separator | 
|---|
| 99 | ;           LA7ECH = HL7 encoding characters | 
|---|
| 100 | ; Returns OBR-12 sequence | 
|---|
| 101 | ; | 
|---|
| 102 | N LA7X | 
|---|
| 103 | ; | 
|---|
| 104 | S LRDFN=$G(LRDFN),LA7ECH=$G(LA7ECH) | 
|---|
| 105 | ; Infection Warning | 
|---|
| 106 | S LA7X=$P($G(^LR(LRDFN,.091)),U) | 
|---|
| 107 | S LA7X=$$CHKDATA^LA7VHLU3(LA7X,LA7FS_LA7ECH) | 
|---|
| 108 | ; | 
|---|
| 109 | Q $E(LA7ECH,1)_LA7X | 
|---|
| 110 | ; | 
|---|
| 111 | ; | 
|---|
| 112 | OBR13(LA7TXT,LA7FS,LA7ECH) ; Build OBR-13 sequence - revelant clinical info | 
|---|
| 113 | ; Call with LA7TXT = text to place into OBR-13 | 
|---|
| 114 | ;            LA7FS = HL7 field separator | 
|---|
| 115 | ;           LA7ECH = HL7 encoding characters | 
|---|
| 116 | ; Returns OBR-12 sequence | 
|---|
| 117 | ; | 
|---|
| 118 | N LA7X | 
|---|
| 119 | ; | 
|---|
| 120 | S LA7X=$$CHKDATA^LA7VHLU3(LA7TXT,LA7FS_LA7ECH) | 
|---|
| 121 | ; | 
|---|
| 122 | Q LA7X | 
|---|
| 123 | ; | 
|---|
| 124 | ; | 
|---|
| 125 | OBR14(LA7DT) ; Build OBR-14 sequence - speciman arrival date/time | 
|---|
| 126 | ; Call with LA7DT = FileMan date/time | 
|---|
| 127 | ; Returns OBR-14 sequence | 
|---|
| 128 | ; | 
|---|
| 129 | S LA7DT=$$CHKDT^LA7VHLU1(LA7DT) | 
|---|
| 130 | Q $$FMTHL7^XLFDT(LA7DT) | 
|---|
| 131 | ; | 
|---|
| 132 | ; | 
|---|
| 133 | OBR15(LA761,LA762,LA7ALT,LA7FS,LA7ECH,LA7CM) ; Build OBR-15 sequence - specimen source | 
|---|
| 134 | ; Call with LA761 = ien of topography file #61 | 
|---|
| 135 | ;           LA762 = ien of collection sample in file #62 | 
|---|
| 136 | ;          LA7ALT = alternate non-HL7 codes/text/coding system in form - | 
|---|
| 137 | ;                   specimen code^specimen text^specimen system^CONTROL^collection sample code^collection sample^collection system. | 
|---|
| 138 | ;                   "CONTROL" only present when specimen is a lab control from file #62.3. | 
|---|
| 139 | ;                   presence of these will override standard HL7 tables | 
|---|
| 140 | ;           LA7FS = HL7 field separator | 
|---|
| 141 | ;          LA7ECH = HL encoding characters | 
|---|
| 142 | ;           LA7CM = ien of shipping condition file #62.93 (collection method) | 
|---|
| 143 | ; Returns OBR-15 sequence in LA7Y | 
|---|
| 144 | ; | 
|---|
| 145 | N LA764061,LA7COMP,LA7ERR,LA7X,LA7Y,LA7Z,X,Y | 
|---|
| 146 | ; | 
|---|
| 147 | D OBR15^LA7VOBRA | 
|---|
| 148 | ; | 
|---|
| 149 | Q LA7Y | 
|---|
| 150 | ; | 
|---|
| 151 | ; | 
|---|
| 152 | OBR18(LA7X,LA7FS,LA7ECH) ; Build OBR-18 sequence - Placer's field #1 | 
|---|
| 153 | ; Call with   LA7X = array containing components to store, pass by reference. | 
|---|
| 154 | ;            LA7FS = HL7 field separator | 
|---|
| 155 | ;           LA7ECH = HL encoding characters | 
|---|
| 156 | ; | 
|---|
| 157 | ; Returns OBR-18 sequence | 
|---|
| 158 | ; | 
|---|
| 159 | N LA7I,LA7Y,LA7Z | 
|---|
| 160 | ; | 
|---|
| 161 | D OBRPF^LA7VOBRA | 
|---|
| 162 | ; | 
|---|
| 163 | Q LA7Y | 
|---|
| 164 | ; | 
|---|
| 165 | ; | 
|---|
| 166 | OBR19(LA7X,LA7FS,LA7ECH) ; Build OBR-19 sequence - Placer's field #2 | 
|---|
| 167 | ; Call with LA7X() = array containing components to store, pass by reference. | 
|---|
| 168 | ;            LA7FS = HL7 field separator | 
|---|
| 169 | ;           LA7ECH = HL encoding characters | 
|---|
| 170 | ; | 
|---|
| 171 | ; Returns OBR-19 sequence | 
|---|
| 172 | ; | 
|---|
| 173 | N LA7I,LA7Y,LA7Z | 
|---|
| 174 | ; | 
|---|
| 175 | D OBRPF^LA7VOBRA | 
|---|
| 176 | ; | 
|---|
| 177 | Q LA7Y | 
|---|
| 178 | ; | 
|---|
| 179 | ; | 
|---|
| 180 | OBR20(LA7X,LA7FS,LA7ECH) ; Build OBR-20 sequence - Filler's field #1 | 
|---|
| 181 | ; Call with   LA7X = array containing components to store, pass by reference. | 
|---|
| 182 | ;            LA7FS = HL7 field separator | 
|---|
| 183 | ;           LA7ECH = HL encoding characters | 
|---|
| 184 | ; | 
|---|
| 185 | ; Returns OBR-20 sequence | 
|---|
| 186 | ; | 
|---|
| 187 | N LA7I,LA7Y,LA7Z | 
|---|
| 188 | ; | 
|---|
| 189 | D OBRPF^LA7VOBRA | 
|---|
| 190 | ; | 
|---|
| 191 | Q LA7Y | 
|---|
| 192 | ; | 
|---|
| 193 | ; | 
|---|
| 194 | OBR21(LA7X,LA7FS,LA7ECH) ; Build OBR-21 sequence - Filler's field #2 | 
|---|
| 195 | ; Call with LA7X() = array containing components to store, pass by reference. | 
|---|
| 196 | ;            LA7FS = HL7 field separator | 
|---|
| 197 | ;           LA7ECH = HL encoding characters | 
|---|
| 198 | ; | 
|---|
| 199 | ; Returns OBR-21 sequence | 
|---|
| 200 | ; | 
|---|
| 201 | N LA7I,LA7Y,LA7Z | 
|---|
| 202 | ; | 
|---|
| 203 | D OBRPF^LA7VOBRA | 
|---|
| 204 | ; | 
|---|
| 205 | Q LA7Y | 
|---|
| 206 | ; | 
|---|
| 207 | ; | 
|---|
| 208 | OBR22(LA7DT) ; Build OBR-22 sequence - date report completed | 
|---|
| 209 | ; Call with LA7DT = FileMan date/time | 
|---|
| 210 | ; | 
|---|
| 211 | ; Returns OBR-22 sequence | 
|---|
| 212 | ; | 
|---|
| 213 | S LA7DT=$$CHKDT^LA7VHLU1(LA7DT) | 
|---|
| 214 | Q $$FMTHL7^XLFDT(LA7DT) | 
|---|
| 215 | ; | 
|---|
| 216 | ; | 
|---|
| 217 | OBR24(LA7SS) ; Build OBR-24 sequence - diagnostice service id | 
|---|
| 218 | ; Call with LA7SS = File #63 subscript^section within subscript | 
|---|
| 219 | ; | 
|---|
| 220 | ; Returns OBR-24 sequence | 
|---|
| 221 | ; | 
|---|
| 222 | N LA7Y,LA7X | 
|---|
| 223 | ; | 
|---|
| 224 | D OBR24^LA7VOBRA | 
|---|
| 225 | ; | 
|---|
| 226 | Q LA7Y | 
|---|
| 227 | ; | 
|---|
| 228 | ; | 
|---|
| 229 | OBR26(LA7OBX3,LA7OBX4,LA7OBX5,LA7FS,LA7ECH)     ; Build OBR-26 sequence - Parent result | 
|---|
| 230 | ; Call with LA7OBX3 = OBX-3 observation id of parent result | 
|---|
| 231 | ;           LA7OBX4 = OBX-4 sub-id of parent result | 
|---|
| 232 | ;           LA7OBX5 = OBX-5 parent result | 
|---|
| 233 | ;             LA7FS = HL7 Field separator | 
|---|
| 234 | ;            LA7ECH = HL7 encoding characters | 
|---|
| 235 | ; | 
|---|
| 236 | N LA7C,LA7SC,LA7Y,LA7Z | 
|---|
| 237 | ; | 
|---|
| 238 | D OBR26^LA7VOBRA | 
|---|
| 239 | ; | 
|---|
| 240 | Q LA7Y | 
|---|
| 241 | ; | 
|---|
| 242 | ; | 
|---|
| 243 | OBR27(LA7DUR,LA7DURU,LA76205,LA7FS,LA7ECH) ; Build OBR-27 sequence - Quantity/Timing | 
|---|
| 244 | ; Call with  LA7DUR = collection duration | 
|---|
| 245 | ;           LA7DURU = duration units (pointer to #64.061) | 
|---|
| 246 | ;           LA76205 = test urgency | 
|---|
| 247 | ;             LA7FS = HL7 field separator | 
|---|
| 248 | ;            LA7ECH = HL encoding characters | 
|---|
| 249 | ; | 
|---|
| 250 | ; Returns OBR-27 sequence | 
|---|
| 251 | ; | 
|---|
| 252 | ; Since field is same as ORC-7, use builder for ORC-7 field. | 
|---|
| 253 | ; | 
|---|
| 254 | ; | 
|---|
| 255 | Q $$ORC7^LA7VORC(LA7DUR,LA7DURU,LA76205,LA7FS,LA7ECH) | 
|---|
| 256 | ; | 
|---|
| 257 | ; | 
|---|
| 258 | OBR29(LA7PON,LA7FON,LA7FS,LA7ECH)       ; Build OBR-29 sequence - Parent | 
|---|
| 259 | ; Call with LA7PON = parent's placer order number | 
|---|
| 260 | ;           LA7FON = parent's filler order nubmer | 
|---|
| 261 | ;            LA7FS = HL7 field separator | 
|---|
| 262 | ;           LA7ECH = HL7 encoding characters | 
|---|
| 263 | ; | 
|---|
| 264 | N LA7Y,LA7Z | 
|---|
| 265 | ; | 
|---|
| 266 | D OBR29^LA7VOBRA | 
|---|
| 267 | ; | 
|---|
| 268 | Q LA7Y | 
|---|
| 269 | ; | 
|---|
| 270 | ; | 
|---|
| 271 | OBR32(LA7DUZ,LA7DIV,LA7FS,LA7ECH) ; Build OBR-32 sequence - Principle Result Interpreter field | 
|---|
| 272 | ; Call with   LA7DUZ = DUZ of verifying user | 
|---|
| 273 | ;             LA7DIV = Institution of user | 
|---|
| 274 | ;              LA7FS = HL field separator | 
|---|
| 275 | ;             LA7ECH = HL encoding characters | 
|---|
| 276 | ; | 
|---|
| 277 | ; Returns OBR-32 sequence | 
|---|
| 278 | ; | 
|---|
| 279 | Q $$XCN^LA7VHLU4(LA7DUZ,LA7DIV,LA7FS,LA7ECH) | 
|---|
| 280 | ; | 
|---|
| 281 | ; | 
|---|
| 282 | OBR33(LA7DUZ,LA7DIV,LA7FS,LA7ECH) ; Build OBR-32 sequence - Assistant Result Interpreter field | 
|---|
| 283 | ; Call with   LA7DUZ = DUZ of assistant interpreter | 
|---|
| 284 | ;             LA7DIV = Institution of user | 
|---|
| 285 | ;              LA7FS = HL field separator | 
|---|
| 286 | ;             LA7ECH = HL encoding characters | 
|---|
| 287 | ; | 
|---|
| 288 | ; Returns OBR-33 sequence | 
|---|
| 289 | ; | 
|---|
| 290 | Q $$XCN^LA7VHLU4(LA7DUZ,LA7DIV,LA7FS,LA7ECH) | 
|---|
| 291 | ; | 
|---|
| 292 | ; | 
|---|
| 293 | OBR34(LA7DUZ,LA7DIV,LA7FS,LA7ECH) ; Build OBR-34 sequence - Technician field | 
|---|
| 294 | ; Call with   LA7DUZ = DUZ of techician | 
|---|
| 295 | ;             LA7DIV = Institution of user | 
|---|
| 296 | ;              LA7FS = HL field separator | 
|---|
| 297 | ;             LA7ECH = HL encoding characters | 
|---|
| 298 | ; | 
|---|
| 299 | ; Returns OBR-34 sequence | 
|---|
| 300 | ; | 
|---|
| 301 | Q $$XCN^LA7VHLU4(LA7DUZ,LA7DIV,LA7FS,LA7ECH) | 
|---|
| 302 | ; | 
|---|
| 303 | ; | 
|---|
| 304 | OBR35(LA7DUZ,LA7DIV,LA7FS,LA7ECH) ; Build OBR-35 sequence - Transcriptionist field | 
|---|
| 305 | ; Call with   LA7DUZ = DUZ of transcriptionist | 
|---|
| 306 | ;             LA7DIV = Institution of user | 
|---|
| 307 | ;              LA7FS = HL field separator | 
|---|
| 308 | ;             LA7ECH = HL encoding characters | 
|---|
| 309 | ; | 
|---|
| 310 | ; Returns OBR-35 sequence | 
|---|
| 311 | ; | 
|---|
| 312 | Q $$XCN^LA7VHLU4(LA7DUZ,LA7DIV,LA7FS,LA7ECH) | 
|---|