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 DG1 message segment (Diagnosis). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>DG1-1: Set ID - DG1 (SI) <b> </b>
052     * <li>DG1-2: Diagnosis Coding Method (ID) <b>optional </b>
053     * <li>DG1-3: Diagnosis Code - DG1 (CE) <b>optional </b>
054     * <li>DG1-4: Diagnosis Description (ST) <b>optional </b>
055     * <li>DG1-5: Diagnosis Date/Time (TS) <b>optional </b>
056     * <li>DG1-6: Diagnosis Type (IS) <b> </b>
057     * <li>DG1-7: Major Diagnostic Category (CE) <b>optional </b>
058     * <li>DG1-8: Diagnostic Related Group (CE) <b>optional </b>
059     * <li>DG1-9: DRG Approval Indicator (ID) <b>optional </b>
060     * <li>DG1-10: DRG Grouper Review Code (IS) <b>optional </b>
061     * <li>DG1-11: Outlier Type (CE) <b>optional </b>
062     * <li>DG1-12: Outlier Days (NM) <b>optional </b>
063     * <li>DG1-13: Outlier Cost (CP) <b>optional </b>
064     * <li>DG1-14: Grouper Version And Type (ST) <b>optional </b>
065     * <li>DG1-15: Diagnosis Priority (ID) <b>optional </b>
066     * <li>DG1-16: Diagnosing Clinician (XCN) <b>optional repeating</b>
067     * <li>DG1-17: Diagnosis Classification (IS) <b>optional </b>
068     * <li>DG1-18: Confidential Indicator (ID) <b>optional </b>
069     * <li>DG1-19: Attestation Date/Time (TS) <b>optional </b>
070     * <li>DG1-20: Diagnosis Identifier (EI) <b>optional </b>
071     * <li>DG1-21: Diagnosis Action Code (ID) <b>optional </b>
072 * </ul>
073 */
074@SuppressWarnings("unused")
075public class DG1 extends AbstractSegment {
076
077    /** 
078     * Creates a new DG1 segment
079     */
080    public DG1(Group parent, ModelClassFactory factory) {
081       super(parent, factory);
082       init(factory);
083    }
084
085    private void init(ModelClassFactory factory) {
086       try {
087                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - DG1");
088                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(53) }, "Diagnosis Coding Method");
089                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Diagnosis Code - DG1");
090                                  this.add(ST.class, false, 1, 40, new Object[]{ getMessage() }, "Diagnosis Description");
091                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Diagnosis Date/Time");
092                                              this.add(IS.class, true, 1, 2, new Object[]{ getMessage(), new Integer(52) }, "Diagnosis Type");
093                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Major Diagnostic Category");
094                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Diagnostic Related Group");
095                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "DRG Approval Indicator");
096                                              this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(56) }, "DRG Grouper Review Code");
097                                  this.add(CE.class, false, 1, 250, new Object[]{ getMessage() }, "Outlier Type");
098                                  this.add(NM.class, false, 1, 3, new Object[]{ getMessage() }, "Outlier Days");
099                                  this.add(CP.class, false, 1, 12, new Object[]{ getMessage() }, "Outlier Cost");
100                                  this.add(ST.class, false, 1, 4, new Object[]{ getMessage() }, "Grouper Version And Type");
101                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(359) }, "Diagnosis Priority");
102                                  this.add(XCN.class, false, 0, 250, new Object[]{ getMessage() }, "Diagnosing Clinician");
103                                              this.add(IS.class, false, 1, 3, new Object[]{ getMessage(), new Integer(228) }, "Diagnosis Classification");
104                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Confidential Indicator");
105                                  this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Attestation Date/Time");
106                                  this.add(EI.class, false, 1, 427, new Object[]{ getMessage() }, "Diagnosis Identifier");
107                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(206) }, "Diagnosis Action Code");
108       } catch(HL7Exception e) {
109          log.error("Unexpected error creating DG1 - this is probably a bug in the source code generator.", e);
110       }
111    }
112
113
114
115    /**
116     * Returns
117     * DG1-1: "Set ID - DG1" - creates it if necessary
118     */
119    public SI getSetIDDG1() { 
120                SI retVal = this.getTypedField(1, 0);
121                return retVal;
122    }
123    
124    /**
125     * Returns
126     * DG1-1: "Set ID - DG1" - creates it if necessary
127     */
128    public SI getDg11_SetIDDG1() { 
129                SI retVal = this.getTypedField(1, 0);
130                return retVal;
131    }
132
133
134
135    /**
136     * Returns
137     * DG1-2: "Diagnosis Coding Method" - creates it if necessary
138     */
139    public ID getDiagnosisCodingMethod() { 
140                ID retVal = this.getTypedField(2, 0);
141                return retVal;
142    }
143    
144    /**
145     * Returns
146     * DG1-2: "Diagnosis Coding Method" - creates it if necessary
147     */
148    public ID getDg12_DiagnosisCodingMethod() { 
149                ID retVal = this.getTypedField(2, 0);
150                return retVal;
151    }
152
153
154
155    /**
156     * Returns
157     * DG1-3: "Diagnosis Code - DG1" - creates it if necessary
158     */
159    public CE getDiagnosisCodeDG1() { 
160                CE retVal = this.getTypedField(3, 0);
161                return retVal;
162    }
163    
164    /**
165     * Returns
166     * DG1-3: "Diagnosis Code - DG1" - creates it if necessary
167     */
168    public CE getDg13_DiagnosisCodeDG1() { 
169                CE retVal = this.getTypedField(3, 0);
170                return retVal;
171    }
172
173
174
175    /**
176     * Returns
177     * DG1-4: "Diagnosis Description" - creates it if necessary
178     */
179    public ST getDiagnosisDescription() { 
180                ST retVal = this.getTypedField(4, 0);
181                return retVal;
182    }
183    
184    /**
185     * Returns
186     * DG1-4: "Diagnosis Description" - creates it if necessary
187     */
188    public ST getDg14_DiagnosisDescription() { 
189                ST retVal = this.getTypedField(4, 0);
190                return retVal;
191    }
192
193
194
195    /**
196     * Returns
197     * DG1-5: "Diagnosis Date/Time" - creates it if necessary
198     */
199    public TS getDiagnosisDateTime() { 
200                TS retVal = this.getTypedField(5, 0);
201                return retVal;
202    }
203    
204    /**
205     * Returns
206     * DG1-5: "Diagnosis Date/Time" - creates it if necessary
207     */
208    public TS getDg15_DiagnosisDateTime() { 
209                TS retVal = this.getTypedField(5, 0);
210                return retVal;
211    }
212
213
214
215    /**
216     * Returns
217     * DG1-6: "Diagnosis Type" - creates it if necessary
218     */
219    public IS getDiagnosisType() { 
220                IS retVal = this.getTypedField(6, 0);
221                return retVal;
222    }
223    
224    /**
225     * Returns
226     * DG1-6: "Diagnosis Type" - creates it if necessary
227     */
228    public IS getDg16_DiagnosisType() { 
229                IS retVal = this.getTypedField(6, 0);
230                return retVal;
231    }
232
233
234
235    /**
236     * Returns
237     * DG1-7: "Major Diagnostic Category" - creates it if necessary
238     */
239    public CE getMajorDiagnosticCategory() { 
240                CE retVal = this.getTypedField(7, 0);
241                return retVal;
242    }
243    
244    /**
245     * Returns
246     * DG1-7: "Major Diagnostic Category" - creates it if necessary
247     */
248    public CE getDg17_MajorDiagnosticCategory() { 
249                CE retVal = this.getTypedField(7, 0);
250                return retVal;
251    }
252
253
254
255    /**
256     * Returns
257     * DG1-8: "Diagnostic Related Group" - creates it if necessary
258     */
259    public CE getDiagnosticRelatedGroup() { 
260                CE retVal = this.getTypedField(8, 0);
261                return retVal;
262    }
263    
264    /**
265     * Returns
266     * DG1-8: "Diagnostic Related Group" - creates it if necessary
267     */
268    public CE getDg18_DiagnosticRelatedGroup() { 
269                CE retVal = this.getTypedField(8, 0);
270                return retVal;
271    }
272
273
274
275    /**
276     * Returns
277     * DG1-9: "DRG Approval Indicator" - creates it if necessary
278     */
279    public ID getDRGApprovalIndicator() { 
280                ID retVal = this.getTypedField(9, 0);
281                return retVal;
282    }
283    
284    /**
285     * Returns
286     * DG1-9: "DRG Approval Indicator" - creates it if necessary
287     */
288    public ID getDg19_DRGApprovalIndicator() { 
289                ID retVal = this.getTypedField(9, 0);
290                return retVal;
291    }
292
293
294
295    /**
296     * Returns
297     * DG1-10: "DRG Grouper Review Code" - creates it if necessary
298     */
299    public IS getDRGGrouperReviewCode() { 
300                IS retVal = this.getTypedField(10, 0);
301                return retVal;
302    }
303    
304    /**
305     * Returns
306     * DG1-10: "DRG Grouper Review Code" - creates it if necessary
307     */
308    public IS getDg110_DRGGrouperReviewCode() { 
309                IS retVal = this.getTypedField(10, 0);
310                return retVal;
311    }
312
313
314
315    /**
316     * Returns
317     * DG1-11: "Outlier Type" - creates it if necessary
318     */
319    public CE getOutlierType() { 
320                CE retVal = this.getTypedField(11, 0);
321                return retVal;
322    }
323    
324    /**
325     * Returns
326     * DG1-11: "Outlier Type" - creates it if necessary
327     */
328    public CE getDg111_OutlierType() { 
329                CE retVal = this.getTypedField(11, 0);
330                return retVal;
331    }
332
333
334
335    /**
336     * Returns
337     * DG1-12: "Outlier Days" - creates it if necessary
338     */
339    public NM getOutlierDays() { 
340                NM retVal = this.getTypedField(12, 0);
341                return retVal;
342    }
343    
344    /**
345     * Returns
346     * DG1-12: "Outlier Days" - creates it if necessary
347     */
348    public NM getDg112_OutlierDays() { 
349                NM retVal = this.getTypedField(12, 0);
350                return retVal;
351    }
352
353
354
355    /**
356     * Returns
357     * DG1-13: "Outlier Cost" - creates it if necessary
358     */
359    public CP getOutlierCost() { 
360                CP retVal = this.getTypedField(13, 0);
361                return retVal;
362    }
363    
364    /**
365     * Returns
366     * DG1-13: "Outlier Cost" - creates it if necessary
367     */
368    public CP getDg113_OutlierCost() { 
369                CP retVal = this.getTypedField(13, 0);
370                return retVal;
371    }
372
373
374
375    /**
376     * Returns
377     * DG1-14: "Grouper Version And Type" - creates it if necessary
378     */
379    public ST getGrouperVersionAndType() { 
380                ST retVal = this.getTypedField(14, 0);
381                return retVal;
382    }
383    
384    /**
385     * Returns
386     * DG1-14: "Grouper Version And Type" - creates it if necessary
387     */
388    public ST getDg114_GrouperVersionAndType() { 
389                ST retVal = this.getTypedField(14, 0);
390                return retVal;
391    }
392
393
394
395    /**
396     * Returns
397     * DG1-15: "Diagnosis Priority" - creates it if necessary
398     */
399    public ID getDiagnosisPriority() { 
400                ID retVal = this.getTypedField(15, 0);
401                return retVal;
402    }
403    
404    /**
405     * Returns
406     * DG1-15: "Diagnosis Priority" - creates it if necessary
407     */
408    public ID getDg115_DiagnosisPriority() { 
409                ID retVal = this.getTypedField(15, 0);
410                return retVal;
411    }
412
413
414    /**
415     * Returns all repetitions of Diagnosing Clinician (DG1-16).
416     */
417    public XCN[] getDiagnosingClinician() {
418        XCN[] retVal = this.getTypedField(16, new XCN[0]);
419        return retVal;
420    }
421
422
423    /**
424     * Returns all repetitions of Diagnosing Clinician (DG1-16).
425     */
426    public XCN[] getDg116_DiagnosingClinician() {
427        XCN[] retVal = this.getTypedField(16, new XCN[0]);
428        return retVal;
429    }
430
431
432    /**
433     * Returns a count of the current number of repetitions of Diagnosing Clinician (DG1-16).
434     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
435     * it will return zero.
436     */
437    public int getDiagnosingClinicianReps() {
438        return this.getReps(16);
439    }
440
441
442    /**
443     * Returns a specific repetition of
444     * DG1-16: "Diagnosing Clinician" - creates it if necessary
445     *
446     * @param rep The repetition index (0-indexed)
447     */
448    public XCN getDiagnosingClinician(int rep) { 
449                XCN retVal = this.getTypedField(16, rep);
450                return retVal;
451    }
452
453    /**
454     * Returns a specific repetition of
455     * DG1-16: "Diagnosing Clinician" - creates it if necessary
456     *
457     * @param rep The repetition index (0-indexed)
458     */
459    public XCN getDg116_DiagnosingClinician(int rep) { 
460                XCN retVal = this.getTypedField(16, rep);
461                return retVal;
462    }
463
464    /**
465     * Returns a count of the current number of repetitions of Diagnosing Clinician (DG1-16).
466     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
467     * it will return zero.
468     */
469    public int getDg116_DiagnosingClinicianReps() {
470        return this.getReps(16);
471    }
472
473
474    /**
475     * Inserts a repetition of
476     * DG1-16: "Diagnosing Clinician" at a specific index
477     *
478     * @param rep The repetition index (0-indexed)
479     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
480     */
481    public XCN insertDiagnosingClinician(int rep) throws HL7Exception { 
482        return (XCN) super.insertRepetition(16, rep);
483    }
484
485
486    /**
487     * Inserts a repetition of
488     * DG1-16: "Diagnosing Clinician" at a specific index
489     *
490     * @param rep The repetition index (0-indexed)
491     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
492     */
493    public XCN insertDg116_DiagnosingClinician(int rep) throws HL7Exception { 
494        return (XCN) super.insertRepetition(16, rep);
495    }
496
497
498    /**
499     * Removes a repetition of
500     * DG1-16: "Diagnosing Clinician" at a specific index
501     *
502     * @param rep The repetition index (0-indexed)
503     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
504     */
505    public XCN removeDiagnosingClinician(int rep) throws HL7Exception { 
506        return (XCN) super.removeRepetition(16, rep);
507    }
508
509
510    /**
511     * Removes a repetition of
512     * DG1-16: "Diagnosing Clinician" at a specific index
513     *
514     * @param rep The repetition index (0-indexed)
515     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
516     */
517    public XCN removeDg116_DiagnosingClinician(int rep) throws HL7Exception { 
518        return (XCN) super.removeRepetition(16, rep);
519    }
520
521
522
523
524    /**
525     * Returns
526     * DG1-17: "Diagnosis Classification" - creates it if necessary
527     */
528    public IS getDiagnosisClassification() { 
529                IS retVal = this.getTypedField(17, 0);
530                return retVal;
531    }
532    
533    /**
534     * Returns
535     * DG1-17: "Diagnosis Classification" - creates it if necessary
536     */
537    public IS getDg117_DiagnosisClassification() { 
538                IS retVal = this.getTypedField(17, 0);
539                return retVal;
540    }
541
542
543
544    /**
545     * Returns
546     * DG1-18: "Confidential Indicator" - creates it if necessary
547     */
548    public ID getConfidentialIndicator() { 
549                ID retVal = this.getTypedField(18, 0);
550                return retVal;
551    }
552    
553    /**
554     * Returns
555     * DG1-18: "Confidential Indicator" - creates it if necessary
556     */
557    public ID getDg118_ConfidentialIndicator() { 
558                ID retVal = this.getTypedField(18, 0);
559                return retVal;
560    }
561
562
563
564    /**
565     * Returns
566     * DG1-19: "Attestation Date/Time" - creates it if necessary
567     */
568    public TS getAttestationDateTime() { 
569                TS retVal = this.getTypedField(19, 0);
570                return retVal;
571    }
572    
573    /**
574     * Returns
575     * DG1-19: "Attestation Date/Time" - creates it if necessary
576     */
577    public TS getDg119_AttestationDateTime() { 
578                TS retVal = this.getTypedField(19, 0);
579                return retVal;
580    }
581
582
583
584    /**
585     * Returns
586     * DG1-20: "Diagnosis Identifier" - creates it if necessary
587     */
588    public EI getDiagnosisIdentifier() { 
589                EI retVal = this.getTypedField(20, 0);
590                return retVal;
591    }
592    
593    /**
594     * Returns
595     * DG1-20: "Diagnosis Identifier" - creates it if necessary
596     */
597    public EI getDg120_DiagnosisIdentifier() { 
598                EI retVal = this.getTypedField(20, 0);
599                return retVal;
600    }
601
602
603
604    /**
605     * Returns
606     * DG1-21: "Diagnosis Action Code" - creates it if necessary
607     */
608    public ID getDiagnosisActionCode() { 
609                ID retVal = this.getTypedField(21, 0);
610                return retVal;
611    }
612    
613    /**
614     * Returns
615     * DG1-21: "Diagnosis Action Code" - creates it if necessary
616     */
617    public ID getDg121_DiagnosisActionCode() { 
618                ID retVal = this.getTypedField(21, 0);
619                return retVal;
620    }
621
622
623
624
625
626    /** {@inheritDoc} */   
627    protected Type createNewTypeWithoutReflection(int field) {
628       switch (field) {
629          case 0: return new SI(getMessage());
630          case 1: return new ID(getMessage(), new Integer( 53 ));
631          case 2: return new CE(getMessage());
632          case 3: return new ST(getMessage());
633          case 4: return new TS(getMessage());
634          case 5: return new IS(getMessage(), new Integer( 52 ));
635          case 6: return new CE(getMessage());
636          case 7: return new CE(getMessage());
637          case 8: return new ID(getMessage(), new Integer( 136 ));
638          case 9: return new IS(getMessage(), new Integer( 56 ));
639          case 10: return new CE(getMessage());
640          case 11: return new NM(getMessage());
641          case 12: return new CP(getMessage());
642          case 13: return new ST(getMessage());
643          case 14: return new ID(getMessage(), new Integer( 359 ));
644          case 15: return new XCN(getMessage());
645          case 16: return new IS(getMessage(), new Integer( 228 ));
646          case 17: return new ID(getMessage(), new Integer( 136 ));
647          case 18: return new TS(getMessage());
648          case 19: return new EI(getMessage());
649          case 20: return new ID(getMessage(), new Integer( 206 ));
650          default: return null;
651       }
652   }
653
654
655}
656