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.v22.segment; 035 036// import ca.uhn.hl7v2.model.v22.group.*; 037import ca.uhn.hl7v2.model.v22.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 OM3 message segment (CATEGORICAL TEST/OBSERVATION). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>OM3-1: Segment Type ID (ST) <b>optional </b> 052 * <li>OM3-2: Sequence Number - Test/ Observation Master File (NM) <b>optional </b> 053 * <li>OM3-3: Preferred Coding System (ID) <b>optional </b> 054 * <li>OM3-4: Valid coded answers (CE) <b>optional repeating</b> 055 * <li>OM3-5: Normal test codes for categorical observations (CE) <b>optional repeating</b> 056 * <li>OM3-6: Abnormal test codes for categorical observations (CE) <b>optional </b> 057 * <li>OM3-7: Critical test codes for categorical observations (CE) <b>optional </b> 058 * <li>OM3-8: Data Type (ID) <b>optional </b> 059 * </ul> 060 */ 061@SuppressWarnings("unused") 062public class OM3 extends AbstractSegment { 063 064 /** 065 * Creates a new OM3 segment 066 */ 067 public OM3(Group parent, ModelClassFactory factory) { 068 super(parent, factory); 069 init(factory); 070 } 071 072 private void init(ModelClassFactory factory) { 073 try { 074 this.add(ST.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Type ID"); 075 this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/ Observation Master File"); 076 this.add(ID.class, false, 1, 5, new Object[]{ getMessage(), new Integer(0) }, "Preferred Coding System"); 077 this.add(CE.class, false, 0, 60, new Object[]{ getMessage() }, "Valid coded answers"); 078 this.add(CE.class, false, 0, 200, new Object[]{ getMessage() }, "Normal test codes for categorical observations"); 079 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Abnormal test codes for categorical observations"); 080 this.add(CE.class, false, 1, 200, new Object[]{ getMessage() }, "Critical test codes for categorical observations"); 081 this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(0) }, "Data Type"); 082 } catch(HL7Exception e) { 083 log.error("Unexpected error creating OM3 - this is probably a bug in the source code generator.", e); 084 } 085 } 086 087 088 089 /** 090 * Returns 091 * OM3-1: "Segment Type ID" - creates it if necessary 092 */ 093 public ST getSegmentTypeID() { 094 ST retVal = this.getTypedField(1, 0); 095 return retVal; 096 } 097 098 /** 099 * Returns 100 * OM3-1: "Segment Type ID" - creates it if necessary 101 */ 102 public ST getOm31_SegmentTypeID() { 103 ST retVal = this.getTypedField(1, 0); 104 return retVal; 105 } 106 107 108 109 /** 110 * Returns 111 * OM3-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary 112 */ 113 public NM getSequenceNumberTestObservationMasterFile() { 114 NM retVal = this.getTypedField(2, 0); 115 return retVal; 116 } 117 118 /** 119 * Returns 120 * OM3-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary 121 */ 122 public NM getOm32_SequenceNumberTestObservationMasterFile() { 123 NM retVal = this.getTypedField(2, 0); 124 return retVal; 125 } 126 127 128 129 /** 130 * Returns 131 * OM3-3: "Preferred Coding System" - creates it if necessary 132 */ 133 public ID getPreferredCodingSystem() { 134 ID retVal = this.getTypedField(3, 0); 135 return retVal; 136 } 137 138 /** 139 * Returns 140 * OM3-3: "Preferred Coding System" - creates it if necessary 141 */ 142 public ID getOm33_PreferredCodingSystem() { 143 ID retVal = this.getTypedField(3, 0); 144 return retVal; 145 } 146 147 148 /** 149 * Returns all repetitions of Valid coded answers (OM3-4). 150 */ 151 public CE[] getValidCodedAnswers() { 152 CE[] retVal = this.getTypedField(4, new CE[0]); 153 return retVal; 154 } 155 156 157 /** 158 * Returns all repetitions of Valid coded answers (OM3-4). 159 */ 160 public CE[] getOm34_ValidCodedAnswers() { 161 CE[] retVal = this.getTypedField(4, new CE[0]); 162 return retVal; 163 } 164 165 166 /** 167 * Returns a count of the current number of repetitions of Valid coded answers (OM3-4). 168 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 169 * it will return zero. 170 */ 171 public int getValidCodedAnswersReps() { 172 return this.getReps(4); 173 } 174 175 176 /** 177 * Returns a specific repetition of 178 * OM3-4: "Valid coded answers" - creates it if necessary 179 * 180 * @param rep The repetition index (0-indexed) 181 */ 182 public CE getValidCodedAnswers(int rep) { 183 CE retVal = this.getTypedField(4, rep); 184 return retVal; 185 } 186 187 /** 188 * Returns a specific repetition of 189 * OM3-4: "Valid coded answers" - creates it if necessary 190 * 191 * @param rep The repetition index (0-indexed) 192 */ 193 public CE getOm34_ValidCodedAnswers(int rep) { 194 CE retVal = this.getTypedField(4, rep); 195 return retVal; 196 } 197 198 /** 199 * Returns a count of the current number of repetitions of Valid coded answers (OM3-4). 200 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 201 * it will return zero. 202 */ 203 public int getOm34_ValidCodedAnswersReps() { 204 return this.getReps(4); 205 } 206 207 208 /** 209 * Inserts a repetition of 210 * OM3-4: "Valid coded answers" 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 CE insertValidCodedAnswers(int rep) throws HL7Exception { 216 return (CE) super.insertRepetition(4, rep); 217 } 218 219 220 /** 221 * Inserts a repetition of 222 * OM3-4: "Valid coded answers" 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 CE insertOm34_ValidCodedAnswers(int rep) throws HL7Exception { 228 return (CE) super.insertRepetition(4, rep); 229 } 230 231 232 /** 233 * Removes a repetition of 234 * OM3-4: "Valid coded answers" 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 CE removeValidCodedAnswers(int rep) throws HL7Exception { 240 return (CE) super.removeRepetition(4, rep); 241 } 242 243 244 /** 245 * Removes a repetition of 246 * OM3-4: "Valid coded answers" at a specific index 247 * 248 * @param rep The repetition index (0-indexed) 249 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 250 */ 251 public CE removeOm34_ValidCodedAnswers(int rep) throws HL7Exception { 252 return (CE) super.removeRepetition(4, rep); 253 } 254 255 256 257 /** 258 * Returns all repetitions of Normal test codes for categorical observations (OM3-5). 259 */ 260 public CE[] getNormalTestCodesForCategoricalObservations() { 261 CE[] retVal = this.getTypedField(5, new CE[0]); 262 return retVal; 263 } 264 265 266 /** 267 * Returns all repetitions of Normal test codes for categorical observations (OM3-5). 268 */ 269 public CE[] getOm35_NormalTestCodesForCategoricalObservations() { 270 CE[] retVal = this.getTypedField(5, new CE[0]); 271 return retVal; 272 } 273 274 275 /** 276 * Returns a count of the current number of repetitions of Normal test codes for categorical observations (OM3-5). 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 getNormalTestCodesForCategoricalObservationsReps() { 281 return this.getReps(5); 282 } 283 284 285 /** 286 * Returns a specific repetition of 287 * OM3-5: "Normal test codes for categorical observations" - creates it if necessary 288 * 289 * @param rep The repetition index (0-indexed) 290 */ 291 public CE getNormalTestCodesForCategoricalObservations(int rep) { 292 CE retVal = this.getTypedField(5, rep); 293 return retVal; 294 } 295 296 /** 297 * Returns a specific repetition of 298 * OM3-5: "Normal test codes for categorical observations" - creates it if necessary 299 * 300 * @param rep The repetition index (0-indexed) 301 */ 302 public CE getOm35_NormalTestCodesForCategoricalObservations(int rep) { 303 CE retVal = this.getTypedField(5, rep); 304 return retVal; 305 } 306 307 /** 308 * Returns a count of the current number of repetitions of Normal test codes for categorical observations (OM3-5). 309 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 310 * it will return zero. 311 */ 312 public int getOm35_NormalTestCodesForCategoricalObservationsReps() { 313 return this.getReps(5); 314 } 315 316 317 /** 318 * Inserts a repetition of 319 * OM3-5: "Normal test codes for categorical observations" 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 CE insertNormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 325 return (CE) super.insertRepetition(5, rep); 326 } 327 328 329 /** 330 * Inserts a repetition of 331 * OM3-5: "Normal test codes for categorical observations" 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 CE insertOm35_NormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 337 return (CE) super.insertRepetition(5, rep); 338 } 339 340 341 /** 342 * Removes a repetition of 343 * OM3-5: "Normal test codes for categorical observations" 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 CE removeNormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 349 return (CE) super.removeRepetition(5, rep); 350 } 351 352 353 /** 354 * Removes a repetition of 355 * OM3-5: "Normal test codes for categorical observations" at a specific index 356 * 357 * @param rep The repetition index (0-indexed) 358 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 359 */ 360 public CE removeOm35_NormalTestCodesForCategoricalObservations(int rep) throws HL7Exception { 361 return (CE) super.removeRepetition(5, rep); 362 } 363 364 365 366 367 /** 368 * Returns 369 * OM3-6: "Abnormal test codes for categorical observations" - creates it if necessary 370 */ 371 public CE getAbnormalTestCodesForCategoricalObservations() { 372 CE retVal = this.getTypedField(6, 0); 373 return retVal; 374 } 375 376 /** 377 * Returns 378 * OM3-6: "Abnormal test codes for categorical observations" - creates it if necessary 379 */ 380 public CE getOm36_AbnormalTestCodesForCategoricalObservations() { 381 CE retVal = this.getTypedField(6, 0); 382 return retVal; 383 } 384 385 386 387 /** 388 * Returns 389 * OM3-7: "Critical test codes for categorical observations" - creates it if necessary 390 */ 391 public CE getCriticalTestCodesForCategoricalObservations() { 392 CE retVal = this.getTypedField(7, 0); 393 return retVal; 394 } 395 396 /** 397 * Returns 398 * OM3-7: "Critical test codes for categorical observations" - creates it if necessary 399 */ 400 public CE getOm37_CriticalTestCodesForCategoricalObservations() { 401 CE retVal = this.getTypedField(7, 0); 402 return retVal; 403 } 404 405 406 407 /** 408 * Returns 409 * OM3-8: "Data Type" - creates it if necessary 410 */ 411 public ID getDataType() { 412 ID retVal = this.getTypedField(8, 0); 413 return retVal; 414 } 415 416 /** 417 * Returns 418 * OM3-8: "Data Type" - creates it if necessary 419 */ 420 public ID getOm38_DataType() { 421 ID retVal = this.getTypedField(8, 0); 422 return retVal; 423 } 424 425 426 427 428 429 /** {@inheritDoc} */ 430 protected Type createNewTypeWithoutReflection(int field) { 431 switch (field) { 432 case 0: return new ST(getMessage()); 433 case 1: return new NM(getMessage()); 434 case 2: return new ID(getMessage(), new Integer( 0 )); 435 case 3: return new CE(getMessage()); 436 case 4: return new CE(getMessage()); 437 case 5: return new CE(getMessage()); 438 case 6: return new CE(getMessage()); 439 case 7: return new ID(getMessage(), new Integer( 0 )); 440 default: return null; 441 } 442 } 443 444 445} 446