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