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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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 (OBSERVATION RESULT). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>OBX-1: Set ID - Observational Simple (SI) <b>optional </b>
053     * <li>OBX-2: Value Type (ID) <b> </b>
054     * <li>OBX-3: Observation Identifier (CE) <b> </b>
055     * <li>OBX-4: Observation Sub-ID (ST) <b>optional </b>
056     * <li>OBX-5: Observation Value (Varies) <b>optional </b>
057     * <li>OBX-6: Units (CE) <b>optional </b>
058     * <li>OBX-7: References Range (ST) <b>optional </b>
059     * <li>OBX-8: Abnormal Flags (ID) <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: Observation result status (ID) <b> </b>
063     * <li>OBX-12: Effective date last observation normal values (TS) <b>optional </b>
064     * <li>OBX-13: User Defined Access Checks (ST) <b>optional </b>
065     * <li>OBX-14: Date / time of the observation (TS) <b>optional </b>
066     * <li>OBX-15: Producer's ID (CE) <b>optional </b>
067     * <li>OBX-16: Responsible Observer (CN) <b>optional </b>
068 * </ul>
069 */
070@SuppressWarnings("unused")
071public class OBX extends AbstractSegment {
072
073    /** 
074     * Creates a new OBX segment
075     */
076    public OBX(Group parent, ModelClassFactory factory) {
077       super(parent, factory);
078       init(factory);
079    }
080
081    private void init(ModelClassFactory factory) {
082       try {
083                                  this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - Observational Simple");
084                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "Value Type");
085                                  this.add(CE.class, true, 1, 80, new Object[]{ getMessage() }, "Observation Identifier");
086                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Observation Sub-ID");
087                                  this.add(Varies.class, false, 1, 65536, new Object[]{ getMessage() }, "Observation Value");
088                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Units");
089                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "References Range");
090                                              this.add(ID.class, false, 5, 10, new Object[]{ getMessage(), new Integer(78) }, "Abnormal Flags");
091                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Probability");
092                                              this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(80) }, "Nature of Abnormal Test");
093                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(85) }, "Observation result status");
094                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Effective date last observation normal values");
095                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "User Defined Access Checks");
096                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / time of the observation");
097                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Producer's ID");
098                                  this.add(CN.class, false, 1, 60, new Object[]{ getMessage() }, "Responsible Observer");
099       } 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