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