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 *<p>Represents an HL7 RXG message segment (PHARMACY GIVE). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>RXG-1: Give Sub-ID Counter (NM) <b> </b>
052     * <li>RXG-2: Dispense Sub-ID Counter (NM) <b>optional </b>
053     * <li>RXG-3: Quantity / timing (TQ) <b>optional repeating</b>
054     * <li>RXG-4: Give Code (CE) <b> </b>
055     * <li>RXG-5: Give Amount - Minimum (NM) <b> </b>
056     * <li>RXG-6: Give Amount - Maximum (NM) <b>optional </b>
057     * <li>RXG-7: Give Units (CE) <b> </b>
058     * <li>RXG-8: Give Dosage Form (CE) <b>optional </b>
059     * <li>RXG-9: Administration Notes (ST) <b>optional </b>
060     * <li>RXG-10: Substitution Status (ID) <b>optional </b>
061     * <li>RXG-11: Deliver-to location (CM_LA1) <b>optional </b>
062     * <li>RXG-12: Needs Human Review (ID) <b>optional </b>
063     * <li>RXG-13: Pharmacy Special Administration Instructions (CE) <b>optional repeating</b>
064     * <li>RXG-14: Give Per (Time Unit) (ST) <b>optional </b>
065     * <li>RXG-15: Give Rate Amount (CE) <b>optional </b>
066     * <li>RXG-16: Give Rate Units (CE) <b>optional </b>
067 * </ul>
068 */
069@SuppressWarnings("unused")
070public class RXG extends AbstractSegment {
071
072    /** 
073     * Creates a new RXG segment
074     */
075    public RXG(Group parent, ModelClassFactory factory) {
076       super(parent, factory);
077       init(factory);
078    }
079
080    private void init(ModelClassFactory factory) {
081       try {
082                                  this.add(NM.class, true, 1, 4, new Object[]{ getMessage() }, "Give Sub-ID Counter");
083                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Dispense Sub-ID Counter");
084                                  this.add(TQ.class, false, 0, 200, new Object[]{ getMessage() }, "Quantity / timing");
085                                  this.add(CE.class, true, 1, 100, new Object[]{ getMessage() }, "Give Code");
086                                  this.add(NM.class, true, 1, 20, new Object[]{ getMessage() }, "Give Amount - Minimum");
087                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Give Amount - Maximum");
088                                  this.add(CE.class, true, 1, 60, new Object[]{ getMessage() }, "Give Units");
089                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Give Dosage Form");
090                                  this.add(ST.class, false, 1, 200, new Object[]{ getMessage() }, "Administration Notes");
091                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(167) }, "Substitution Status");
092                                  this.add(CM_LA1.class, false, 1, 12, new Object[]{ getMessage() }, "Deliver-to location");
093                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(0) }, "Needs Human Review");
094                                  this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Pharmacy Special Administration Instructions");
095                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Give Per (Time Unit)");
096                                  this.add(CE.class, false, 1, 6, new Object[]{ getMessage() }, "Give Rate Amount");
097                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Give Rate Units");
098       } catch(HL7Exception e) {
099          log.error("Unexpected error creating RXG - this is probably a bug in the source code generator.", e);
100       }
101    }
102
103
104
105    /**
106     * Returns
107     * RXG-1: "Give Sub-ID Counter" - creates it if necessary
108     */
109    public NM getGiveSubIDCounter() { 
110                NM retVal = this.getTypedField(1, 0);
111                return retVal;
112    }
113    
114    /**
115     * Returns
116     * RXG-1: "Give Sub-ID Counter" - creates it if necessary
117     */
118    public NM getRxg1_GiveSubIDCounter() { 
119                NM retVal = this.getTypedField(1, 0);
120                return retVal;
121    }
122
123
124
125    /**
126     * Returns
127     * RXG-2: "Dispense Sub-ID Counter" - creates it if necessary
128     */
129    public NM getDispenseSubIDCounter() { 
130                NM retVal = this.getTypedField(2, 0);
131                return retVal;
132    }
133    
134    /**
135     * Returns
136     * RXG-2: "Dispense Sub-ID Counter" - creates it if necessary
137     */
138    public NM getRxg2_DispenseSubIDCounter() { 
139                NM retVal = this.getTypedField(2, 0);
140                return retVal;
141    }
142
143
144    /**
145     * Returns all repetitions of Quantity / timing (RXG-3).
146     */
147    public TQ[] getQuantityTiming() {
148        TQ[] retVal = this.getTypedField(3, new TQ[0]);
149        return retVal;
150    }
151
152
153    /**
154     * Returns all repetitions of Quantity / timing (RXG-3).
155     */
156    public TQ[] getRxg3_QuantityTiming() {
157        TQ[] retVal = this.getTypedField(3, new TQ[0]);
158        return retVal;
159    }
160
161
162    /**
163     * Returns a count of the current number of repetitions of Quantity / timing (RXG-3).
164     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
165     * it will return zero.
166     */
167    public int getQuantityTimingReps() {
168        return this.getReps(3);
169    }
170
171
172    /**
173     * Returns a specific repetition of
174     * RXG-3: "Quantity / timing" - creates it if necessary
175     *
176     * @param rep The repetition index (0-indexed)
177     */
178    public TQ getQuantityTiming(int rep) { 
179                TQ retVal = this.getTypedField(3, rep);
180                return retVal;
181    }
182
183    /**
184     * Returns a specific repetition of
185     * RXG-3: "Quantity / timing" - creates it if necessary
186     *
187     * @param rep The repetition index (0-indexed)
188     */
189    public TQ getRxg3_QuantityTiming(int rep) { 
190                TQ retVal = this.getTypedField(3, rep);
191                return retVal;
192    }
193
194    /**
195     * Returns a count of the current number of repetitions of Quantity / timing (RXG-3).
196     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
197     * it will return zero.
198     */
199    public int getRxg3_QuantityTimingReps() {
200        return this.getReps(3);
201    }
202
203
204    /**
205     * Inserts a repetition of
206     * RXG-3: "Quantity / timing" at a specific index
207     *
208     * @param rep The repetition index (0-indexed)
209     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
210     */
211    public TQ insertQuantityTiming(int rep) throws HL7Exception { 
212        return (TQ) super.insertRepetition(3, rep);
213    }
214
215
216    /**
217     * Inserts a repetition of
218     * RXG-3: "Quantity / timing" at a specific index
219     *
220     * @param rep The repetition index (0-indexed)
221     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
222     */
223    public TQ insertRxg3_QuantityTiming(int rep) throws HL7Exception { 
224        return (TQ) super.insertRepetition(3, rep);
225    }
226
227
228    /**
229     * Removes a repetition of
230     * RXG-3: "Quantity / timing" at a specific index
231     *
232     * @param rep The repetition index (0-indexed)
233     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
234     */
235    public TQ removeQuantityTiming(int rep) throws HL7Exception { 
236        return (TQ) super.removeRepetition(3, rep);
237    }
238
239
240    /**
241     * Removes a repetition of
242     * RXG-3: "Quantity / timing" at a specific index
243     *
244     * @param rep The repetition index (0-indexed)
245     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
246     */
247    public TQ removeRxg3_QuantityTiming(int rep) throws HL7Exception { 
248        return (TQ) super.removeRepetition(3, rep);
249    }
250
251
252
253
254    /**
255     * Returns
256     * RXG-4: "Give Code" - creates it if necessary
257     */
258    public CE getGiveCode() { 
259                CE retVal = this.getTypedField(4, 0);
260                return retVal;
261    }
262    
263    /**
264     * Returns
265     * RXG-4: "Give Code" - creates it if necessary
266     */
267    public CE getRxg4_GiveCode() { 
268                CE retVal = this.getTypedField(4, 0);
269                return retVal;
270    }
271
272
273
274    /**
275     * Returns
276     * RXG-5: "Give Amount - Minimum" - creates it if necessary
277     */
278    public NM getGiveAmountMinimum() { 
279                NM retVal = this.getTypedField(5, 0);
280                return retVal;
281    }
282    
283    /**
284     * Returns
285     * RXG-5: "Give Amount - Minimum" - creates it if necessary
286     */
287    public NM getRxg5_GiveAmountMinimum() { 
288                NM retVal = this.getTypedField(5, 0);
289                return retVal;
290    }
291
292
293
294    /**
295     * Returns
296     * RXG-6: "Give Amount - Maximum" - creates it if necessary
297     */
298    public NM getGiveAmountMaximum() { 
299                NM retVal = this.getTypedField(6, 0);
300                return retVal;
301    }
302    
303    /**
304     * Returns
305     * RXG-6: "Give Amount - Maximum" - creates it if necessary
306     */
307    public NM getRxg6_GiveAmountMaximum() { 
308                NM retVal = this.getTypedField(6, 0);
309                return retVal;
310    }
311
312
313
314    /**
315     * Returns
316     * RXG-7: "Give Units" - creates it if necessary
317     */
318    public CE getGiveUnits() { 
319                CE retVal = this.getTypedField(7, 0);
320                return retVal;
321    }
322    
323    /**
324     * Returns
325     * RXG-7: "Give Units" - creates it if necessary
326     */
327    public CE getRxg7_GiveUnits() { 
328                CE retVal = this.getTypedField(7, 0);
329                return retVal;
330    }
331
332
333
334    /**
335     * Returns
336     * RXG-8: "Give Dosage Form" - creates it if necessary
337     */
338    public CE getGiveDosageForm() { 
339                CE retVal = this.getTypedField(8, 0);
340                return retVal;
341    }
342    
343    /**
344     * Returns
345     * RXG-8: "Give Dosage Form" - creates it if necessary
346     */
347    public CE getRxg8_GiveDosageForm() { 
348                CE retVal = this.getTypedField(8, 0);
349                return retVal;
350    }
351
352
353
354    /**
355     * Returns
356     * RXG-9: "Administration Notes" - creates it if necessary
357     */
358    public ST getAdministrationNotes() { 
359                ST retVal = this.getTypedField(9, 0);
360                return retVal;
361    }
362    
363    /**
364     * Returns
365     * RXG-9: "Administration Notes" - creates it if necessary
366     */
367    public ST getRxg9_AdministrationNotes() { 
368                ST retVal = this.getTypedField(9, 0);
369                return retVal;
370    }
371
372
373
374    /**
375     * Returns
376     * RXG-10: "Substitution Status" - creates it if necessary
377     */
378    public ID getSubstitutionStatus() { 
379                ID retVal = this.getTypedField(10, 0);
380                return retVal;
381    }
382    
383    /**
384     * Returns
385     * RXG-10: "Substitution Status" - creates it if necessary
386     */
387    public ID getRxg10_SubstitutionStatus() { 
388                ID retVal = this.getTypedField(10, 0);
389                return retVal;
390    }
391
392
393
394    /**
395     * Returns
396     * RXG-11: "Deliver-to location" - creates it if necessary
397     */
398    public CM_LA1 getDeliverToLocation() { 
399                CM_LA1 retVal = this.getTypedField(11, 0);
400                return retVal;
401    }
402    
403    /**
404     * Returns
405     * RXG-11: "Deliver-to location" - creates it if necessary
406     */
407    public CM_LA1 getRxg11_DeliverToLocation() { 
408                CM_LA1 retVal = this.getTypedField(11, 0);
409                return retVal;
410    }
411
412
413
414    /**
415     * Returns
416     * RXG-12: "Needs Human Review" - creates it if necessary
417     */
418    public ID getNeedsHumanReview() { 
419                ID retVal = this.getTypedField(12, 0);
420                return retVal;
421    }
422    
423    /**
424     * Returns
425     * RXG-12: "Needs Human Review" - creates it if necessary
426     */
427    public ID getRxg12_NeedsHumanReview() { 
428                ID retVal = this.getTypedField(12, 0);
429                return retVal;
430    }
431
432
433    /**
434     * Returns all repetitions of Pharmacy Special Administration Instructions (RXG-13).
435     */
436    public CE[] getPharmacySpecialAdministrationInstructions() {
437        CE[] retVal = this.getTypedField(13, new CE[0]);
438        return retVal;
439    }
440
441
442    /**
443     * Returns all repetitions of Pharmacy Special Administration Instructions (RXG-13).
444     */
445    public CE[] getRxg13_PharmacySpecialAdministrationInstructions() {
446        CE[] retVal = this.getTypedField(13, new CE[0]);
447        return retVal;
448    }
449
450
451    /**
452     * Returns a count of the current number of repetitions of Pharmacy Special Administration Instructions (RXG-13).
453     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
454     * it will return zero.
455     */
456    public int getPharmacySpecialAdministrationInstructionsReps() {
457        return this.getReps(13);
458    }
459
460
461    /**
462     * Returns a specific repetition of
463     * RXG-13: "Pharmacy Special Administration Instructions" - creates it if necessary
464     *
465     * @param rep The repetition index (0-indexed)
466     */
467    public CE getPharmacySpecialAdministrationInstructions(int rep) { 
468                CE retVal = this.getTypedField(13, rep);
469                return retVal;
470    }
471
472    /**
473     * Returns a specific repetition of
474     * RXG-13: "Pharmacy Special Administration Instructions" - creates it if necessary
475     *
476     * @param rep The repetition index (0-indexed)
477     */
478    public CE getRxg13_PharmacySpecialAdministrationInstructions(int rep) { 
479                CE retVal = this.getTypedField(13, rep);
480                return retVal;
481    }
482
483    /**
484     * Returns a count of the current number of repetitions of Pharmacy Special Administration Instructions (RXG-13).
485     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
486     * it will return zero.
487     */
488    public int getRxg13_PharmacySpecialAdministrationInstructionsReps() {
489        return this.getReps(13);
490    }
491
492
493    /**
494     * Inserts a repetition of
495     * RXG-13: "Pharmacy Special Administration Instructions" at a specific index
496     *
497     * @param rep The repetition index (0-indexed)
498     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
499     */
500    public CE insertPharmacySpecialAdministrationInstructions(int rep) throws HL7Exception { 
501        return (CE) super.insertRepetition(13, rep);
502    }
503
504
505    /**
506     * Inserts a repetition of
507     * RXG-13: "Pharmacy Special Administration Instructions" at a specific index
508     *
509     * @param rep The repetition index (0-indexed)
510     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
511     */
512    public CE insertRxg13_PharmacySpecialAdministrationInstructions(int rep) throws HL7Exception { 
513        return (CE) super.insertRepetition(13, rep);
514    }
515
516
517    /**
518     * Removes a repetition of
519     * RXG-13: "Pharmacy Special Administration Instructions" at a specific index
520     *
521     * @param rep The repetition index (0-indexed)
522     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
523     */
524    public CE removePharmacySpecialAdministrationInstructions(int rep) throws HL7Exception { 
525        return (CE) super.removeRepetition(13, rep);
526    }
527
528
529    /**
530     * Removes a repetition of
531     * RXG-13: "Pharmacy Special Administration Instructions" at a specific index
532     *
533     * @param rep The repetition index (0-indexed)
534     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
535     */
536    public CE removeRxg13_PharmacySpecialAdministrationInstructions(int rep) throws HL7Exception { 
537        return (CE) super.removeRepetition(13, rep);
538    }
539
540
541
542
543    /**
544     * Returns
545     * RXG-14: "Give Per (Time Unit)" - creates it if necessary
546     */
547    public ST getGivePerTimeUnit() { 
548                ST retVal = this.getTypedField(14, 0);
549                return retVal;
550    }
551    
552    /**
553     * Returns
554     * RXG-14: "Give Per (Time Unit)" - creates it if necessary
555     */
556    public ST getRxg14_GivePerTimeUnit() { 
557                ST retVal = this.getTypedField(14, 0);
558                return retVal;
559    }
560
561
562
563    /**
564     * Returns
565     * RXG-15: "Give Rate Amount" - creates it if necessary
566     */
567    public CE getGiveRateAmount() { 
568                CE retVal = this.getTypedField(15, 0);
569                return retVal;
570    }
571    
572    /**
573     * Returns
574     * RXG-15: "Give Rate Amount" - creates it if necessary
575     */
576    public CE getRxg15_GiveRateAmount() { 
577                CE retVal = this.getTypedField(15, 0);
578                return retVal;
579    }
580
581
582
583    /**
584     * Returns
585     * RXG-16: "Give Rate Units" - creates it if necessary
586     */
587    public CE getGiveRateUnits() { 
588                CE retVal = this.getTypedField(16, 0);
589                return retVal;
590    }
591    
592    /**
593     * Returns
594     * RXG-16: "Give Rate Units" - creates it if necessary
595     */
596    public CE getRxg16_GiveRateUnits() { 
597                CE retVal = this.getTypedField(16, 0);
598                return retVal;
599    }
600
601
602
603
604
605    /** {@inheritDoc} */   
606    protected Type createNewTypeWithoutReflection(int field) {
607       switch (field) {
608          case 0: return new NM(getMessage());
609          case 1: return new NM(getMessage());
610          case 2: return new TQ(getMessage());
611          case 3: return new CE(getMessage());
612          case 4: return new NM(getMessage());
613          case 5: return new NM(getMessage());
614          case 6: return new CE(getMessage());
615          case 7: return new CE(getMessage());
616          case 8: return new ST(getMessage());
617          case 9: return new ID(getMessage(), new Integer( 167 ));
618          case 10: return new CM_LA1(getMessage());
619          case 11: return new ID(getMessage(), new Integer( 0 ));
620          case 12: return new CE(getMessage());
621          case 13: return new ST(getMessage());
622          case 14: return new CE(getMessage());
623          case 15: return new CE(getMessage());
624          default: return null;
625       }
626   }
627
628
629}
630