/*******************************************************************************
 *  Copyright 2017-2018 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.dcm30_04.services.mwl.mwlsourceimpl;

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPregnancyStatus;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSmokingStatus;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;

/**
 *  This class contains the Attributes required for Query Model. Also contains methods to populate and fill data set of Query Model.
 */
public class PatientMedicalAttributes extends Attributes
{
	/**
	 * Description of patient state (comatose, disoriented, vision impaired, etc.)
	 * 
	 * @param strPatientState - String value of Patient State.
	 */
	public void setPatientState(String strPatientState)
	{
		/*Accept Patient State in String Array format of type LO.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0038, 0x0500, DicomConstants.DCM_DT_LO, strPatientState);
	}
	
	/**
	 * Retrieves patient state.
	 * 
	 * @return String - String value of Patient State.
	 */
	public String getPatientState()
	{
		Object objectValue = getValue(0x0038, 0x0500);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}
	
	/**
	 * Describes pregnancy state of patient. Enumerated Values:0001 = not pregnant,0002 = possibly pregnant
	 * 0003 = definitely pregnant, 0004 = unknown
	 * 
	 * @param enumPregnancyStatus - Enum value indicating pregnancy state of patient.
	 */
	public void setPregnancyStatus(EnumPregnancyStatus enumPregnancyStatus)
	{
		/*Accept Pregnancy Status in String Array format of type US.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0010, 0x21C0, DicomConstants.DCM_DT_US, enumPregnancyStatus.getValue());
	}
	
	/**
	 * Retrieves Pregnancy Status.
	 * 
	 * @return String - String value of Pregnancy Status.
	 */
	public String getPregnancyStatus()
	{
		Object objectValue = getValue(0x0010, 0x21C0);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}
	
	/**
	 * Sets Conditions to which medical staff should be alerted (e.g. contagious condition, drug allergies, etc.)
	 * 
	 * @param arrStrMedicalAlerts - String array of Medical Alerts.
	 */
	public void setMedicalAlerts(String[] arrStrMedicalAlerts)
	{
		/*Accept Medical Alerts in String Array format of type LO.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0010, 0x2000, DicomConstants.DCM_DT_LO, arrStrMedicalAlerts);
	}
	
	/**
	 * Retrieves Conditions to which medical staff should be alerted.
	 * 
	 * @return String[] - String array of Medical Alerts.
	 */
	public String[] getMedicalAlerts()
	{
		Object objectValue = getValue(0x0010, 0x2000);
		if(objectValue!=null)
			return (String[])objectValue;
		return null;
	}
	
	/**
	 * Sets Description of prior reaction to contrast agents.
	 * 
	 * @param arrStrContrastAllergies - String array of Contrast Allergies.
	 */
	public void setContrastAllergies(String[] arrStrContrastAllergies)
	{
		/*Accept Contrast Allergies in String Array format of type LO.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0010, 0x2110, DicomConstants.DCM_DT_LO, arrStrContrastAllergies);
	}
	
	/**
	 * Retrieves Description of prior reaction to contrast agents.
	 * 
	 * @return String[] - String array of Contrast Allergies
	 */
	public String[] getContrastAllergies()
	{
		Object objectValue = getValue(0x0010, 0x2110);
		if(objectValue!=null)
			return (String[])objectValue;
		return null;
	}
	
	/**
	 * Sets Medical and social needs (e.g. wheelchair, oxygen, non-English-speaking, etc.)
	 * 
	 * @param strSpecialNeeds - String value of Special Needs.
	 */
	public void setSpecialNeeds(String strSpecialNeeds)
	{
		/*Accept Special Needs in String Array format of type LO.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0038, 0x0050, DicomConstants.DCM_DT_LO, strSpecialNeeds);
	}
	
	/**
	 * Retrieves Medical and social needs.
	 * 
	 * @return String - String value of Special Needs.
	 */
	public String getSpecialNeeds()
	{
		Object objectValue = getValue(0x0038, 0x0050);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}
	
	/**
	 * Indicates whether patient smokes. Enumerated Values:YES, NO, UNKNOWN.
	 * 
	 * @param enumSmokingStatus - Enum value indicating whether patient smokes.
	 */
	public void setSmokingStatus(EnumSmokingStatus enumSmokingStatus)
	{
		/*Accept Smoking Status in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0010, 0x21A0, DicomConstants.DCM_DT_CS, enumSmokingStatus.getValue());
	}

	/**
	 * Sets Additional information about the patient's medical history.
	 * 
	 * @param strAdditionalPatientHistory - String containing additional patient history.
	 */
	public void setAdditionalPatientHistory(String strAdditionalPatientHistory)
	{
		/*Accept Additional Patient History in String Array format of type LT.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0010, 0x21B0, DicomConstants.DCM_DT_LT, strAdditionalPatientHistory);
	}


	/**
	 * Sets Date of onset of last menstrual period.
	 * 
	 * @param strLastMenstrualDate - String value of Last Menstrual Date.
	 */
	public void setLastMenstrualDate(String strLastMenstrualDate)
	{
		/*Accept Last Menstrual Date in String Array format of type DA.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0010, 0x21D0, DicomConstants.DCM_DT_DA, strLastMenstrualDate);
	}

	/**
	 * Retrieves whether patient smokes.
	 * 
	 * @return String - String value of Smoking Status.
	 */
	public String getSmokingStatus()
	{
		Object objectValue = getValue(0x0010, 0x21A0);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Retrieves Additional Patient History.
	 * 
	 * @return String - String value of Additional Patient History.
	 */
	public String getAdditionalPatientHistory()
	{
		Object objectValue = getValue(0x0010, 0x21B0);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}


	/**
	 * Retrieves Last Menstrual Date.
	 * 
	 * @return String - String value of Last Menstrual Date.
	 */
	public String getLastMenstrualDate()
	{
		Object objectValue = getValue(0x0010, 0x21D0);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Populates the query Model using filled data set.
	 */
	public void populate(IDataSet objIDataSet)
	{
		super.populate(objIDataSet);
	}	
	
	/**
	 * Fills the data set using already populated Query Model.
	 */
	public void fill(IDataSet objIDataSet)
	{
		super.fill(objIDataSet);
	}
}
