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.v22.segment; 35 36 // import ca.uhn.hl7v2.model.v22.group.*; 37 import ca.uhn.hl7v2.model.v22.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 OM3 message segment (CATEGORICAL TEST/OBSERVATION). 50 * This segment has the following fields:</p> 51 * <ul> 52 * <li>OM3-1: Segment Type ID (ST) <b>optional </b> 53 * <li>OM3-2: Sequence Number - Test/ Observation Master File (NM) <b>optional </b> 54 * <li>OM3-3: Preferred Coding System (ID) <b>optional </b> 55 * <li>OM3-4: Valid coded answers (CE) <b>optional repeating</b> 56 * <li>OM3-5: Normal test codes for categorical observations (CE) <b>optional repeating</b> 57 * <li>OM3-6: Abnormal test codes for categorical observations (CE) <b>optional </b> 58 * <li>OM3-7: Critical test codes for categorical observations (CE) <b>optional </b> 59 * <li>OM3-8: Data Type (ID) <b>optional </b> 60 * </ul> 61 */ 62 @SuppressWarnings("unused") 63 public class OM3 extends AbstractSegment { 64 65 /** 66 * Creates a new OM3 segment 67 */ 68 public OM3(Group parent, ModelClassFactory factory) { 69 super(parent, factory); 70 init(factory); 71 } 72 73 private void init(ModelClassFactory factory) { 74 try { 75 this.add(ST.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Type ID"); 76 this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/ Observation Master File"); 77 this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(0) }, "Preferred Coding System"); 78 this.add(CE.class, false, 0, 60, new Object[]{ getMessage() }, "Valid coded answers"); 79 this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Normal test codes for categorical observations"); 80 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Abnormal test codes for categorical observations"); 81 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Critical test codes for categorical observations"); 82 this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Data Type"); 83 } catch(HL7Exception e) { 84 log.error("Unexpected error creating OM3 - this is probably a bug in the source code generator.", e); 85 } 86 } 87 88 89 90 /** 91 * Returns 92 * OM3-1: "Segment Type ID" - creates it if necessary 93 */ 94 public ST getSegmentTypeID() { 95 ST retVal = this.getTypedField(1, 0); 96 return retVal; 97 } 98 99 /** 100 * Returns 101 * OM3-1: "Segment Type ID" - creates it if necessary 102 */ 103 public ST getOm31_SegmentTypeID() { 104 ST retVal = this.getTypedField(1, 0); 105 return retVal; 106 } 107 108 109 110 /** 111 * Returns 112 * OM3-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary 113 */ 114 public NM getSequenceNumberTestObservationMasterFile() { 115 NM retVal = this.getTypedField(2, 0); 116 return retVal; 117 } 118 119 /** 120 * Returns 121 * OM3-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary 122 */ 123 public NM getOm32_SequenceNumberTestObservationMasterFile() { 124 NM retVal = this.getTypedField(2, 0); 125 return retVal; 126 } 127 128 129 130 /** 131 * Returns 132 * OM3-3: "Preferred Coding System" - creates it if necessary 133 */ 134 public ID getPreferredCodingSystem() { 135 ID retVal = this.getTypedField(3, 0); 136 return retVal; 137 } 138 139 /** 140 * Returns 141 * OM3-3: "Preferred Coding System" - creates it if necessary 142 */ 143 public ID getOm33_PreferredCodingSystem() { 144 ID retVal = this.getTypedField(3, 0); 145 return retVal; 146 } 147 148 149 /** 150 * Returns all repetitions of Valid coded answers (OM3-4). 151 */ 152 public CE[] getValidCodedAnswers() { 153 CE[] retVal = this.getTypedField(4, new CE[0]); 154 return retVal; 155 } 156 157 158 /** 159 * Returns all repetitions of Valid coded answers (OM3-4). 160 */ 161 public CE[] getOm34_ValidCodedAnswers() { 162 CE[] retVal = this.getTypedField(4, new CE[0]); 163 return retVal; 164 } 165 166 167 /** 168 * Returns a count of the current number of repetitions of Valid coded answers (OM3-4). 169 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 170 * it will return zero. 171 */ 172 public int getValidCodedAnswersReps() { 173 return this.getReps(4); 174 } 175 176 177 /** 178 * Returns a specific repetition of 179 * OM3-4: "Valid coded answers" - creates it if necessary 180 * 181 * @param rep The repetition index (0-indexed) 182 */ 183 public CE getValidCodedAnswers(int rep) { 184 CE retVal = this.getTypedField(4, rep); 185 return retVal; 186 } 187 188 /** 189 * Returns a specific repetition of 190 * OM3-4: "Valid coded answers" - creates it if necessary 191 * 192 * @param rep The repetition index (0-indexed) 193 */ 194 public CE getOm34_ValidCodedAnswers(int rep) { 195 CE retVal = this.getTypedField(4, rep); 196 return retVal; 197 } 198 199 /** 200 * Returns a count of the current number of repetitions of Valid coded answers (OM3-4). 201 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 202 * it will return zero. 203 */ 204 public int getOm34_ValidCodedAnswersReps() { 205 return this.getReps(4); 206 } 207 208 209 /** 210 * Inserts a repetition of 211 * OM3-4: "Valid coded answers" at a specific index 212 * 213 * @param rep The repetition index (0-indexed) 214 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 215 */ 216 public CE insertValidCodedAnswers(int rep) throws HL7Exception { 217 return (CE) super.insertRepetition(4, rep); 218 } 219 220 221 /** 222 * Inserts a repetition of 223 * OM3-4: "Valid coded answers" at a specific index 224 * 225 * @param rep The repetition index (0-indexed) 226 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 227 */ 228 public CE insertOm34_ValidCodedAnswers(int rep) throws HL7Exception { 229 return (CE) super.insertRepetition(4, rep); 230 } 231 232 233 /** 234 * Removes a repetition of 235 * OM3-4: "Valid coded answers" at a specific index 236 * 237 * @param rep The repetition index (0-indexed) 238 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 239 */ 240 public CE removeValidCodedAnswers(int rep) throws HL7Exception { 241 return (CE) super.removeRepetition(4, rep); 242 } 243 244 245 /** 246 * Removes a repetition of 247 * OM3-4: "Valid coded answers" at a specific index 248 * 249 * @param rep The repetition index (0-indexed) 250 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 251 */ 252 public CE removeOm34_ValidCodedAnswers(int rep) throws HL7Exception { 253 return (CE) super.removeRepetition(4, rep); 254 } 255 256 257 258 /** 259 * Returns all repetitions of Normal test codes for categorical observations (OM3-5). 260 */ 261 public CE[] getNormalTestCodesForCategoricalObservations() { 262 CE[] retVal = this.getTypedField(5, new CE[0]); 263 return retVal; 264 } 265 266 267 /** 268 * Returns all repetitions of Normal test codes for categorical observations (OM3-5). 269 */ 270 public CE[] getOm35_NormalTestCodesForCategoricalObservations() { 271 CE[] retVal = this.getTypedField(5, new CE[0]); 272 return retVal; 273 } 274 275 276 /** 277 * Returns a count of the current number of repetitions of Normal test codes for categorical observations (OM3-5). 278 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 279 * it will return zero. 280 */ 281 public int getNormalTestCodesForCategoricalObservationsReps() { 282 return this.getReps(5); 283 } 284 285 286 /** 287 * Returns a specific repetition of 288 * OM3-5: "Normal test codes for categorical observations" - creates it if necessary 289 * 290 * @param rep The repetition index (0-indexed) 291 */ 292 public CE getNormalTestCodesForCategoricalObservations(int rep) { 293 CE retVal = this.getTypedField(5, rep); 294 return retVal; 295 } 296 297 /** 298 * Returns a specific repetition of 299 * OM3-5: "Normal test codes for categorical observations" - creates it if necessary 300 * 301 * @param rep The repetition index (0-indexed) 302 */ 303 public CE getOm35_NormalTestCodesForCategoricalObservations(int rep) { 304 CE retVal = this.getTypedField(5, rep); 305 return retVal; 306 } 307 308 /** 309 * Returns a count of the current number of repetitions of Normal test codes for categorical observations (OM3-5). 310 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 311 * it will return zero. 312 */ 313 public int getOm35_NormalTestCodesForCategoricalObservationsReps() { 314 return this.getReps(5); 315 } 316 317 318 /** 319 * Inserts a repetition of 320 * OM3-5: "Normal test codes for categorical observations" at a specific index 321 * 322 * @param rep The repetition index (0-indexed) 323 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 324 */ 325 public CE insertNormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 326 return (CE) super.insertRepetition(5, rep); 327 } 328 329 330 /** 331 * Inserts a repetition of 332 * OM3-5: "Normal test codes for categorical observations" at a specific index 333 * 334 * @param rep The repetition index (0-indexed) 335 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 336 */ 337 public CE insertOm35_NormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 338 return (CE) super.insertRepetition(5, rep); 339 } 340 341 342 /** 343 * Removes a repetition of 344 * OM3-5: "Normal test codes for categorical observations" at a specific index 345 * 346 * @param rep The repetition index (0-indexed) 347 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 348 */ 349 public CE removeNormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 350 return (CE) super.removeRepetition(5, rep); 351 } 352 353 354 /** 355 * Removes a repetition of 356 * OM3-5: "Normal test codes for categorical observations" at a specific index 357 * 358 * @param rep The repetition index (0-indexed) 359 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 360 */ 361 public CE removeOm35_NormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 362 return (CE) super.removeRepetition(5, rep); 363 } 364 365 366 367 368 /** 369 * Returns 370 * OM3-6: "Abnormal test codes for categorical observations" - creates it if necessary 371 */ 372 public CE getAbnormalTestCodesForCategoricalObservations() { 373 CE retVal = this.getTypedField(6, 0); 374 return retVal; 375 } 376 377 /** 378 * Returns 379 * OM3-6: "Abnormal test codes for categorical observations" - creates it if necessary 380 */ 381 public CE getOm36_AbnormalTestCodesForCategoricalObservations() { 382 CE retVal = this.getTypedField(6, 0); 383 return retVal; 384 } 385 386 387 388 /** 389 * Returns 390 * OM3-7: "Critical test codes for categorical observations" - creates it if necessary 391 */ 392 public CE getCriticalTestCodesForCategoricalObservations() { 393 CE retVal = this.getTypedField(7, 0); 394 return retVal; 395 } 396 397 /** 398 * Returns 399 * OM3-7: "Critical test codes for categorical observations" - creates it if necessary 400 */ 401 public CE getOm37_CriticalTestCodesForCategoricalObservations() { 402 CE retVal = this.getTypedField(7, 0); 403 return retVal; 404 } 405 406 407 408 /** 409 * Returns 410 * OM3-8: "Data Type" - creates it if necessary 411 */ 412 public ID getDataType() { 413 ID retVal = this.getTypedField(8, 0); 414 return retVal; 415 } 416 417 /** 418 * Returns 419 * OM3-8: "Data Type" - creates it if necessary 420 */ 421 public ID getOm38_DataType() { 422 ID retVal = this.getTypedField(8, 0); 423 return retVal; 424 } 425 426 427 428 429 430 /** {@inheritDoc} */ 431 protected Type createNewTypeWithoutReflection(int field) { 432 switch (field) { 433 case 0: return new ST(getMessage()); 434 case 1: return new NM(getMessage()); 435 case 2: return new ID(getMessage(), new Integer( 0 )); 436 case 3: return new CE(getMessage()); 437 case 4: return new CE(getMessage()); 438 case 5: return new CE(getMessage()); 439 case 6: return new CE(getMessage()); 440 case 7: return new ID(getMessage(), new Integer( 0 )); 441 default: return null; 442 } 443 } 444 445 446 } 447