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