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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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 *<p>Represents an HL7 OBX message segment (Observation segment). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>OBX-1: Set ID - OBX (SI) <b>optional </b>
052     * <li>OBX-2: Value Type (ID) <b> </b>
053     * <li>OBX-3: Observation Identifier (CE) <b> </b>
054     * <li>OBX-4: Observation Sub-ID (ST) <b>optional </b>
055     * <li>OBX-5: Observation Value (Varies) <b>optional repeating</b>
056     * <li>OBX-6: Units (CE) <b>optional </b>
057     * <li>OBX-7: References Range (ST) <b>optional </b>
058     * <li>OBX-8: Abnormal Flags (ID) <b>optional repeating</b>
059     * <li>OBX-9: Probability (NM) <b>optional </b>
060     * <li>OBX-10: Nature of Abnormal Test (ID) <b>optional </b>
061     * <li>OBX-11: Observ Result Status (ID) <b> </b>
062     * <li>OBX-12: Date Last Obs Normal Values (TS) <b>optional </b>
063     * <li>OBX-13: User Defined Access Checks (ST) <b>optional </b>
064     * <li>OBX-14: Date/Time of the Observation (TS) <b>optional </b>
065     * <li>OBX-15: Producer's ID (CE) <b>optional </b>
066     * <li>OBX-16: Responsible Observer (XCN) <b>optional </b>
067     * <li>OBX-17: Observation Method (CE) <b>optional repeating</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 - OBX");
084                                              this.add(ID.class, true, 1, 2, new Object[]{ getMessage(), new Integer(125) }, "Value Type");
085                                  this.add(CE.class, true, 1, 590, 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, 0, 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, 10, new Object[]{ getMessage() }, "References Range");
090                                              this.add(ID.class, false, 5, 5, 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, 2, new Object[]{ getMessage(), new Integer(80) }, "Nature of Abnormal Test");
093                                              this.add(ID.class, true, 1, 1, new Object[]{ getMessage(), new Integer(85) }, "Observ Result Status");
094                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date Last Obs 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(XCN.class, false, 1, 80, new Object[]{ getMessage() }, "Responsible Observer");
099                                  this.add(CE.class, false, 0, 80, new Object[]{ getMessage() }, "Observation Method");
100       } catch(HL7Exception e) {
101          log.error("Unexpected error creating OBX - this is probably a bug in the source code generator.", e);
102       }
103    }
104
105
106
107    /**
108     * Returns
109     * OBX-1: "Set ID - OBX" - creates it if necessary
110     */
111    public SI getSetIDOBX() { 
112                SI retVal = this.getTypedField(1, 0);
113                return retVal;
114    }
115    
116    /**
117     * Returns
118     * OBX-1: "Set ID - OBX" - creates it if necessary
119     */
120    public SI getObx1_SetIDOBX() { 
121                SI retVal = this.getTypedField(1, 0);
122                return retVal;
123    }
124
125
126
127    /**
128     * Returns
129     * OBX-2: "Value Type" - creates it if necessary
130     */
131    public ID getValueType() { 
132                ID retVal = this.getTypedField(2, 0);
133                return retVal;
134    }
135    
136    /**
137     * Returns
138     * OBX-2: "Value Type" - creates it if necessary
139     */
140    public ID getObx2_ValueType() { 
141                ID retVal = this.getTypedField(2, 0);
142                return retVal;
143    }
144
145
146
147    /**
148     * Returns
149     * OBX-3: "Observation Identifier" - creates it if necessary
150     */
151    public CE getObservationIdentifier() { 
152                CE retVal = this.getTypedField(3, 0);
153                return retVal;
154    }
155    
156    /**
157     * Returns
158     * OBX-3: "Observation Identifier" - creates it if necessary
159     */
160    public CE getObx3_ObservationIdentifier() { 
161                CE retVal = this.getTypedField(3, 0);
162                return retVal;
163    }
164
165
166
167    /**
168     * Returns
169     * OBX-4: "Observation Sub-ID" - creates it if necessary
170     */
171    public ST getObservationSubID() { 
172                ST retVal = this.getTypedField(4, 0);
173                return retVal;
174    }
175    
176    /**
177     * Returns
178     * OBX-4: "Observation Sub-ID" - creates it if necessary
179     */
180    public ST getObx4_ObservationSubID() { 
181                ST retVal = this.getTypedField(4, 0);
182                return retVal;
183    }
184
185
186    /**
187     * Returns all repetitions of Observation Value (OBX-5).
188     */
189    public Varies[] getObservationValue() {
190        Varies[] retVal = this.getTypedField(5, new Varies[0]);
191        return retVal;
192    }
193
194
195    /**
196     * Returns all repetitions of Observation Value (OBX-5).
197     */
198    public Varies[] getObx5_ObservationValue() {
199        Varies[] retVal = this.getTypedField(5, new Varies[0]);
200        return retVal;
201    }
202
203
204    /**
205     * Returns a count of the current number of repetitions of Observation Value (OBX-5).
206     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
207     * it will return zero.
208     */
209    public int getObservationValueReps() {
210        return this.getReps(5);
211    }
212
213
214    /**
215     * Returns a specific repetition of
216     * OBX-5: "Observation Value" - creates it if necessary
217     *
218     * @param rep The repetition index (0-indexed)
219     */
220    public Varies getObservationValue(int rep) { 
221                Varies retVal = this.getTypedField(5, rep);
222                return retVal;
223    }
224
225    /**
226     * Returns a specific repetition of
227     * OBX-5: "Observation Value" - creates it if necessary
228     *
229     * @param rep The repetition index (0-indexed)
230     */
231    public Varies getObx5_ObservationValue(int rep) { 
232                Varies retVal = this.getTypedField(5, rep);
233                return retVal;
234    }
235
236    /**
237     * Returns a count of the current number of repetitions of Observation Value (OBX-5).
238     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
239     * it will return zero.
240     */
241    public int getObx5_ObservationValueReps() {
242        return this.getReps(5);
243    }
244
245
246    /**
247     * Inserts a repetition of
248     * OBX-5: "Observation Value" at a specific index
249     *
250     * @param rep The repetition index (0-indexed)
251     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
252     */
253    public Varies insertObservationValue(int rep) throws HL7Exception { 
254        return (Varies) super.insertRepetition(5, rep);
255    }
256
257
258    /**
259     * Inserts a repetition of
260     * OBX-5: "Observation Value" at a specific index
261     *
262     * @param rep The repetition index (0-indexed)
263     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
264     */
265    public Varies insertObx5_ObservationValue(int rep) throws HL7Exception { 
266        return (Varies) super.insertRepetition(5, rep);
267    }
268
269
270    /**
271     * Removes a repetition of
272     * OBX-5: "Observation Value" at a specific index
273     *
274     * @param rep The repetition index (0-indexed)
275     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
276     */
277    public Varies removeObservationValue(int rep) throws HL7Exception { 
278        return (Varies) super.removeRepetition(5, rep);
279    }
280
281
282    /**
283     * Removes a repetition of
284     * OBX-5: "Observation Value" at a specific index
285     *
286     * @param rep The repetition index (0-indexed)
287     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
288     */
289    public Varies removeObx5_ObservationValue(int rep) throws HL7Exception { 
290        return (Varies) super.removeRepetition(5, rep);
291    }
292
293
294
295
296    /**
297     * Returns
298     * OBX-6: "Units" - creates it if necessary
299     */
300    public CE getUnits() { 
301                CE retVal = this.getTypedField(6, 0);
302                return retVal;
303    }
304    
305    /**
306     * Returns
307     * OBX-6: "Units" - creates it if necessary
308     */
309    public CE getObx6_Units() { 
310                CE retVal = this.getTypedField(6, 0);
311                return retVal;
312    }
313
314
315
316    /**
317     * Returns
318     * OBX-7: "References Range" - creates it if necessary
319     */
320    public ST getReferencesRange() { 
321                ST retVal = this.getTypedField(7, 0);
322                return retVal;
323    }
324    
325    /**
326     * Returns
327     * OBX-7: "References Range" - creates it if necessary
328     */
329    public ST getObx7_ReferencesRange() { 
330                ST retVal = this.getTypedField(7, 0);
331                return retVal;
332    }
333
334
335    /**
336     * Returns all repetitions of Abnormal Flags (OBX-8).
337     */
338    public ID[] getAbnormalFlags() {
339        ID[] retVal = this.getTypedField(8, new ID[0]);
340        return retVal;
341    }
342
343
344    /**
345     * Returns all repetitions of Abnormal Flags (OBX-8).
346     */
347    public ID[] getObx8_AbnormalFlags() {
348        ID[] retVal = this.getTypedField(8, new ID[0]);
349        return retVal;
350    }
351
352
353    /**
354     * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
355     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
356     * it will return zero.
357     */
358    public int getAbnormalFlagsReps() {
359        return this.getReps(8);
360    }
361
362
363    /**
364     * Returns a specific repetition of
365     * OBX-8: "Abnormal Flags" - creates it if necessary
366     *
367     * @param rep The repetition index (0-indexed)
368     */
369    public ID getAbnormalFlags(int rep) { 
370                ID retVal = this.getTypedField(8, rep);
371                return retVal;
372    }
373
374    /**
375     * Returns a specific repetition of
376     * OBX-8: "Abnormal Flags" - creates it if necessary
377     *
378     * @param rep The repetition index (0-indexed)
379     */
380    public ID getObx8_AbnormalFlags(int rep) { 
381                ID retVal = this.getTypedField(8, rep);
382                return retVal;
383    }
384
385    /**
386     * Returns a count of the current number of repetitions of Abnormal Flags (OBX-8).
387     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
388     * it will return zero.
389     */
390    public int getObx8_AbnormalFlagsReps() {
391        return this.getReps(8);
392    }
393
394
395    /**
396     * Inserts a repetition of
397     * OBX-8: "Abnormal Flags" at a specific index
398     *
399     * @param rep The repetition index (0-indexed)
400     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
401     */
402    public ID insertAbnormalFlags(int rep) throws HL7Exception { 
403        return (ID) super.insertRepetition(8, rep);
404    }
405
406
407    /**
408     * Inserts a repetition of
409     * OBX-8: "Abnormal Flags" at a specific index
410     *
411     * @param rep The repetition index (0-indexed)
412     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
413     */
414    public ID insertObx8_AbnormalFlags(int rep) throws HL7Exception { 
415        return (ID) super.insertRepetition(8, rep);
416    }
417
418
419    /**
420     * Removes a repetition of
421     * OBX-8: "Abnormal Flags" at a specific index
422     *
423     * @param rep The repetition index (0-indexed)
424     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
425     */
426    public ID removeAbnormalFlags(int rep) throws HL7Exception { 
427        return (ID) super.removeRepetition(8, rep);
428    }
429
430
431    /**
432     * Removes a repetition of
433     * OBX-8: "Abnormal Flags" at a specific index
434     *
435     * @param rep The repetition index (0-indexed)
436     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
437     */
438    public ID removeObx8_AbnormalFlags(int rep) throws HL7Exception { 
439        return (ID) super.removeRepetition(8, rep);
440    }
441
442
443
444
445    /**
446     * Returns
447     * OBX-9: "Probability" - creates it if necessary
448     */
449    public NM getProbability() { 
450                NM retVal = this.getTypedField(9, 0);
451                return retVal;
452    }
453    
454    /**
455     * Returns
456     * OBX-9: "Probability" - creates it if necessary
457     */
458    public NM getObx9_Probability() { 
459                NM retVal = this.getTypedField(9, 0);
460                return retVal;
461    }
462
463
464
465    /**
466     * Returns
467     * OBX-10: "Nature of Abnormal Test" - creates it if necessary
468     */
469    public ID getNatureOfAbnormalTest() { 
470                ID retVal = this.getTypedField(10, 0);
471                return retVal;
472    }
473    
474    /**
475     * Returns
476     * OBX-10: "Nature of Abnormal Test" - creates it if necessary
477     */
478    public ID getObx10_NatureOfAbnormalTest() { 
479                ID retVal = this.getTypedField(10, 0);
480                return retVal;
481    }
482
483
484
485    /**
486     * Returns
487     * OBX-11: "Observ Result Status" - creates it if necessary
488     */
489    public ID getObservResultStatus() { 
490                ID retVal = this.getTypedField(11, 0);
491                return retVal;
492    }
493    
494    /**
495     * Returns
496     * OBX-11: "Observ Result Status" - creates it if necessary
497     */
498    public ID getObx11_ObservResultStatus() { 
499                ID retVal = this.getTypedField(11, 0);
500                return retVal;
501    }
502
503
504
505    /**
506     * Returns
507     * OBX-12: "Date Last Obs Normal Values" - creates it if necessary
508     */
509    public TS getDateLastObsNormalValues() { 
510                TS retVal = this.getTypedField(12, 0);
511                return retVal;
512    }
513    
514    /**
515     * Returns
516     * OBX-12: "Date Last Obs Normal Values" - creates it if necessary
517     */
518    public TS getObx12_DateLastObsNormalValues() { 
519                TS retVal = this.getTypedField(12, 0);
520                return retVal;
521    }
522
523
524
525    /**
526     * Returns
527     * OBX-13: "User Defined Access Checks" - creates it if necessary
528     */
529    public ST getUserDefinedAccessChecks() { 
530                ST retVal = this.getTypedField(13, 0);
531                return retVal;
532    }
533    
534    /**
535     * Returns
536     * OBX-13: "User Defined Access Checks" - creates it if necessary
537     */
538    public ST getObx13_UserDefinedAccessChecks() { 
539                ST retVal = this.getTypedField(13, 0);
540                return retVal;
541    }
542
543
544
545    /**
546     * Returns
547     * OBX-14: "Date/Time of the Observation" - creates it if necessary
548     */
549    public TS getDateTimeOfTheObservation() { 
550                TS retVal = this.getTypedField(14, 0);
551                return retVal;
552    }
553    
554    /**
555     * Returns
556     * OBX-14: "Date/Time of the Observation" - creates it if necessary
557     */
558    public TS getObx14_DateTimeOfTheObservation() { 
559                TS retVal = this.getTypedField(14, 0);
560                return retVal;
561    }
562
563
564
565    /**
566     * Returns
567     * OBX-15: "Producer's ID" - creates it if necessary
568     */
569    public CE getProducerSID() { 
570                CE retVal = this.getTypedField(15, 0);
571                return retVal;
572    }
573    
574    /**
575     * Returns
576     * OBX-15: "Producer's ID" - creates it if necessary
577     */
578    public CE getObx15_ProducerSID() { 
579                CE retVal = this.getTypedField(15, 0);
580                return retVal;
581    }
582
583
584
585    /**
586     * Returns
587     * OBX-16: "Responsible Observer" - creates it if necessary
588     */
589    public XCN getResponsibleObserver() { 
590                XCN retVal = this.getTypedField(16, 0);
591                return retVal;
592    }
593    
594    /**
595     * Returns
596     * OBX-16: "Responsible Observer" - creates it if necessary
597     */
598    public XCN getObx16_ResponsibleObserver() { 
599                XCN retVal = this.getTypedField(16, 0);
600                return retVal;
601    }
602
603
604    /**
605     * Returns all repetitions of Observation Method (OBX-17).
606     */
607    public CE[] getObservationMethod() {
608        CE[] retVal = this.getTypedField(17, new CE[0]);
609        return retVal;
610    }
611
612
613    /**
614     * Returns all repetitions of Observation Method (OBX-17).
615     */
616    public CE[] getObx17_ObservationMethod() {
617        CE[] retVal = this.getTypedField(17, new CE[0]);
618        return retVal;
619    }
620
621
622    /**
623     * Returns a count of the current number of repetitions of Observation Method (OBX-17).
624     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
625     * it will return zero.
626     */
627    public int getObservationMethodReps() {
628        return this.getReps(17);
629    }
630
631
632    /**
633     * Returns a specific repetition of
634     * OBX-17: "Observation Method" - creates it if necessary
635     *
636     * @param rep The repetition index (0-indexed)
637     */
638    public CE getObservationMethod(int rep) { 
639                CE retVal = this.getTypedField(17, rep);
640                return retVal;
641    }
642
643    /**
644     * Returns a specific repetition of
645     * OBX-17: "Observation Method" - creates it if necessary
646     *
647     * @param rep The repetition index (0-indexed)
648     */
649    public CE getObx17_ObservationMethod(int rep) { 
650                CE retVal = this.getTypedField(17, rep);
651                return retVal;
652    }
653
654    /**
655     * Returns a count of the current number of repetitions of Observation Method (OBX-17).
656     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
657     * it will return zero.
658     */
659    public int getObx17_ObservationMethodReps() {
660        return this.getReps(17);
661    }
662
663
664    /**
665     * Inserts a repetition of
666     * OBX-17: "Observation Method" at a specific index
667     *
668     * @param rep The repetition index (0-indexed)
669     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
670     */
671    public CE insertObservationMethod(int rep) throws HL7Exception { 
672        return (CE) super.insertRepetition(17, rep);
673    }
674
675
676    /**
677     * Inserts a repetition of
678     * OBX-17: "Observation Method" at a specific index
679     *
680     * @param rep The repetition index (0-indexed)
681     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
682     */
683    public CE insertObx17_ObservationMethod(int rep) throws HL7Exception { 
684        return (CE) super.insertRepetition(17, rep);
685    }
686
687
688    /**
689     * Removes a repetition of
690     * OBX-17: "Observation Method" at a specific index
691     *
692     * @param rep The repetition index (0-indexed)
693     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
694     */
695    public CE removeObservationMethod(int rep) throws HL7Exception { 
696        return (CE) super.removeRepetition(17, rep);
697    }
698
699
700    /**
701     * Removes a repetition of
702     * OBX-17: "Observation Method" at a specific index
703     *
704     * @param rep The repetition index (0-indexed)
705     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
706     */
707    public CE removeObx17_ObservationMethod(int rep) throws HL7Exception { 
708        return (CE) super.removeRepetition(17, rep);
709    }
710
711
712
713
714
715
716    /** {@inheritDoc} */   
717    protected Type createNewTypeWithoutReflection(int field) {
718       switch (field) {
719          case 0: return new SI(getMessage());
720          case 1: return new ID(getMessage(), new Integer( 125 ));
721          case 2: return new CE(getMessage());
722          case 3: return new ST(getMessage());
723          case 4: return new Varies(getMessage());
724          case 5: return new CE(getMessage());
725          case 6: return new ST(getMessage());
726          case 7: return new ID(getMessage(), new Integer( 78 ));
727          case 8: return new NM(getMessage());
728          case 9: return new ID(getMessage(), new Integer( 80 ));
729          case 10: return new ID(getMessage(), new Integer( 85 ));
730          case 11: return new TS(getMessage());
731          case 12: return new ST(getMessage());
732          case 13: return new TS(getMessage());
733          case 14: return new CE(getMessage());
734          case 15: return new XCN(getMessage());
735          case 16: return new CE(getMessage());
736          default: return null;
737       }
738   }
739
740
741}
742