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 RXD message segment (PHARMACY DISPENSE). 
50   * This segment has the following fields:</p>
51   * <ul>
52       * <li>RXD-1: Dispense Sub-ID Counter (NM) <b>optional </b>
53       * <li>RXD-2: Dispense / give code (CE) <b> </b>
54       * <li>RXD-3: Date / time dispensed (TS) <b>optional </b>
55       * <li>RXD-4: Actual Dispense Amount (NM) <b> </b>
56       * <li>RXD-5: Actual Dispense Units (CE) <b>optional </b>
57       * <li>RXD-6: Actual Dosage Form (CE) <b>optional </b>
58       * <li>RXD-7: Prescription Number (ST) <b> </b>
59       * <li>RXD-8: Number of Refills Remaining (NM) <b>optional </b>
60       * <li>RXD-9: Dispense Notes (ST) <b>optional repeating</b>
61       * <li>RXD-10: Dispensing Provider (CN) <b>optional </b>
62       * <li>RXD-11: Substitution Status (ID) <b>optional </b>
63       * <li>RXD-12: Total Daily Dose (CQ_QUANTITY) <b>optional </b>
64       * <li>RXD-13: Deliver-to location (CM_LA1) <b>optional </b>
65       * <li>RXD-14: Needs Human Review (ID) <b>optional </b>
66       * <li>RXD-15: Pharmacy Special Dispensing Instructions (CE) <b>optional </b>
67   * </ul>
68   */
69  @SuppressWarnings("unused")
70  public class RXD extends AbstractSegment {
71  
72      /** 
73       * Creates a new RXD segment
74       */
75      public RXD(Group parent, ModelClassFactory factory) {
76         super(parent, factory);
77         init(factory);
78      }
79  
80      private void init(ModelClassFactory factory) {
81         try {
82                                    this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Dispense Sub-ID Counter");
83                                    this.add(CE.class, true, 1, 100, new Object[]{ getMessage() }, "Dispense / give code");
84                                    this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Date / time dispensed");
85                                    this.add(NM.class, true, 1, 20, new Object[]{ getMessage() }, "Actual Dispense Amount");
86                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Actual Dispense Units");
87                                    this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Actual Dosage Form");
88                                    this.add(ST.class, true, 1, 20, new Object[]{ getMessage() }, "Prescription Number");
89                                    this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Number of Refills Remaining");
90                                    this.add(ST.class, false, 0, 200, new Object[]{ getMessage() }, "Dispense Notes");
91                                    this.add(CN.class, false, 1, 200, new Object[]{ getMessage() }, "Dispensing Provider");
92                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(167) }, "Substitution Status");
93                                    this.add(CQ_QUANTITY.class, false, 1, 10, new Object[]{ getMessage() }, "Total Daily Dose");
94                                    this.add(CM_LA1.class, false, 1, 12, new Object[]{ getMessage() }, "Deliver-to location");
95                                                this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(0) }, "Needs Human Review");
96                                    this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Pharmacy Special Dispensing Instructions");
97         } catch(HL7Exception e) {
98            log.error("Unexpected error creating RXD - this is probably a bug in the source code generator.", e);
99         }
100     }
101 
102 
103 
104     /**
105      * Returns
106      * RXD-1: "Dispense Sub-ID Counter" - creates it if necessary
107      */
108     public NM getDispenseSubIDCounter() { 
109 		NM retVal = this.getTypedField(1, 0);
110 		return retVal;
111     }
112     
113     /**
114      * Returns
115      * RXD-1: "Dispense Sub-ID Counter" - creates it if necessary
116      */
117     public NM getRxd1_DispenseSubIDCounter() { 
118 		NM retVal = this.getTypedField(1, 0);
119 		return retVal;
120     }
121 
122 
123 
124     /**
125      * Returns
126      * RXD-2: "Dispense / give code" - creates it if necessary
127      */
128     public CE getDispenseGiveCode() { 
129 		CE retVal = this.getTypedField(2, 0);
130 		return retVal;
131     }
132     
133     /**
134      * Returns
135      * RXD-2: "Dispense / give code" - creates it if necessary
136      */
137     public CE getRxd2_DispenseGiveCode() { 
138 		CE retVal = this.getTypedField(2, 0);
139 		return retVal;
140     }
141 
142 
143 
144     /**
145      * Returns
146      * RXD-3: "Date / time dispensed" - creates it if necessary
147      */
148     public TS getDateTimeDispensed() { 
149 		TS retVal = this.getTypedField(3, 0);
150 		return retVal;
151     }
152     
153     /**
154      * Returns
155      * RXD-3: "Date / time dispensed" - creates it if necessary
156      */
157     public TS getRxd3_DateTimeDispensed() { 
158 		TS retVal = this.getTypedField(3, 0);
159 		return retVal;
160     }
161 
162 
163 
164     /**
165      * Returns
166      * RXD-4: "Actual Dispense Amount" - creates it if necessary
167      */
168     public NM getActualDispenseAmount() { 
169 		NM retVal = this.getTypedField(4, 0);
170 		return retVal;
171     }
172     
173     /**
174      * Returns
175      * RXD-4: "Actual Dispense Amount" - creates it if necessary
176      */
177     public NM getRxd4_ActualDispenseAmount() { 
178 		NM retVal = this.getTypedField(4, 0);
179 		return retVal;
180     }
181 
182 
183 
184     /**
185      * Returns
186      * RXD-5: "Actual Dispense Units" - creates it if necessary
187      */
188     public CE getActualDispenseUnits() { 
189 		CE retVal = this.getTypedField(5, 0);
190 		return retVal;
191     }
192     
193     /**
194      * Returns
195      * RXD-5: "Actual Dispense Units" - creates it if necessary
196      */
197     public CE getRxd5_ActualDispenseUnits() { 
198 		CE retVal = this.getTypedField(5, 0);
199 		return retVal;
200     }
201 
202 
203 
204     /**
205      * Returns
206      * RXD-6: "Actual Dosage Form" - creates it if necessary
207      */
208     public CE getActualDosageForm() { 
209 		CE retVal = this.getTypedField(6, 0);
210 		return retVal;
211     }
212     
213     /**
214      * Returns
215      * RXD-6: "Actual Dosage Form" - creates it if necessary
216      */
217     public CE getRxd6_ActualDosageForm() { 
218 		CE retVal = this.getTypedField(6, 0);
219 		return retVal;
220     }
221 
222 
223 
224     /**
225      * Returns
226      * RXD-7: "Prescription Number" - creates it if necessary
227      */
228     public ST getPrescriptionNumber() { 
229 		ST retVal = this.getTypedField(7, 0);
230 		return retVal;
231     }
232     
233     /**
234      * Returns
235      * RXD-7: "Prescription Number" - creates it if necessary
236      */
237     public ST getRxd7_PrescriptionNumber() { 
238 		ST retVal = this.getTypedField(7, 0);
239 		return retVal;
240     }
241 
242 
243 
244     /**
245      * Returns
246      * RXD-8: "Number of Refills Remaining" - creates it if necessary
247      */
248     public NM getNumberOfRefillsRemaining() { 
249 		NM retVal = this.getTypedField(8, 0);
250 		return retVal;
251     }
252     
253     /**
254      * Returns
255      * RXD-8: "Number of Refills Remaining" - creates it if necessary
256      */
257     public NM getRxd8_NumberOfRefillsRemaining() { 
258 		NM retVal = this.getTypedField(8, 0);
259 		return retVal;
260     }
261 
262 
263     /**
264      * Returns all repetitions of Dispense Notes (RXD-9).
265      */
266     public ST[] getDispenseNotes() {
267     	ST[] retVal = this.getTypedField(9, new ST[0]);
268     	return retVal;
269     }
270 
271 
272     /**
273      * Returns all repetitions of Dispense Notes (RXD-9).
274      */
275     public ST[] getRxd9_DispenseNotes() {
276     	ST[] retVal = this.getTypedField(9, new ST[0]);
277     	return retVal;
278     }
279 
280 
281     /**
282      * Returns a count of the current number of repetitions of Dispense Notes (RXD-9).
283      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
284      * it will return zero.
285      */
286     public int getDispenseNotesReps() {
287     	return this.getReps(9);
288     }
289 
290 
291     /**
292      * Returns a specific repetition of
293      * RXD-9: "Dispense Notes" - creates it if necessary
294      *
295      * @param rep The repetition index (0-indexed)
296      */
297     public ST getDispenseNotes(int rep) { 
298 		ST retVal = this.getTypedField(9, rep);
299 		return retVal;
300     }
301 
302     /**
303      * Returns a specific repetition of
304      * RXD-9: "Dispense Notes" - creates it if necessary
305      *
306      * @param rep The repetition index (0-indexed)
307      */
308     public ST getRxd9_DispenseNotes(int rep) { 
309 		ST retVal = this.getTypedField(9, rep);
310 		return retVal;
311     }
312 
313     /**
314      * Returns a count of the current number of repetitions of Dispense Notes (RXD-9).
315      * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
316      * it will return zero.
317      */
318     public int getRxd9_DispenseNotesReps() {
319     	return this.getReps(9);
320     }
321 
322 
323     /**
324      * Inserts a repetition of
325      * RXD-9: "Dispense Notes" at a specific index
326      *
327      * @param rep The repetition index (0-indexed)
328      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
329      */
330     public ST insertDispenseNotes(int rep) throws HL7Exception { 
331         return (ST) super.insertRepetition(9, rep);
332     }
333 
334 
335     /**
336      * Inserts a repetition of
337      * RXD-9: "Dispense Notes" at a specific index
338      *
339      * @param rep The repetition index (0-indexed)
340      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
341      */
342     public ST insertRxd9_DispenseNotes(int rep) throws HL7Exception { 
343         return (ST) super.insertRepetition(9, rep);
344     }
345 
346 
347     /**
348      * Removes a repetition of
349      * RXD-9: "Dispense Notes" at a specific index
350      *
351      * @param rep The repetition index (0-indexed)
352      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
353      */
354     public ST removeDispenseNotes(int rep) throws HL7Exception { 
355         return (ST) super.removeRepetition(9, rep);
356     }
357 
358 
359     /**
360      * Removes a repetition of
361      * RXD-9: "Dispense Notes" at a specific index
362      *
363      * @param rep The repetition index (0-indexed)
364      * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
365      */
366     public ST removeRxd9_DispenseNotes(int rep) throws HL7Exception { 
367         return (ST) super.removeRepetition(9, rep);
368     }
369 
370 
371 
372 
373     /**
374      * Returns
375      * RXD-10: "Dispensing Provider" - creates it if necessary
376      */
377     public CN getDispensingProvider() { 
378 		CN retVal = this.getTypedField(10, 0);
379 		return retVal;
380     }
381     
382     /**
383      * Returns
384      * RXD-10: "Dispensing Provider" - creates it if necessary
385      */
386     public CN getRxd10_DispensingProvider() { 
387 		CN retVal = this.getTypedField(10, 0);
388 		return retVal;
389     }
390 
391 
392 
393     /**
394      * Returns
395      * RXD-11: "Substitution Status" - creates it if necessary
396      */
397     public ID getSubstitutionStatus() { 
398 		ID retVal = this.getTypedField(11, 0);
399 		return retVal;
400     }
401     
402     /**
403      * Returns
404      * RXD-11: "Substitution Status" - creates it if necessary
405      */
406     public ID getRxd11_SubstitutionStatus() { 
407 		ID retVal = this.getTypedField(11, 0);
408 		return retVal;
409     }
410 
411 
412 
413     /**
414      * Returns
415      * RXD-12: "Total Daily Dose" - creates it if necessary
416      */
417     public CQ_QUANTITY getTotalDailyDose() { 
418 		CQ_QUANTITY retVal = this.getTypedField(12, 0);
419 		return retVal;
420     }
421     
422     /**
423      * Returns
424      * RXD-12: "Total Daily Dose" - creates it if necessary
425      */
426     public CQ_QUANTITY getRxd12_TotalDailyDose() { 
427 		CQ_QUANTITY retVal = this.getTypedField(12, 0);
428 		return retVal;
429     }
430 
431 
432 
433     /**
434      * Returns
435      * RXD-13: "Deliver-to location" - creates it if necessary
436      */
437     public CM_LA1 getDeliverToLocation() { 
438 		CM_LA1 retVal = this.getTypedField(13, 0);
439 		return retVal;
440     }
441     
442     /**
443      * Returns
444      * RXD-13: "Deliver-to location" - creates it if necessary
445      */
446     public CM_LA1 getRxd13_DeliverToLocation() { 
447 		CM_LA1 retVal = this.getTypedField(13, 0);
448 		return retVal;
449     }
450 
451 
452 
453     /**
454      * Returns
455      * RXD-14: "Needs Human Review" - creates it if necessary
456      */
457     public ID getNeedsHumanReview() { 
458 		ID retVal = this.getTypedField(14, 0);
459 		return retVal;
460     }
461     
462     /**
463      * Returns
464      * RXD-14: "Needs Human Review" - creates it if necessary
465      */
466     public ID getRxd14_NeedsHumanReview() { 
467 		ID retVal = this.getTypedField(14, 0);
468 		return retVal;
469     }
470 
471 
472 
473     /**
474      * Returns
475      * RXD-15: "Pharmacy Special Dispensing Instructions" - creates it if necessary
476      */
477     public CE getPharmacySpecialDispensingInstructions() { 
478 		CE retVal = this.getTypedField(15, 0);
479 		return retVal;
480     }
481     
482     /**
483      * Returns
484      * RXD-15: "Pharmacy Special Dispensing Instructions" - creates it if necessary
485      */
486     public CE getRxd15_PharmacySpecialDispensingInstructions() { 
487 		CE retVal = this.getTypedField(15, 0);
488 		return retVal;
489     }
490 
491 
492 
493 
494 
495     /** {@inheritDoc} */   
496     protected Type createNewTypeWithoutReflection(int field) {
497        switch (field) {
498           case 0: return new NM(getMessage());
499           case 1: return new CE(getMessage());
500           case 2: return new TS(getMessage());
501           case 3: return new NM(getMessage());
502           case 4: return new CE(getMessage());
503           case 5: return new CE(getMessage());
504           case 6: return new ST(getMessage());
505           case 7: return new NM(getMessage());
506           case 8: return new ST(getMessage());
507           case 9: return new CN(getMessage());
508           case 10: return new ID(getMessage(), new Integer( 167 ));
509           case 11: return new CQ_QUANTITY(getMessage());
510           case 12: return new CM_LA1(getMessage());
511           case 13: return new ID(getMessage(), new Integer( 0 ));
512           case 14: return new CE(getMessage());
513           default: return null;
514        }
515    }
516 
517 
518 }
519