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    
008    package ca.uhn.hl7v2.model.v24.segment;
009    
010    // import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.datatype.*;
012    import ca.uhn.log.HapiLogFactory;
013    import ca.uhn.hl7v2.HL7Exception;
014    import ca.uhn.hl7v2.parser.ModelClassFactory;
015    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016    import ca.uhn.hl7v2.model.AbstractMessage;
017    import ca.uhn.hl7v2.model.Group;
018    import ca.uhn.hl7v2.model.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 DRG message segment (Diagnosis Related Group). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>DRG-1: Diagnostic Related Group (CE) <b>optional </b>
027         * <li>DRG-2: DRG Assigned Date/Time (TS) <b>optional </b>
028         * <li>DRG-3: DRG Approval Indicator (ID) <b>optional </b>
029         * <li>DRG-4: DRG Grouper Review Code (IS) <b>optional </b>
030         * <li>DRG-5: Outlier Type (CE) <b>optional </b>
031         * <li>DRG-6: Outlier Days (NM) <b>optional </b>
032         * <li>DRG-7: Outlier Cost (CP) <b>optional </b>
033         * <li>DRG-8: DRG Payor (IS) <b>optional </b>
034         * <li>DRG-9: Outlier Reimbursement (CP) <b>optional </b>
035         * <li>DRG-10: Confidential Indicator (ID) <b>optional </b>
036         * <li>DRG-11: DRG Transfer Type (IS) <b>optional </b>
037     * </ul>
038     */
039    public class DRG extends AbstractSegment {
040    
041        /** 
042         * Creates a new DRG segment
043         */
044        public DRG(Group parent, ModelClassFactory factory) {
045           super(parent, factory);
046           init(factory);
047        }
048    
049        private void init(ModelClassFactory factory) {
050           try {
051                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(55) }, "Diagnostic Related Group");
052                                      this.add(TS.class, false, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "DRG Assigned Date/Time");
053                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "DRG Approval Indicator");
054                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "DRG Grouper Review Code");
055                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(83) }, "Outlier Type");
056                                      this.add(NM.class, false, 1, 3, new Object[]{ getMessage(), new Integer(0) }, "Outlier Days");
057                                      this.add(CP.class, false, 1, 12, new Object[]{ getMessage(), new Integer(0) }, "Outlier Cost");
058                                      this.add(IS.class, false, 1, 1, new Object[]{ getMessage() }, "DRG Payor");
059                                      this.add(CP.class, false, 1, 9, new Object[]{ getMessage(), new Integer(0) }, "Outlier Reimbursement");
060                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Confidential Indicator");
061                                      this.add(IS.class, false, 1, 21, new Object[]{ getMessage() }, "DRG Transfer Type");
062           } catch(HL7Exception e) {
063              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating DRG - this is probably a bug in the source code generator.", e);
064           }
065        }
066    
067    
068    
069        /**
070         * Returns
071         * DRG-1: "Diagnostic Related Group" - creates it if necessary
072         */
073        public CE getDiagnosticRelatedGroup() { 
074            CE ret = null;
075            try {
076                Type t = this.getField(1, 0);
077                ret = (CE)t;
078            } catch (ClassCastException cce) {
079                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
080                throw new RuntimeException(cce);
081            } catch (HL7Exception he) {
082                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
083                throw new RuntimeException(he);
084            }
085            return ret;
086        }
087    
088    
089        /**
090         * Returns
091         * DRG-1: "Diagnostic Related Group" - creates it if necessary
092         */
093        public CE getDrg1_DiagnosticRelatedGroup() { 
094            CE ret = null;
095            try {
096                Type t = this.getField(1, 0);
097                ret = (CE)t;
098            } catch (ClassCastException cce) {
099                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
100                throw new RuntimeException(cce);
101            } catch (HL7Exception he) {
102                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
103                throw new RuntimeException(he);
104            }
105            return ret;
106        }
107    
108    
109    
110        /**
111         * Returns
112         * DRG-2: "DRG Assigned Date/Time" - creates it if necessary
113         */
114        public TS getDRGAssignedDateTime() { 
115            TS ret = null;
116            try {
117                Type t = this.getField(2, 0);
118                ret = (TS)t;
119            } catch (ClassCastException cce) {
120                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
121                throw new RuntimeException(cce);
122            } catch (HL7Exception he) {
123                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
124                throw new RuntimeException(he);
125            }
126            return ret;
127        }
128    
129    
130        /**
131         * Returns
132         * DRG-2: "DRG Assigned Date/Time" - creates it if necessary
133         */
134        public TS getDrg2_DRGAssignedDateTime() { 
135            TS ret = null;
136            try {
137                Type t = this.getField(2, 0);
138                ret = (TS)t;
139            } catch (ClassCastException cce) {
140                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
141                throw new RuntimeException(cce);
142            } catch (HL7Exception he) {
143                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
144                throw new RuntimeException(he);
145            }
146            return ret;
147        }
148    
149    
150    
151        /**
152         * Returns
153         * DRG-3: "DRG Approval Indicator" - creates it if necessary
154         */
155        public ID getDRGApprovalIndicator() { 
156            ID ret = null;
157            try {
158                Type t = this.getField(3, 0);
159                ret = (ID)t;
160            } catch (ClassCastException cce) {
161                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
162                throw new RuntimeException(cce);
163            } catch (HL7Exception he) {
164                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
165                throw new RuntimeException(he);
166            }
167            return ret;
168        }
169    
170    
171        /**
172         * Returns
173         * DRG-3: "DRG Approval Indicator" - creates it if necessary
174         */
175        public ID getDrg3_DRGApprovalIndicator() { 
176            ID ret = null;
177            try {
178                Type t = this.getField(3, 0);
179                ret = (ID)t;
180            } catch (ClassCastException cce) {
181                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
182                throw new RuntimeException(cce);
183            } catch (HL7Exception he) {
184                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
185                throw new RuntimeException(he);
186            }
187            return ret;
188        }
189    
190    
191    
192        /**
193         * Returns
194         * DRG-4: "DRG Grouper Review Code" - creates it if necessary
195         */
196        public IS getDRGGrouperReviewCode() { 
197            IS ret = null;
198            try {
199                Type t = this.getField(4, 0);
200                ret = (IS)t;
201            } catch (ClassCastException cce) {
202                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
203                throw new RuntimeException(cce);
204            } catch (HL7Exception he) {
205                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
206                throw new RuntimeException(he);
207            }
208            return ret;
209        }
210    
211    
212        /**
213         * Returns
214         * DRG-4: "DRG Grouper Review Code" - creates it if necessary
215         */
216        public IS getDrg4_DRGGrouperReviewCode() { 
217            IS ret = null;
218            try {
219                Type t = this.getField(4, 0);
220                ret = (IS)t;
221            } catch (ClassCastException cce) {
222                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
223                throw new RuntimeException(cce);
224            } catch (HL7Exception he) {
225                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
226                throw new RuntimeException(he);
227            }
228            return ret;
229        }
230    
231    
232    
233        /**
234         * Returns
235         * DRG-5: "Outlier Type" - creates it if necessary
236         */
237        public CE getOutlierType() { 
238            CE ret = null;
239            try {
240                Type t = this.getField(5, 0);
241                ret = (CE)t;
242            } catch (ClassCastException cce) {
243                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
244                throw new RuntimeException(cce);
245            } catch (HL7Exception he) {
246                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
247                throw new RuntimeException(he);
248            }
249            return ret;
250        }
251    
252    
253        /**
254         * Returns
255         * DRG-5: "Outlier Type" - creates it if necessary
256         */
257        public CE getDrg5_OutlierType() { 
258            CE ret = null;
259            try {
260                Type t = this.getField(5, 0);
261                ret = (CE)t;
262            } catch (ClassCastException cce) {
263                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
264                throw new RuntimeException(cce);
265            } catch (HL7Exception he) {
266                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
267                throw new RuntimeException(he);
268            }
269            return ret;
270        }
271    
272    
273    
274        /**
275         * Returns
276         * DRG-6: "Outlier Days" - creates it if necessary
277         */
278        public NM getOutlierDays() { 
279            NM ret = null;
280            try {
281                Type t = this.getField(6, 0);
282                ret = (NM)t;
283            } catch (ClassCastException cce) {
284                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
285                throw new RuntimeException(cce);
286            } catch (HL7Exception he) {
287                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
288                throw new RuntimeException(he);
289            }
290            return ret;
291        }
292    
293    
294        /**
295         * Returns
296         * DRG-6: "Outlier Days" - creates it if necessary
297         */
298        public NM getDrg6_OutlierDays() { 
299            NM ret = null;
300            try {
301                Type t = this.getField(6, 0);
302                ret = (NM)t;
303            } catch (ClassCastException cce) {
304                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
305                throw new RuntimeException(cce);
306            } catch (HL7Exception he) {
307                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
308                throw new RuntimeException(he);
309            }
310            return ret;
311        }
312    
313    
314    
315        /**
316         * Returns
317         * DRG-7: "Outlier Cost" - creates it if necessary
318         */
319        public CP getOutlierCost() { 
320            CP ret = null;
321            try {
322                Type t = this.getField(7, 0);
323                ret = (CP)t;
324            } catch (ClassCastException cce) {
325                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
326                throw new RuntimeException(cce);
327            } catch (HL7Exception he) {
328                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
329                throw new RuntimeException(he);
330            }
331            return ret;
332        }
333    
334    
335        /**
336         * Returns
337         * DRG-7: "Outlier Cost" - creates it if necessary
338         */
339        public CP getDrg7_OutlierCost() { 
340            CP ret = null;
341            try {
342                Type t = this.getField(7, 0);
343                ret = (CP)t;
344            } catch (ClassCastException cce) {
345                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
346                throw new RuntimeException(cce);
347            } catch (HL7Exception he) {
348                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
349                throw new RuntimeException(he);
350            }
351            return ret;
352        }
353    
354    
355    
356        /**
357         * Returns
358         * DRG-8: "DRG Payor" - creates it if necessary
359         */
360        public IS getDRGPayor() { 
361            IS ret = null;
362            try {
363                Type t = this.getField(8, 0);
364                ret = (IS)t;
365            } catch (ClassCastException cce) {
366                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
367                throw new RuntimeException(cce);
368            } catch (HL7Exception he) {
369                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
370                throw new RuntimeException(he);
371            }
372            return ret;
373        }
374    
375    
376        /**
377         * Returns
378         * DRG-8: "DRG Payor" - creates it if necessary
379         */
380        public IS getDrg8_DRGPayor() { 
381            IS ret = null;
382            try {
383                Type t = this.getField(8, 0);
384                ret = (IS)t;
385            } catch (ClassCastException cce) {
386                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
387                throw new RuntimeException(cce);
388            } catch (HL7Exception he) {
389                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
390                throw new RuntimeException(he);
391            }
392            return ret;
393        }
394    
395    
396    
397        /**
398         * Returns
399         * DRG-9: "Outlier Reimbursement" - creates it if necessary
400         */
401        public CP getOutlierReimbursement() { 
402            CP ret = null;
403            try {
404                Type t = this.getField(9, 0);
405                ret = (CP)t;
406            } catch (ClassCastException cce) {
407                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
408                throw new RuntimeException(cce);
409            } catch (HL7Exception he) {
410                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
411                throw new RuntimeException(he);
412            }
413            return ret;
414        }
415    
416    
417        /**
418         * Returns
419         * DRG-9: "Outlier Reimbursement" - creates it if necessary
420         */
421        public CP getDrg9_OutlierReimbursement() { 
422            CP ret = null;
423            try {
424                Type t = this.getField(9, 0);
425                ret = (CP)t;
426            } catch (ClassCastException cce) {
427                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
428                throw new RuntimeException(cce);
429            } catch (HL7Exception he) {
430                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
431                throw new RuntimeException(he);
432            }
433            return ret;
434        }
435    
436    
437    
438        /**
439         * Returns
440         * DRG-10: "Confidential Indicator" - creates it if necessary
441         */
442        public ID getConfidentialIndicator() { 
443            ID ret = null;
444            try {
445                Type t = this.getField(10, 0);
446                ret = (ID)t;
447            } catch (ClassCastException cce) {
448                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
449                throw new RuntimeException(cce);
450            } catch (HL7Exception he) {
451                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
452                throw new RuntimeException(he);
453            }
454            return ret;
455        }
456    
457    
458        /**
459         * Returns
460         * DRG-10: "Confidential Indicator" - creates it if necessary
461         */
462        public ID getDrg10_ConfidentialIndicator() { 
463            ID ret = null;
464            try {
465                Type t = this.getField(10, 0);
466                ret = (ID)t;
467            } catch (ClassCastException cce) {
468                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
469                throw new RuntimeException(cce);
470            } catch (HL7Exception he) {
471                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
472                throw new RuntimeException(he);
473            }
474            return ret;
475        }
476    
477    
478    
479        /**
480         * Returns
481         * DRG-11: "DRG Transfer Type" - creates it if necessary
482         */
483        public IS getDRGTransferType() { 
484            IS ret = null;
485            try {
486                Type t = this.getField(11, 0);
487                ret = (IS)t;
488            } catch (ClassCastException cce) {
489                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
490                throw new RuntimeException(cce);
491            } catch (HL7Exception he) {
492                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
493                throw new RuntimeException(he);
494            }
495            return ret;
496        }
497    
498    
499        /**
500         * Returns
501         * DRG-11: "DRG Transfer Type" - creates it if necessary
502         */
503        public IS getDrg11_DRGTransferType() { 
504            IS ret = null;
505            try {
506                Type t = this.getField(11, 0);
507                ret = (IS)t;
508            } catch (ClassCastException cce) {
509                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
510                throw new RuntimeException(cce);
511            } catch (HL7Exception he) {
512                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
513                throw new RuntimeException(he);
514            }
515            return ret;
516        }
517    
518    
519    
520    
521    
522        /** {@inheritDoc} */   
523        protected Type createNewTypeWithoutReflection(int field) {
524           switch (field) {
525              case 0: return new CE(getMessage());
526              case 1: return new TS(getMessage());
527              case 2: return new ID(getMessage(), new Integer( 136 ));
528              case 3: return new IS(getMessage(), new Integer( 56 ));
529              case 4: return new CE(getMessage());
530              case 5: return new NM(getMessage());
531              case 6: return new CP(getMessage());
532              case 7: return new IS(getMessage(), new Integer( 229 ));
533              case 8: return new CP(getMessage());
534              case 9: return new ID(getMessage(), new Integer( 136 ));
535              case 10: return new IS(getMessage(), new Integer( 415 ));
536              default: return null;
537           }
538       }
539    
540    
541    }
542