1 /* 2 * This class is an auto-generated source file for a HAPI 3 * HL7 v2.x standard structure class. 4 * 5 * For more information, visit: http://hl7api.sourceforge.net/ 6 * 7 * The contents of this file are subject to the Mozilla Public License Version 1.1 8 * (the "License"); you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 10 * Software distributed under the License is distributed on an "AS IS" basis, 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 12 * specific language governing rights and limitations under the License. 13 * 14 * The Original Code is "[file_name]". Description: 15 * "[one_line_description]" 16 * 17 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 18 * 2012. All Rights Reserved. 19 * 20 * Contributor(s): ______________________________________. 21 * 22 * Alternatively, the contents of this file may be used under the terms of the 23 * GNU General Public License (the "GPL"), in which case the provisions of the GPL are 24 * applicable instead of those above. If you wish to allow use of your version of this 25 * file only under the terms of the GPL and not to allow others to use your version 26 * of this file under the MPL, indicate your decision by deleting the provisions above 27 * and replace them with the notice and other provisions required by the GPL License. 28 * If you do not delete the provisions above, a recipient may use your version of 29 * this file under either the MPL or the GPL. 30 * 31 */ 32 33 34 package ca.uhn.hl7v2.model.v27.segment; 35 36 // import ca.uhn.hl7v2.model.v27.group.*; 37 import ca.uhn.hl7v2.model.v27.datatype.*; 38 import ca.uhn.hl7v2.HL7Exception; 39 import ca.uhn.hl7v2.parser.ModelClassFactory; 40 import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 41 import ca.uhn.hl7v2.model.AbstractMessage; 42 import ca.uhn.hl7v2.model.Group; 43 import ca.uhn.hl7v2.model.Type; 44 import ca.uhn.hl7v2.model.AbstractSegment; 45 import ca.uhn.hl7v2.model.Varies; 46 47 48 /** 49 *<p>Represents an HL7 MRG message segment (Merge Patient Information). 50 * This segment has the following fields:</p> 51 * <ul> 52 * <li>MRG-1: Prior Patient Identifier List (CX) <b> repeating</b> 53 * <li>MRG-2: Prior Alternate Patient ID (NULLDT) <b>optional </b> 54 * <li>MRG-3: Prior Patient Account Number (CX) <b>optional </b> 55 * <li>MRG-4: Prior Patient ID (NULLDT) <b>optional </b> 56 * <li>MRG-5: Prior Visit Number (CX) <b>optional </b> 57 * <li>MRG-6: Prior Alternate Visit ID (CX) <b>optional </b> 58 * <li>MRG-7: Prior Patient Name (XPN) <b>optional repeating</b> 59 * </ul> 60 */ 61 @SuppressWarnings("unused") 62 public class MRG extends AbstractSegment { 63 64 /** 65 * Creates a new MRG segment 66 */ 67 public MRG(Group parent, ModelClassFactory factory) { 68 super(parent, factory); 69 init(factory); 70 } 71 72 private void init(ModelClassFactory factory) { 73 try { 74 this.add(CX.class, true, 0, 0, new Object[]{ getMessage() }, "Prior Patient Identifier List"); 75 this.add(NULLDT.class, false, 1, 0, new Object[]{ getMessage() }, "Prior Alternate Patient ID"); 76 this.add(CX.class, false, 1, 0, new Object[]{ getMessage() }, "Prior Patient Account Number"); 77 this.add(NULLDT.class, false, 1, 0, new Object[]{ getMessage() }, "Prior Patient ID"); 78 this.add(CX.class, false, 1, 0, new Object[]{ getMessage() }, "Prior Visit Number"); 79 this.add(CX.class, false, 1, 0, new Object[]{ getMessage() }, "Prior Alternate Visit ID"); 80 this.add(XPN.class, false, 0, 0, new Object[]{ getMessage() }, "Prior Patient Name"); 81 } catch(HL7Exception e) { 82 log.error("Unexpected error creating MRG - this is probably a bug in the source code generator.", e); 83 } 84 } 85 86 87 /** 88 * Returns all repetitions of Prior Patient Identifier List (MRG-1). 89 */ 90 public CX[] getPriorPatientIdentifierList() { 91 CX[] retVal = this.getTypedField(1, new CX[0]); 92 return retVal; 93 } 94 95 96 /** 97 * Returns all repetitions of Prior Patient Identifier List (MRG-1). 98 */ 99 public CX[] getMrg1_PriorPatientIdentifierList() { 100 CX[] retVal = this.getTypedField(1, new CX[0]); 101 return retVal; 102 } 103 104 105 /** 106 * Returns a count of the current number of repetitions of Prior Patient Identifier List (MRG-1). 107 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 108 * it will return zero. 109 */ 110 public int getPriorPatientIdentifierListReps() { 111 return this.getReps(1); 112 } 113 114 115 /** 116 * Returns a specific repetition of 117 * MRG-1: "Prior Patient Identifier List" - creates it if necessary 118 * 119 * @param rep The repetition index (0-indexed) 120 */ 121 public CX getPriorPatientIdentifierList(int rep) { 122 CX retVal = this.getTypedField(1, rep); 123 return retVal; 124 } 125 126 /** 127 * Returns a specific repetition of 128 * MRG-1: "Prior Patient Identifier List" - creates it if necessary 129 * 130 * @param rep The repetition index (0-indexed) 131 */ 132 public CX getMrg1_PriorPatientIdentifierList(int rep) { 133 CX retVal = this.getTypedField(1, rep); 134 return retVal; 135 } 136 137 /** 138 * Returns a count of the current number of repetitions of Prior Patient Identifier List (MRG-1). 139 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 140 * it will return zero. 141 */ 142 public int getMrg1_PriorPatientIdentifierListReps() { 143 return this.getReps(1); 144 } 145 146 147 /** 148 * Inserts a repetition of 149 * MRG-1: "Prior Patient Identifier List" at a specific index 150 * 151 * @param rep The repetition index (0-indexed) 152 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 153 */ 154 public CX insertPriorPatientIdentifierList(int rep) throws HL7Exception { 155 return (CX) super.insertRepetition(1, rep); 156 } 157 158 159 /** 160 * Inserts a repetition of 161 * MRG-1: "Prior Patient Identifier List" at a specific index 162 * 163 * @param rep The repetition index (0-indexed) 164 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 165 */ 166 public CX insertMrg1_PriorPatientIdentifierList(int rep) throws HL7Exception { 167 return (CX) super.insertRepetition(1, rep); 168 } 169 170 171 /** 172 * Removes a repetition of 173 * MRG-1: "Prior Patient Identifier List" at a specific index 174 * 175 * @param rep The repetition index (0-indexed) 176 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 177 */ 178 public CX removePriorPatientIdentifierList(int rep) throws HL7Exception { 179 return (CX) super.removeRepetition(1, rep); 180 } 181 182 183 /** 184 * Removes a repetition of 185 * MRG-1: "Prior Patient Identifier List" at a specific index 186 * 187 * @param rep The repetition index (0-indexed) 188 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 189 */ 190 public CX removeMrg1_PriorPatientIdentifierList(int rep) throws HL7Exception { 191 return (CX) super.removeRepetition(1, rep); 192 } 193 194 195 196 197 /** 198 * Returns 199 * MRG-2: "Prior Alternate Patient ID" - creates it if necessary 200 */ 201 public NULLDT getPriorAlternatePatientID() { 202 NULLDT retVal = this.getTypedField(2, 0); 203 return retVal; 204 } 205 206 /** 207 * Returns 208 * MRG-2: "Prior Alternate Patient ID" - creates it if necessary 209 */ 210 public NULLDT getMrg2_PriorAlternatePatientID() { 211 NULLDT retVal = this.getTypedField(2, 0); 212 return retVal; 213 } 214 215 216 217 /** 218 * Returns 219 * MRG-3: "Prior Patient Account Number" - creates it if necessary 220 */ 221 public CX getPriorPatientAccountNumber() { 222 CX retVal = this.getTypedField(3, 0); 223 return retVal; 224 } 225 226 /** 227 * Returns 228 * MRG-3: "Prior Patient Account Number" - creates it if necessary 229 */ 230 public CX getMrg3_PriorPatientAccountNumber() { 231 CX retVal = this.getTypedField(3, 0); 232 return retVal; 233 } 234 235 236 237 /** 238 * Returns 239 * MRG-4: "Prior Patient ID" - creates it if necessary 240 */ 241 public NULLDT getPriorPatientID() { 242 NULLDT retVal = this.getTypedField(4, 0); 243 return retVal; 244 } 245 246 /** 247 * Returns 248 * MRG-4: "Prior Patient ID" - creates it if necessary 249 */ 250 public NULLDT getMrg4_PriorPatientID() { 251 NULLDT retVal = this.getTypedField(4, 0); 252 return retVal; 253 } 254 255 256 257 /** 258 * Returns 259 * MRG-5: "Prior Visit Number" - creates it if necessary 260 */ 261 public CX getPriorVisitNumber() { 262 CX retVal = this.getTypedField(5, 0); 263 return retVal; 264 } 265 266 /** 267 * Returns 268 * MRG-5: "Prior Visit Number" - creates it if necessary 269 */ 270 public CX getMrg5_PriorVisitNumber() { 271 CX retVal = this.getTypedField(5, 0); 272 return retVal; 273 } 274 275 276 277 /** 278 * Returns 279 * MRG-6: "Prior Alternate Visit ID" - creates it if necessary 280 */ 281 public CX getPriorAlternateVisitID() { 282 CX retVal = this.getTypedField(6, 0); 283 return retVal; 284 } 285 286 /** 287 * Returns 288 * MRG-6: "Prior Alternate Visit ID" - creates it if necessary 289 */ 290 public CX getMrg6_PriorAlternateVisitID() { 291 CX retVal = this.getTypedField(6, 0); 292 return retVal; 293 } 294 295 296 /** 297 * Returns all repetitions of Prior Patient Name (MRG-7). 298 */ 299 public XPN[] getPriorPatientName() { 300 XPN[] retVal = this.getTypedField(7, new XPN[0]); 301 return retVal; 302 } 303 304 305 /** 306 * Returns all repetitions of Prior Patient Name (MRG-7). 307 */ 308 public XPN[] getMrg7_PriorPatientName() { 309 XPN[] retVal = this.getTypedField(7, new XPN[0]); 310 return retVal; 311 } 312 313 314 /** 315 * Returns a count of the current number of repetitions of Prior Patient Name (MRG-7). 316 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 317 * it will return zero. 318 */ 319 public int getPriorPatientNameReps() { 320 return this.getReps(7); 321 } 322 323 324 /** 325 * Returns a specific repetition of 326 * MRG-7: "Prior Patient Name" - creates it if necessary 327 * 328 * @param rep The repetition index (0-indexed) 329 */ 330 public XPN getPriorPatientName(int rep) { 331 XPN retVal = this.getTypedField(7, rep); 332 return retVal; 333 } 334 335 /** 336 * Returns a specific repetition of 337 * MRG-7: "Prior Patient Name" - creates it if necessary 338 * 339 * @param rep The repetition index (0-indexed) 340 */ 341 public XPN getMrg7_PriorPatientName(int rep) { 342 XPN retVal = this.getTypedField(7, rep); 343 return retVal; 344 } 345 346 /** 347 * Returns a count of the current number of repetitions of Prior Patient Name (MRG-7). 348 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 349 * it will return zero. 350 */ 351 public int getMrg7_PriorPatientNameReps() { 352 return this.getReps(7); 353 } 354 355 356 /** 357 * Inserts a repetition of 358 * MRG-7: "Prior Patient Name" at a specific index 359 * 360 * @param rep The repetition index (0-indexed) 361 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 362 */ 363 public XPN insertPriorPatientName(int rep) throws HL7Exception { 364 return (XPN) super.insertRepetition(7, rep); 365 } 366 367 368 /** 369 * Inserts a repetition of 370 * MRG-7: "Prior Patient Name" at a specific index 371 * 372 * @param rep The repetition index (0-indexed) 373 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 374 */ 375 public XPN insertMrg7_PriorPatientName(int rep) throws HL7Exception { 376 return (XPN) super.insertRepetition(7, rep); 377 } 378 379 380 /** 381 * Removes a repetition of 382 * MRG-7: "Prior Patient Name" at a specific index 383 * 384 * @param rep The repetition index (0-indexed) 385 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 386 */ 387 public XPN removePriorPatientName(int rep) throws HL7Exception { 388 return (XPN) super.removeRepetition(7, rep); 389 } 390 391 392 /** 393 * Removes a repetition of 394 * MRG-7: "Prior Patient Name" at a specific index 395 * 396 * @param rep The repetition index (0-indexed) 397 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 398 */ 399 public XPN removeMrg7_PriorPatientName(int rep) throws HL7Exception { 400 return (XPN) super.removeRepetition(7, rep); 401 } 402 403 404 405 406 407 408 /** {@inheritDoc} */ 409 protected Type createNewTypeWithoutReflection(int field) { 410 switch (field) { 411 case 0: return new CX(getMessage()); 412 case 1: return new NULLDT(getMessage()); 413 case 2: return new CX(getMessage()); 414 case 3: return new NULLDT(getMessage()); 415 case 4: return new CX(getMessage()); 416 case 5: return new CX(getMessage()); 417 case 6: return new XPN(getMessage()); 418 default: return null; 419 } 420 } 421 422 423 } 424