/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/core/vo/PatientDiagnosisEDischargeListVo.java
//#############################################################################
//#                                                                           #
//#  Copyright (C) <2015>  <IMS MAXIMS>                                       #
//#                                                                           #
//#  This program is free software: you can redistribute it and/or modify     #
//#  it under the terms of the GNU Affero General Public License as           #
//#  published by the Free Software Foundation, either version 3 of the       #
//#  License, or (at your option) any later version.                          # 
//#                                                                           #
//#  This program is distributed in the hope that it will be useful,          #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of           #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
//#  GNU Affero General Public License for more details.                      #
//#                                                                           #
//#  You should have received a copy of the GNU Affero General Public License #
//#  along with this program.  If not, see <http://www.gnu.org/licenses/>.    #
//#                                                                           #
//#  IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of    #
//#  this program.  Users of this software do so entirely at their own risk.  #
//#  IMS MAXIMS only ensures the Clinical Safety of unaltered run-time        #
//#  software that it builds, deploys and maintains.                          #
//#                                                                           #
//#############################################################################
//#EOH
// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5589.25814)
// Copyright (C) 1995-2015 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file

package ims.core.vo;

/**
 * Linked to core.clinical.PatientDiagnosis business object (ID: 1003100016).
 */
public class PatientDiagnosisEDischargeListVo extends ims.core.clinical.vo.PatientDiagnosisRefVo implements ims.vo.ImsCloneable, Comparable, ims.vo.interfaces.IEDischargeSummary
{
	private static final long serialVersionUID = 1L;

	public PatientDiagnosisEDischargeListVo()
	{
	}
	public PatientDiagnosisEDischargeListVo(Integer id, int version)
	{
		super(id, version);
	}
	public PatientDiagnosisEDischargeListVo(ims.core.vo.beans.PatientDiagnosisEDischargeListVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.diagnosisdescription = bean.getDiagnosisDescription();
		this.diagnoseddate = bean.getDiagnosedDate() == null ? null : bean.getDiagnosedDate().buildPartialDate();
		this.diagnosis = bean.getDiagnosis() == null ? null : bean.getDiagnosis().buildVo();
		this.sourceofinformation = bean.getSourceofInformation() == null ? null : ims.core.vo.lookups.SourceofInformation.buildLookup(bean.getSourceofInformation());
		this.iscomplication = bean.getIsComplication();
		this.iscomorbidity = bean.getIsComorbidity();
		this.dateresolved = bean.getDateResolved() == null ? null : bean.getDateResolved().buildDate();
		this.carecontext = bean.getCareContext() == null ? null : bean.getCareContext().buildVo();
		this.diaglaterality = bean.getDiagLaterality() == null ? null : ims.core.vo.lookups.LateralityLRB.buildLookup(bean.getDiagLaterality());
		this.sitetext = bean.getSiteText();
		this.authoringinfo = bean.getAuthoringInfo() == null ? null : bean.getAuthoringInfo().buildVo();
		this.includediagnosisindiscreports = ims.core.vo.IncludeDiagnosisInDischargeReportVoCollection.buildFromBeanCollection(bean.getIncludeDiagnosisInDiscReports());
		this.isprevrelevantdiagnosis = bean.getIsPrevRelevantDiagnosis();
		this.sysinfo = bean.getSysInfo() == null ? null : bean.getSysInfo().buildSystemInformation();
		this.dateonset = bean.getDateOnset() == null ? null : bean.getDateOnset().buildDate();
		this.clinicalcontact = bean.getClinicalContact() == null ? null : new ims.core.admin.vo.ClinicalContactRefVo(new Integer(bean.getClinicalContact().getId()), bean.getClinicalContact().getVersion());
		this.primaryforcarespells = ims.core.vo.CSPrimaryDiagnosisVoCollection.buildFromBeanCollection(bean.getPrimaryForCareSpells());
		this.comorbidityforepisodeofcares = ims.core.vo.EpisodeOfCareCoMorbidityVoCollection.buildFromBeanCollection(bean.getCoMorbidityForEpisodeOfCares());
		this.episodeofcare = bean.getEpisodeOfCare() == null ? null : new ims.core.admin.vo.EpisodeOfCareRefVo(new Integer(bean.getEpisodeOfCare().getId()), bean.getEpisodeOfCare().getVersion());
		this.diagnosedonadmission = bean.getDiagnosedOnAdmission();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.PatientDiagnosisEDischargeListVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.diagnosisdescription = bean.getDiagnosisDescription();
		this.diagnoseddate = bean.getDiagnosedDate() == null ? null : bean.getDiagnosedDate().buildPartialDate();
		this.diagnosis = bean.getDiagnosis() == null ? null : bean.getDiagnosis().buildVo(map);
		this.sourceofinformation = bean.getSourceofInformation() == null ? null : ims.core.vo.lookups.SourceofInformation.buildLookup(bean.getSourceofInformation());
		this.iscomplication = bean.getIsComplication();
		this.iscomorbidity = bean.getIsComorbidity();
		this.dateresolved = bean.getDateResolved() == null ? null : bean.getDateResolved().buildDate();
		this.carecontext = bean.getCareContext() == null ? null : bean.getCareContext().buildVo(map);
		this.diaglaterality = bean.getDiagLaterality() == null ? null : ims.core.vo.lookups.LateralityLRB.buildLookup(bean.getDiagLaterality());
		this.sitetext = bean.getSiteText();
		this.authoringinfo = bean.getAuthoringInfo() == null ? null : bean.getAuthoringInfo().buildVo(map);
		this.includediagnosisindiscreports = ims.core.vo.IncludeDiagnosisInDischargeReportVoCollection.buildFromBeanCollection(bean.getIncludeDiagnosisInDiscReports());
		this.isprevrelevantdiagnosis = bean.getIsPrevRelevantDiagnosis();
		this.sysinfo = bean.getSysInfo() == null ? null : bean.getSysInfo().buildSystemInformation();
		this.dateonset = bean.getDateOnset() == null ? null : bean.getDateOnset().buildDate();
		this.clinicalcontact = bean.getClinicalContact() == null ? null : new ims.core.admin.vo.ClinicalContactRefVo(new Integer(bean.getClinicalContact().getId()), bean.getClinicalContact().getVersion());
		this.primaryforcarespells = ims.core.vo.CSPrimaryDiagnosisVoCollection.buildFromBeanCollection(bean.getPrimaryForCareSpells());
		this.comorbidityforepisodeofcares = ims.core.vo.EpisodeOfCareCoMorbidityVoCollection.buildFromBeanCollection(bean.getCoMorbidityForEpisodeOfCares());
		this.episodeofcare = bean.getEpisodeOfCare() == null ? null : new ims.core.admin.vo.EpisodeOfCareRefVo(new Integer(bean.getEpisodeOfCare().getId()), bean.getEpisodeOfCare().getVersion());
		this.diagnosedonadmission = bean.getDiagnosedOnAdmission();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.core.vo.beans.PatientDiagnosisEDischargeListVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.PatientDiagnosisEDischargeListVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.PatientDiagnosisEDischargeListVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public Object getFieldValueByFieldName(String fieldName)
	{
		if(fieldName == null)
			throw new ims.framework.exceptions.CodingRuntimeException("Invalid field name");
		fieldName = fieldName.toUpperCase();
		if(fieldName.equals("DIAGNOSISDESCRIPTION"))
			return getDiagnosisDescription();
		if(fieldName.equals("DIAGNOSEDDATE"))
			return getDiagnosedDate();
		if(fieldName.equals("DIAGNOSIS"))
			return getDiagnosis();
		if(fieldName.equals("SOURCEOFINFORMATION"))
			return getSourceofInformation();
		if(fieldName.equals("ISCOMPLICATION"))
			return getIsComplication();
		if(fieldName.equals("ISCOMORBIDITY"))
			return getIsComorbidity();
		if(fieldName.equals("DATERESOLVED"))
			return getDateResolved();
		if(fieldName.equals("CARECONTEXT"))
			return getCareContext();
		if(fieldName.equals("DIAGLATERALITY"))
			return getDiagLaterality();
		if(fieldName.equals("SITETEXT"))
			return getSiteText();
		if(fieldName.equals("AUTHORINGINFO"))
			return getAuthoringInfo();
		if(fieldName.equals("INCLUDEDIAGNOSISINDISCREPORTS"))
			return getIncludeDiagnosisInDiscReports();
		if(fieldName.equals("ISPREVRELEVANTDIAGNOSIS"))
			return getIsPrevRelevantDiagnosis();
		if(fieldName.equals("SYSINFO"))
			return getSysInfo();
		if(fieldName.equals("DATEONSET"))
			return getDateOnset();
		if(fieldName.equals("CLINICALCONTACT"))
			return getClinicalContact();
		if(fieldName.equals("PRIMARYFORCARESPELLS"))
			return getPrimaryForCareSpells();
		if(fieldName.equals("COMORBIDITYFOREPISODEOFCARES"))
			return getCoMorbidityForEpisodeOfCares();
		if(fieldName.equals("EPISODEOFCARE"))
			return getEpisodeOfCare();
		if(fieldName.equals("DIAGNOSEDONADMISSION"))
			return getDiagnosedOnAdmission();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getDiagnosisDescriptionIsNotNull()
	{
		return this.diagnosisdescription != null;
	}
	public String getDiagnosisDescription()
	{
		return this.diagnosisdescription;
	}
	public static int getDiagnosisDescriptionMaxLength()
	{
		return 255;
	}
	public void setDiagnosisDescription(String value)
	{
		this.isValidated = false;
		this.diagnosisdescription = value;
	}
	public boolean getDiagnosedDateIsNotNull()
	{
		return this.diagnoseddate != null;
	}
	public ims.framework.utils.PartialDate getDiagnosedDate()
	{
		return this.diagnoseddate;
	}
	public void setDiagnosedDate(ims.framework.utils.PartialDate value)
	{
		this.isValidated = false;
		this.diagnoseddate = value;
	}
	public boolean getDiagnosisIsNotNull()
	{
		return this.diagnosis != null;
	}
	public ims.core.vo.DiagLiteVo getDiagnosis()
	{
		return this.diagnosis;
	}
	public void setDiagnosis(ims.core.vo.DiagLiteVo value)
	{
		this.isValidated = false;
		this.diagnosis = value;
	}
	public boolean getSourceofInformationIsNotNull()
	{
		return this.sourceofinformation != null;
	}
	public ims.core.vo.lookups.SourceofInformation getSourceofInformation()
	{
		return this.sourceofinformation;
	}
	public void setSourceofInformation(ims.core.vo.lookups.SourceofInformation value)
	{
		this.isValidated = false;
		this.sourceofinformation = value;
	}
	public boolean getIsComplicationIsNotNull()
	{
		return this.iscomplication != null;
	}
	public Boolean getIsComplication()
	{
		return this.iscomplication;
	}
	public void setIsComplication(Boolean value)
	{
		this.isValidated = false;
		this.iscomplication = value;
	}
	public boolean getIsComorbidityIsNotNull()
	{
		return this.iscomorbidity != null;
	}
	public Boolean getIsComorbidity()
	{
		return this.iscomorbidity;
	}
	public void setIsComorbidity(Boolean value)
	{
		this.isValidated = false;
		this.iscomorbidity = value;
	}
	public boolean getDateResolvedIsNotNull()
	{
		return this.dateresolved != null;
	}
	public ims.framework.utils.Date getDateResolved()
	{
		return this.dateresolved;
	}
	public void setDateResolved(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dateresolved = value;
	}
	public boolean getCareContextIsNotNull()
	{
		return this.carecontext != null;
	}
	public ims.core.vo.CareContextForEdischargeDiagnosisVo getCareContext()
	{
		return this.carecontext;
	}
	public void setCareContext(ims.core.vo.CareContextForEdischargeDiagnosisVo value)
	{
		this.isValidated = false;
		this.carecontext = value;
	}
	public boolean getDiagLateralityIsNotNull()
	{
		return this.diaglaterality != null;
	}
	public ims.core.vo.lookups.LateralityLRB getDiagLaterality()
	{
		return this.diaglaterality;
	}
	public void setDiagLaterality(ims.core.vo.lookups.LateralityLRB value)
	{
		this.isValidated = false;
		this.diaglaterality = value;
	}
	public boolean getSiteTextIsNotNull()
	{
		return this.sitetext != null;
	}
	public String getSiteText()
	{
		return this.sitetext;
	}
	public static int getSiteTextMaxLength()
	{
		return 255;
	}
	public void setSiteText(String value)
	{
		this.isValidated = false;
		this.sitetext = value;
	}
	public boolean getAuthoringInfoIsNotNull()
	{
		return this.authoringinfo != null;
	}
	public ims.core.vo.AuthoringInformationVo getAuthoringInfo()
	{
		return this.authoringinfo;
	}
	public void setAuthoringInfo(ims.core.vo.AuthoringInformationVo value)
	{
		this.isValidated = false;
		this.authoringinfo = value;
	}
	public boolean getIncludeDiagnosisInDiscReportsIsNotNull()
	{
		return this.includediagnosisindiscreports != null;
	}
	public ims.core.vo.IncludeDiagnosisInDischargeReportVoCollection getIncludeDiagnosisInDiscReports()
	{
		return this.includediagnosisindiscreports;
	}
	public void setIncludeDiagnosisInDiscReports(ims.core.vo.IncludeDiagnosisInDischargeReportVoCollection value)
	{
		this.isValidated = false;
		this.includediagnosisindiscreports = value;
	}
	public boolean getIsPrevRelevantDiagnosisIsNotNull()
	{
		return this.isprevrelevantdiagnosis != null;
	}
	public Boolean getIsPrevRelevantDiagnosis()
	{
		return this.isprevrelevantdiagnosis;
	}
	public void setIsPrevRelevantDiagnosis(Boolean value)
	{
		this.isValidated = false;
		this.isprevrelevantdiagnosis = value;
	}
	public boolean getSysInfoIsNotNull()
	{
		return this.sysinfo != null;
	}
	public ims.vo.SystemInformation getSysInfo()
	{
		return this.sysinfo;
	}
	public void setSysInfo(ims.vo.SystemInformation value)
	{
		this.isValidated = false;
		this.sysinfo = value;
	}
	public boolean getDateOnsetIsNotNull()
	{
		return this.dateonset != null;
	}
	public ims.framework.utils.Date getDateOnset()
	{
		return this.dateonset;
	}
	public void setDateOnset(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dateonset = value;
	}
	public boolean getClinicalContactIsNotNull()
	{
		return this.clinicalcontact != null;
	}
	public ims.core.admin.vo.ClinicalContactRefVo getClinicalContact()
	{
		return this.clinicalcontact;
	}
	public void setClinicalContact(ims.core.admin.vo.ClinicalContactRefVo value)
	{
		this.isValidated = false;
		this.clinicalcontact = value;
	}
	public boolean getPrimaryForCareSpellsIsNotNull()
	{
		return this.primaryforcarespells != null;
	}
	public ims.core.vo.CSPrimaryDiagnosisVoCollection getPrimaryForCareSpells()
	{
		return this.primaryforcarespells;
	}
	public void setPrimaryForCareSpells(ims.core.vo.CSPrimaryDiagnosisVoCollection value)
	{
		this.isValidated = false;
		this.primaryforcarespells = value;
	}
	public boolean getCoMorbidityForEpisodeOfCaresIsNotNull()
	{
		return this.comorbidityforepisodeofcares != null;
	}
	public ims.core.vo.EpisodeOfCareCoMorbidityVoCollection getCoMorbidityForEpisodeOfCares()
	{
		return this.comorbidityforepisodeofcares;
	}
	public void setCoMorbidityForEpisodeOfCares(ims.core.vo.EpisodeOfCareCoMorbidityVoCollection value)
	{
		this.isValidated = false;
		this.comorbidityforepisodeofcares = value;
	}
	public boolean getEpisodeOfCareIsNotNull()
	{
		return this.episodeofcare != null;
	}
	public ims.core.admin.vo.EpisodeOfCareRefVo getEpisodeOfCare()
	{
		return this.episodeofcare;
	}
	public void setEpisodeOfCare(ims.core.admin.vo.EpisodeOfCareRefVo value)
	{
		this.isValidated = false;
		this.episodeofcare = value;
	}
	public boolean getDiagnosedOnAdmissionIsNotNull()
	{
		return this.diagnosedonadmission != null;
	}
	public Boolean getDiagnosedOnAdmission()
	{
		return this.diagnosedonadmission;
	}
	public void setDiagnosedOnAdmission(Boolean value)
	{
		this.isValidated = false;
		this.diagnosedonadmission = value;
	}
	/**
	* PatientDiagnosisEDischargeListVoDateTimeComparator  (class definition)
	*/
	public static class PatientDiagnosisEDischargeListVoDateTimeComparator implements java.util.Comparator
	{
		private int direction = 1;
		public PatientDiagnosisEDischargeListVoDateTimeComparator()
		{
			this(ims.framework.enumerations.SortOrder.ASCENDING);
		}
		public PatientDiagnosisEDischargeListVoDateTimeComparator(ims.framework.enumerations.SortOrder order)
		{
			if (order == ims.framework.enumerations.SortOrder.DESCENDING)
			{
				direction = -1;
			}
		}
	
		public int compare(Object obj1, Object obj2)
		{
			PatientDiagnosisEDischargeListVo voObj1 = (PatientDiagnosisEDischargeListVo)obj1;
			PatientDiagnosisEDischargeListVo voObj2 = (PatientDiagnosisEDischargeListVo)obj2;
			if (voObj1.getDiagnosedDateIsNotNull()
				&& voObj2.getDiagnosedDateIsNotNull())
			{	
				return direction*(voObj1.getDiagnosedDate().compareTo(voObj2.getDiagnosedDate()));
			}
			if (voObj1.getDiagnosedDate() == null)
				return -1;
			if (voObj2.getDiagnosedDate() == null)
				return 1;	
	
			return direction;
		}
	
		public boolean equals(Object obj)
		{
			return false;
		}	
	}
	
	/**
	* getDateTimeComparator - retrieves a new instance of static class PatientDiagnosisEDischargeListVoDateTimeComparator 
	*/
	public static PatientDiagnosisEDischargeListVoDateTimeComparator getDateTimeComparator(ims.framework.enumerations.SortOrder sortOrder)
	{
		return new PatientDiagnosisEDischargeListVo.PatientDiagnosisEDischargeListVoDateTimeComparator(sortOrder);
	}
	/**
	* PatientDiagnosisEDischargeListVoAuthoringComparator  (class definition)
	*/
	public static class PatientDiagnosisEDischargeListVoAuthoringComparator implements java.util.Comparator
	{
		private int direction = 1;
		public PatientDiagnosisEDischargeListVoAuthoringComparator ()
		{
			this(ims.framework.enumerations.SortOrder.ASCENDING);
		}
		public PatientDiagnosisEDischargeListVoAuthoringComparator (ims.framework.enumerations.SortOrder order)
		{
			if (order == ims.framework.enumerations.SortOrder.DESCENDING)
			{
				direction = -1;
			}
		}
		public int compare(Object obj1, Object obj2)
		{
			PatientDiagnosisEDischargeListVo voObj1 = (PatientDiagnosisEDischargeListVo)obj1;
			PatientDiagnosisEDischargeListVo voObj2 = (PatientDiagnosisEDischargeListVo)obj2;
	
			int retVal = 0;
	
			if(voObj1.getAuthoringInfo() == null || voObj2.getAuthoringInfo() == null)
				return -1;
			if(voObj1.getAuthoringInfo().getAuthoringHcp() == null || voObj2.getAuthoringInfo().getAuthoringHcp() == null)
				return -1;
					
			if(voObj1.getAuthoringInfo().getAuthoringHcp().getName() == null && voObj2.getAuthoringInfo().getAuthoringHcp().getName() != null)
				return -1;
			if(voObj1.getAuthoringInfo().getAuthoringHcp().getName() != null && voObj2.getAuthoringInfo().getAuthoringHcp().getName() == null)
				return 1;
				
			if(voObj1.getAuthoringInfo().getAuthoringHcp().getName() != null && voObj2.getAuthoringInfo().getAuthoringHcp().getName() != null)
				retVal = direction*voObj1.getAuthoringInfo().getAuthoringHcp().getName().compareTo(voObj2.getAuthoringInfo().getAuthoringHcp().getName());
	
			if (retVal == 0)
			{
				if(voObj1.getAuthoringInfo().getAuthoringDateTime() == null && voObj2.getAuthoringInfo().getAuthoringDateTime() != null)
					return -1;
				if(voObj1.getAuthoringInfo().getAuthoringDateTime() != null && voObj2.getAuthoringInfo().getAuthoringDateTime() == null)
					return 1;
				if(voObj1.getAuthoringInfo().getAuthoringDateTime() != null && voObj2.getAuthoringInfo().getAuthoringDateTime() != null)
					retVal = direction*voObj1.getAuthoringInfo().getAuthoringDateTime().compareTo(voObj2.getAuthoringInfo().getAuthoringDateTime());
			}
			return retVal;
		}
		public boolean equals(Object obj)
		{
			return false;
		}	
	}
	/**
	* getAuthoringComparator - retrieves a new instance of static class PatientDiagnosisEDischargeListVoAuthoringComparator 
	*/
	public static PatientDiagnosisEDischargeListVoAuthoringComparator getAuthoringComparator(ims.framework.enumerations.SortOrder sortOrder)
	{
		return new PatientDiagnosisEDischargeListVo.PatientDiagnosisEDischargeListVoAuthoringComparator(sortOrder);
	}
	/**
	* PatientDiagnosisEDischargeListVoAuditComparator  (class definition)
	*/
	public static class PatientDiagnosisEDischargeListVoAuditComparator implements java.util.Comparator
	{
		private int direction = 1;
		public PatientDiagnosisEDischargeListVoAuditComparator()
		{
			this(ims.framework.enumerations.SortOrder.ASCENDING);
		}
		public PatientDiagnosisEDischargeListVoAuditComparator(ims.framework.enumerations.SortOrder order)
		{
			if (order == ims.framework.enumerations.SortOrder.DESCENDING)
			{
				direction = -1;
			}
		}
	
		public int compare(Object obj1, Object obj2)
		{
			PatientDiagnosisEDischargeListVo voObj1 = (PatientDiagnosisEDischargeListVo)obj1;
			PatientDiagnosisEDischargeListVo voObj2 = (PatientDiagnosisEDischargeListVo)obj2;
			if(voObj1.getSysInfo().getLastupdateUser() == null)
				return direction;
				
			if (voObj2.getSysInfo().getLastupdateUser() == null)
				return direction*-1;
								
			if(voObj1.getSysInfo().getLastupdateUser() == null && voObj2.getSysInfo().getLastupdateUser() != null)
				return direction;
		
			if(voObj1.getSysInfo().getLastupdateUser() != null && voObj2.getSysInfo().getLastupdateUser() == null)
				return direction*-1;
				
			return direction;					
		}
	
		public boolean equals(Object obj)
		{
			return false;
		}	
	}
	/**
	* getAuditComparator - retrieves a new instance of static class PatientDiagnosisEDischargeListVoAuditComparator 
	*/
	public static PatientDiagnosisEDischargeListVoAuditComparator getAuditComparator(ims.framework.enumerations.SortOrder sortOrder)
	{
		return new PatientDiagnosisEDischargeListVo.PatientDiagnosisEDischargeListVoAuditComparator(sortOrder);
	}
	/**
	* getIsComorbidityComparator - retrieves a new instance of static class PatientDiagnosisEDischargeListVoIsComorbidityComparator 
	*/
	public static PatientDiagnosisEDischargeListVoIsComorbidityComparator getIsComorbidityComparator(ims.framework.enumerations.SortOrder sortOrder)
	{
		return new PatientDiagnosisEDischargeListVo.PatientDiagnosisEDischargeListVoIsComorbidityComparator(sortOrder);
	}
	
	/**
	* PatientDiagnosisEDischargeListVoIsComorbidityComparator  (class definition)
	*/
	public static class PatientDiagnosisEDischargeListVoIsComorbidityComparator implements java.util.Comparator
	{
		private int direction = 1;
		public PatientDiagnosisEDischargeListVoIsComorbidityComparator ()
		{
			this(ims.framework.enumerations.SortOrder.ASCENDING);
		}
		public PatientDiagnosisEDischargeListVoIsComorbidityComparator (ims.framework.enumerations.SortOrder order)
		{
			if (order == ims.framework.enumerations.SortOrder.DESCENDING)
			{
				direction = -1;
			}
		}
	
		public int compare(Object obj1, Object obj2)
		{
			PatientDiagnosisEDischargeListVo voObj1 = (PatientDiagnosisEDischargeListVo)obj1;
			PatientDiagnosisEDischargeListVo voObj2 = (PatientDiagnosisEDischargeListVo)obj2;
			if(voObj1.getIsComorbidity() == null)
				return direction;
							
			if (voObj2.getIsComorbidity() == null)
				return direction*-1;
		
			if((voObj1.getIsComorbidity() != null && !voObj1.getIsComorbidity().booleanValue()) 
					&& (voObj2.getIsComorbidity() != null && voObj2.getIsComorbidity().booleanValue()) )
				return direction;
			if((voObj2.getIsComorbidity() != null && !voObj2.getIsComorbidity().booleanValue()) 
					&& (voObj1.getIsComorbidity() != null && voObj1.getIsComorbidity().booleanValue()) )
				return direction*-1;
										
			return direction;	
		}
	
		public boolean equals(Object obj)
		{
			return false;
		}	
	}
	
	/**
	* getIsComplicationComparator - retrieves a new instance of static class PatientDiagnosisEDischargeListVoIsComplicationComparator 
	*/
	public static PatientDiagnosisEDischargeListVoIsComplicationComparator getIsComplicationComparator(ims.framework.enumerations.SortOrder sortOrder)
	{
		return new PatientDiagnosisEDischargeListVo.PatientDiagnosisEDischargeListVoIsComplicationComparator(sortOrder);
	}
	
	/**
	* PatientDiagnosisEDischargeListVoIsComplicationComparator  (class definition)
	*/
	public static class PatientDiagnosisEDischargeListVoIsComplicationComparator implements java.util.Comparator
	{
		private int direction = 1;
		public PatientDiagnosisEDischargeListVoIsComplicationComparator ()
		{
			this(ims.framework.enumerations.SortOrder.ASCENDING);
		}
		public PatientDiagnosisEDischargeListVoIsComplicationComparator (ims.framework.enumerations.SortOrder order)
		{
			if (order == ims.framework.enumerations.SortOrder.DESCENDING)
			{
				direction = -1;
			}
		}
	
		public int compare(Object obj1, Object obj2)
		{
			PatientDiagnosisEDischargeListVo voObj1 = (PatientDiagnosisEDischargeListVo)obj1;
			PatientDiagnosisEDischargeListVo voObj2 = (PatientDiagnosisEDischargeListVo)obj2;
			if(voObj1.getIsComplication() == null)
				return direction;
							
			if (voObj2.getIsComplication() == null)
				return direction*-1;
		
			if((voObj1.getIsComplication() != null && !voObj1.getIsComplication().booleanValue()) 
					&& (voObj2.getIsComplication() != null && voObj2.getIsComplication().booleanValue()) )
				return direction;
			if((voObj2.getIsComplication() != null && !voObj2.getIsComplication().booleanValue()) 
					&& (voObj1.getIsComplication() != null && voObj1.getIsComplication().booleanValue()) )
				return direction*-1;
											
			return direction;	
		}
	
		public boolean equals(Object obj)
		{
			return false;
		}	
	}
	
	/**
	* PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator  (class definition)
	*/
	public static class PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator implements java.util.Comparator
		{
			private int direction = 1;
			public PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator()
			{
				this(ims.framework.enumerations.SortOrder.ASCENDING);
			}
			public PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator(ims.framework.enumerations.SortOrder order)
			{
				if (order == ims.framework.enumerations.SortOrder.DESCENDING)
				{
					direction = -1;
				}
			}
		
			public int compare(Object obj1, Object obj2)
			{
				PatientDiagnosisEDischargeListVo voObj1 = (PatientDiagnosisEDischargeListVo)obj1;
				PatientDiagnosisEDischargeListVo voObj2 = (PatientDiagnosisEDischargeListVo)obj2;
				if (voObj1.getCareContextIsNotNull() && voObj1.getCareContext().getStartDateTimeIsNotNull()
					&& voObj2.getCareContextIsNotNull() && voObj2.getCareContext().getStartDateTimeIsNotNull())
				{	
					return direction*(voObj1.getCareContext().getStartDateTime().compareTo(voObj2.getCareContext().getStartDateTime()));
				}
				if (voObj1.getCareContext() == null || voObj1.getCareContext().getStartDateTime() == null)
					return -1;
				if (voObj2.getCareContext() == null || voObj2.getCareContext().getStartDateTime() == null)
					return 1;	
		
				return direction;
			}
		
			public boolean equals(Object obj)
			{
				return false;
			}	
		}
	/**
	* getCareContextStartDateTimeComparator - retrieves a new instance of static class PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator
	*/
	public static PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator getCareContextStartDateTimeComparator(ims.framework.enumerations.SortOrder sortOrder)
		{
			return new PatientDiagnosisEDischargeListVo.PatientDiagnosisEDischargeListVoCareContextStartDateTimeComparator(sortOrder);
		}
	/**
	* IEDischarge Interface implementation methods
	*/
	public Boolean getIEDischargeSummaryIsComplete()
	{
		//only called when true
		return true;
	}
	public ims.clinical.vo.lookups.EDischargeSummarySection getIEDischargeSummarySection()
	{
		return ims.clinical.vo.lookups.EDischargeSummarySection.DIAGNOSIS;
	}
	/**
	* IClinicalCoding Interface implementation methods
	*/
	public ims.vo.ValueObject getIClinicalCodingValue() 
	{
		return this.diagnosis;
	}
	public void setIClinicalCodingValue(ims.vo.ValueObject vo) 
	{
		this.diagnosis = (ims.core.vo.DiagLiteVo)vo;		
	}
	public String getIClinicalCodingValueDescription() 
	{
		return this.diagnosisdescription;
	}
	public void setIClinicalCodingValueDescription(String value) 
	{
		this.diagnosisdescription = value;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.authoringinfo != null)
		{
			if(!this.authoringinfo.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.includediagnosisindiscreports != null)
		{
			if(!this.includediagnosisindiscreports.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.primaryforcarespells != null)
		{
			if(!this.primaryforcarespells.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.comorbidityforepisodeofcares != null)
		{
			if(!this.comorbidityforepisodeofcares.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		this.isBusy = false;
		return true;
	}
	public String[] validate()
	{
		return validate(null);
	}
	public String[] validate(String[] existingErrors)
	{
		if(this.isBusy)
			return null;
		this.isBusy = true;
	
		java.util.ArrayList<String> listOfErrors = new java.util.ArrayList<String>();
		if(existingErrors != null)
		{
			for(int x = 0; x < existingErrors.length; x++)
			{
				listOfErrors.add(existingErrors[x]);
			}
		}
		if(this.diagnosisdescription == null || this.diagnosisdescription.length() == 0)
			listOfErrors.add("DiagnosisDescription is mandatory");
		else if(this.diagnosisdescription.length() > 255)
			listOfErrors.add("The length of the field [diagnosisdescription] in the value object [ims.core.vo.PatientDiagnosisEDischargeListVo] is too big. It should be less or equal to 255");
		if(this.sourceofinformation == null)
			listOfErrors.add("SourceofInformation is mandatory");
		if(this.sitetext != null)
			if(this.sitetext.length() > 255)
				listOfErrors.add("The length of the field [sitetext] in the value object [ims.core.vo.PatientDiagnosisEDischargeListVo] is too big. It should be less or equal to 255");
		if(this.authoringinfo != null)
		{
			String[] listOfOtherErrors = this.authoringinfo.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.includediagnosisindiscreports != null)
		{
			String[] listOfOtherErrors = this.includediagnosisindiscreports.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.primaryforcarespells != null)
		{
			String[] listOfOtherErrors = this.primaryforcarespells.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.comorbidityforepisodeofcares != null)
		{
			String[] listOfOtherErrors = this.comorbidityforepisodeofcares.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.episodeofcare == null)
			listOfErrors.add("EpisodeOfCare is mandatory");
		int errorCount = listOfErrors.size();
		if(errorCount == 0)
		{
			this.isBusy = false;
			this.isValidated = true;
			return null;
		}
		String[] result = new String[errorCount];
		for(int x = 0; x < errorCount; x++)
			result[x] = (String)listOfErrors.get(x);
		this.isBusy = false;
		this.isValidated = false;
		return result;
	}
	public void clearIDAndVersion()
	{
		this.id = null;
		this.version = 0;
	}
	public Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		PatientDiagnosisEDischargeListVo clone = new PatientDiagnosisEDischargeListVo(this.id, this.version);
		
		clone.diagnosisdescription = this.diagnosisdescription;
		if(this.diagnoseddate == null)
			clone.diagnoseddate = null;
		else
			clone.diagnoseddate = (ims.framework.utils.PartialDate)this.diagnoseddate.clone();
		if(this.diagnosis == null)
			clone.diagnosis = null;
		else
			clone.diagnosis = (ims.core.vo.DiagLiteVo)this.diagnosis.clone();
		if(this.sourceofinformation == null)
			clone.sourceofinformation = null;
		else
			clone.sourceofinformation = (ims.core.vo.lookups.SourceofInformation)this.sourceofinformation.clone();
		clone.iscomplication = this.iscomplication;
		clone.iscomorbidity = this.iscomorbidity;
		if(this.dateresolved == null)
			clone.dateresolved = null;
		else
			clone.dateresolved = (ims.framework.utils.Date)this.dateresolved.clone();
		if(this.carecontext == null)
			clone.carecontext = null;
		else
			clone.carecontext = (ims.core.vo.CareContextForEdischargeDiagnosisVo)this.carecontext.clone();
		if(this.diaglaterality == null)
			clone.diaglaterality = null;
		else
			clone.diaglaterality = (ims.core.vo.lookups.LateralityLRB)this.diaglaterality.clone();
		clone.sitetext = this.sitetext;
		if(this.authoringinfo == null)
			clone.authoringinfo = null;
		else
			clone.authoringinfo = (ims.core.vo.AuthoringInformationVo)this.authoringinfo.clone();
		if(this.includediagnosisindiscreports == null)
			clone.includediagnosisindiscreports = null;
		else
			clone.includediagnosisindiscreports = (ims.core.vo.IncludeDiagnosisInDischargeReportVoCollection)this.includediagnosisindiscreports.clone();
		clone.isprevrelevantdiagnosis = this.isprevrelevantdiagnosis;
		if(this.sysinfo == null)
			clone.sysinfo = null;
		else
			clone.sysinfo = (ims.vo.SystemInformation)this.sysinfo.clone();
		if(this.dateonset == null)
			clone.dateonset = null;
		else
			clone.dateonset = (ims.framework.utils.Date)this.dateonset.clone();
		clone.clinicalcontact = this.clinicalcontact;
		if(this.primaryforcarespells == null)
			clone.primaryforcarespells = null;
		else
			clone.primaryforcarespells = (ims.core.vo.CSPrimaryDiagnosisVoCollection)this.primaryforcarespells.clone();
		if(this.comorbidityforepisodeofcares == null)
			clone.comorbidityforepisodeofcares = null;
		else
			clone.comorbidityforepisodeofcares = (ims.core.vo.EpisodeOfCareCoMorbidityVoCollection)this.comorbidityforepisodeofcares.clone();
		clone.episodeofcare = this.episodeofcare;
		clone.diagnosedonadmission = this.diagnosedonadmission;
		clone.isValidated = this.isValidated;
		
		this.isBusy = false;
		return clone;
	}
	public int compareTo(Object obj)
	{
		return compareTo(obj, true);
	}
	public int compareTo(Object obj, boolean caseInsensitive)
	{
		if (obj == null)
		{
			return -1;
		}
		if(caseInsensitive); // this is to avoid eclipse warning only.
		if (!(PatientDiagnosisEDischargeListVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PatientDiagnosisEDischargeListVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((PatientDiagnosisEDischargeListVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((PatientDiagnosisEDischargeListVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.diagnosisdescription != null)
			count++;
		if(this.diagnoseddate != null)
			count++;
		if(this.diagnosis != null)
			count++;
		if(this.sourceofinformation != null)
			count++;
		if(this.iscomplication != null)
			count++;
		if(this.iscomorbidity != null)
			count++;
		if(this.dateresolved != null)
			count++;
		if(this.carecontext != null)
			count++;
		if(this.diaglaterality != null)
			count++;
		if(this.sitetext != null)
			count++;
		if(this.authoringinfo != null)
			count++;
		if(this.includediagnosisindiscreports != null)
			count++;
		if(this.isprevrelevantdiagnosis != null)
			count++;
		if(this.sysinfo != null)
			count++;
		if(this.dateonset != null)
			count++;
		if(this.clinicalcontact != null)
			count++;
		if(this.primaryforcarespells != null)
			count++;
		if(this.comorbidityforepisodeofcares != null)
			count++;
		if(this.episodeofcare != null)
			count++;
		if(this.diagnosedonadmission != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 20;
	}
	protected String diagnosisdescription;
	protected ims.framework.utils.PartialDate diagnoseddate;
	protected ims.core.vo.DiagLiteVo diagnosis;
	protected ims.core.vo.lookups.SourceofInformation sourceofinformation;
	protected Boolean iscomplication;
	protected Boolean iscomorbidity;
	protected ims.framework.utils.Date dateresolved;
	protected ims.core.vo.CareContextForEdischargeDiagnosisVo carecontext;
	protected ims.core.vo.lookups.LateralityLRB diaglaterality;
	protected String sitetext;
	protected ims.core.vo.AuthoringInformationVo authoringinfo;
	protected ims.core.vo.IncludeDiagnosisInDischargeReportVoCollection includediagnosisindiscreports;
	protected Boolean isprevrelevantdiagnosis;
	protected ims.vo.SystemInformation sysinfo;
	protected ims.framework.utils.Date dateonset;
	protected ims.core.admin.vo.ClinicalContactRefVo clinicalcontact;
	protected ims.core.vo.CSPrimaryDiagnosisVoCollection primaryforcarespells;
	protected ims.core.vo.EpisodeOfCareCoMorbidityVoCollection comorbidityforepisodeofcares;
	protected ims.core.admin.vo.EpisodeOfCareRefVo episodeofcare;
	protected Boolean diagnosedonadmission;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
