/*******************************************************************************
 *  Copyright 2017 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.hl7282.baselibs.segments;

import cdac.medinfo.sdk.hl7282.baselibs.CQ;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.EI;
import cdac.medinfo.sdk.hl7282.baselibs.FN;
import cdac.medinfo.sdk.hl7282.baselibs.HD;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.MO;
import cdac.medinfo.sdk.hl7282.baselibs.ST;
import cdac.medinfo.sdk.hl7282.baselibs.XCN;
import cdac.medinfo.sdk.hl7282.baselibs.XON;
import cdac.medinfo.sdk.hl7282.baselibs.XTN;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * RF1 - Referral Information Segment.<p>
 * This segment represents information that may be useful when sending referrals from the
 * referring provider to the referred-to provider
 * <p>Represents an HL7 RF1 message segment. 
 * This segment has the following fields:</p><p>
 * RF1-1: Referral Status (CWE)<b>Optional</b><br> 
 * RF1-2: Referral Priority (CWE)<b>Optional</b><br> 
 * RF1-3: Referral Type (CWE)<b>Optional</b><br> 
 * RF1-4: Referral Disposition (CWE)<b>Optional</b><br> 
 * RF1-5: Referral Category (CWE)<b>Optional</b><br> 
 * RF1-6: Originating Referral Identifier (EI)<b>Required</b><br> 
 * RF1-7: Effective Date (DTM)<b>Optional</b><br> 
 * RF1-8: Expiration Date (DTM)<b>Optional</b><br> 
 * RF1-9: Process Date (DTM)<b>Optional</b><br> 
 * RF1-10: Referral Reason (CWE)<b>Optional</b><br> 
 * RF1-11: External Referral Identifier (EI)<b>Optional</b><br>
 * RF1-12: Referral Documentation Completion Status  (CWE)<b>Optional</b><br> 
 * RF1-13: Planned Treatment Stop Date (DTM)<b>Optional</b><br> 
 * RF1-14: Referral Reason Text (ST)<b>Optional</b><br> 
 * RF1-15: Number of Authorized Treatments/Units (CQ)<b>Optional</b><br> 
 * RF1-16: Number of Used Treatments/Units (CQ)<b>Optional</b><br> 
 * RF1-17: Number of Schedule Treatments/Units (CQ)<b>Optional</b><br> 
 * RF1-18: Remaining Benefit Amount (MO)<b>Optional</b><br> 
 * RF1-19: Authorized Provider (XON)<b>Optional</b><br> 
 * RF1-20: Authorized Health Professional (XCN)<b>Optional</b><br> 
 * RF1-21: Source Text (ST)<b>Optional</b><br> 
 * RF1-22: Source Date (DTM)<b>Optional</b><br>
 * RF1-23: Source Phone (XTN)<b>Optional</b><br> 
 * RF1-24: Comment (ST)<b>Optional</b><br> 
 * RF1-25: Action Code (ID)<b>Optional</b><br><p>
 * This class provides mechanism to validate message against HL7 v 2.8.2 standard.
 * The class provides accessors & mutators for the elements mentioned above.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 *
 * <p>User can also create Segment through {@link SegmentFactory}
 */
 public class RF1 extends Segment   
{
	

	/**
	 * Constucts the RF1 segment.
	 */
	public RF1()
	{super(EnumSegments.HL7_SEG_RF1);
	}

	/**
	 * Retrieves the Effective Date.
	 * This field specify the date on which the referral is effective.
	 * @return DTM - effectiveDate
	 */
	public DTM getEffectiveDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1143);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Expiration Date.
	 * @return DTM - expirationDate
	 */
	public DTM getExpirationDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1144);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the External Referral Identifier.
	 * This field specify an external application's permanent identifier for the referral.
	 * @return ISingleCollection<EI> - externalReferralIdentifier
	 */
	public ISingleCollection<EI> getExternalReferralIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1300);
		ISingleCollection<EI> objDataList = new SingleCollection<EI>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				EI objEI = (EI)objDataType;
				objDataList.add(objEI);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Originating Referral Identifier.
	 * This field specify the originating application's permanent identifier for the referral.
	 * @return EI - originatingReferralIdentifier
	 */
	public EI getOriginatingReferralIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1142);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Process Date.
	 * This field specify the date on which the referral originated.
	 * @return DTM - processDate
	 */
	public DTM getProcessDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1145);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Referral Category.
	 * @return CWE - referralCategory
	 */
	public CWE getReferralCategory() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1141);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Referral Disposition. 
	 * @return ISingleCollection<CWE> - referralDisposition
	 */
	public ISingleCollection<CWE> getReferralDisposition() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1140);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Referral Priority.
	 * @return CWE - referralPriority
	 */
	public CWE getReferralPriority() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1138);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Referral Reason.
	 * @return ISingleCollection<CWE> - referralReason
	 */
	public ISingleCollection<CWE> getReferralReason() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1228);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Referral Status.
	 * This field specify the status of the referral as define by either the referred-to or the referred-by provider.
	 * @return CWE - referralStatus
	 */
	public CWE getReferralStatus() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1137);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Referral Type. 
	 * @return CWE - referralType
	 */
	public CWE getReferralType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1139);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Number of Used Treatments/Units.
	 * The scheduled treatments is the amount of time, in days or visits that the patient has planned treatments scheduled The duration of "days" is reserved for inpatient authorizations. The duration of "days" is reserved for inpatient authorizations.
	 * @return CQ - NumberOfUsedTreatmentsUnits
	 */
	public CQ getNumberOfUsedTreatmentsUnits() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3419);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Number of Used Treatments/Units.
	 * The scheduled treatments is the amount of time, in days or visits that the patient has planned treatments scheduled The duration of "days" is reserved for inpatient authorizations. The duration of "days" is reserved for inpatient authorizations.
	 * @param strQuantity Use as Quantity
	 * @param objUnits Use as Units
	 */ 
	public void setNumberOfUsedTreatmentsUnits (String strQuantity,CWE objUnits) 
	{
		CQ NumberOfUsedTreatmentsUnits  = (CQ)getDataElement(3419);
		NumberOfUsedTreatmentsUnits.setQuantity(strQuantity);
		NumberOfUsedTreatmentsUnits.setUnits(objUnits); 
		setNumberOfUsedTreatmentsUnits(NumberOfUsedTreatmentsUnits);

	} 

	/** 
	 * Set the Number of Used Treatments/Units.
	 * The scheduled treatments is the amount of time, in days or visits that the patient has planned treatments scheduled The duration of "days" is reserved for inpatient authorizations. The duration of "days" is reserved for inpatient authorizations.
	 * @param objNumberOfUsedTreatmentsUnits Object of Number of Used Treatments/Units.
	 */ 
	public void setNumberOfUsedTreatmentsUnits(CQ objNumberOfUsedTreatmentsUnits)
	{
		setDataType(3419,objNumberOfUsedTreatmentsUnits);
	}
	
	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation chcecks include optionality of segment or group.
	 * It also verifies the number of times segment or group is repeated in message.
	 * e.g 
	 * {PSH} while parsing PSH segment validate method will check for its mandatory presence.
	 * [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment.
	 * @return boolean - true or false.
	 * @throws InvalidSegmentException Throws when Segment Validation fails.
	 */	
	@Override
	public boolean validate() throws InvalidSegmentException 
	{
		/*
		 * Originating Referral Identifier is required fields.
		 */

		try 
		{
			super.validate();
			return true;		
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}

	/**
	 * Set the Effective Date.
	 * This field specify the date on which the referral is effective.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setEffectiveDate (String strTime) 
	{
		DTM effectiveDate  = (DTM)getDataElement(1143);
		effectiveDate.setValue(strTime);
		setEffectiveDate(effectiveDate);
	} 

	/** Set the Effective Date.
	 * This field specify the date on which the referral is effective.
	 * @param objeffectiveDate object of EffectiveDate
	 */ 
	public void setEffectiveDate(DTM objeffectiveDate)
	{
		setDataType(1143,objeffectiveDate);
	}

	/**
	 * Set the Expiration Date.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setExpirationDate (String strTime) 
	{
		DTM expirationDate  = (DTM)getDataElement(1144);
		expirationDate.setValue(strTime);
		setExpirationDate(expirationDate);
	} 

	/** Set the Expiration Date.
	 * @param objexpirationDate object of ExpirationDate
	 */ 
	public void setExpirationDate(DTM objexpirationDate)
	{
		setDataType(1144,objexpirationDate);
	}

	/**
	 * Set the External Referral Identifier.
	 * This field specify an external application's permanent identifier for the referral.
	 * @param strEntityIdentifier Specifies defined by a hierarchic designator, represented by components 2 through 4.
	 * 								[Reference Section 2.A.33, "HD - hierarchic designator".] 
	 * @param strNamespaceId Specifies  the HL7 identifier for the user-defined table of values for this component.
	 * 						   [Refer to User-defined Table 0363 - Assigning authority] 	 
	 * @param strUniversalId Specifies string formatted according to the scheme defined by the component, 
	 * 							<universal ID type> (UID type). 
	 * @param strUniversalIdType Specifies  the interpretation of the second component of the HD. 
	 * @return - function status [success/failure].
	 */ 
	public void addExternalReferralIdentifier (String strEntityIdentifier,String strNamespaceId,String strUniversalId,
			String strUniversalIdType)
	{
		EI tempExternalReferralIdentifier  = (EI)getDataElement(1300);
		tempExternalReferralIdentifier.setEntityIdentifier(strEntityIdentifier);
		tempExternalReferralIdentifier.setNamespaceId(strNamespaceId);
		tempExternalReferralIdentifier.setUniversalId(strUniversalId);
		tempExternalReferralIdentifier.setUniversalIdType(strUniversalIdType); 
		addExternalReferralIdentifier(tempExternalReferralIdentifier);
	} 

	/**Sets the External Referral Identifier.
	 * @param objtempExternalReferralIdentifier object of ExternalReferralIdentifier 
	 */ 
	public void addExternalReferralIdentifier(EI objtempExternalReferralIdentifier)
	{
		addDataType(1300,objtempExternalReferralIdentifier);
	}

	/**
	 * Set the External Referral Identifier list.
	 * @param objExternalReferralIdentifierList List of External Referral Identifier.
	 */	
	@SuppressWarnings("unchecked")
	public void setExternalReferralIdentifier(ISingleCollection<EI> objExternalReferralIdentifierList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objExternalReferralIdentifierList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1300,objCollection);
	}

	/**
	 * Set the Originating Referral Identifier.
	 * This field specify the originating application's permanent identifier for the referral.
	 * @param strEntityIdentifier Specifies defined by a hierarchic designator, represented by components 2 through 4.
	 * 								[Reference Section 2.A.33, "HD - hierarchic designator".] 
	 * @param strNamespaceId Specifies  the HL7 identifier for the user-defined table of values for this component.
	 * 						   [Refer to User-defined Table 0363 - Assigning authority] 	 
	 * @param strUniversalId Specifies string formatted according to the scheme defined by the component, 
	 * 							<universal ID type> (UID type). 
	 * @param strUniversalIdType Specifies  the interpretation of the second component of the HD. 
	 */ 
	public void setOriginatingReferralIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI originatingReferralIdentifier  = (EI)getDataElement(1142);
		originatingReferralIdentifier.setEntityIdentifier(strEntityIdentifier);
		originatingReferralIdentifier.setNamespaceId(strNamespaceId);
		originatingReferralIdentifier.setUniversalId(strUniversalId);
		originatingReferralIdentifier.setUniversalIdType(strUniversalIdType); 
		setOriginatingReferralIdentifier(originatingReferralIdentifier);
	} 

	/** Set the Originating Referral Identifier.
	 * This field specify the originating application's permanent identifier for the referral.
	 * @param objoriginatingReferralIdentifier object of originatingReferralIdentifier 
	 */ 
	public void setOriginatingReferralIdentifier(EI objoriginatingReferralIdentifier)
	{
		setDataType(1142,objoriginatingReferralIdentifier);
	}

	/**
	 * Set the Process Date.
	 * This field specify the date on which the referral originated.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setProcessDate (String strTime) 
	{
		DTM processDate  = (DTM)getDataElement(1145);
		processDate.setValue(strTime);
		setProcessDate(processDate);
	} 

	/** Set the Process Date.
	 * This field specify the date on which the referral originated.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 * @param objprocessDate object of ProcessDate
	 */ 
	public void setProcessDate(DTM objprocessDate)
	{
		setDataType(1145,objprocessDate);
	}

	/**
	 * Set the Referral Category.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setReferralCategory (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1141);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setReferralCategory(cwe);
	} 

	/** Set the Referral Category.
	 * @param objreferralCategory object of ReferralCategory
	 */ 
	public void setReferralCategory(CWE objreferralCategory)
	{
		setDataType(1141,objreferralCategory);
	}

	/**
	 * Set the Referral Type.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setReferralType (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1139);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setReferralType(cwe);
	} 

	/** Set the Referral Type.
	 * @param objreferralType object of ReferralType
	 */ 
	public void setReferralType(CWE objreferralType)
	{
		setDataType(1139,objreferralType);
	}

	/**
	 * Set the Referral Priority.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void setReferralPriority (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1138);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		setReferralPriority(cwe);
	} 

	/** Set the Referral Priority.
	 * @param objreferralPriority object of ReferralPriority
	 */ 
	public void setReferralPriority(CWE objreferralPriority)
	{
		setDataType(1138,objreferralPriority);
	}

	/**
	 * Set the Referral Status.
	 * This field specify the status of the referral as define by either the referred-to or the referred-by provider.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setReferralStatus (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1137);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setReferralStatus(cwe);
	} 

	/** Set the Referral Status.
	 * This field specify the status of the referral as define by either the referred-to or the referred-by provider.
	 * @param objreferralStatus object of ReferralStatus
	 */ 
	public void setReferralStatus(CWE objreferralStatus)
	{
		setDataType(1137,objreferralStatus);
	}

	/**
	 * Set the Referral Disposition. 
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void addReferralDisposition  (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1140);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		addReferralDisposition (cwe);
	} 

	/** Set the Referral Disposition. 
	 * @param objtempReferralDisposition object of ReferralDisposition
	 */ 
	public void addReferralDisposition(CWE objtempReferralDisposition)
	{
		addDataType(1140,objtempReferralDisposition);
	}

	/**
	 * Set the Referral Disposition list.
	 * @param objReferralDispositionList List of Referral Disposition.
	 */	
	@SuppressWarnings("unchecked")
	public void setReferralDisposition(ISingleCollection<CWE> objReferralDispositionList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objReferralDispositionList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1140,objCollection);
	}

	/**
	 * Set the Referral Reason.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void addReferralReason (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1228);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		addReferralReason(cwe);
	} 

	/** Set the Referral Reason.
	 * @param objtempReferralReason object of ReferralReason
	 */ 
	public void addReferralReason(CWE objtempReferralReason)
	{
		addDataType(1228,objtempReferralReason);
	}
	/**
	 * Set the Referral Reason list.
	 * @param objReferralDispositionList List of Referral Reason.
	 */	
	@SuppressWarnings("unchecked")
	public void setReferralReason(ISingleCollection<CWE> objReferralReasonList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objReferralReasonList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1228,objCollection);
	}
	
	/**
	 * Retrieves the Referral Documentation Completion Status.
	 * This field can be used to indicate to the receiving provider that the clinical history in the message is incomplete and that more will follow.
	 * @return CWE - ReferralDocumentationCompletionStatus
	 */
	public CWE getReferralDocumentationCompletionStatus() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2262);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Referral Documentation Completion Status.
	 * This field can be used to indicate to the receiving provider that the clinical history in the message is incomplete and that more will follow.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void setReferralDocumentationCompletionStatus(String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(2262);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setReferralDocumentationCompletionStatus(cwe);

	} 

	/** 
	 * Set the Referral Documentation Completion Status.
	 * This field can be used to indicate to the receiving provider that the clinical history in the message is incomplete and that more will follow.
	 * @param objReferralDocumentationCompletionStatus Object of Referral Documentation Completion Status.
	 */ 
	public void setReferralDocumentationCompletionStatus(CWE objReferralDocumentationCompletionStatus)
	{
		setDataType(2262,objReferralDocumentationCompletionStatus);

	}
	
	/**
	 * Retrieves the Planned Treatment Stop Date.
	 * The planned treatment stop date is the date that the patient's treatment from this referral is expected to complete, based on procedural protocols.
	 * @return DTM - PlannedTreatmentStopDate
	 */
	public DTM getPlannedTreatmentStopDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3400);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Planned Treatment Stop Date.
	 * The planned treatment stop date is the date that the patient's treatment from this referral is expected to complete, based on procedural protocols.
	 * @param strPlannedTreatmentStopDate String values for date that the patient's treatment from this referral is expected to complete, based on procedural protocols. 
	 * 
	 */ 
	public void setPlannedTreatmentStopDate (String strPlannedTreatmentStopDate) 
	{
		DTM PlannedTreatmentStopDate  = (DTM)getDataElement(3400);
		PlannedTreatmentStopDate.setValue(strPlannedTreatmentStopDate);
		setPlannedTreatmentStopDate(PlannedTreatmentStopDate);

	} 

	/**
	 * Set the Planned Treatment Stop Date.
	 * The planned treatment stop date is the date that the patient's treatment from this referral is expected to complete, based on procedural protocols.
	 * @param objPlannedTreatmentStopDate
	 */ 
	public void setPlannedTreatmentStopDate(DTM objPlannedTreatmentStopDate)
	{
		setDataType(3400,objPlannedTreatmentStopDate);
	}
	
	/**
	 * Retrieves the Referral Reason Text.
	 * The referral reason is a free text field allowing a user to capture, in a non-coded format, the reason for the referral.  
	 * @return String - ReferralReasonText
	 */
	public ST getReferralReasonText() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3401);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Referral Reason Text.
	 * The referral reason is a free text field allowing a user to capture, in a non-coded format, the reason for the referral.  
	 * @param strAccidentDecription Used as AccidentDeathIndicator
	 */
	public void setReferralReasonText (String strAccidentDecription) 
	{
		ST ReferralReasonText  = (ST)getDataElement(3401);
		ReferralReasonText.setValue(strAccidentDecription);
		setReferralReasonText (ReferralReasonText);
	}

	/**
	 * Set the Referral Reason Text.
	 * The referral reason is a free text field allowing a user to capture, in a non-coded format, the reason for the referral.  
	 * @param ReferralReasonText Used as AccidentDeathIndicator
	 */
	public void setReferralReasonText(ST ReferralReasonText)
	{
		setDataType(3401,ReferralReasonText);
	}
	
	/**
	 * Retrieves the Number of Authorized Treatments/Units.
	 * The authorized duration is the amount of time, in days or visits, that the patient has been authorized for treatment for this referral.  
	 * @return CQ - NumberOfAuthorizedTreatmentsUnits
	 */
	public CQ getNumberOfAuthorizedTreatmentsUnits() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3404);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Number of Authorized Treatments/Units.
	 * The authorized duration is the amount of time, in days or visits, that the patient has been authorized for treatment for this referral.  
	 * @param strQuantity Use as Quantity
	 * @param objUnits Use as Units
	 */ 
	public void setNumberOfAuthorizedTreatmentsUnits (String strQuantity,CWE objUnits) 
	{
		CQ NumberOfAuthorizedTreatmentsUnits  = (CQ)getDataElement(3404);
		NumberOfAuthorizedTreatmentsUnits.setQuantity(strQuantity);
		NumberOfAuthorizedTreatmentsUnits.setUnits(objUnits); 
		setNumberOfAuthorizedTreatmentsUnits(NumberOfAuthorizedTreatmentsUnits);

	} 

	/** 
	 * Set the Number of Authorized Treatments/Units.
	 * The authorized duration is the amount of time, in days or visits, that the patient has been authorized for treatment for this referral.  
	 * @param objNumberOfAuthorizedTreatmentsUnits Object of Number of Authorized Treatments/Units.
	 */ 
	public void setNumberOfAuthorizedTreatmentsUnits(CQ objNumberOfAuthorizedTreatmentsUnits)
	{
		setDataType(3404,objNumberOfAuthorizedTreatmentsUnits);

	}
	
	/**
	 * Retrieves the Number of Schedule Treatments/Units.
	 * The used duration is the amount of time, in days or visits that the patient has used of the originally authorized duration.
	 * @return CQ - NumberOfScheduleTreatmentsUnits
	 */
	public CQ getNumberOfScheduleTreatmentsUnits() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3404);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Number of Schedule Treatments/Units.
	 * The used duration is the amount of time, in days or visits that the patient has used of the originally authorized duration.
	 * @param strQuantity Use as Quantity
	 * @param objUnits Use as Units
	 */ 
	public void setNumberOfScheduleTreatmentsUnits (String strQuantity,CWE objUnits) 
	{
		CQ NumberOfScheduleTreatmentsUnits  = (CQ)getDataElement(3404);
		NumberOfScheduleTreatmentsUnits.setQuantity(strQuantity);
		NumberOfScheduleTreatmentsUnits.setUnits(objUnits); 
		setNumberOfScheduleTreatmentsUnits(NumberOfScheduleTreatmentsUnits);

	} 

	/** 
	 * Set the Number of Schedule Treatments/Units.
	 * The used duration is the amount of time, in days or visits that the patient has used of the originally authorized duration.
	 * @param objNumberOfScheduleTreatmentsUnits Object of Number of Schedule Treatments/Units.
	 */ 
	public void setNumberOfScheduleTreatmentsUnits(CQ objNumberOfScheduleTreatmentsUnits)
	{
		setDataType(3404,objNumberOfScheduleTreatmentsUnits);
	}
	
	/**
	 * Retrieves the Remaining Benefit Amount.
	 * The remaining benefit amount is the amount remaining from the insurance company related to this referral. 
	 * @return MO - RemainingBenefitAmount
	 */
	public MO getRemainingBenefitAmount() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3405);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (MO)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Remaining Benefit Amount.
	 * The remaining benefit amount is the amount remaining from the insurance company related to this referral. 
	 * @param strQuantity Specifies the Quantity.
	 * @param strDenomination Specifies the denomination in which the quantity is expressed. 
	 */ 
	public void setRemainingBenefitAmount (String strQuantity,String strDenomination)
	{
		MO RemainingBenefitAmount  = (MO)getDataElement(3405);
		RemainingBenefitAmount.setQuantity(strQuantity);
		RemainingBenefitAmount.setDenomination(strDenomination); 
		setRemainingBenefitAmount(RemainingBenefitAmount);
	} 

	/** 
	 * Set the Remaining Benefit Amount.
	 * The remaining benefit amount is the amount remaining from the insurance company related to this referral. 
	 * @param objRemainingBenefitAmount Object of  Remaining Benefit Amount.
	 */ 
	public void setRemainingBenefitAmount(MO objRemainingBenefitAmount)
	{
		setDataType(3405,objRemainingBenefitAmount);
	}
	
	/**
	 * Retrieves the Authorized Provider.
	 * This represents the organization to which the patient was referred to perform the procedure(s).  
	 * @return XON - AuthorizedProvider
	 */
	public XON getAuthorizedProvider() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3406);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XON)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Authorized Provider.
	 * This represents the organization to which the patient was referred to perform the procedure(s).  
	 * @param strOrganizationName Specifies name of the specified organization.
	 * @param strOrganizationNameTypeCode Specifies a code that represents the type of name i.e., legal name, display name.
	 * 										Suggested Values A,L,D,SL.[Refer to table No.0204]  
	 * @param objAssigningAuthority Specifies The assigning authority is a unique identifier of the system 
	 * 									(or organization or agency or department) that creates the data. 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier. 
	 * @param objAssigningFacility Specifies The place or location identifier where the identifier was first assigned to the person. 
	 * @param strNameRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465] 
	 * @param strOrganizationIdentifier This component contains the sequence of characters (the code) that uniquely 
	 * 									  identifies the item being referenced by XON.1 Organization Name. 
	 * 									  This component replaces XON.3 ID Number as of v 2.5.
	 */ 
	public void setAuthorizedProvider (String strOrganizationName, CWE objOrganizationNameTypeCode,
			 HD objAssigningAuthority,
			String strIdentifierTypeCode, HD objAssigningFacility, String strNameRepresentationCode,
			String strOrganizationIdentifier)
	{
		XON AuthorizedProvider  = (XON)getDataElement(3406);
		AuthorizedProvider.setOrganizationName(strOrganizationName);
		AuthorizedProvider.setOrganizationNameTypeCode(objOrganizationNameTypeCode);
		AuthorizedProvider.setAssigningAuthority(objAssigningAuthority);
		AuthorizedProvider.setIdentifierTypeCode(strIdentifierTypeCode);
		AuthorizedProvider.setAssigningFacility(objAssigningFacility);
		AuthorizedProvider.setNameRepresentationCode(strNameRepresentationCode);
		AuthorizedProvider.setOrganizationIdentifier(strOrganizationIdentifier); 
		setAuthorizedProvider(AuthorizedProvider);
	} 

	/**
	 * Ses the Authorized Provider.
	 * This represents the organization to which the patient was referred to perform the procedure(s).  
	 * @param objAuthorizedProvider object of Authorized Provider. 
	 */ 
	public void setAuthorizedProvider(XON objAuthorizedProvider)
	{
		setDataType(3406,objAuthorizedProvider);
	}
	
	/**
	 * Retrieves the Authorized Health Professional.
	 * The authorized HP represents the specific health professional authorized to perform the services for the patient.  
	 * @return XCN - AuthorizedHealthProfessional
	 */
	public XCN getAuthorizedHealthProfessional()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3407);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XCN)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Authorized Health Professional.
	 * The authorized HP represents the specific health professional authorized to perform the services for the patient.  
	 * @param strIDNumber Refers to the coded ID according to a user-defined table
	 * @param objFamilyName Specifies the surname of a person.
	 * @param strGivenName Specifies First name.
	 * @param strSecondAndFurtherGivenNamesOrInitialsThereof Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 * @param strSuffix Used to specify a name suffix (e.g., Jr. or III).
	 * @param strPrefix Used to specify a name prefix (e.g., Dr.).
	 * @param strSourceTable Used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 - CN ID.]
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 - Assigning authority]
	 * @param strNameTypeCode Specifies a code that represents the type of name. 
	 * @param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 * @param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 * @param strNameRepresentationCode Provides an indication of the representation provided by the data item.  
	 * @param objNameContext Designates the context in which a name is used. [Refer User-defined Table 03412 ]
	 * @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 * @param strSecurityCheck Specifies the version code that may be assigned to the person identifier
	 * @param strSecurityCheckScheme Specifies the check digit scheme.
	 */ 
	public void setAuthorizedHealthProfessional (String strIDNumber,FN objFamilyName,String strGivenName,String strSecondAndFurtherGivenNamesOrInitialsThereof,
			String 	strSuffix,String strPrefix,CWE objSourceTable,HD objAssigningAuthority,
			String strNameTypeCode,String strIdentifierCheckDigit,String strCheckDigitScheme,String strIdentifierTypeCode,
			HD objAssigningFacility,String strNameRepresentationCode,CWE objNameContext,
			String strNameAssemblyOrder, String strEffectiveDate,String strExpirationDate,String strProfessionalSuffix,
			CWE objAssigningJurisdiction,CWE objAssigningAgencyOrDepratment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		XCN AuthorizedHealthProfessional  = (XCN)getDataElement(3407);
		AuthorizedHealthProfessional.setIdNumber(strIDNumber);
		AuthorizedHealthProfessional.setFamilyName(objFamilyName);
		AuthorizedHealthProfessional.setGivenName(strGivenName);
		AuthorizedHealthProfessional.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		AuthorizedHealthProfessional.setSuffix(strSuffix);
		AuthorizedHealthProfessional.setPrefix(strPrefix);
//		AuthorizedHealthProfessional.setDegree(strDegree);
		AuthorizedHealthProfessional.setSourceTable(objSourceTable);
		AuthorizedHealthProfessional.setAssigningAuthority(objAssigningAuthority);
		AuthorizedHealthProfessional.setNameTypeCode(strNameTypeCode);
		AuthorizedHealthProfessional.setIdentifierCheckDigit(strIdentifierCheckDigit);
		AuthorizedHealthProfessional.setCheckDigitScheme(strCheckDigitScheme);
		AuthorizedHealthProfessional.setIdentifierTypeCode(strIdentifierTypeCode);
		AuthorizedHealthProfessional.setAssigningFacility(objAssigningFacility);
		AuthorizedHealthProfessional.setNameRepresentationCode(strNameRepresentationCode);
		AuthorizedHealthProfessional.setNameContext(objNameContext);
//		AuthorizedHealthProfessional.setNameValidityRange(objNameValidityRange);
		AuthorizedHealthProfessional.setNameAssemblyOrder(strNameAssemblyOrder);
		AuthorizedHealthProfessional.setEffectiveDate(strEffectiveDate);
		AuthorizedHealthProfessional.setExpirationDate(strExpirationDate);
		AuthorizedHealthProfessional.setProfessionalSuffix(strProfessionalSuffix);
		AuthorizedHealthProfessional.setAssigningJurisdiction(objAssigningJurisdiction);
		AuthorizedHealthProfessional.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		AuthorizedHealthProfessional.setSecurityCheck(strSecurityCheck);
		AuthorizedHealthProfessional.setSecurityCheckScheme(strSecurityCheckScheme);
		setAuthorizedHealthProfessional(AuthorizedHealthProfessional);


	} 

	/**
	 * Sets the Authorized Health Professional.
	 * The authorized HP represents the specific health professional authorized to perform the services for the patient.  
	 * @param objAuthorizedHealthProfessional object of Authorized Health Professional.
	 */ 
	public void setAuthorizedHealthProfessional(XCN objAuthorizedHealthProfessional)
	{
		setDataType(3407,objAuthorizedHealthProfessional);
	}
	
	/**
	 * Retrieves the Source Text.
	 * The source text allows a user to capture information (such as the name) of the person contacted regarding the specific referral.
	 * @return String - SourceText
	 */
	public ST getSourceText() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3408);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Source Text.
	 * The source text allows a user to capture information (such as the name) of the person contacted regarding the specific referral.
	 * @param strSourceText String value of the reason for the action indicated in the
	 * IAM-7 - Allergy Action Code field. 
	 */ 
	public void setSourceText (String strSourceText) 
	{
		ST SourceText  = (ST)getDataElement(3408);
		SourceText.setValue(strSourceText); 
		setSourceText(SourceText);

	} 

	/** Set the Source Text.
	 * The source text allows a user to capture information (such as the name) of the person contacted regarding the specific referral.
	 * @param objSourceText object of Source Text. 
	 */ 
	public void setSourceText(ST objSourceText)
	{
		setDataType(3408,objSourceText);
	}
	
	/**
	 * Retrieves the Source Date.
	 * The source date allows a user to capture the date the person was contacted regarding the specific referral.
	 * @return DTM - SourceDate
	 */
	public DTM getSourceDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3409);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Source Date.
	 * The source date allows a user to capture the date the person was contacted regarding the specific referral.
	 * @param strDateTimePlannedEvent This field contains the date/time that the event is planned. 
	 */ 
	public void setSourceDate (String strDateTimePlannedEvent)  
	{
		DTM SourceDate  = (DTM)getDataElement(3409);
		SourceDate.setValue(strDateTimePlannedEvent);
		setSourceDate(SourceDate);

	} 

	/** 
	 * Sets the Source Date.
	 * The source date allows a user to capture the date the person was contacted regarding the specific referral.
	 * @param objSourceDate object of Source Date.
	 */ 
	public void setSourceDate(DTM objSourceDate)
	{
		setDataType(3409,objSourceDate);
	}
	
	/**
	 * Retrieves the Source Phone.
	 * The source phone number allows a user to capture the phone number of the person contacted regarding the specific referral.
	 * @return XTN - Source Phone
	 */
	public XTN getSourcePhone() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3410);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XTN)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/** 
	 * Set the Source Phone.
	 * The source phone number allows a user to capture the phone number of the person contacted regarding the specific referral.
	 * @param strTeleCommunicationUseCode Specifies a code that represents a specific use of a telecommunication number.
	 										Suggested values are PRN,ORN,WPN,VHN,ASN,EMR,NET,BPN  [Refer table 0201.]
	 * @param strTeleCommunicationEquipmentType Specifies a code that represents the type of telecommunication equipment.
	 * 											  Suggested values are PH,FX,MD,CP,BP,Internet,X.400,TDD,TTY  [Refer table 0202.]
	 * @param strCommuinicationAddress Specifies Email address.
	 * @param strCountryCode Specifies the Country code.
	 * @param strAreaCityCode Specifies the area /City Code.
	 * @param strLocalNumber Specifies an Local Number.
	 * @param strExtension Specifies an Extension.
	 * @param strAnyText Contains comments with respect to the telephone number.
	 * @param strExtensionPrefix Specifies the characters established within a company's 
	 * 							   internal telephone system network used as a prefix to the Extension component for internal dialing. 
	 * @param strSpeedDialCode Specifies The characters established within a 
	 * 							 company's internal telephone system used in place of the (external) telephone number.
	 * @param strUnformattedTelephoneNumber Specifies an expression of the telephone number as an unparsible string.
	 * @param strEffectiveStartDate Specifies start date.
	 * @param strExpirationDate Specifies expiration date.
	 * @param objExpirationReason Specifies reason why this contact is marked as ended.
	 * @param objProtectionCode Specifies reason why this information is sensitive or protected.
	 * @param objSharedTelecommunicationIdentifier Specifies a unique phone number phone telephone number or email-id.
	 * @param strPreferenceOrder Specifies the preference order for an entity..
	 */  
	public void setSourcePhone  (String strTeleCommunicationUseCode,String strTeleCommunicationEquipmentType
			,String strCommuinicationAddress,String strCountryCode,String strAreaCityCode,String strLocalNumber,String strExtension,String strAnyText,
			String strExtensionPrefix,String strSpeedDialCode,String strUnformattedTelephoneNumber, String strEffectiveStartDate, String strExpirationDate,
			CWE objExpirationReason, CWE objProtectionCode, EI objSharedTelecommunicationIdentifier, String strPreferenceOrder)
	{
		XTN xtn  = (XTN)getDataElement(3410);
//		xtn.setTelephoneNumber(strTelephoneNumber);
		xtn.setTelecommunicationUseCode(strTeleCommunicationUseCode);
		xtn.setTelecommunicationEquipmentType(strTeleCommunicationEquipmentType);
		xtn.setCommuinicationAddress(strCommuinicationAddress);
		xtn.setCountryCode(strCountryCode);
		xtn.setAreaCityCode(strAreaCityCode);
		xtn.setLocalNumber(strLocalNumber);
		xtn.setExtension(strExtension);
		xtn.setAnyText(strAnyText);
		xtn.setExtensionPrefix(strExtensionPrefix);
		xtn.setSpeedDialCode(strSpeedDialCode);
		xtn.setUnformattedTelephonenumber(strUnformattedTelephoneNumber); 
		xtn.setEffectiveStartDate(strEffectiveStartDate);
		xtn.setExpirationDate(strExpirationDate);
		xtn.setExpirationReason(objExpirationReason);
		xtn.setProtectionCode(objProtectionCode);
		xtn.setSharedTelecommunicationIdentifier(objSharedTelecommunicationIdentifier);
		xtn.setPreferenceOrder(strPreferenceOrder); 
		setSourcePhone (xtn);
	}
	
	/**Sets the Source Phone. 
	 * The source phone number allows a user to capture the phone number of the person contacted regarding the specific referral.
	 * @param objXtn object of Source Phone.
	 */ 
	public void setSourcePhone(XTN objXtn)
	{
		setDataType(3410,objXtn);
	}
	
	/**
	 * Retrieves the Comment.
	 * The comment allows for a free text capture of any notes the user wishes to capture related to the referral.
	 * @return String - Comment
	 */
	public ST getComment() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3411);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Comment.
	 * The comment allows for a free text capture of any notes the user wishes to capture related to the referral.
	 * @param strComment String value of the reason for the action indicated in the
	 * IAM-7 - Allergy Action Code field. 
	 */ 
	public void setComment (String strComment) 
	{
		ST Comment  = (ST)getDataElement(3411);
		Comment.setValue(strComment); 
		setComment(Comment);

	} 

	/** Set the Comment.
	 * The comment allows for a free text capture of any notes the user wishes to capture related to the referral.
	 * @param objComment object of Comment. 
	 */ 
	public void setComment(ST objComment)
	{
		setDataType(3411,objComment);
	}
	
	/**
	 * Retrieves the Action Code.
	 * This field defines the action to be taken for this referral. 
	 * @return ID - ActionCode
	 */
	public ID getActionCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3412);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/** 
	 * Set the Action Code.
	 * This field defines the action to be taken for this referral. 
	 * @param strActionCode Specifies indicates whether the insurance company requires a written notice of
	 * 									 admission from the healthcare provider.[Refer to HL7 table 0136].Suggested 
	 * 									Values Y,N. 
	 */ 
	public void setActionCode (String strActionCode)  
	{
		ID ActionCode  = (ID)getDataElement(3412);
		ActionCode.setValue(strActionCode); 
		setActionCode(ActionCode);

	} 

	/** Set the Action Code.
	 * This field defines the action to be taken for this referral. 
	 * @param objActionCode Specifies indicates whether the insurance company requires a written notice of
	 * 									 admission from the healthcare provider.[Refer to HL7 table 0136].Suggested 
	 * 									Values Y,N. 
	 */ 
	public void setActionCode(ID objActionCode)
	{
		setDataType(3412,objActionCode);

	}
}