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.v23.segment; 035 036// import ca.uhn.hl7v2.model.v23.group.*; 037import ca.uhn.hl7v2.model.v23.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 PD1 message segment (Patient Demographic). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>PD1-1: Living Dependency (IS) <b>optional </b> 052 * <li>PD1-2: Living Arrangement (IS) <b>optional </b> 053 * <li>PD1-3: Patient Primary Facility (XON) <b>optional repeating</b> 054 * <li>PD1-4: Patient Primary Care Provider Name & ID No. (XCN) <b>optional repeating</b> 055 * <li>PD1-5: Student Indicator (IS) <b>optional </b> 056 * <li>PD1-6: Handicap (IS) <b>optional </b> 057 * <li>PD1-7: Living Will (IS) <b>optional </b> 058 * <li>PD1-8: Organ Donor (IS) <b>optional </b> 059 * <li>PD1-9: Separate Bill (ID) <b>optional </b> 060 * <li>PD1-10: Duplicate Patient (CX) <b>optional repeating</b> 061 * <li>PD1-11: Publicity Indicator (CE) <b>optional </b> 062 * <li>PD1-12: Protection Indicator (ID) <b>optional </b> 063 * </ul> 064 */ 065@SuppressWarnings("unused") 066public class PD1 extends AbstractSegment { 067 068 /** 069 * Creates a new PD1 segment 070 */ 071 public PD1(Group parent, ModelClassFactory factory) { 072 super(parent, factory); 073 init(factory); 074 } 075 076 private void init(ModelClassFactory factory) { 077 try { 078 this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(223) }, "Living Dependency"); 079 this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(220) }, "Living Arrangement"); 080 this.add(XON.class, false, 0, 90, new Object[]{ getMessage() }, "Patient Primary Facility"); 081 this.add(XCN.class, false, 0, 90, new Object[]{ getMessage() }, "Patient Primary Care Provider Name & ID No."); 082 this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(231) }, "Student Indicator"); 083 this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(310) }, "Handicap"); 084 this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(315) }, "Living Will"); 085 this.add(IS.class, false, 1, 2, new Object[]{ getMessage(), new Integer(316) }, "Organ Donor"); 086 this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(136) }, "Separate Bill"); 087 this.add(CX.class, false, 0, 2, new Object[]{ getMessage() }, "Duplicate Patient"); 088 this.add(CE.class, false, 1, 1, new Object[]{ getMessage() }, "Publicity Indicator"); 089 this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(136) }, "Protection Indicator"); 090 } catch(HL7Exception e) { 091 log.error("Unexpected error creating PD1 - this is probably a bug in the source code generator.", e); 092 } 093 } 094 095 096 097 /** 098 * Returns 099 * PD1-1: "Living Dependency" - creates it if necessary 100 */ 101 public IS getLivingDependency() { 102 IS retVal = this.getTypedField(1, 0); 103 return retVal; 104 } 105 106 /** 107 * Returns 108 * PD1-1: "Living Dependency" - creates it if necessary 109 */ 110 public IS getPd11_LivingDependency() { 111 IS retVal = this.getTypedField(1, 0); 112 return retVal; 113 } 114 115 116 117 /** 118 * Returns 119 * PD1-2: "Living Arrangement" - creates it if necessary 120 */ 121 public IS getLivingArrangement() { 122 IS retVal = this.getTypedField(2, 0); 123 return retVal; 124 } 125 126 /** 127 * Returns 128 * PD1-2: "Living Arrangement" - creates it if necessary 129 */ 130 public IS getPd12_LivingArrangement() { 131 IS retVal = this.getTypedField(2, 0); 132 return retVal; 133 } 134 135 136 /** 137 * Returns all repetitions of Patient Primary Facility (PD1-3). 138 */ 139 public XON[] getPatientPrimaryFacility() { 140 XON[] retVal = this.getTypedField(3, new XON[0]); 141 return retVal; 142 } 143 144 145 /** 146 * Returns all repetitions of Patient Primary Facility (PD1-3). 147 */ 148 public XON[] getPd13_PatientPrimaryFacility() { 149 XON[] retVal = this.getTypedField(3, new XON[0]); 150 return retVal; 151 } 152 153 154 /** 155 * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3). 156 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 157 * it will return zero. 158 */ 159 public int getPatientPrimaryFacilityReps() { 160 return this.getReps(3); 161 } 162 163 164 /** 165 * Returns a specific repetition of 166 * PD1-3: "Patient Primary Facility" - creates it if necessary 167 * 168 * @param rep The repetition index (0-indexed) 169 */ 170 public XON getPatientPrimaryFacility(int rep) { 171 XON retVal = this.getTypedField(3, rep); 172 return retVal; 173 } 174 175 /** 176 * Returns a specific repetition of 177 * PD1-3: "Patient Primary Facility" - creates it if necessary 178 * 179 * @param rep The repetition index (0-indexed) 180 */ 181 public XON getPd13_PatientPrimaryFacility(int rep) { 182 XON retVal = this.getTypedField(3, rep); 183 return retVal; 184 } 185 186 /** 187 * Returns a count of the current number of repetitions of Patient Primary Facility (PD1-3). 188 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 189 * it will return zero. 190 */ 191 public int getPd13_PatientPrimaryFacilityReps() { 192 return this.getReps(3); 193 } 194 195 196 /** 197 * Inserts a repetition of 198 * PD1-3: "Patient Primary Facility" at a specific index 199 * 200 * @param rep The repetition index (0-indexed) 201 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 202 */ 203 public XON insertPatientPrimaryFacility(int rep) throws HL7Exception { 204 return (XON) super.insertRepetition(3, rep); 205 } 206 207 208 /** 209 * Inserts a repetition of 210 * PD1-3: "Patient Primary Facility" at a specific index 211 * 212 * @param rep The repetition index (0-indexed) 213 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 214 */ 215 public XON insertPd13_PatientPrimaryFacility(int rep) throws HL7Exception { 216 return (XON) super.insertRepetition(3, rep); 217 } 218 219 220 /** 221 * Removes a repetition of 222 * PD1-3: "Patient Primary Facility" at a specific index 223 * 224 * @param rep The repetition index (0-indexed) 225 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 226 */ 227 public XON removePatientPrimaryFacility(int rep) throws HL7Exception { 228 return (XON) super.removeRepetition(3, rep); 229 } 230 231 232 /** 233 * Removes a repetition of 234 * PD1-3: "Patient Primary Facility" at a specific index 235 * 236 * @param rep The repetition index (0-indexed) 237 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 238 */ 239 public XON removePd13_PatientPrimaryFacility(int rep) throws HL7Exception { 240 return (XON) super.removeRepetition(3, rep); 241 } 242 243 244 245 /** 246 * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4). 247 */ 248 public XCN[] getPatientPrimaryCareProviderNameIDNo() { 249 XCN[] retVal = this.getTypedField(4, new XCN[0]); 250 return retVal; 251 } 252 253 254 /** 255 * Returns all repetitions of Patient Primary Care Provider Name & ID No. (PD1-4). 256 */ 257 public XCN[] getPd14_PatientPrimaryCareProviderNameIDNo() { 258 XCN[] retVal = this.getTypedField(4, new XCN[0]); 259 return retVal; 260 } 261 262 263 /** 264 * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4). 265 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 266 * it will return zero. 267 */ 268 public int getPatientPrimaryCareProviderNameIDNoReps() { 269 return this.getReps(4); 270 } 271 272 273 /** 274 * Returns a specific repetition of 275 * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary 276 * 277 * @param rep The repetition index (0-indexed) 278 */ 279 public XCN getPatientPrimaryCareProviderNameIDNo(int rep) { 280 XCN retVal = this.getTypedField(4, rep); 281 return retVal; 282 } 283 284 /** 285 * Returns a specific repetition of 286 * PD1-4: "Patient Primary Care Provider Name & ID No." - creates it if necessary 287 * 288 * @param rep The repetition index (0-indexed) 289 */ 290 public XCN getPd14_PatientPrimaryCareProviderNameIDNo(int rep) { 291 XCN retVal = this.getTypedField(4, rep); 292 return retVal; 293 } 294 295 /** 296 * Returns a count of the current number of repetitions of Patient Primary Care Provider Name & ID No. (PD1-4). 297 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 298 * it will return zero. 299 */ 300 public int getPd14_PatientPrimaryCareProviderNameIDNoReps() { 301 return this.getReps(4); 302 } 303 304 305 /** 306 * Inserts a repetition of 307 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index 308 * 309 * @param rep The repetition index (0-indexed) 310 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 311 */ 312 public XCN insertPatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 313 return (XCN) super.insertRepetition(4, rep); 314 } 315 316 317 /** 318 * Inserts a repetition of 319 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index 320 * 321 * @param rep The repetition index (0-indexed) 322 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 323 */ 324 public XCN insertPd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 325 return (XCN) super.insertRepetition(4, rep); 326 } 327 328 329 /** 330 * Removes a repetition of 331 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index 332 * 333 * @param rep The repetition index (0-indexed) 334 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 335 */ 336 public XCN removePatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 337 return (XCN) super.removeRepetition(4, rep); 338 } 339 340 341 /** 342 * Removes a repetition of 343 * PD1-4: "Patient Primary Care Provider Name & ID No." at a specific index 344 * 345 * @param rep The repetition index (0-indexed) 346 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 347 */ 348 public XCN removePd14_PatientPrimaryCareProviderNameIDNo(int rep) throws HL7Exception { 349 return (XCN) super.removeRepetition(4, rep); 350 } 351 352 353 354 355 /** 356 * Returns 357 * PD1-5: "Student Indicator" - creates it if necessary 358 */ 359 public IS getStudentIndicator() { 360 IS retVal = this.getTypedField(5, 0); 361 return retVal; 362 } 363 364 /** 365 * Returns 366 * PD1-5: "Student Indicator" - creates it if necessary 367 */ 368 public IS getPd15_StudentIndicator() { 369 IS retVal = this.getTypedField(5, 0); 370 return retVal; 371 } 372 373 374 375 /** 376 * Returns 377 * PD1-6: "Handicap" - creates it if necessary 378 */ 379 public IS getHandicap() { 380 IS retVal = this.getTypedField(6, 0); 381 return retVal; 382 } 383 384 /** 385 * Returns 386 * PD1-6: "Handicap" - creates it if necessary 387 */ 388 public IS getPd16_Handicap() { 389 IS retVal = this.getTypedField(6, 0); 390 return retVal; 391 } 392 393 394 395 /** 396 * Returns 397 * PD1-7: "Living Will" - creates it if necessary 398 */ 399 public IS getLivingWill() { 400 IS retVal = this.getTypedField(7, 0); 401 return retVal; 402 } 403 404 /** 405 * Returns 406 * PD1-7: "Living Will" - creates it if necessary 407 */ 408 public IS getPd17_LivingWill() { 409 IS retVal = this.getTypedField(7, 0); 410 return retVal; 411 } 412 413 414 415 /** 416 * Returns 417 * PD1-8: "Organ Donor" - creates it if necessary 418 */ 419 public IS getOrganDonor() { 420 IS retVal = this.getTypedField(8, 0); 421 return retVal; 422 } 423 424 /** 425 * Returns 426 * PD1-8: "Organ Donor" - creates it if necessary 427 */ 428 public IS getPd18_OrganDonor() { 429 IS retVal = this.getTypedField(8, 0); 430 return retVal; 431 } 432 433 434 435 /** 436 * Returns 437 * PD1-9: "Separate Bill" - creates it if necessary 438 */ 439 public ID getSeparateBill() { 440 ID retVal = this.getTypedField(9, 0); 441 return retVal; 442 } 443 444 /** 445 * Returns 446 * PD1-9: "Separate Bill" - creates it if necessary 447 */ 448 public ID getPd19_SeparateBill() { 449 ID retVal = this.getTypedField(9, 0); 450 return retVal; 451 } 452 453 454 /** 455 * Returns all repetitions of Duplicate Patient (PD1-10). 456 */ 457 public CX[] getDuplicatePatient() { 458 CX[] retVal = this.getTypedField(10, new CX[0]); 459 return retVal; 460 } 461 462 463 /** 464 * Returns all repetitions of Duplicate Patient (PD1-10). 465 */ 466 public CX[] getPd110_DuplicatePatient() { 467 CX[] retVal = this.getTypedField(10, new CX[0]); 468 return retVal; 469 } 470 471 472 /** 473 * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10). 474 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 475 * it will return zero. 476 */ 477 public int getDuplicatePatientReps() { 478 return this.getReps(10); 479 } 480 481 482 /** 483 * Returns a specific repetition of 484 * PD1-10: "Duplicate Patient" - creates it if necessary 485 * 486 * @param rep The repetition index (0-indexed) 487 */ 488 public CX getDuplicatePatient(int rep) { 489 CX retVal = this.getTypedField(10, rep); 490 return retVal; 491 } 492 493 /** 494 * Returns a specific repetition of 495 * PD1-10: "Duplicate Patient" - creates it if necessary 496 * 497 * @param rep The repetition index (0-indexed) 498 */ 499 public CX getPd110_DuplicatePatient(int rep) { 500 CX retVal = this.getTypedField(10, rep); 501 return retVal; 502 } 503 504 /** 505 * Returns a count of the current number of repetitions of Duplicate Patient (PD1-10). 506 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 507 * it will return zero. 508 */ 509 public int getPd110_DuplicatePatientReps() { 510 return this.getReps(10); 511 } 512 513 514 /** 515 * Inserts a repetition of 516 * PD1-10: "Duplicate Patient" at a specific index 517 * 518 * @param rep The repetition index (0-indexed) 519 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 520 */ 521 public CX insertDuplicatePatient(int rep) throws HL7Exception { 522 return (CX) super.insertRepetition(10, rep); 523 } 524 525 526 /** 527 * Inserts a repetition of 528 * PD1-10: "Duplicate Patient" at a specific index 529 * 530 * @param rep The repetition index (0-indexed) 531 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 532 */ 533 public CX insertPd110_DuplicatePatient(int rep) throws HL7Exception { 534 return (CX) super.insertRepetition(10, rep); 535 } 536 537 538 /** 539 * Removes a repetition of 540 * PD1-10: "Duplicate Patient" at a specific index 541 * 542 * @param rep The repetition index (0-indexed) 543 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 544 */ 545 public CX removeDuplicatePatient(int rep) throws HL7Exception { 546 return (CX) super.removeRepetition(10, rep); 547 } 548 549 550 /** 551 * Removes a repetition of 552 * PD1-10: "Duplicate Patient" at a specific index 553 * 554 * @param rep The repetition index (0-indexed) 555 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 556 */ 557 public CX removePd110_DuplicatePatient(int rep) throws HL7Exception { 558 return (CX) super.removeRepetition(10, rep); 559 } 560 561 562 563 564 /** 565 * Returns 566 * PD1-11: "Publicity Indicator" - creates it if necessary 567 */ 568 public CE getPublicityIndicator() { 569 CE retVal = this.getTypedField(11, 0); 570 return retVal; 571 } 572 573 /** 574 * Returns 575 * PD1-11: "Publicity Indicator" - creates it if necessary 576 */ 577 public CE getPd111_PublicityIndicator() { 578 CE retVal = this.getTypedField(11, 0); 579 return retVal; 580 } 581 582 583 584 /** 585 * Returns 586 * PD1-12: "Protection Indicator" - creates it if necessary 587 */ 588 public ID getProtectionIndicator() { 589 ID retVal = this.getTypedField(12, 0); 590 return retVal; 591 } 592 593 /** 594 * Returns 595 * PD1-12: "Protection Indicator" - creates it if necessary 596 */ 597 public ID getPd112_ProtectionIndicator() { 598 ID retVal = this.getTypedField(12, 0); 599 return retVal; 600 } 601 602 603 604 605 606 /** {@inheritDoc} */ 607 protected Type createNewTypeWithoutReflection(int field) { 608 switch (field) { 609 case 0: return new IS(getMessage(), new Integer( 223 )); 610 case 1: return new IS(getMessage(), new Integer( 220 )); 611 case 2: return new XON(getMessage()); 612 case 3: return new XCN(getMessage()); 613 case 4: return new IS(getMessage(), new Integer( 231 )); 614 case 5: return new IS(getMessage(), new Integer( 310 )); 615 case 6: return new IS(getMessage(), new Integer( 315 )); 616 case 7: return new IS(getMessage(), new Integer( 316 )); 617 case 8: return new ID(getMessage(), new Integer( 136 )); 618 case 9: return new CX(getMessage()); 619 case 10: return new CE(getMessage()); 620 case 11: return new ID(getMessage(), new Integer( 136 )); 621 default: return null; 622 } 623 } 624 625 626} 627