001/*
002 * This class is an auto-generated source file for a HAPI
003 * HL7 v2.x standard structure class.
004 *
005 * For more information, visit: http://hl7api.sourceforge.net/
006 * 
007 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v21.segment;
035
036// import ca.uhn.hl7v2.model.v21.group.*;
037import ca.uhn.hl7v2.model.v21.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 OBX message segment (RESULT). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>OBX-1: SET ID - OBSERVATION SIMPLE (SI) <b>optional </b>
053     * <li>OBX-2: VALUE TYPE (ID) <b>optional </b>
054     * <li>OBX-3: OBSERVATION IDENTIFIER (CE) <b> </b>
055     * <li>OBX-4: OBSERVATION SUB-ID (NM) <b>optional </b>
056     * <li>OBX-5: OBSERVATION RESULTS (Varies) <b> </b>
057     * <li>OBX-6: UNITS (ID) <b>optional </b>
058     * <li>OBX-7: REFERENCES RANGE (ST) <b>optional </b>
059     * <li>OBX-8: ABNORMAL FLAGS (ST) <b>optional repeating</b>
060     * <li>OBX-9: PROBABILITY (NM) <b>optional </b>
061     * <li>OBX-10: NATURE OF ABNORMAL TEST (ID) <b>optional </b>
062     * <li>OBX-11: OBSERV RESULT STATUS (ID) <b>optional </b>
063     * <li>OBX-12: DATE LAST OBS NORMAL VALUES (TS) <b>optional </b>
064 * </ul>
065 */
066@SuppressWarnings("unused")
067public class OBX extends AbstractSegment {
068
069    /** 
070     * Creates a new OBX segment
071     */
072    public OBX(Group parent, ModelClassFactory factory) {
073       super(parent, factory);
074       init(factory);
075    }
076
077    private void init(ModelClassFactory factory) {
078       try {
079                                  this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "SET ID - OBSERVATION SIMPLE");
080                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "VALUE TYPE");
081                                  this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "OBSERVATION IDENTIFIER");
082                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "OBSERVATION SUB-ID");
083                                  this.add(Varies.class, true, 1, 65, new Object[]{ getMessage() }, "OBSERVATION RESULTS");
084                                              this.add(ID.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "UNITS");
085                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "REFERENCES RANGE");
086                                  this.add(ST.class, false, 5, 10, new Object[]{ getMessage() }, "ABNORMAL FLAGS");
087                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "PROBABILITY");
088                                              this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(80) }, "NATURE OF ABNORMAL TEST");
089                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(85) }, "OBSERV RESULT STATUS");
090                                  this.add(TS.class, false, 1, 19, new Object[]{ getMessage() }, "DATE LAST OBS NORMAL VALUES");
091       } catch(HL7Exception e) {
092          log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
093       }
094    }
095
096
097
098    /**
099     * 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