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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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/**
049 *<p>Represents an HL7 NK1 message segment (NEXT OF KIN). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>NK1-1: Set ID - Next of Kin (SI) <b> </b>
053     * <li>NK1-2: NK Name (PN) <b>optional </b>
054     * <li>NK1-3: Relationship (CE) <b>optional </b>
055     * <li>NK1-4: Address (AD) <b>optional </b>
056     * <li>NK1-5: Phone Number (TN) <b>optional repeating</b>
057     * <li>NK1-6: Business Phone Number (TN) <b>optional </b>
058     * <li>NK1-7: Contact Role (CE) <b>optional </b>
059     * <li>NK1-8: Start Date (DT) <b>optional </b>
060     * <li>NK1-9: End Date (DT) <b>optional </b>
061     * <li>NK1-10: Next of Kin (ST) <b>optional </b>
062     * <li>NK1-11: Next of kin job code / class (CM_JOB_CODE) <b>optional </b>
063     * <li>NK1-12: Next of Kin Employee Number (ST) <b>optional </b>
064     * <li>NK1-13: Organization Name (ST) <b>optional </b>
065 * </ul>
066 */
067@SuppressWarnings("unused")
068public class NK1 extends AbstractSegment {
069
070    /** 
071     * Creates a new NK1 segment
072     */
073    public NK1(Group parent, ModelClassFactory factory) {
074       super(parent, factory);
075       init(factory);
076    }
077
078    private void init(ModelClassFactory factory) {
079       try {
080                                  this.add(SI.class, true, 1, 4, new Object[]{ getMessage() }, "Set ID - Next of Kin");
081                                  this.add(PN.class, false, 1, 48, new Object[]{ getMessage() }, "NK Name");
082                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Relationship");
083                                  this.add(AD.class, false, 1, 106, new Object[]{ getMessage() }, "Address");
084                                  this.add(TN.class, false, 3, 40, new Object[]{ getMessage() }, "Phone Number");
085                                  this.add(TN.class, false, 1, 40, new Object[]{ getMessage() }, "Business Phone Number");
086                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Contact Role");
087                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "Start Date");
088                                  this.add(DT.class, false, 1, 8, new Object[]{ getMessage() }, "End Date");
089                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Next of Kin");
090                                  this.add(CM_JOB_CODE.class, false, 1, 60, new Object[]{ getMessage() }, "Next of kin job code / class");
091                                  this.add(ST.class, false, 1, 20, new Object[]{ getMessage() }, "Next of Kin Employee Number");
092                                  this.add(ST.class, false, 1, 60, new Object[]{ getMessage() }, "Organization Name");
093       } catch(HL7Exception e) {
094          log.error("Unexpected error creating NK1 - this is probably a bug in the source code generator.", e);
095       }
096    }
097
098
099
100    /**
101     * Returns
102     * NK1-1: "Set ID - Next of Kin" - creates it if necessary
103     */
104    public SI getSetIDNextOfKin() { 
105                SI retVal = this.getTypedField(1, 0);
106                return retVal;
107    }
108    
109    /**
110     * Returns
111     * NK1-1: "Set ID - Next of Kin" - creates it if necessary
112     */
113    public SI getNk11_SetIDNextOfKin() { 
114                SI retVal = this.getTypedField(1, 0);
115                return retVal;
116    }
117
118
119
120    /**
121     * Returns
122     * NK1-2: "NK Name" - creates it if necessary
123     */
124    public PN getNKName() { 
125                PN retVal = this.getTypedField(2, 0);
126                return retVal;
127    }
128    
129    /**
130     * Returns
131     * NK1-2: "NK Name" - creates it if necessary
132     */
133    public PN getNk12_NKName() { 
134                PN retVal = this.getTypedField(2, 0);
135                return retVal;
136    }
137
138
139
140    /**
141     * Returns
142     * NK1-3: "Relationship" - creates it if necessary
143     */
144    public CE getRelationship() { 
145                CE retVal = this.getTypedField(3, 0);
146                return retVal;
147    }
148    
149    /**
150     * Returns
151     * NK1-3: "Relationship" - creates it if necessary
152     */
153    public CE getNk13_Relationship() { 
154                CE retVal = this.getTypedField(3, 0);
155                return retVal;
156    }
157
158
159
160    /**
161     * Returns
162     * NK1-4: "Address" - creates it if necessary
163     */
164    public AD getAddress() { 
165                AD retVal = this.getTypedField(4, 0);
166                return retVal;
167    }
168    
169    /**
170     * Returns
171     * NK1-4: "Address" - creates it if necessary
172     */
173    public AD getNk14_Address() { 
174                AD retVal = this.getTypedField(4, 0);
175                return retVal;
176    }
177
178
179    /**
180     * Returns all repetitions of Phone Number (NK1-5).
181     */
182    public TN[] getPhoneNumber() {
183        TN[] retVal = this.getTypedField(5, new TN[0]);
184        return retVal;
185    }
186
187
188    /**
189     * Returns all repetitions of Phone Number (NK1-5).
190     */
191    public TN[] getNk15_PhoneNumber() {
192        TN[] retVal = this.getTypedField(5, new TN[0]);
193        return retVal;
194    }
195
196
197    /**
198     * Returns a count of the current number of repetitions of Phone Number (NK1-5).
199     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
200     * it will return zero.
201     */
202    public int getPhoneNumberReps() {
203        return this.getReps(5);
204    }
205
206
207    /**
208     * Returns a specific repetition of
209     * NK1-5: "Phone Number" - creates it if necessary
210     *
211     * @param rep The repetition index (0-indexed)
212     */
213    public TN getPhoneNumber(int rep) { 
214                TN retVal = this.getTypedField(5, rep);
215                return retVal;
216    }
217
218    /**
219     * Returns a specific repetition of
220     * NK1-5: "Phone Number" - creates it if necessary
221     *
222     * @param rep The repetition index (0-indexed)
223     */
224    public TN getNk15_PhoneNumber(int rep) { 
225                TN retVal = this.getTypedField(5, rep);
226                return retVal;
227    }
228
229    /**
230     * Returns a count of the current number of repetitions of Phone Number (NK1-5).
231     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
232     * it will return zero.
233     */
234    public int getNk15_PhoneNumberReps() {
235        return this.getReps(5);
236    }
237
238
239    /**
240     * Inserts a repetition of
241     * NK1-5: "Phone Number" at a specific index
242     *
243     * @param rep The repetition index (0-indexed)
244     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
245     */
246    public TN insertPhoneNumber(int rep) throws HL7Exception { 
247        return (TN) super.insertRepetition(5, rep);
248    }
249
250
251    /**
252     * Inserts a repetition of
253     * NK1-5: "Phone Number" at a specific index
254     *
255     * @param rep The repetition index (0-indexed)
256     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
257     */
258    public TN insertNk15_PhoneNumber(int rep) throws HL7Exception { 
259        return (TN) super.insertRepetition(5, rep);
260    }
261
262
263    /**
264     * Removes a repetition of
265     * NK1-5: "Phone Number" at a specific index
266     *
267     * @param rep The repetition index (0-indexed)
268     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
269     */
270    public TN removePhoneNumber(int rep) throws HL7Exception { 
271        return (TN) super.removeRepetition(5, rep);
272    }
273
274
275    /**
276     * Removes a repetition of
277     * NK1-5: "Phone Number" at a specific index
278     *
279     * @param rep The repetition index (0-indexed)
280     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
281     */
282    public TN removeNk15_PhoneNumber(int rep) throws HL7Exception { 
283        return (TN) super.removeRepetition(5, rep);
284    }
285
286
287
288
289    /**
290     * Returns
291     * NK1-6: "Business Phone Number" - creates it if necessary
292     */
293    public TN getBusinessPhoneNumber() { 
294                TN retVal = this.getTypedField(6, 0);
295                return retVal;
296    }
297    
298    /**
299     * Returns
300     * NK1-6: "Business Phone Number" - creates it if necessary
301     */
302    public TN getNk16_BusinessPhoneNumber() { 
303                TN retVal = this.getTypedField(6, 0);
304                return retVal;
305    }
306
307
308
309    /**
310     * Returns
311     * NK1-7: "Contact Role" - creates it if necessary
312     */
313    public CE getContactRole() { 
314                CE retVal = this.getTypedField(7, 0);
315                return retVal;
316    }
317    
318    /**
319     * Returns
320     * NK1-7: "Contact Role" - creates it if necessary
321     */
322    public CE getNk17_ContactRole() { 
323                CE retVal = this.getTypedField(7, 0);
324                return retVal;
325    }
326
327
328
329    /**
330     * Returns
331     * NK1-8: "Start Date" - creates it if necessary
332     */
333    public DT getStartDate() { 
334                DT retVal = this.getTypedField(8, 0);
335                return retVal;
336    }
337    
338    /**
339     * Returns
340     * NK1-8: "Start Date" - creates it if necessary
341     */
342    public DT getNk18_StartDate() { 
343                DT retVal = this.getTypedField(8, 0);
344                return retVal;
345    }
346
347
348
349    /**
350     * Returns
351     * NK1-9: "End Date" - creates it if necessary
352     */
353    public DT getEndDate() { 
354                DT retVal = this.getTypedField(9, 0);
355                return retVal;
356    }
357    
358    /**
359     * Returns
360     * NK1-9: "End Date" - creates it if necessary
361     */
362    public DT getNk19_EndDate() { 
363                DT retVal = this.getTypedField(9, 0);
364                return retVal;
365    }
366
367
368
369    /**
370     * Returns
371     * NK1-10: "Next of Kin" - creates it if necessary
372     */
373    public ST getNextOfKin() { 
374                ST retVal = this.getTypedField(10, 0);
375                return retVal;
376    }
377    
378    /**
379     * Returns
380     * NK1-10: "Next of Kin" - creates it if necessary
381     */
382    public ST getNk110_NextOfKin() { 
383                ST retVal = this.getTypedField(10, 0);
384                return retVal;
385    }
386
387
388
389    /**
390     * Returns
391     * NK1-11: "Next of kin job code / class" - creates it if necessary
392     */
393    public CM_JOB_CODE getNextOfKinJobCodeClass() { 
394                CM_JOB_CODE retVal = this.getTypedField(11, 0);
395                return retVal;
396    }
397    
398    /**
399     * Returns
400     * NK1-11: "Next of kin job code / class" - creates it if necessary
401     */
402    public CM_JOB_CODE getNk111_NextOfKinJobCodeClass() { 
403                CM_JOB_CODE retVal = this.getTypedField(11, 0);
404                return retVal;
405    }
406
407
408
409    /**
410     * Returns
411     * NK1-12: "Next of Kin Employee Number" - creates it if necessary
412     */
413    public ST getNextOfKinEmployeeNumber() { 
414                ST retVal = this.getTypedField(12, 0);
415                return retVal;
416    }
417    
418    /**
419     * Returns
420     * NK1-12: "Next of Kin Employee Number" - creates it if necessary
421     */
422    public ST getNk112_NextOfKinEmployeeNumber() { 
423                ST retVal = this.getTypedField(12, 0);
424                return retVal;
425    }
426
427
428
429    /**
430     * Returns
431     * NK1-13: "Organization Name" - creates it if necessary
432     */
433    public ST getOrganizationName() { 
434                ST retVal = this.getTypedField(13, 0);
435                return retVal;
436    }
437    
438    /**
439     * Returns
440     * NK1-13: "Organization Name" - creates it if necessary
441     */
442    public ST getNk113_OrganizationName() { 
443                ST retVal = this.getTypedField(13, 0);
444                return retVal;
445    }
446
447
448
449
450
451    /** {@inheritDoc} */   
452    protected Type createNewTypeWithoutReflection(int field) {
453       switch (field) {
454          case 0: return new SI(getMessage());
455          case 1: return new PN(getMessage());
456          case 2: return new CE(getMessage());
457          case 3: return new AD(getMessage());
458          case 4: return new TN(getMessage());
459          case 5: return new TN(getMessage());
460          case 6: return new CE(getMessage());
461          case 7: return new DT(getMessage());
462          case 8: return new DT(getMessage());
463          case 9: return new ST(getMessage());
464          case 10: return new CM_JOB_CODE(getMessage());
465          case 11: return new ST(getMessage());
466          case 12: return new ST(getMessage());
467          default: return null;
468       }
469   }
470
471
472}
473