source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPFHLU1.m@ 724

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1DGPFHLU1 ;ALB/RPM - PRF HL7 BUILD OBR SEGMENT ; 2/18/03
2 ;;5.3;Registration;**425**;Aug 13, 1993
3 ;
4 Q
5 ;
6OBR(DGSET,DGPFA,DGPFAH,DGFLD,DGHL) ;OBR Segment API
7 ;This function wraps the data retrieval and segment creation APIs and
8 ;returns a formatted OBR segment.
9 ;
10 ; Input:
11 ; DGSET - (required) OBR segment Set ID
12 ; DGPFA - (required) Assignment data array
13 ; DGPFAH - (required) Assignment history data array
14 ; DGFLD - (optional) List of comma-separated fields (sequence #'s)
15 ; to include. Defaults to all required fields (4).
16 ; DGHL - HL7 environment array
17 ;
18 ; Output:
19 ; Function Value - OBR segment on success, "" on failure
20 ;
21 N DGOBR
22 N DGVAL
23 ;
24 S DGOBR=""
25 I $G(DGSET)>0,$D(DGPFA),$D(DGPFAH) D
26 . S DGFLD=$$CKSTR^DGPFHLUT("4",DGFLD) ;validate the field string
27 . S DGFLD=","_DGFLD_","
28 . I $$OBRVAL(DGFLD,DGSET,.DGPFA,.DGPFAH,.DGVAL) D
29 . . S DGOBR=$$BLDSEG^DGPFHLUT("OBR",.DGVAL,.DGHL)
30 Q DGOBR
31 ;
32OBRVAL(DGFLD,DGSET,DGPFA,DGPFAH,DGVAL) ;build OBR value array
33 ;
34 ; Input:
35 ; DGFLD - (required) Fields string
36 ; DGSET - (required) OBR segment Set ID
37 ; DGPFA - (required) Assignment data array
38 ; DGPFAH - (required) Assignment history data array
39 ;
40 ; Output:
41 ; Function Value - 1 on sucess, 0 on failure
42 ; DGVAL - OBR field array [SUB1:field, SUB2:repetition,
43 ; SUB3:component, SUB4:sub-component]
44 ;
45 N DGRSLT ;function value
46 N DGADT ;assignment date
47 N DGORIG ;originating site
48 N DGOWN ;assignment owner
49 ;
50 S DGRSLT=0
51 I $G(DGFLD)]"",+$G(DGSET)>0,+$G(DGPFA("FLAG"))>0,+$G(DGPFAH("ASSIGN"))>0 D
52 . ;
53 . ; seq 1 Set ID
54 . I DGFLD[",1," D
55 . . S DGVAL(1)=DGSET
56 . ;
57 . ; seq 2 Placer Order Number
58 . I DGFLD[",2," D
59 . ;
60 . ; seq 3 Filler Order Number
61 . I DGFLD[",3," D
62 . ;
63 . ; seq 4 Universal Service ID
64 . I DGFLD[",4," D ;required field
65 . . S DGVAL(4,1,1)=+DGPFA("FLAG") ;flag record# only, not IEN
66 . . S DGVAL(4,1,2)=$P(DGPFA("FLAG"),U,2) ;flag name
67 . . S DGVAL(4,1,3)="VA085" ;table name
68 . ;
69 . ; seq 5 Priority
70 . I DGFLD[",5," D
71 . ;
72 . ; seq 6 Requested Date/time
73 . I DGFLD[",6," D
74 . ;
75 . ; seq 7 Observation Date/Time
76 . I DGFLD[",7," D
77 . . S DGADT=$$FMTHL7^XLFDT(+$$GETADT^DGPFAAH(+DGPFAH("ASSIGN")))
78 . . S DGVAL(7)=$S(DGADT>0:DGADT,1:"")
79 . ;
80 . ; seq 8 Observation End Date/Time
81 . I DGFLD[",8," D
82 . ;
83 . ; seq 9 Collection volume
84 . I DGFLD[",9," D
85 . ;
86 . ; seq 10 Collector Identifier
87 . I DGFLD[",10," D
88 . ;
89 . ; seq 11 Specimen Action Code
90 . I DGFLD[",11," D
91 . ;
92 . ; seq 12 Danger Code
93 . I DGFLD[",12," D
94 . ;
95 . ; seq 13 Relevant Clinical Info
96 . I DGFLD[",13," D
97 . ;
98 . ; seq 14 Specimen Received Date/Time
99 . I DGFLD[",14," D
100 . ;
101 . ; seq 15 Specimen Source
102 . I DGFLD[",15," D
103 . ;
104 . ; seq 16 Ordering Provider
105 . I DGFLD[",16," D
106 . ;
107 . ; seq 17 Order Callback Phone Number
108 . I DGFLD[",17," D
109 . ;
110 . ; seq 18 Placer field 1
111 . I DGFLD[",18," D
112 . ;
113 . ; seq 19 Placer field 2
114 . I DGFLD[",19," D
115 . ;
116 . ; seq 20 Filler field 1
117 . I DGFLD[",20," D
118 . . S DGOWN=+$G(DGPFA("OWNER"))
119 . . S DGVAL(20)=$S(DGOWN>0:$$STA^XUAF4(DGOWN),1:"")
120 . ;
121 . ; seq 21 Filler Field 2
122 . I DGFLD[",21," D
123 . . S DGORIG=+$G(DGPFA("ORIGSITE"))
124 . . S DGVAL(21)=$S(DGORIG>0:$$STA^XUAF4(DGORIG),1:"")
125 . ;
126 . ; seq 22 Results Rpt/Status Chng - Date/Time
127 . I DGFLD[",22," D
128 . ;
129 . ; seq 23 Charge to Practice
130 . I DGFLD[",23," D
131 . ;
132 . ; seq 24 Diagnostic Serv Sect ID
133 . I DGFLD[",24," D
134 . ;
135 . ; seq 25 Result Status
136 . I DGFLD[",25," D
137 . ;
138 . ; seq 26 Parent Result
139 . I DGFLD[",26," D
140 . ;
141 . ; seq 27 Quantity/Timing
142 . I DGFLD[",27," D
143 . ;
144 . ; seq 28 Result Copies To
145 . I DGFLD[",28," D
146 . ;
147 . ; seq 29 Parent
148 . I DGFLD[",29," D
149 . ;
150 . ; seq 30 Transportation Mode
151 . I DGFLD[",30," D
152 . ;
153 . ; seq 31 Reason for Study
154 . I DGFLD[",31," D
155 . ;
156 . ; seq 32 Principal Result Interpreter
157 . I DGFLD[",32," D
158 . ;
159 . ; seq 33 Assistant Result Interpreter
160 . I DGFLD[",33," D
161 . ;
162 . ; seq 34 Technician
163 . I DGFLD[",34," D
164 . ;
165 . ; seq 35 Transcription
166 . I DGFLD[",35," D
167 . ;
168 . ; seq 36 Scheduled Date/Time
169 . I DGFLD[",36," D
170 . ;
171 . ; seq 37 Number of Sample Containers
172 . I DGFLD[",37," D
173 . ;
174 . ; seq 38 Transport Logistics of Collected Sample
175 . I DGFLD[",38," D
176 . ;
177 . ; seq 39 Collector's Comment
178 . I DGFLD[",39," D
179 . ;
180 . ; seq 40 Transport Arrangement Responsibility
181 . I DGFLD[",40," D
182 . ;
183 . ; seq 41 Transport Arranged
184 . I DGFLD[",41," D
185 . ;
186 . ; seq 42 Escort Required
187 . I DGFLD[",42," D
188 . ;
189 . ; seq 43 Planned Patient Transport Comment
190 . I DGFLD[",43," D
191 . ;
192 . S DGRSLT=1
193 I 'DGRSLT K DGVAL
194 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.