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.v26.segment; 035 036// import ca.uhn.hl7v2.model.v26.group.*; 037import ca.uhn.hl7v2.model.v26.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 MRG message segment (Merge Patient Information). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>MRG-1: Prior Patient Identifier List (CX) <b> repeating</b> 052 * <li>MRG-2: Prior Alternate Patient ID (CX) <b>optional repeating</b> 053 * <li>MRG-3: Prior Patient Account Number (CX) <b>optional </b> 054 * <li>MRG-4: Prior Patient ID (CX) <b>optional </b> 055 * <li>MRG-5: Prior Visit Number (CX) <b>optional </b> 056 * <li>MRG-6: Prior Alternate Visit ID (CX) <b>optional </b> 057 * <li>MRG-7: Prior Patient Name (XPN) <b>optional repeating</b> 058 * </ul> 059 */ 060@SuppressWarnings("unused") 061public class MRG extends AbstractSegment { 062 063 /** 064 * Creates a new MRG segment 065 */ 066 public MRG(Group parent, ModelClassFactory factory) { 067 super(parent, factory); 068 init(factory); 069 } 070 071 private void init(ModelClassFactory factory) { 072 try { 073 this.add(CX.class, true, 0, 250, new Object[]{ getMessage() }, "Prior Patient Identifier List"); 074 this.add(CX.class, false, 0, 0, new Object[]{ getMessage() }, "Prior Alternate Patient ID"); 075 this.add(CX.class, false, 1, 250, new Object[]{ getMessage() }, "Prior Patient Account Number"); 076 this.add(CX.class, false, 1, 0, new Object[]{ getMessage() }, "Prior Patient ID"); 077 this.add(CX.class, false, 1, 250, new Object[]{ getMessage() }, "Prior Visit Number"); 078 this.add(CX.class, false, 1, 250, new Object[]{ getMessage() }, "Prior Alternate Visit ID"); 079 this.add(XPN.class, false, 0, 250, new Object[]{ getMessage() }, "Prior Patient Name"); 080 } catch(HL7Exception e) { 081 log.error("Unexpected error creating MRG - this is probably a bug in the source code generator.", e); 082 } 083 } 084 085 086 /** 087 * Returns all repetitions of Prior Patient Identifier List (MRG-1). 088 */ 089 public CX[] getPriorPatientIdentifierList() { 090 CX[] retVal = this.getTypedField(1, new CX[0]); 091 return retVal; 092 } 093 094 095 /** 096 * Returns all repetitions of Prior Patient Identifier List (MRG-1). 097 */ 098 public CX[] getMrg1_PriorPatientIdentifierList() { 099 CX[] retVal = this.getTypedField(1, new CX[0]); 100 return retVal; 101 } 102 103 104 /** 105 * Returns a count of the current number of repetitions of Prior Patient Identifier List (MRG-1). 106 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 107 * it will return zero. 108 */ 109 public int getPriorPatientIdentifierListReps() { 110 return this.getReps(1); 111 } 112 113 114 /** 115 * Returns a specific repetition of 116 * MRG-1: "Prior Patient Identifier List" - creates it if necessary 117 * 118 * @param rep The repetition index (0-indexed) 119 */ 120 public CX getPriorPatientIdentifierList(int rep) { 121 CX retVal = this.getTypedField(1, rep); 122 return retVal; 123 } 124 125 /** 126 * Returns a specific repetition of 127 * MRG-1: "Prior Patient Identifier List" - creates it if necessary 128 * 129 * @param rep The repetition index (0-indexed) 130 */ 131 public CX getMrg1_PriorPatientIdentifierList(int rep) { 132 CX retVal = this.getTypedField(1, rep); 133 return retVal; 134 } 135 136 /** 137 * Returns a count of the current number of repetitions of Prior Patient Identifier List (MRG-1). 138 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 139 * it will return zero. 140 */ 141 public int getMrg1_PriorPatientIdentifierListReps() { 142 return this.getReps(1); 143 } 144 145 146 /** 147 * Inserts a repetition of 148 * MRG-1: "Prior Patient Identifier List" at a specific index 149 * 150 * @param rep The repetition index (0-indexed) 151 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 152 */ 153 public CX insertPriorPatientIdentifierList(int rep) throws HL7Exception { 154 return (CX) super.insertRepetition(1, rep); 155 } 156 157 158 /** 159 * Inserts a repetition of 160 * MRG-1: "Prior Patient Identifier List" at a specific index 161 * 162 * @param rep The repetition index (0-indexed) 163 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 164 */ 165 public CX insertMrg1_PriorPatientIdentifierList(int rep) throws HL7Exception { 166 return (CX) super.insertRepetition(1, rep); 167 } 168 169 170 /** 171 * Removes a repetition of 172 * MRG-1: "Prior Patient Identifier List" at a specific index 173 * 174 * @param rep The repetition index (0-indexed) 175 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 176 */ 177 public CX removePriorPatientIdentifierList(int rep) throws HL7Exception { 178 return (CX) super.removeRepetition(1, rep); 179 } 180 181 182 /** 183 * Removes a repetition of 184 * MRG-1: "Prior Patient Identifier List" at a specific index 185 * 186 * @param rep The repetition index (0-indexed) 187 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 188 */ 189 public CX removeMrg1_PriorPatientIdentifierList(int rep) throws HL7Exception { 190 return (CX) super.removeRepetition(1, rep); 191 } 192 193 194 195 /** 196 * Returns all repetitions of Prior Alternate Patient ID (MRG-2). 197 */ 198 public CX[] getPriorAlternatePatientID() { 199 CX[] retVal = this.getTypedField(2, new CX[0]); 200 return retVal; 201 } 202 203 204 /** 205 * Returns all repetitions of Prior Alternate Patient ID (MRG-2). 206 */ 207 public CX[] getMrg2_PriorAlternatePatientID() { 208 CX[] retVal = this.getTypedField(2, new CX[0]); 209 return retVal; 210 } 211 212 213 /** 214 * Returns a count of the current number of repetitions of Prior Alternate Patient ID (MRG-2). 215 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 216 * it will return zero. 217 */ 218 public int getPriorAlternatePatientIDReps() { 219 return this.getReps(2); 220 } 221 222 223 /** 224 * Returns a specific repetition of 225 * MRG-2: "Prior Alternate Patient ID" - creates it if necessary 226 * 227 * @param rep The repetition index (0-indexed) 228 */ 229 public CX getPriorAlternatePatientID(int rep) { 230 CX retVal = this.getTypedField(2, rep); 231 return retVal; 232 } 233 234 /** 235 * Returns a specific repetition of 236 * MRG-2: "Prior Alternate Patient ID" - creates it if necessary 237 * 238 * @param rep The repetition index (0-indexed) 239 */ 240 public CX getMrg2_PriorAlternatePatientID(int rep) { 241 CX retVal = this.getTypedField(2, rep); 242 return retVal; 243 } 244 245 /** 246 * Returns a count of the current number of repetitions of Prior Alternate Patient ID (MRG-2). 247 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 248 * it will return zero. 249 */ 250 public int getMrg2_PriorAlternatePatientIDReps() { 251 return this.getReps(2); 252 } 253 254 255 /** 256 * Inserts a repetition of 257 * MRG-2: "Prior Alternate Patient ID" at a specific index 258 * 259 * @param rep The repetition index (0-indexed) 260 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 261 */ 262 public CX insertPriorAlternatePatientID(int rep) throws HL7Exception { 263 return (CX) super.insertRepetition(2, rep); 264 } 265 266 267 /** 268 * Inserts a repetition of 269 * MRG-2: "Prior Alternate Patient ID" at a specific index 270 * 271 * @param rep The repetition index (0-indexed) 272 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 273 */ 274 public CX insertMrg2_PriorAlternatePatientID(int rep) throws HL7Exception { 275 return (CX) super.insertRepetition(2, rep); 276 } 277 278 279 /** 280 * Removes a repetition of 281 * MRG-2: "Prior Alternate Patient ID" at a specific index 282 * 283 * @param rep The repetition index (0-indexed) 284 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 285 */ 286 public CX removePriorAlternatePatientID(int rep) throws HL7Exception { 287 return (CX) super.removeRepetition(2, rep); 288 } 289 290 291 /** 292 * Removes a repetition of 293 * MRG-2: "Prior Alternate Patient ID" at a specific index 294 * 295 * @param rep The repetition index (0-indexed) 296 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 297 */ 298 public CX removeMrg2_PriorAlternatePatientID(int rep) throws HL7Exception { 299 return (CX) super.removeRepetition(2, rep); 300 } 301 302 303 304 305 /** 306 * Returns 307 * MRG-3: "Prior Patient Account Number" - creates it if necessary 308 */ 309 public CX getPriorPatientAccountNumber() { 310 CX retVal = this.getTypedField(3, 0); 311 return retVal; 312 } 313 314 /** 315 * Returns 316 * MRG-3: "Prior Patient Account Number" - creates it if necessary 317 */ 318 public CX getMrg3_PriorPatientAccountNumber() { 319 CX retVal = this.getTypedField(3, 0); 320 return retVal; 321 } 322 323 324 325 /** 326 * Returns 327 * MRG-4: "Prior Patient ID" - creates it if necessary 328 */ 329 public CX getPriorPatientID() { 330 CX retVal = this.getTypedField(4, 0); 331 return retVal; 332 } 333 334 /** 335 * Returns 336 * MRG-4: "Prior Patient ID" - creates it if necessary 337 */ 338 public CX getMrg4_PriorPatientID() { 339 CX retVal = this.getTypedField(4, 0); 340 return retVal; 341 } 342 343 344 345 /** 346 * Returns 347 * MRG-5: "Prior Visit Number" - creates it if necessary 348 */ 349 public CX getPriorVisitNumber() { 350 CX retVal = this.getTypedField(5, 0); 351 return retVal; 352 } 353 354 /** 355 * Returns 356 * MRG-5: "Prior Visit Number" - creates it if necessary 357 */ 358 public CX getMrg5_PriorVisitNumber() { 359 CX retVal = this.getTypedField(5, 0); 360 return retVal; 361 } 362 363 364 365 /** 366 * Returns 367 * MRG-6: "Prior Alternate Visit ID" - creates it if necessary 368 */ 369 public CX getPriorAlternateVisitID() { 370 CX retVal = this.getTypedField(6, 0); 371 return retVal; 372 } 373 374 /** 375 * Returns 376 * MRG-6: "Prior Alternate Visit ID" - creates it if necessary 377 */ 378 public CX getMrg6_PriorAlternateVisitID() { 379 CX retVal = this.getTypedField(6, 0); 380 return retVal; 381 } 382 383 384 /** 385 * Returns all repetitions of Prior Patient Name (MRG-7). 386 */ 387 public XPN[] getPriorPatientName() { 388 XPN[] retVal = this.getTypedField(7, new XPN[0]); 389 return retVal; 390 } 391 392 393 /** 394 * Returns all repetitions of Prior Patient Name (MRG-7). 395 */ 396 public XPN[] getMrg7_PriorPatientName() { 397 XPN[] retVal = this.getTypedField(7, new XPN[0]); 398 return retVal; 399 } 400 401 402 /** 403 * Returns a count of the current number of repetitions of Prior Patient Name (MRG-7). 404 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 405 * it will return zero. 406 */ 407 public int getPriorPatientNameReps() { 408 return this.getReps(7); 409 } 410 411 412 /** 413 * Returns a specific repetition of 414 * MRG-7: "Prior Patient Name" - creates it if necessary 415 * 416 * @param rep The repetition index (0-indexed) 417 */ 418 public XPN getPriorPatientName(int rep) { 419 XPN retVal = this.getTypedField(7, rep); 420 return retVal; 421 } 422 423 /** 424 * Returns a specific repetition of 425 * MRG-7: "Prior Patient Name" - creates it if necessary 426 * 427 * @param rep The repetition index (0-indexed) 428 */ 429 public XPN getMrg7_PriorPatientName(int rep) { 430 XPN retVal = this.getTypedField(7, rep); 431 return retVal; 432 } 433 434 /** 435 * Returns a count of the current number of repetitions of Prior Patient Name (MRG-7). 436 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 437 * it will return zero. 438 */ 439 public int getMrg7_PriorPatientNameReps() { 440 return this.getReps(7); 441 } 442 443 444 /** 445 * Inserts a repetition of 446 * MRG-7: "Prior Patient Name" at a specific index 447 * 448 * @param rep The repetition index (0-indexed) 449 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 450 */ 451 public XPN insertPriorPatientName(int rep) throws HL7Exception { 452 return (XPN) super.insertRepetition(7, rep); 453 } 454 455 456 /** 457 * Inserts a repetition of 458 * MRG-7: "Prior Patient Name" at a specific index 459 * 460 * @param rep The repetition index (0-indexed) 461 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 462 */ 463 public XPN insertMrg7_PriorPatientName(int rep) throws HL7Exception { 464 return (XPN) super.insertRepetition(7, rep); 465 } 466 467 468 /** 469 * Removes a repetition of 470 * MRG-7: "Prior Patient Name" at a specific index 471 * 472 * @param rep The repetition index (0-indexed) 473 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 474 */ 475 public XPN removePriorPatientName(int rep) throws HL7Exception { 476 return (XPN) super.removeRepetition(7, rep); 477 } 478 479 480 /** 481 * Removes a repetition of 482 * MRG-7: "Prior Patient Name" at a specific index 483 * 484 * @param rep The repetition index (0-indexed) 485 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 486 */ 487 public XPN removeMrg7_PriorPatientName(int rep) throws HL7Exception { 488 return (XPN) super.removeRepetition(7, rep); 489 } 490 491 492 493 494 495 496 /** {@inheritDoc} */ 497 protected Type createNewTypeWithoutReflection(int field) { 498 switch (field) { 499 case 0: return new CX(getMessage()); 500 case 1: return new CX(getMessage()); 501 case 2: return new CX(getMessage()); 502 case 3: return new CX(getMessage()); 503 case 4: return new CX(getMessage()); 504 case 5: return new CX(getMessage()); 505 case 6: return new XPN(getMessage()); 506 default: return null; 507 } 508 } 509 510 511} 512