View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "[file_name]".  Description: 
15   * "[one_line_description]" 
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2012.  All Rights Reserved. 
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  
34  package ca.uhn.hl7v2.model.v22.segment;
35  
36  // import ca.uhn.hl7v2.model.v22.group.*;
37  import ca.uhn.hl7v2.model.v22.datatype.*;
38  import ca.uhn.hl7v2.HL7Exception;
39  import ca.uhn.hl7v2.parser.ModelClassFactory;
40  import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
41  import ca.uhn.hl7v2.model.AbstractMessage;
42  import ca.uhn.hl7v2.model.Group;
43  import ca.uhn.hl7v2.model.Type;
44  import ca.uhn.hl7v2.model.AbstractSegment;
45  import ca.uhn.hl7v2.model.Varies;
46  
47  
48  /**
49   *<p>Represents an HL7 OBX message segment (OBSERVATION RESULT). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>OBX-1: Set ID - Observational Simple (SI) <b>optional </b>
53       * <li>OBX-2: Value Type (ID) <b> </b>
54       * <li>OBX-3: Observation Identifier (CE) <b> </b>
55       * <li>OBX-4: Observation Sub-ID (ST) <b>optional </b>
56       * <li>OBX-5: Observation Value (Varies) <b>optional </b>
57       * <li>OBX-6: Units (CE) <b>optional </b>
58       * <li>OBX-7: References Range (ST) <b>optional </b>
59       * <li>OBX-8: Abnormal Flags (ID) <b>optional repeating</b>
60       * <li>OBX-9: Probability (NM) <b>optional </b>
61       * <li>OBX-10: Nature of Abnormal Test (ID) <b>optional </b>
62       * <li>OBX-11: Observation result status (ID) <b> </b>
63       * <li>OBX-12: Effective date last observation normal values (TS) <b>optional </b>
64       * <li>OBX-13: User Defined Access Checks (ST) <b>optional </b>
65       * <li>OBX-14: Date / time of the observation (TS) <b>optional </b>
66       * <li>OBX-15: Producer's ID (CE) <b>optional </b>
67       * <li>OBX-16: Responsible Observer (CN) <b>optional </b>
68   * </ul>
69   */
70  @SuppressWarnings("unused")
71  public class OBX extends AbstractSegment {
72  
73      /** 
74       * Creates a new OBX segment
75       */
76      public OBX(Group parent, ModelClassFactory factory) {
77         super(parent, factory);
78         init(factory);
79      }
80  
81      private void init(ModelClassFactory factory) {
82         try {
83                                    this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - Observational Simple");
84                                                this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "Value Type");
85                                    this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "Observation Identifier");
86                                    this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Observation Sub-ID");
87                                    this.add(Varies.class, false, 1, 65536, new Object[]{ getMessage() }, "Observation Value");
88                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Units");
89                                    this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "References Range");
90                                                this.add(ID.class, false, 5, 10, new Object[]{ getMessage(), new Integer(78) }, "Abnormal Flags");
91                                    this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Probability");
92                                                this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(80) }, "Nature of Abnormal Test");
93                                                this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(85) }, "Observation result status");
94                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Effective date last observation normal values");
95                                    this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "User Defined Access Checks");
96                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / time of the observation");
97                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Producer's ID");
98                                    this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "Responsible Observer");
99         } catch(HL7Exception e) {
100           log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
101        }
102     }
103 
104 
105 
106     /**
107      * Returns
108      * OBX-1: "Set ID - Observational Simple" - creates it if necessary
109      */
110     public SI getSetIDObservationalSimple() { 
111 		SI retVal = this.getTypedField(1, 0);
112 		return retVal;
113     }
114     
115     /**
116      * Returns
117      * OBX-1: "Set ID - Observational Simple" - creates it if necessary
118      */
119     public SI getObx1_SetIDObservationalSimple() { 
120 		SI retVal = this.getTypedField(1, 0);
121 		return retVal;
122     }
123 
124 
125 
126     /**
127      * Returns
128      * OBX-2: "Value Type" - creates it if necessary
129      */
130     public ID getValueType() { 
131 		ID retVal = this.getTypedField(2, 0);
132 		return retVal;
133     }
134     
135     /**
136      * Returns
137      * OBX-2: "Value Type" - creates it if necessary
138      */
139     public ID getObx2_ValueType() { 
140 		ID retVal = this.getTypedField(2, 0);
141 		return retVal;
142     }
143 
144 
145 
146     /**
147      * Returns
148      * OBX-3: "Observation Identifier" - creates it if necessary
149      */
150     public CE getObservationIdentifier() { 
151 		CE retVal = this.getTypedField(3, 0);
152 		return retVal;
153     }
154     
155     /**
156      * Returns
157      * OBX-3: "Observation Identifier" - creates it if necessary
158      */
159     public CE getObx3_ObservationIdentifier() { 
160 		CE retVal = this.getTypedField(3, 0);
161 		return retVal;
162     }
163 
164 
165 
166     /**
167      * Returns
168      * OBX-4: "Observation Sub-ID" - creates it if necessary
169      */
170     public ST getObservationSubID() { 
171 		ST retVal = this.getTypedField(4, 0);
172 		return retVal;
173     }
174     
175     /**
176      * Returns
177      * OBX-4: "Observation Sub-ID" - creates it if necessary
178      */
179     public ST getObx4_ObservationSubID() { 
180 		ST retVal = this.getTypedField(4, 0);
181 		return retVal;
182     }
183 
184 
185 
186     /**
187      * Returns
188      * OBX-5: "Observation Value" - creates it if necessary
189      */
190     public Varies getObservationValue() { 
191 		Varies retVal = this.getTypedField(5, 0);
192 		return retVal;
193     }
194     
195     /**
196      * Returns
197      * OBX-5: "Observation Value" - creates it if necessary
198      */
199     public Varies getObx5_ObservationValue() { 
200 		Varies retVal = this.getTypedField(5, 0);
201 		return retVal;
202     }
203 
204 
205 
206     /**
207      * Returns
208      * OBX-6: "Units" - creates it if necessary
209      */
210     public CE getUnits() { 
211 		CE retVal = this.getTypedField(6, 0);
212 		return retVal;
213     }
214     
215     /**
216      * Returns
217      * OBX-6: "Units" - creates it if necessary
218      */
219     public CE getObx6_Units() { 
220 		CE retVal = this.getTypedField(6, 0);
221 		return retVal;
222     }
223 
224 
225 
226     /**
227      * Returns
228      * OBX-7: "References Range" - creates it if necessary
229      */
230     public ST getReferencesRange() { 
231 		ST retVal = this.getTypedField(7, 0);
232 		return retVal;
233     }
234     
235     /**
236      * Returns
237      * OBX-7: "References Range" - creates it if necessary
238      */
239     public ST getObx7_ReferencesRange() { 
240 		ST retVal = this.getTypedField(7, 0);
241 		return retVal;
242     }
243 
244 
245     /**
246      * Returns all repetitions of Abnormal Flags (OBX-8).
247      */
248     public ID[] getAbnormalFlags() {
249     	ID[] retVal = this.getTypedField(8, new ID[0]);
250     	return retVal;
251     }
252 
253 
254     /**
255      * Returns all repetitions of Abnormal Flags (OBX-8).
256      */
257     public ID[] getObx8_AbnormalFlags() {
258     	ID[] retVal = this.getTypedField(8, new ID[0]);
259     	return retVal;
260     }
261 
262 
263     /**
264      * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
265      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
266      * it will return zero.
267      */
268     public int getAbnormalFlagsReps() {
269     	return this.getReps(8);
270     }
271 
272 
273     /**
274      * Returns a specific repetition of
275      * OBX-8: "Abnormal Flags" - creates it if necessary
276      *
277      * @param rep The repetition index (0-indexed)
278      */
279     public ID getAbnormalFlags(int rep) { 
280 		ID retVal = this.getTypedField(8, rep);
281 		return retVal;
282     }
283 
284     /**
285      * Returns a specific repetition of
286      * OBX-8: "Abnormal Flags" - creates it if necessary
287      *
288      * @param rep The repetition index (0-indexed)
289      */
290     public ID getObx8_AbnormalFlags(int rep) { 
291 		ID retVal = this.getTypedField(8, rep);
292 		return retVal;
293     }
294 
295     /**
296      * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
297      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
298      * it will return zero.
299      */
300     public int getObx8_AbnormalFlagsReps() {
301     	return this.getReps(8);
302     }
303 
304 
305     /**
306      * Inserts a repetition of
307      * OBX-8: "Abnormal Flags" at a specific index
308      *
309      * @param rep The repetition index (0-indexed)
310      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
311      */
312     public ID insertAbnormalFlags(int rep) throws HL7Exception { 
313         return (ID) super.insertRepetition(8, rep);
314     }
315 
316 
317     /**
318      * Inserts a repetition of
319      * OBX-8: "Abnormal Flags" at a specific index
320      *
321      * @param rep The repetition index (0-indexed)
322      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
323      */
324     public ID insertObx8_AbnormalFlags(int rep) throws HL7Exception { 
325         return (ID) super.insertRepetition(8, rep);
326     }
327 
328 
329     /**
330      * Removes a repetition of
331      * OBX-8: "Abnormal Flags" at a specific index
332      *
333      * @param rep The repetition index (0-indexed)
334      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
335      */
336     public ID removeAbnormalFlags(int rep) throws HL7Exception { 
337         return (ID) super.removeRepetition(8, rep);
338     }
339 
340 
341     /**
342      * Removes a repetition of
343      * OBX-8: "Abnormal Flags" at a specific index
344      *
345      * @param rep The repetition index (0-indexed)
346      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
347      */
348     public ID removeObx8_AbnormalFlags(int rep) throws HL7Exception { 
349         return (ID) super.removeRepetition(8, rep);
350     }
351 
352 
353 
354 
355     /**
356      * Returns
357      * OBX-9: "Probability" - creates it if necessary
358      */
359     public NM getProbability() { 
360 		NM retVal = this.getTypedField(9, 0);
361 		return retVal;
362     }
363     
364     /**
365      * Returns
366      * OBX-9: "Probability" - creates it if necessary
367      */
368     public NM getObx9_Probability() { 
369 		NM retVal = this.getTypedField(9, 0);
370 		return retVal;
371     }
372 
373 
374 
375     /**
376      * Returns
377      * OBX-10: "Nature of Abnormal Test" - creates it if necessary
378      */
379     public ID getNatureOfAbnormalTest() { 
380 		ID retVal = this.getTypedField(10, 0);
381 		return retVal;
382     }
383     
384     /**
385      * Returns
386      * OBX-10: "Nature of Abnormal Test" - creates it if necessary
387      */
388     public ID getObx10_NatureOfAbnormalTest() { 
389 		ID retVal = this.getTypedField(10, 0);
390 		return retVal;
391     }
392 
393 
394 
395     /**
396      * Returns
397      * OBX-11: "Observation result status" - creates it if necessary
398      */
399     public ID getObservationResultStatus() { 
400 		ID retVal = this.getTypedField(11, 0);
401 		return retVal;
402     }
403     
404     /**
405      * Returns
406      * OBX-11: "Observation result status" - creates it if necessary
407      */
408     public ID getObx11_ObservationResultStatus() { 
409 		ID retVal = this.getTypedField(11, 0);
410 		return retVal;
411     }
412 
413 
414 
415     /**
416      * Returns
417      * OBX-12: "Effective date last observation normal values" - creates it if necessary
418      */
419     public TS getEffectiveDateLastObservationNormalValues() { 
420 		TS retVal = this.getTypedField(12, 0);
421 		return retVal;
422     }
423     
424     /**
425      * Returns
426      * OBX-12: "Effective date last observation normal values" - creates it if necessary
427      */
428     public TS getObx12_EffectiveDateLastObservationNormalValues() { 
429 		TS retVal = this.getTypedField(12, 0);
430 		return retVal;
431     }
432 
433 
434 
435     /**
436      * Returns
437      * OBX-13: "User Defined Access Checks" - creates it if necessary
438      */
439     public ST getUserDefinedAccessChecks() { 
440 		ST retVal = this.getTypedField(13, 0);
441 		return retVal;
442     }
443     
444     /**
445      * Returns
446      * OBX-13: "User Defined Access Checks" - creates it if necessary
447      */
448     public ST getObx13_UserDefinedAccessChecks() { 
449 		ST retVal = this.getTypedField(13, 0);
450 		return retVal;
451     }
452 
453 
454 
455     /**
456      * Returns
457      * OBX-14: "Date / time of the observation" - creates it if necessary
458      */
459     public TS getDateTimeOfTheObservation() { 
460 		TS retVal = this.getTypedField(14, 0);
461 		return retVal;
462     }
463     
464     /**
465      * Returns
466      * OBX-14: "Date / time of the observation" - creates it if necessary
467      */
468     public TS getObx14_DateTimeOfTheObservation() { 
469 		TS retVal = this.getTypedField(14, 0);
470 		return retVal;
471     }
472 
473 
474 
475     /**
476      * Returns
477      * OBX-15: "Producer's ID" - creates it if necessary
478      */
479     public CE getProducerSID() { 
480 		CE retVal = this.getTypedField(15, 0);
481 		return retVal;
482     }
483     
484     /**
485      * Returns
486      * OBX-15: "Producer's ID" - creates it if necessary
487      */
488     public CE getObx15_ProducerSID() { 
489 		CE retVal = this.getTypedField(15, 0);
490 		return retVal;
491     }
492 
493 
494 
495     /**
496      * Returns
497      * OBX-16: "Responsible Observer" - creates it if necessary
498      */
499     public CN getResponsibleObserver() { 
500 		CN retVal = this.getTypedField(16, 0);
501 		return retVal;
502     }
503     
504     /**
505      * Returns
506      * OBX-16: "Responsible Observer" - creates it if necessary
507      */
508     public CN getObx16_ResponsibleObserver() { 
509 		CN retVal = this.getTypedField(16, 0);
510 		return retVal;
511     }
512 
513 
514 
515 
516 
517     /** {@inheritDoc} */   
518     protected Type createNewTypeWithoutReflection(int field) {
519        switch (field) {
520           case 0: return new SI(getMessage());
521           case 1: return new ID(getMessage(), new Integer( 125 ));
522           case 2: return new CE(getMessage());
523           case 3: return new ST(getMessage());
524           case 4: return new Varies(getMessage());
525           case 5: return new CE(getMessage());
526           case 6: return new ST(getMessage());
527           case 7: return new ID(getMessage(), new Integer( 78 ));
528           case 8: return new NM(getMessage());
529           case 9: return new ID(getMessage(), new Integer( 80 ));
530           case 10: return new ID(getMessage(), new Integer( 85 ));
531           case 11: return new TS(getMessage());
532           case 12: return new ST(getMessage());
533           case 13: return new TS(getMessage());
534           case 14: return new CE(getMessage());
535           case 15: return new CN(getMessage());
536           default: return null;
537        }
538    }
539 
540 
541 }
542