source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LR7OU01.m@ 862

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1LR7OU01 ;slc/dcm - Build HL7 Components ;8/11/97
2 ;;5.2;LAB SERVICE;**121,187**;Sep 27, 1994
3 ;
4ORC(COUNT) ;ORC segment
5 ;X1 = Order Control (SN-backdoor new order, OC-Cancel, SC-on collection
6 ; SC-collected, RE-completed) See table 119
7 ;X2 = Lab Number
8 ;X3 = Order Status (table 38)
9 ;X4 = Quantity/Timing - Quantity^Interval^Duration^Start D/T^End D/T^Priority^Condition^Text^Conjunction
10 ;X5 = Date ordered/entered
11 ;X6 = Provider # (ptr to file 200)
12 ;X7 = Order effective D/T
13 ;X8 = Order Control Reason
14 ;X9 = OE/RR Order #
15 ;X10 = Entered by
16 N ORC,CTR,ARAY
17 S CTR=0,ARAY=""
18 D BUILD("ORC|"),BUILD(X1_"|"_$S($L(X9):X9_"^OR",1:"")_"|"),BUILD(X2_"^||"),BUILD(X3_"||"),BUILD(X4_"||"),BUILD(X5_"|"),BUILD($$PERSON(X10)_"||")
19 D BUILD($$PERSON(X6)_"|||"),BUILD(X7_"|"),BUILD(X8)
20 M @MSG@(COUNT)=ARAY
21 Q
22OBR(COUNT) ;OBR segment
23 ;COUNT=Current count for MSG array
24 ;X1 = Universal ID - ^^^ifn (from file 60)^Test Name^99_SectionID
25 ; SectionID: LRT=Chem Hem Tox Micro AP, LRB=Bloodbank
26 ;X2 = Observation D/T
27 ;X3 = Specimen Action Code (table 65)
28 ;X4 = Specimen Recieved D/T
29 ;X5 = Specimen Source (table 70)
30 ;X6 = Accession (Filler Field 1)
31 ;X7 = Results reported or Status changed D/T
32 ;X8 = Result Status (table 123)
33 ;X9 = Quantity/timing
34 ;X10 = Result copies to: location
35 ;COBR = OBR counter
36 N OBR,CTR,ARAY
37 S CTR=0,ARAY=""
38 D BUILD("OBR|"),BUILD(COBR_"|||"),BUILD(X1_"|||"),BUILD(X2_"||||"),BUILD(X3_"|||"),BUILD(X4_"|"),BUILD(X5_"|||||")
39 D BUILD(X6_"||"),BUILD(X7_"|||"),BUILD(X8_"||"),BUILD(X9_"|"),BUILD(X10)
40 M @MSG@(COUNT)=ARAY
41 Q
42OBX(COUNT) ;OBX Result segment
43 ;X1 = Value type (table 125)
44 ;X2 = Observation ID - ^^^ifn (from file 60)^Test Name^99_SectionID
45 ;X3 = Observation Sub-ID
46 ;X4 = Result
47 ;X5 = coded per table 36
48 ;X6 = Reference Range
49 ;X7 = Abnormal Flag (table 78)
50 ;X8 = Observ Result Status (table 85)
51 ;COBX = OBX Counter
52 ;X10 = User Defined Access Checks
53 ;X11 = Verified by
54 N OBX,CTR,ARAY
55 S CTR=0,ARAY=""
56 D BUILD("OBX|"_COBX_"|"),BUILD(X1_"|"),BUILD(X2_"|"),BUILD(X3_"|"),BUILD(X4_"|"),BUILD(X5_"|"),BUILD(X6_"|"),BUILD(X7_"|||"),BUILD(X8_"||"),BUILD(X10_"||"),BUILD($$PERSON(X11))
57 M @MSG@(COUNT)=ARAY
58 Q
59NTE(ID,SOURCE,NODE,CTR) ;NTE Notes segment
60 ;ID=SET ID
61 ;SOURCE = Source of comment P=>Placer, L=>Filler, O=>Other system
62 ;NODE=Local array with text in the form ARRAY( or ARRAY(I,
63 ;CTR=Counter for 1st subscript in MSG(ctr) array
64 Q:'$L(NODE) N NTE,FIRST,SUB,X,IFN
65 S NTE="NTE|"_ID_"|"_SOURCE,IFN=0,FIRST=1
66 F S IFN=$O(@(NODE_IFN_")")) Q:IFN<1 S X=@(NODE_IFN_")") D
67 . I X["For Test: " Q ;Screen out unecessary test text
68 . I FIRST S @MSG@(CTR)=NTE_"|"_X S FIRST=0,SUB=0 Q
69 . S SUB=SUB+1,@MSG@(CTR,SUB)=X
70 Q
71PERSON(X) ;Get person in external format
72 I '$G(X) Q 0
73 I '$D(^VA(200,+X,0)) Q X
74 S X=+X_"^"_$P(^VA(200,+X,0),"^")
75 Q X
76BUILD(FIELD) ;Build a segment
77 ;FIELD=text/field to add to segment
78 ;ARAY is built until length is >244 characters then
79 ;ARAY(ifn) is created
80 S:'$D(ARAY) ARAY="" Q:'$D(FIELD) Q:'$D(CTR)
81 N IFN,X
82 S X=$S($O(ARAY(0)):$O(ARAY(9999),-1),1:ARAY)
83 S:$L(FIELD)>244 FIELD=$E(FIELD,1,244)
84 I $L(FIELD)+$L(X)>244 S CTR=CTR+1,ARAY(CTR)=""
85 S:CTR=0 ARAY=ARAY_FIELD
86 S:CTR ARAY(CTR)=ARAY(CTR)_FIELD
87 Q
Note: See TracBrowser for help on using the repository browser.