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.v21.segment;
35  
36  // import ca.uhn.hl7v2.model.v21.group.*;
37  import ca.uhn.hl7v2.model.v21.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 (RESULT). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>OBX-1: SET ID - OBSERVATION SIMPLE (SI) <b>optional </b>
53       * <li>OBX-2: VALUE TYPE (ID) <b>optional </b>
54       * <li>OBX-3: OBSERVATION IDENTIFIER (CE) <b> </b>
55       * <li>OBX-4: OBSERVATION SUB-ID (NM) <b>optional </b>
56       * <li>OBX-5: OBSERVATION RESULTS (Varies) <b> </b>
57       * <li>OBX-6: UNITS (ID) <b>optional </b>
58       * <li>OBX-7: REFERENCES RANGE (ST) <b>optional </b>
59       * <li>OBX-8: ABNORMAL FLAGS (ST) <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: OBSERV RESULT STATUS (ID) <b>optional </b>
63       * <li>OBX-12: DATE LAST OBS NORMAL VALUES (TS) <b>optional </b>
64   * </ul>
65   */
66  @SuppressWarnings("unused")
67  public class OBX extends AbstractSegment {
68  
69      /** 
70       * Creates a new OBX segment
71       */
72      public OBX(Group parent, ModelClassFactory factory) {
73         super(parent, factory);
74         init(factory);
75      }
76  
77      private void init(ModelClassFactory factory) {
78         try {
79                                    this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "SET ID - OBSERVATION SIMPLE");
80                                                this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "VALUE TYPE");
81                                    this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "OBSERVATION IDENTIFIER");
82                                    this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "OBSERVATION SUB-ID");
83                                    this.add(Varies.class, true, 1, 65, new Object[]{ getMessage() }, "OBSERVATION RESULTS");
84                                                this.add(ID.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "UNITS");
85                                    this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "REFERENCES RANGE");
86                                    this.add(ST.class, false, 5, 10, new Object[]{ getMessage() }, "ABNORMAL FLAGS");
87                                    this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "PROBABILITY");
88                                                this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(80) }, "NATURE OF ABNORMAL TEST");
89                                                this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(85) }, "OBSERV RESULT STATUS");
90                                    this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "DATE LAST OBS NORMAL VALUES");
91         } catch(HL7Exception e) {
92            log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
93         }
94      }
95  
96  
97  
98      /**
99       * Returns
100      * OBX-1: "SET ID - OBSERVATION SIMPLE" - creates it if necessary
101      */
102     public SI getSETIDOBSERVATIONSIMPLE() { 
103 		SI retVal = this.getTypedField(1, 0);
104 		return retVal;
105     }
106     
107     /**
108      * Returns
109      * OBX-1: "SET ID - OBSERVATION SIMPLE" - creates it if necessary
110      */
111     public SI getObx1_SETIDOBSERVATIONSIMPLE() { 
112 		SI retVal = this.getTypedField(1, 0);
113 		return retVal;
114     }
115 
116 
117 
118     /**
119      * Returns
120      * OBX-2: "VALUE TYPE" - creates it if necessary
121      */
122     public ID getVALUETYPE() { 
123 		ID retVal = this.getTypedField(2, 0);
124 		return retVal;
125     }
126     
127     /**
128      * Returns
129      * OBX-2: "VALUE TYPE" - creates it if necessary
130      */
131     public ID getObx2_VALUETYPE() { 
132 		ID retVal = this.getTypedField(2, 0);
133 		return retVal;
134     }
135 
136 
137 
138     /**
139      * Returns
140      * OBX-3: "OBSERVATION IDENTIFIER" - creates it if necessary
141      */
142     public CE getOBSERVATIONIDENTIFIER() { 
143 		CE retVal = this.getTypedField(3, 0);
144 		return retVal;
145     }
146     
147     /**
148      * Returns
149      * OBX-3: "OBSERVATION IDENTIFIER" - creates it if necessary
150      */
151     public CE getObx3_OBSERVATIONIDENTIFIER() { 
152 		CE retVal = this.getTypedField(3, 0);
153 		return retVal;
154     }
155 
156 
157 
158     /**
159      * Returns
160      * OBX-4: "OBSERVATION SUB-ID" - creates it if necessary
161      */
162     public NM getOBSERVATIONSUBID() { 
163 		NM retVal = this.getTypedField(4, 0);
164 		return retVal;
165     }
166     
167     /**
168      * Returns
169      * OBX-4: "OBSERVATION SUB-ID" - creates it if necessary
170      */
171     public NM getObx4_OBSERVATIONSUBID() { 
172 		NM retVal = this.getTypedField(4, 0);
173 		return retVal;
174     }
175 
176 
177 
178     /**
179      * Returns
180      * OBX-5: "OBSERVATION RESULTS" - creates it if necessary
181      */
182     public Varies getOBSERVATIONRESULTS() { 
183 		Varies retVal = this.getTypedField(5, 0);
184 		return retVal;
185     }
186     
187     /**
188      * Returns
189      * OBX-5: "OBSERVATION RESULTS" - creates it if necessary
190      */
191     public Varies getObx5_OBSERVATIONRESULTS() { 
192 		Varies retVal = this.getTypedField(5, 0);
193 		return retVal;
194     }
195 
196 
197 
198     /**
199      * Returns
200      * OBX-6: "UNITS" - creates it if necessary
201      */
202     public ID getUNITS() { 
203 		ID retVal = this.getTypedField(6, 0);
204 		return retVal;
205     }
206     
207     /**
208      * Returns
209      * OBX-6: "UNITS" - creates it if necessary
210      */
211     public ID getObx6_UNITS() { 
212 		ID retVal = this.getTypedField(6, 0);
213 		return retVal;
214     }
215 
216 
217 
218     /**
219      * Returns
220      * OBX-7: "REFERENCES RANGE" - creates it if necessary
221      */
222     public ST getREFERENCESRANGE() { 
223 		ST retVal = this.getTypedField(7, 0);
224 		return retVal;
225     }
226     
227     /**
228      * Returns
229      * OBX-7: "REFERENCES RANGE" - creates it if necessary
230      */
231     public ST getObx7_REFERENCESRANGE() { 
232 		ST retVal = this.getTypedField(7, 0);
233 		return retVal;
234     }
235 
236 
237     /**
238      * Returns all repetitions of ABNORMAL FLAGS (OBX-8).
239      */
240     public ST[] getABNORMALFLAGS() {
241     	ST[] retVal = this.getTypedField(8, new ST[0]);
242     	return retVal;
243     }
244 
245 
246     /**
247      * Returns all repetitions of ABNORMAL FLAGS (OBX-8).
248      */
249     public ST[] getObx8_ABNORMALFLAGS() {
250     	ST[] retVal = this.getTypedField(8, new ST[0]);
251     	return retVal;
252     }
253 
254 
255     /**
256      * Returns a count of the current number of repetitions of ABNORMAL FLAGS (OBX-8).
257      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
258      * it will return zero.
259      */
260     public int getABNORMALFLAGSReps() {
261     	return this.getReps(8);
262     }
263 
264 
265     /**
266      * Returns a specific repetition of
267      * OBX-8: "ABNORMAL FLAGS" - creates it if necessary
268      *
269      * @param rep The repetition index (0-indexed)
270      */
271     public ST getABNORMALFLAGS(int rep) { 
272 		ST retVal = this.getTypedField(8, rep);
273 		return retVal;
274     }
275 
276     /**
277      * Returns a specific repetition of
278      * OBX-8: "ABNORMAL FLAGS" - creates it if necessary
279      *
280      * @param rep The repetition index (0-indexed)
281      */
282     public ST getObx8_ABNORMALFLAGS(int rep) { 
283 		ST retVal = this.getTypedField(8, rep);
284 		return retVal;
285     }
286 
287     /**
288      * Returns a count of the current number of repetitions of ABNORMAL FLAGS (OBX-8).
289      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
290      * it will return zero.
291      */
292     public int getObx8_ABNORMALFLAGSReps() {
293     	return this.getReps(8);
294     }
295 
296 
297     /**
298      * Inserts a repetition of
299      * OBX-8: "ABNORMAL FLAGS" at a specific index
300      *
301      * @param rep The repetition index (0-indexed)
302      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
303      */
304     public ST insertABNORMALFLAGS(int rep) throws HL7Exception { 
305         return (ST) super.insertRepetition(8, rep);
306     }
307 
308 
309     /**
310      * Inserts a repetition of
311      * OBX-8: "ABNORMAL FLAGS" at a specific index
312      *
313      * @param rep The repetition index (0-indexed)
314      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
315      */
316     public ST insertObx8_ABNORMALFLAGS(int rep) throws HL7Exception { 
317         return (ST) super.insertRepetition(8, rep);
318     }
319 
320 
321     /**
322      * Removes a repetition of
323      * OBX-8: "ABNORMAL FLAGS" at a specific index
324      *
325      * @param rep The repetition index (0-indexed)
326      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
327      */
328     public ST removeABNORMALFLAGS(int rep) throws HL7Exception { 
329         return (ST) super.removeRepetition(8, rep);
330     }
331 
332 
333     /**
334      * Removes a repetition of
335      * OBX-8: "ABNORMAL FLAGS" at a specific index
336      *
337      * @param rep The repetition index (0-indexed)
338      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
339      */
340     public ST removeObx8_ABNORMALFLAGS(int rep) throws HL7Exception { 
341         return (ST) super.removeRepetition(8, rep);
342     }
343 
344 
345 
346 
347     /**
348      * Returns
349      * OBX-9: "PROBABILITY" - creates it if necessary
350      */
351     public NM getPROBABILITY() { 
352 		NM retVal = this.getTypedField(9, 0);
353 		return retVal;
354     }
355     
356     /**
357      * Returns
358      * OBX-9: "PROBABILITY" - creates it if necessary
359      */
360     public NM getObx9_PROBABILITY() { 
361 		NM retVal = this.getTypedField(9, 0);
362 		return retVal;
363     }
364 
365 
366 
367     /**
368      * Returns
369      * OBX-10: "NATURE OF ABNORMAL TEST" - creates it if necessary
370      */
371     public ID getNATUREOFABNORMALTEST() { 
372 		ID retVal = this.getTypedField(10, 0);
373 		return retVal;
374     }
375     
376     /**
377      * Returns
378      * OBX-10: "NATURE OF ABNORMAL TEST" - creates it if necessary
379      */
380     public ID getObx10_NATUREOFABNORMALTEST() { 
381 		ID retVal = this.getTypedField(10, 0);
382 		return retVal;
383     }
384 
385 
386 
387     /**
388      * Returns
389      * OBX-11: "OBSERV RESULT STATUS" - creates it if necessary
390      */
391     public ID getOBSERVRESULTSTATUS() { 
392 		ID retVal = this.getTypedField(11, 0);
393 		return retVal;
394     }
395     
396     /**
397      * Returns
398      * OBX-11: "OBSERV RESULT STATUS" - creates it if necessary
399      */
400     public ID getObx11_OBSERVRESULTSTATUS() { 
401 		ID retVal = this.getTypedField(11, 0);
402 		return retVal;
403     }
404 
405 
406 
407     /**
408      * Returns
409      * OBX-12: "DATE LAST OBS NORMAL VALUES" - creates it if necessary
410      */
411     public TS getDATELASTOBSNORMALVALUES() { 
412 		TS retVal = this.getTypedField(12, 0);
413 		return retVal;
414     }
415     
416     /**
417      * Returns
418      * OBX-12: "DATE LAST OBS NORMAL VALUES" - creates it if necessary
419      */
420     public TS getObx12_DATELASTOBSNORMALVALUES() { 
421 		TS retVal = this.getTypedField(12, 0);
422 		return retVal;
423     }
424 
425 
426 
427 
428 
429     /** {@inheritDoc} */   
430     protected Type createNewTypeWithoutReflection(int field) {
431        switch (field) {
432           case 0: return new SI(getMessage());
433           case 1: return new ID(getMessage(), new Integer( 125 ));
434           case 2: return new CE(getMessage());
435           case 3: return new NM(getMessage());
436           case 4: return new Varies(getMessage());
437           case 5: return new ID(getMessage(), new Integer( 0 ));
438           case 6: return new ST(getMessage());
439           case 7: return new ST(getMessage());
440           case 8: return new NM(getMessage());
441           case 9: return new ID(getMessage(), new Integer( 80 ));
442           case 10: return new ID(getMessage(), new Integer( 85 ));
443           case 11: return new TS(getMessage());
444           default: return null;
445        }
446    }
447 
448 
449 }
450