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.v251.segment;
035
036// import ca.uhn.hl7v2.model.v251.group.*;
037import ca.uhn.hl7v2.model.v251.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 GP2 message segment (Grouping/Reimbursement - Procedure Line Item). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>GP2-1: Revenue Code (IS) <b>optional </b>
052     * <li>GP2-2: Number of Service Units (NM) <b>optional </b>
053     * <li>GP2-3: Charge (CP) <b>optional </b>
054     * <li>GP2-4: Reimbursement Action Code (IS) <b>optional </b>
055     * <li>GP2-5: Denial or Rejection Code (IS) <b>optional </b>
056     * <li>GP2-6: OCE Edit Code (IS) <b>optional repeating</b>
057     * <li>GP2-7: Ambulatory Payment Classification Code (CE) <b>optional </b>
058     * <li>GP2-8: Modifier Edit Code (IS) <b>optional repeating</b>
059     * <li>GP2-9: Payment Adjustment Code (IS) <b>optional </b>
060     * <li>GP2-10: Packaging Status Code (IS) <b>optional </b>
061     * <li>GP2-11: Expected CMS Payment Amount (CP) <b>optional </b>
062     * <li>GP2-12: Reimbursement Type Code (IS) <b>optional </b>
063     * <li>GP2-13: Co-Pay Amount (CP) <b>optional </b>
064     * <li>GP2-14: Pay Rate per Service Unit (NM) <b>optional </b>
065 * </ul>
066 */
067@SuppressWarnings("unused")
068public class GP2 extends AbstractSegment {
069
070    /** 
071     * Creates a new GP2 segment
072     */
073    public GP2(Group parent, ModelClassFactory factory) {
074       super(parent, factory);
075       init(factory);
076    }
077
078    private void init(ModelClassFactory factory) {
079       try {
080                                              this.add(IS.class, false, 1, 3, new Object[]{ getMessage(), new Integer(456) }, "Revenue Code");
081                                  this.add(NM.class, false, 1, 7, new Object[]{ getMessage() }, "Number of Service Units");
082                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Charge");
083                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(459) }, "Reimbursement Action Code");
084                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(460) }, "Denial or Rejection Code");
085                                              this.add(IS.class, false, 0, 3, new Object[]{ getMessage(), new Integer(458) }, "OCE Edit Code");
086                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Ambulatory Payment Classification Code");
087                                              this.add(IS.class, false, 0, 1, new Object[]{ getMessage(), new Integer(467) }, "Modifier Edit Code");
088                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(468) }, "Payment Adjustment Code");
089                                              this.add(IS.class, false, 1, 1, new Object[]{ getMessage(), new Integer(469) }, "Packaging Status Code");
090                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Expected CMS Payment Amount");
091                                              this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(470) }, "Reimbursement Type Code");
092                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Co-Pay Amount");
093                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Pay Rate per Service Unit");
094       } catch(HL7Exception e) {
095          log.error("Unexpected error creating GP2 - this is probably a bug in the source code generator.", e);
096       }
097    }
098
099
100
101    /**
102     * Returns
103     * GP2-1: "Revenue Code" - creates it if necessary
104     */
105    public IS getRevenueCode() { 
106                IS retVal = this.getTypedField(1, 0);
107                return retVal;
108    }
109    
110    /**
111     * Returns
112     * GP2-1: "Revenue Code" - creates it if necessary
113     */
114    public IS getGp21_RevenueCode() { 
115                IS retVal = this.getTypedField(1, 0);
116                return retVal;
117    }
118
119
120
121    /**
122     * Returns
123     * GP2-2: "Number of Service Units" - creates it if necessary
124     */
125    public NM getNumberOfServiceUnits() { 
126                NM retVal = this.getTypedField(2, 0);
127                return retVal;
128    }
129    
130    /**
131     * Returns
132     * GP2-2: "Number of Service Units" - creates it if necessary
133     */
134    public NM getGp22_NumberOfServiceUnits() { 
135                NM retVal = this.getTypedField(2, 0);
136                return retVal;
137    }
138
139
140
141    /**
142     * Returns
143     * GP2-3: "Charge" - creates it if necessary
144     */
145    public CP getCharge() { 
146                CP retVal = this.getTypedField(3, 0);
147                return retVal;
148    }
149    
150    /**
151     * Returns
152     * GP2-3: "Charge" - creates it if necessary
153     */
154    public CP getGp23_Charge() { 
155                CP retVal = this.getTypedField(3, 0);
156                return retVal;
157    }
158
159
160
161    /**
162     * Returns
163     * GP2-4: "Reimbursement Action Code" - creates it if necessary
164     */
165    public IS getReimbursementActionCode() { 
166                IS retVal = this.getTypedField(4, 0);
167                return retVal;
168    }
169    
170    /**
171     * Returns
172     * GP2-4: "Reimbursement Action Code" - creates it if necessary
173     */
174    public IS getGp24_ReimbursementActionCode() { 
175                IS retVal = this.getTypedField(4, 0);
176                return retVal;
177    }
178
179
180
181    /**
182     * Returns
183     * GP2-5: "Denial or Rejection Code" - creates it if necessary
184     */
185    public IS getDenialOrRejectionCode() { 
186                IS retVal = this.getTypedField(5, 0);
187                return retVal;
188    }
189    
190    /**
191     * Returns
192     * GP2-5: "Denial or Rejection Code" - creates it if necessary
193     */
194    public IS getGp25_DenialOrRejectionCode() { 
195                IS retVal = this.getTypedField(5, 0);
196                return retVal;
197    }
198
199
200    /**
201     * Returns all repetitions of OCE Edit Code (GP2-6).
202     */
203    public IS[] getOCEEditCode() {
204        IS[] retVal = this.getTypedField(6, new IS[0]);
205        return retVal;
206    }
207
208
209    /**
210     * Returns all repetitions of OCE Edit Code (GP2-6).
211     */
212    public IS[] getGp26_OCEEditCode() {
213        IS[] retVal = this.getTypedField(6, new IS[0]);
214        return retVal;
215    }
216
217
218    /**
219     * Returns a count of the current number of repetitions of OCE Edit Code (GP2-6).
220     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
221     * it will return zero.
222     */
223    public int getOCEEditCodeReps() {
224        return this.getReps(6);
225    }
226
227
228    /**
229     * Returns a specific repetition of
230     * GP2-6: "OCE Edit Code" - creates it if necessary
231     *
232     * @param rep The repetition index (0-indexed)
233     */
234    public IS getOCEEditCode(int rep) { 
235                IS retVal = this.getTypedField(6, rep);
236                return retVal;
237    }
238
239    /**
240     * Returns a specific repetition of
241     * GP2-6: "OCE Edit Code" - creates it if necessary
242     *
243     * @param rep The repetition index (0-indexed)
244     */
245    public IS getGp26_OCEEditCode(int rep) { 
246                IS retVal = this.getTypedField(6, rep);
247                return retVal;
248    }
249
250    /**
251     * Returns a count of the current number of repetitions of OCE Edit Code (GP2-6).
252     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
253     * it will return zero.
254     */
255    public int getGp26_OCEEditCodeReps() {
256        return this.getReps(6);
257    }
258
259
260    /**
261     * Inserts a repetition of
262     * GP2-6: "OCE Edit Code" at a specific index
263     *
264     * @param rep The repetition index (0-indexed)
265     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
266     */
267    public IS insertOCEEditCode(int rep) throws HL7Exception { 
268        return (IS) super.insertRepetition(6, rep);
269    }
270
271
272    /**
273     * Inserts a repetition of
274     * GP2-6: "OCE Edit Code" at a specific index
275     *
276     * @param rep The repetition index (0-indexed)
277     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
278     */
279    public IS insertGp26_OCEEditCode(int rep) throws HL7Exception { 
280        return (IS) super.insertRepetition(6, rep);
281    }
282
283
284    /**
285     * Removes a repetition of
286     * GP2-6: "OCE Edit Code" at a specific index
287     *
288     * @param rep The repetition index (0-indexed)
289     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
290     */
291    public IS removeOCEEditCode(int rep) throws HL7Exception { 
292        return (IS) super.removeRepetition(6, rep);
293    }
294
295
296    /**
297     * Removes a repetition of
298     * GP2-6: "OCE Edit Code" at a specific index
299     *
300     * @param rep The repetition index (0-indexed)
301     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
302     */
303    public IS removeGp26_OCEEditCode(int rep) throws HL7Exception { 
304        return (IS) super.removeRepetition(6, rep);
305    }
306
307
308
309
310    /**
311     * Returns
312     * GP2-7: "Ambulatory Payment Classification Code" - creates it if necessary
313     */
314    public CE getAmbulatoryPaymentClassificationCode() { 
315                CE retVal = this.getTypedField(7, 0);
316                return retVal;
317    }
318    
319    /**
320     * Returns
321     * GP2-7: "Ambulatory Payment Classification Code" - creates it if necessary
322     */
323    public CE getGp27_AmbulatoryPaymentClassificationCode() { 
324                CE retVal = this.getTypedField(7, 0);
325                return retVal;
326    }
327
328
329    /**
330     * Returns all repetitions of Modifier Edit Code (GP2-8).
331     */
332    public IS[] getModifierEditCode() {
333        IS[] retVal = this.getTypedField(8, new IS[0]);
334        return retVal;
335    }
336
337
338    /**
339     * Returns all repetitions of Modifier Edit Code (GP2-8).
340     */
341    public IS[] getGp28_ModifierEditCode() {
342        IS[] retVal = this.getTypedField(8, new IS[0]);
343        return retVal;
344    }
345
346
347    /**
348     * Returns a count of the current number of repetitions of Modifier Edit Code (GP2-8).
349     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
350     * it will return zero.
351     */
352    public int getModifierEditCodeReps() {
353        return this.getReps(8);
354    }
355
356
357    /**
358     * Returns a specific repetition of
359     * GP2-8: "Modifier Edit Code" - creates it if necessary
360     *
361     * @param rep The repetition index (0-indexed)
362     */
363    public IS getModifierEditCode(int rep) { 
364                IS retVal = this.getTypedField(8, rep);
365                return retVal;
366    }
367
368    /**
369     * Returns a specific repetition of
370     * GP2-8: "Modifier Edit Code" - creates it if necessary
371     *
372     * @param rep The repetition index (0-indexed)
373     */
374    public IS getGp28_ModifierEditCode(int rep) { 
375                IS retVal = this.getTypedField(8, rep);
376                return retVal;
377    }
378
379    /**
380     * Returns a count of the current number of repetitions of Modifier Edit Code (GP2-8).
381     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
382     * it will return zero.
383     */
384    public int getGp28_ModifierEditCodeReps() {
385        return this.getReps(8);
386    }
387
388
389    /**
390     * Inserts a repetition of
391     * GP2-8: "Modifier Edit Code" at a specific index
392     *
393     * @param rep The repetition index (0-indexed)
394     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
395     */
396    public IS insertModifierEditCode(int rep) throws HL7Exception { 
397        return (IS) super.insertRepetition(8, rep);
398    }
399
400
401    /**
402     * Inserts a repetition of
403     * GP2-8: "Modifier Edit Code" at a specific index
404     *
405     * @param rep The repetition index (0-indexed)
406     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
407     */
408    public IS insertGp28_ModifierEditCode(int rep) throws HL7Exception { 
409        return (IS) super.insertRepetition(8, rep);
410    }
411
412
413    /**
414     * Removes a repetition of
415     * GP2-8: "Modifier Edit Code" at a specific index
416     *
417     * @param rep The repetition index (0-indexed)
418     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
419     */
420    public IS removeModifierEditCode(int rep) throws HL7Exception { 
421        return (IS) super.removeRepetition(8, rep);
422    }
423
424
425    /**
426     * Removes a repetition of
427     * GP2-8: "Modifier Edit Code" at a specific index
428     *
429     * @param rep The repetition index (0-indexed)
430     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
431     */
432    public IS removeGp28_ModifierEditCode(int rep) throws HL7Exception { 
433        return (IS) super.removeRepetition(8, rep);
434    }
435
436
437
438
439    /**
440     * Returns
441     * GP2-9: "Payment Adjustment Code" - creates it if necessary
442     */
443    public IS getPaymentAdjustmentCode() { 
444                IS retVal = this.getTypedField(9, 0);
445                return retVal;
446    }
447    
448    /**
449     * Returns
450     * GP2-9: "Payment Adjustment Code" - creates it if necessary
451     */
452    public IS getGp29_PaymentAdjustmentCode() { 
453                IS retVal = this.getTypedField(9, 0);
454                return retVal;
455    }
456
457
458
459    /**
460     * Returns
461     * GP2-10: "Packaging Status Code" - creates it if necessary
462     */
463    public IS getPackagingStatusCode() { 
464                IS retVal = this.getTypedField(10, 0);
465                return retVal;
466    }
467    
468    /**
469     * Returns
470     * GP2-10: "Packaging Status Code" - creates it if necessary
471     */
472    public IS getGp210_PackagingStatusCode() { 
473                IS retVal = this.getTypedField(10, 0);
474                return retVal;
475    }
476
477
478
479    /**
480     * Returns
481     * GP2-11: "Expected CMS Payment Amount" - creates it if necessary
482     */
483    public CP getExpectedCMSPaymentAmount() { 
484                CP retVal = this.getTypedField(11, 0);
485                return retVal;
486    }
487    
488    /**
489     * Returns
490     * GP2-11: "Expected CMS Payment Amount" - creates it if necessary
491     */
492    public CP getGp211_ExpectedCMSPaymentAmount() { 
493                CP retVal = this.getTypedField(11, 0);
494                return retVal;
495    }
496
497
498
499    /**
500     * Returns
501     * GP2-12: "Reimbursement Type Code" - creates it if necessary
502     */
503    public IS getReimbursementTypeCode() { 
504                IS retVal = this.getTypedField(12, 0);
505                return retVal;
506    }
507    
508    /**
509     * Returns
510     * GP2-12: "Reimbursement Type Code" - creates it if necessary
511     */
512    public IS getGp212_ReimbursementTypeCode() { 
513                IS retVal = this.getTypedField(12, 0);
514                return retVal;
515    }
516
517
518
519    /**
520     * Returns
521     * GP2-13: "Co-Pay Amount" - creates it if necessary
522     */
523    public CP getCoPayAmount() { 
524                CP retVal = this.getTypedField(13, 0);
525                return retVal;
526    }
527    
528    /**
529     * Returns
530     * GP2-13: "Co-Pay Amount" - creates it if necessary
531     */
532    public CP getGp213_CoPayAmount() { 
533                CP retVal = this.getTypedField(13, 0);
534                return retVal;
535    }
536
537
538
539    /**
540     * Returns
541     * GP2-14: "Pay Rate per Service Unit" - creates it if necessary
542     */
543    public NM getPayRatePerServiceUnit() { 
544                NM retVal = this.getTypedField(14, 0);
545                return retVal;
546    }
547    
548    /**
549     * Returns
550     * GP2-14: "Pay Rate per Service Unit" - creates it if necessary
551     */
552    public NM getGp214_PayRatePerServiceUnit() { 
553                NM retVal = this.getTypedField(14, 0);
554                return retVal;
555    }
556
557
558
559
560
561    /** {@inheritDoc} */   
562    protected Type createNewTypeWithoutReflection(int field) {
563       switch (field) {
564          case 0: return new IS(getMessage(), new Integer( 456 ));
565          case 1: return new NM(getMessage());
566          case 2: return new CP(getMessage());
567          case 3: return new IS(getMessage(), new Integer( 459 ));
568          case 4: return new IS(getMessage(), new Integer( 460 ));
569          case 5: return new IS(getMessage(), new Integer( 458 ));
570          case 6: return new CE(getMessage());
571          case 7: return new IS(getMessage(), new Integer( 467 ));
572          case 8: return new IS(getMessage(), new Integer( 468 ));
573          case 9: return new IS(getMessage(), new Integer( 469 ));
574          case 10: return new CP(getMessage());
575          case 11: return new IS(getMessage(), new Integer( 470 ));
576          case 12: return new CP(getMessage());
577          case 13: return new NM(getMessage());
578          default: return null;
579       }
580   }
581
582
583}
584