/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/core/vo/Patient.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.patient.Patient business object (ID: 1001100000).
 */
public class Patient extends ims.core.vo.PatientShort implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public Patient()
	{
	}
	public Patient(Integer id, int version)
	{
		super(id, version);
	}
	public Patient(ims.core.vo.beans.PatientBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.name = bean.getName() == null ? null : bean.getName().buildVo();
		this.sex = bean.getSex() == null ? null : ims.core.vo.lookups.Sex.buildLookup(bean.getSex());
		this.age = bean.getAge();
		this.agetext = bean.getAgeText();
		this.address = bean.getAddress() == null ? null : bean.getAddress().buildVo();
		this.dob = bean.getDob() == null ? null : bean.getDob().buildPartialDate();
		this.dod = bean.getDod() == null ? null : bean.getDod().buildDate();
		this.ward = bean.getWard() == null ? null : bean.getWard().buildVo();
		this.religion = bean.getReligion() == null ? null : ims.core.vo.lookups.Religion.buildLookup(bean.getReligion());
		this.hasallergies = bean.getHasAllergies();
		this.hasalerts = bean.getHasAlerts();
		this.identifiers = ims.core.vo.PatientIdCollection.buildFromBeanCollection(bean.getIdentifiers());
		this.isactive = bean.getIsActive();
		this.associatedpatient = bean.getAssociatedPatient() == null ? null : bean.getAssociatedPatient().buildVo();
		this.commchannels = ims.core.vo.CommChannelVoCollection.buildFromBeanCollection(bean.getCommChannels());
		this.ethnicorigin = bean.getEthnicOrigin() == null ? null : ims.core.vo.lookups.EthnicOrigin.buildLookup(bean.getEthnicOrigin());
		this.maritalstatus = bean.getMaritalStatus() == null ? null : ims.core.vo.lookups.MaritalStatus.buildLookup(bean.getMaritalStatus());
		this.scn = bean.getSCN();
		this.sourceofinformation = bean.getSourceOfInformation() == null ? null : ims.core.vo.lookups.RegistrationSourceOfInfo.buildLookup(bean.getSourceOfInformation());
		this.sysinfo = bean.getSysInfo() == null ? null : bean.getSysInfo().buildSystemInformation();
		this.hasactivealerts = bean.getHasActiveAlerts();
		this.timeofdeath = bean.getTimeOfDeath() == null ? null : bean.getTimeOfDeath().buildTime();
		this.isquickregistrationpatient = bean.getIsQuickRegistrationPatient();
		this.ocsnotification = bean.getOCSNotification() == null ? null : bean.getOCSNotification().buildVo();
		this.currentresponsibleconsultant = bean.getCurrentResponsibleConsultant() == null ? null : new ims.core.resource.people.vo.MedicRefVo(new Integer(bean.getCurrentResponsibleConsultant().getId()), bean.getCurrentResponsibleConsultant().getVersion());
		this.dementiabreachdatetime = bean.getDementiaBreachDateTime() == null ? null : bean.getDementiaBreachDateTime().buildDateTime();
		this.dementiaworkliststatus = bean.getDementiaWorklistStatus() == null ? null : ims.core.vo.lookups.DementiaWorklistStatus.buildLookup(bean.getDementiaWorklistStatus());
		this.mrnstatus = bean.getMRNStatus() == null ? null : ims.core.vo.lookups.MRNStatus.buildLookup(bean.getMRNStatus());
		this.hasscannedcasenotefolders = bean.getHasScannedCaseNoteFolders();
		this.isconfidential = bean.getIsConfidential();
		this.timeofbirth = bean.getTimeOfBirth() == null ? null : bean.getTimeOfBirth().buildTime();
		this.isselfadmitpatient = bean.getIsSelfAdmitPatient();
		this.patientcategory = bean.getPatientCategory() == null ? null : ims.core.vo.lookups.PatientStatus.buildLookup(bean.getPatientCategory());
		this.pdspatientgp = bean.getPDSPatientGP() == null ? null : bean.getPDSPatientGP().buildVo();
		this.hasalertcategory1 = bean.getHasAlertCategory1();
		this.hasalertcategory2 = bean.getHasAlertCategory2();
		this.hasalertcategory3 = bean.getHasAlertCategory3();
		this.hasalertcategory4 = bean.getHasAlertCategory4();
		this.hasalertcategoryother = bean.getHasAlertCategoryOther();
		this.futureapptscancelonmarkdeceasedanswer = bean.getFutureApptsCancelOnMarkDeceasedAnswer();
		this.gp = bean.getGp() == null ? null : bean.getGp().buildVo();
		this.occupation = bean.getOccupation() == null ? null : ims.core.vo.lookups.Occupation.buildLookup(bean.getOccupation());
		this.language = bean.getLanguage() == null ? null : ims.core.vo.lookups.Language.buildLookup(bean.getLanguage());
		this.nok = bean.getNok() == null ? null : bean.getNok().buildVo();
		this.othernames = ims.core.vo.PersonNameCollection.buildFromBeanCollection(bean.getOtherNames());
		this.addresses = ims.core.vo.PersonAddressCollection.buildFromBeanCollection(bean.getAddresses());
		this.gpsurgery = bean.getGpSurgery() == null ? null : bean.getGpSurgery().buildVo();
		this.patientalerts = ims.core.vo.PatientAlertLiteVoCollection.buildFromBeanCollection(bean.getPatientAlerts());
		this.clientparent = bean.getClientParent() == null ? null : new ims.core.patient.vo.PatientRefVo(new Integer(bean.getClientParent().getId()), bean.getClientParent().getVersion());
		this.photo = bean.getPhoto() == null ? null : bean.getPhoto().buildVo();
		this.savealias = bean.getSaveAlias();
		this.cancelsd_appts = bean.getCancelSD_APPTS();
		this.homefolderlocation = bean.getHomeFolderLocation() == null ? null : ims.core.vo.lookups.HomeFolderLocation.buildLookup(bean.getHomeFolderLocation());
		this.harccode = bean.getHARCCode();
		this.prefcommlanguage = bean.getPrefCommLanguage() == null ? null : ims.core.vo.lookups.PDSPreferredCommunicationLanguage.buildLookup(bean.getPrefCommLanguage());
		this.practice = bean.getPractice() == null ? null : bean.getPractice().buildVo();
		this.copypatientoncorrespondence = bean.getCopyPatientOnCorrespondence();
		this.copypatientoncorrespondencedate = bean.getCopyPatientOnCorrespondenceDate() == null ? null : bean.getCopyPatientOnCorrespondenceDate().buildDate();
		this.currentmedicalinsurance = bean.getCurrentMedicalInsurance() == null ? null : bean.getCurrentMedicalInsurance().buildVo();
		this.nationalhealthcover = bean.getNationalHealthCover() == null ? null : bean.getNationalHealthCover().buildVo();
		this.alternativecontact = bean.getAlternativeContact() == null ? null : bean.getAlternativeContact().buildVo();
		this.healthboard = bean.getHealthBoard() == null ? null : ims.core.vo.lookups.HealthBoard.buildLookup(bean.getHealthBoard());
		this.supportnetworkfamily = ims.core.vo.SupportNetworkFamilyCollection.buildFromBeanCollection(bean.getSupportNetworkFamily());
		this.pdsdeathnotificationstatus = bean.getPDSDeathNotificationStatus() == null ? null : ims.admin.vo.lookups.PDSDeathNotificationStatus.buildLookup(bean.getPDSDeathNotificationStatus());
		this.pdsinterpreterrequired = bean.getPDSInterpreterRequired();
		this.pdsrelatives = ims.core.vo.PatRelativeCollection.buildFromBeanCollection(bean.getPDSrelatives());
		this.pdspatientupdate = bean.getPDSPatientUpdate() == null ? null : bean.getPDSPatientUpdate().buildVo();
		this.pdspatientgphistory = ims.core.vo.PDSPatientGPVoCollection.buildFromBeanCollection(bean.getPDSPatientGPHistory());
		this.school = bean.getSchool() == null ? null : new ims.core.resource.place.vo.SchoolRefVo(new Integer(bean.getSchool().getId()), bean.getSchool().getVersion());
		this.overseasvisitor = bean.getOverseasVisitor();
		this.overseasclassification = bean.getOverseasClassification() == null ? null : ims.core.vo.lookups.OverseasVisitorStatusCassification.buildLookup(bean.getOverseasClassification());
		this.hasliveduk = bean.getHasLivedUK();
		this.decoupled = bean.getDecoupled();
		this.pdsdatelastchecked = bean.getPDSDateLastChecked() == null ? null : bean.getPDSDateLastChecked().buildDate();
		this.schoolorcollege = bean.getSchoolOrCollege() == null ? null : ims.emergency.vo.lookups.School.buildLookup(bean.getSchoolOrCollege());
		this.ischildinpubliccare = bean.getIsChildInPublicCare();
		this.publiccareneed = bean.getPublicCareNeed() == null ? null : ims.core.vo.lookups.PublicCareNeed.buildLookup(bean.getPublicCareNeed());
		this.txtoccupation = bean.getTxtOccupation();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.PatientBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.name = bean.getName() == null ? null : bean.getName().buildVo(map);
		this.sex = bean.getSex() == null ? null : ims.core.vo.lookups.Sex.buildLookup(bean.getSex());
		this.age = bean.getAge();
		this.agetext = bean.getAgeText();
		this.address = bean.getAddress() == null ? null : bean.getAddress().buildVo(map);
		this.dob = bean.getDob() == null ? null : bean.getDob().buildPartialDate();
		this.dod = bean.getDod() == null ? null : bean.getDod().buildDate();
		this.ward = bean.getWard() == null ? null : bean.getWard().buildVo(map);
		this.religion = bean.getReligion() == null ? null : ims.core.vo.lookups.Religion.buildLookup(bean.getReligion());
		this.hasallergies = bean.getHasAllergies();
		this.hasalerts = bean.getHasAlerts();
		this.identifiers = ims.core.vo.PatientIdCollection.buildFromBeanCollection(bean.getIdentifiers());
		this.isactive = bean.getIsActive();
		this.associatedpatient = bean.getAssociatedPatient() == null ? null : bean.getAssociatedPatient().buildVo(map);
		this.commchannels = ims.core.vo.CommChannelVoCollection.buildFromBeanCollection(bean.getCommChannels());
		this.ethnicorigin = bean.getEthnicOrigin() == null ? null : ims.core.vo.lookups.EthnicOrigin.buildLookup(bean.getEthnicOrigin());
		this.maritalstatus = bean.getMaritalStatus() == null ? null : ims.core.vo.lookups.MaritalStatus.buildLookup(bean.getMaritalStatus());
		this.scn = bean.getSCN();
		this.sourceofinformation = bean.getSourceOfInformation() == null ? null : ims.core.vo.lookups.RegistrationSourceOfInfo.buildLookup(bean.getSourceOfInformation());
		this.sysinfo = bean.getSysInfo() == null ? null : bean.getSysInfo().buildSystemInformation();
		this.hasactivealerts = bean.getHasActiveAlerts();
		this.timeofdeath = bean.getTimeOfDeath() == null ? null : bean.getTimeOfDeath().buildTime();
		this.isquickregistrationpatient = bean.getIsQuickRegistrationPatient();
		this.ocsnotification = bean.getOCSNotification() == null ? null : bean.getOCSNotification().buildVo(map);
		this.currentresponsibleconsultant = bean.getCurrentResponsibleConsultant() == null ? null : new ims.core.resource.people.vo.MedicRefVo(new Integer(bean.getCurrentResponsibleConsultant().getId()), bean.getCurrentResponsibleConsultant().getVersion());
		this.dementiabreachdatetime = bean.getDementiaBreachDateTime() == null ? null : bean.getDementiaBreachDateTime().buildDateTime();
		this.dementiaworkliststatus = bean.getDementiaWorklistStatus() == null ? null : ims.core.vo.lookups.DementiaWorklistStatus.buildLookup(bean.getDementiaWorklistStatus());
		this.mrnstatus = bean.getMRNStatus() == null ? null : ims.core.vo.lookups.MRNStatus.buildLookup(bean.getMRNStatus());
		this.hasscannedcasenotefolders = bean.getHasScannedCaseNoteFolders();
		this.isconfidential = bean.getIsConfidential();
		this.timeofbirth = bean.getTimeOfBirth() == null ? null : bean.getTimeOfBirth().buildTime();
		this.isselfadmitpatient = bean.getIsSelfAdmitPatient();
		this.patientcategory = bean.getPatientCategory() == null ? null : ims.core.vo.lookups.PatientStatus.buildLookup(bean.getPatientCategory());
		this.pdspatientgp = bean.getPDSPatientGP() == null ? null : bean.getPDSPatientGP().buildVo(map);
		this.hasalertcategory1 = bean.getHasAlertCategory1();
		this.hasalertcategory2 = bean.getHasAlertCategory2();
		this.hasalertcategory3 = bean.getHasAlertCategory3();
		this.hasalertcategory4 = bean.getHasAlertCategory4();
		this.hasalertcategoryother = bean.getHasAlertCategoryOther();
		this.futureapptscancelonmarkdeceasedanswer = bean.getFutureApptsCancelOnMarkDeceasedAnswer();
		this.gp = bean.getGp() == null ? null : bean.getGp().buildVo(map);
		this.occupation = bean.getOccupation() == null ? null : ims.core.vo.lookups.Occupation.buildLookup(bean.getOccupation());
		this.language = bean.getLanguage() == null ? null : ims.core.vo.lookups.Language.buildLookup(bean.getLanguage());
		this.nok = bean.getNok() == null ? null : bean.getNok().buildVo(map);
		this.othernames = ims.core.vo.PersonNameCollection.buildFromBeanCollection(bean.getOtherNames());
		this.addresses = ims.core.vo.PersonAddressCollection.buildFromBeanCollection(bean.getAddresses());
		this.gpsurgery = bean.getGpSurgery() == null ? null : bean.getGpSurgery().buildVo(map);
		this.patientalerts = ims.core.vo.PatientAlertLiteVoCollection.buildFromBeanCollection(bean.getPatientAlerts());
		this.clientparent = bean.getClientParent() == null ? null : new ims.core.patient.vo.PatientRefVo(new Integer(bean.getClientParent().getId()), bean.getClientParent().getVersion());
		this.photo = bean.getPhoto() == null ? null : bean.getPhoto().buildVo(map);
		this.savealias = bean.getSaveAlias();
		this.cancelsd_appts = bean.getCancelSD_APPTS();
		this.homefolderlocation = bean.getHomeFolderLocation() == null ? null : ims.core.vo.lookups.HomeFolderLocation.buildLookup(bean.getHomeFolderLocation());
		this.harccode = bean.getHARCCode();
		this.prefcommlanguage = bean.getPrefCommLanguage() == null ? null : ims.core.vo.lookups.PDSPreferredCommunicationLanguage.buildLookup(bean.getPrefCommLanguage());
		this.practice = bean.getPractice() == null ? null : bean.getPractice().buildVo(map);
		this.copypatientoncorrespondence = bean.getCopyPatientOnCorrespondence();
		this.copypatientoncorrespondencedate = bean.getCopyPatientOnCorrespondenceDate() == null ? null : bean.getCopyPatientOnCorrespondenceDate().buildDate();
		this.currentmedicalinsurance = bean.getCurrentMedicalInsurance() == null ? null : bean.getCurrentMedicalInsurance().buildVo(map);
		this.nationalhealthcover = bean.getNationalHealthCover() == null ? null : bean.getNationalHealthCover().buildVo(map);
		this.alternativecontact = bean.getAlternativeContact() == null ? null : bean.getAlternativeContact().buildVo(map);
		this.healthboard = bean.getHealthBoard() == null ? null : ims.core.vo.lookups.HealthBoard.buildLookup(bean.getHealthBoard());
		this.supportnetworkfamily = ims.core.vo.SupportNetworkFamilyCollection.buildFromBeanCollection(bean.getSupportNetworkFamily());
		this.pdsdeathnotificationstatus = bean.getPDSDeathNotificationStatus() == null ? null : ims.admin.vo.lookups.PDSDeathNotificationStatus.buildLookup(bean.getPDSDeathNotificationStatus());
		this.pdsinterpreterrequired = bean.getPDSInterpreterRequired();
		this.pdsrelatives = ims.core.vo.PatRelativeCollection.buildFromBeanCollection(bean.getPDSrelatives());
		this.pdspatientupdate = bean.getPDSPatientUpdate() == null ? null : bean.getPDSPatientUpdate().buildVo(map);
		this.pdspatientgphistory = ims.core.vo.PDSPatientGPVoCollection.buildFromBeanCollection(bean.getPDSPatientGPHistory());
		this.school = bean.getSchool() == null ? null : new ims.core.resource.place.vo.SchoolRefVo(new Integer(bean.getSchool().getId()), bean.getSchool().getVersion());
		this.overseasvisitor = bean.getOverseasVisitor();
		this.overseasclassification = bean.getOverseasClassification() == null ? null : ims.core.vo.lookups.OverseasVisitorStatusCassification.buildLookup(bean.getOverseasClassification());
		this.hasliveduk = bean.getHasLivedUK();
		this.decoupled = bean.getDecoupled();
		this.pdsdatelastchecked = bean.getPDSDateLastChecked() == null ? null : bean.getPDSDateLastChecked().buildDate();
		this.schoolorcollege = bean.getSchoolOrCollege() == null ? null : ims.emergency.vo.lookups.School.buildLookup(bean.getSchoolOrCollege());
		this.ischildinpubliccare = bean.getIsChildInPublicCare();
		this.publiccareneed = bean.getPublicCareNeed() == null ? null : ims.core.vo.lookups.PublicCareNeed.buildLookup(bean.getPublicCareNeed());
		this.txtoccupation = bean.getTxtOccupation();
	}
	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.PatientBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.PatientBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.PatientBean();
			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("GP"))
			return getGp();
		if(fieldName.equals("OCCUPATION"))
			return getOccupation();
		if(fieldName.equals("LANGUAGE"))
			return getLanguage();
		if(fieldName.equals("NOK"))
			return getNok();
		if(fieldName.equals("OTHERNAMES"))
			return getOtherNames();
		if(fieldName.equals("ADDRESSES"))
			return getAddresses();
		if(fieldName.equals("GPSURGERY"))
			return getGpSurgery();
		if(fieldName.equals("PATIENTALERTS"))
			return getPatientAlerts();
		if(fieldName.equals("CLIENTPARENT"))
			return getClientParent();
		if(fieldName.equals("PHOTO"))
			return getPhoto();
		if(fieldName.equals("SAVEALIAS"))
			return getSaveAlias();
		if(fieldName.equals("CANCELSD_APPTS"))
			return getCancelSD_APPTS();
		if(fieldName.equals("HOMEFOLDERLOCATION"))
			return getHomeFolderLocation();
		if(fieldName.equals("HARCCODE"))
			return getHARCCode();
		if(fieldName.equals("PREFCOMMLANGUAGE"))
			return getPrefCommLanguage();
		if(fieldName.equals("PRACTICE"))
			return getPractice();
		if(fieldName.equals("COPYPATIENTONCORRESPONDENCE"))
			return getCopyPatientOnCorrespondence();
		if(fieldName.equals("COPYPATIENTONCORRESPONDENCEDATE"))
			return getCopyPatientOnCorrespondenceDate();
		if(fieldName.equals("CURRENTMEDICALINSURANCE"))
			return getCurrentMedicalInsurance();
		if(fieldName.equals("NATIONALHEALTHCOVER"))
			return getNationalHealthCover();
		if(fieldName.equals("ALTERNATIVECONTACT"))
			return getAlternativeContact();
		if(fieldName.equals("HEALTHBOARD"))
			return getHealthBoard();
		if(fieldName.equals("SUPPORTNETWORKFAMILY"))
			return getSupportNetworkFamily();
		if(fieldName.equals("PDSDEATHNOTIFICATIONSTATUS"))
			return getPDSDeathNotificationStatus();
		if(fieldName.equals("PDSINTERPRETERREQUIRED"))
			return getPDSInterpreterRequired();
		if(fieldName.equals("PDSRELATIVES"))
			return getPDSrelatives();
		if(fieldName.equals("PDSPATIENTUPDATE"))
			return getPDSPatientUpdate();
		if(fieldName.equals("PDSPATIENTGPHISTORY"))
			return getPDSPatientGPHistory();
		if(fieldName.equals("SCHOOL"))
			return getSchool();
		if(fieldName.equals("OVERSEASVISITOR"))
			return getOverseasVisitor();
		if(fieldName.equals("OVERSEASCLASSIFICATION"))
			return getOverseasClassification();
		if(fieldName.equals("HASLIVEDUK"))
			return getHasLivedUK();
		if(fieldName.equals("DECOUPLED"))
			return getDecoupled();
		if(fieldName.equals("PDSDATELASTCHECKED"))
			return getPDSDateLastChecked();
		if(fieldName.equals("SCHOOLORCOLLEGE"))
			return getSchoolOrCollege();
		if(fieldName.equals("ISCHILDINPUBLICCARE"))
			return getIsChildInPublicCare();
		if(fieldName.equals("PUBLICCARENEED"))
			return getPublicCareNeed();
		if(fieldName.equals("TXTOCCUPATION"))
			return getTxtOccupation();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getGpIsNotNull()
	{
		return this.gp != null;
	}
	public ims.core.vo.GpShortVo getGp()
	{
		return this.gp;
	}
	public void setGp(ims.core.vo.GpShortVo value)
	{
		this.isValidated = false;
		this.gp = value;
	}
	public boolean getOccupationIsNotNull()
	{
		return this.occupation != null;
	}
	public ims.core.vo.lookups.Occupation getOccupation()
	{
		return this.occupation;
	}
	public void setOccupation(ims.core.vo.lookups.Occupation value)
	{
		this.isValidated = false;
		this.occupation = value;
	}
	public boolean getLanguageIsNotNull()
	{
		return this.language != null;
	}
	public ims.core.vo.lookups.Language getLanguage()
	{
		return this.language;
	}
	public void setLanguage(ims.core.vo.lookups.Language value)
	{
		this.isValidated = false;
		this.language = value;
	}
	public boolean getNokIsNotNull()
	{
		return this.nok != null;
	}
	public ims.core.vo.NextOfKin getNok()
	{
		return this.nok;
	}
	public void setNok(ims.core.vo.NextOfKin value)
	{
		this.isValidated = false;
		this.nok = value;
	}
	public boolean getOtherNamesIsNotNull()
	{
		return this.othernames != null;
	}
	public ims.core.vo.PersonNameCollection getOtherNames()
	{
		return this.othernames;
	}
	public void setOtherNames(ims.core.vo.PersonNameCollection value)
	{
		this.isValidated = false;
		this.othernames = value;
	}
	public boolean getAddressesIsNotNull()
	{
		return this.addresses != null;
	}
	public ims.core.vo.PersonAddressCollection getAddresses()
	{
		return this.addresses;
	}
	public void setAddresses(ims.core.vo.PersonAddressCollection value)
	{
		this.isValidated = false;
		this.addresses = value;
	}
	public boolean getGpSurgeryIsNotNull()
	{
		return this.gpsurgery != null;
	}
	public ims.core.vo.LocSiteShortVo getGpSurgery()
	{
		return this.gpsurgery;
	}
	public void setGpSurgery(ims.core.vo.LocSiteShortVo value)
	{
		this.isValidated = false;
		this.gpsurgery = value;
	}
	public boolean getPatientAlertsIsNotNull()
	{
		return this.patientalerts != null;
	}
	public ims.core.vo.PatientAlertLiteVoCollection getPatientAlerts()
	{
		return this.patientalerts;
	}
	public void setPatientAlerts(ims.core.vo.PatientAlertLiteVoCollection value)
	{
		this.isValidated = false;
		this.patientalerts = value;
	}
	public boolean getClientParentIsNotNull()
	{
		return this.clientparent != null;
	}
	public ims.core.patient.vo.PatientRefVo getClientParent()
	{
		return this.clientparent;
	}
	public void setClientParent(ims.core.patient.vo.PatientRefVo value)
	{
		this.isValidated = false;
		this.clientparent = value;
	}
	public boolean getPhotoIsNotNull()
	{
		return this.photo != null;
	}
	public ims.core.vo.AppDBImageVo getPhoto()
	{
		return this.photo;
	}
	public void setPhoto(ims.core.vo.AppDBImageVo value)
	{
		this.isValidated = false;
		this.photo = value;
	}
	public boolean getSaveAliasIsNotNull()
	{
		return this.savealias != null;
	}
	public String getSaveAlias()
	{
		return this.savealias;
	}
	public static int getSaveAliasMaxLength()
	{
		return 255;
	}
	public void setSaveAlias(String value)
	{
		this.isValidated = false;
		this.savealias = value;
	}
	public boolean getCancelSD_APPTSIsNotNull()
	{
		return this.cancelsd_appts != null;
	}
	public Boolean getCancelSD_APPTS()
	{
		return this.cancelsd_appts;
	}
	public void setCancelSD_APPTS(Boolean value)
	{
		this.isValidated = false;
		this.cancelsd_appts = value;
	}
	public boolean getHomeFolderLocationIsNotNull()
	{
		return this.homefolderlocation != null;
	}
	public ims.core.vo.lookups.HomeFolderLocation getHomeFolderLocation()
	{
		return this.homefolderlocation;
	}
	public void setHomeFolderLocation(ims.core.vo.lookups.HomeFolderLocation value)
	{
		this.isValidated = false;
		this.homefolderlocation = value;
	}
	public boolean getHARCCodeIsNotNull()
	{
		return this.harccode != null;
	}
	public String getHARCCode()
	{
		return this.harccode;
	}
	public static int getHARCCodeMaxLength()
	{
		return 255;
	}
	public void setHARCCode(String value)
	{
		this.isValidated = false;
		this.harccode = value;
	}
	public boolean getPrefCommLanguageIsNotNull()
	{
		return this.prefcommlanguage != null;
	}
	public ims.core.vo.lookups.PDSPreferredCommunicationLanguage getPrefCommLanguage()
	{
		return this.prefcommlanguage;
	}
	public void setPrefCommLanguage(ims.core.vo.lookups.PDSPreferredCommunicationLanguage value)
	{
		this.isValidated = false;
		this.prefcommlanguage = value;
	}
	public boolean getPracticeIsNotNull()
	{
		return this.practice != null;
	}
	public ims.core.vo.OrganisationWithSitesVo getPractice()
	{
		return this.practice;
	}
	public void setPractice(ims.core.vo.OrganisationWithSitesVo value)
	{
		this.isValidated = false;
		this.practice = value;
	}
	public boolean getCopyPatientOnCorrespondenceIsNotNull()
	{
		return this.copypatientoncorrespondence != null;
	}
	public Boolean getCopyPatientOnCorrespondence()
	{
		return this.copypatientoncorrespondence;
	}
	public void setCopyPatientOnCorrespondence(Boolean value)
	{
		this.isValidated = false;
		this.copypatientoncorrespondence = value;
	}
	public boolean getCopyPatientOnCorrespondenceDateIsNotNull()
	{
		return this.copypatientoncorrespondencedate != null;
	}
	public ims.framework.utils.Date getCopyPatientOnCorrespondenceDate()
	{
		return this.copypatientoncorrespondencedate;
	}
	public void setCopyPatientOnCorrespondenceDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.copypatientoncorrespondencedate = value;
	}
	public boolean getCurrentMedicalInsuranceIsNotNull()
	{
		return this.currentmedicalinsurance != null;
	}
	public ims.core.vo.PatientMedicalInsuranceVo getCurrentMedicalInsurance()
	{
		return this.currentmedicalinsurance;
	}
	public void setCurrentMedicalInsurance(ims.core.vo.PatientMedicalInsuranceVo value)
	{
		this.isValidated = false;
		this.currentmedicalinsurance = value;
	}
	public boolean getNationalHealthCoverIsNotNull()
	{
		return this.nationalhealthcover != null;
	}
	public ims.core.vo.NationalHealthCoverVo getNationalHealthCover()
	{
		return this.nationalhealthcover;
	}
	public void setNationalHealthCover(ims.core.vo.NationalHealthCoverVo value)
	{
		this.isValidated = false;
		this.nationalhealthcover = value;
	}
	public boolean getAlternativeContactIsNotNull()
	{
		return this.alternativecontact != null;
	}
	public ims.core.vo.PatientContactPreferenceVo getAlternativeContact()
	{
		return this.alternativecontact;
	}
	public void setAlternativeContact(ims.core.vo.PatientContactPreferenceVo value)
	{
		this.isValidated = false;
		this.alternativecontact = value;
	}
	public boolean getHealthBoardIsNotNull()
	{
		return this.healthboard != null;
	}
	public ims.core.vo.lookups.HealthBoard getHealthBoard()
	{
		return this.healthboard;
	}
	public void setHealthBoard(ims.core.vo.lookups.HealthBoard value)
	{
		this.isValidated = false;
		this.healthboard = value;
	}
	public boolean getSupportNetworkFamilyIsNotNull()
	{
		return this.supportnetworkfamily != null;
	}
	public ims.core.vo.SupportNetworkFamilyCollection getSupportNetworkFamily()
	{
		return this.supportnetworkfamily;
	}
	public void setSupportNetworkFamily(ims.core.vo.SupportNetworkFamilyCollection value)
	{
		this.isValidated = false;
		this.supportnetworkfamily = value;
	}
	public boolean getPDSDeathNotificationStatusIsNotNull()
	{
		return this.pdsdeathnotificationstatus != null;
	}
	public ims.admin.vo.lookups.PDSDeathNotificationStatus getPDSDeathNotificationStatus()
	{
		return this.pdsdeathnotificationstatus;
	}
	public void setPDSDeathNotificationStatus(ims.admin.vo.lookups.PDSDeathNotificationStatus value)
	{
		this.isValidated = false;
		this.pdsdeathnotificationstatus = value;
	}
	public boolean getPDSInterpreterRequiredIsNotNull()
	{
		return this.pdsinterpreterrequired != null;
	}
	public Boolean getPDSInterpreterRequired()
	{
		return this.pdsinterpreterrequired;
	}
	public void setPDSInterpreterRequired(Boolean value)
	{
		this.isValidated = false;
		this.pdsinterpreterrequired = value;
	}
	public boolean getPDSrelativesIsNotNull()
	{
		return this.pdsrelatives != null;
	}
	public ims.core.vo.PatRelativeCollection getPDSrelatives()
	{
		return this.pdsrelatives;
	}
	public void setPDSrelatives(ims.core.vo.PatRelativeCollection value)
	{
		this.isValidated = false;
		this.pdsrelatives = value;
	}
	public boolean getPDSPatientUpdateIsNotNull()
	{
		return this.pdspatientupdate != null;
	}
	public ims.core.vo.PDSPatientUpdateVo getPDSPatientUpdate()
	{
		return this.pdspatientupdate;
	}
	public void setPDSPatientUpdate(ims.core.vo.PDSPatientUpdateVo value)
	{
		this.isValidated = false;
		this.pdspatientupdate = value;
	}
	public boolean getPDSPatientGPHistoryIsNotNull()
	{
		return this.pdspatientgphistory != null;
	}
	public ims.core.vo.PDSPatientGPVoCollection getPDSPatientGPHistory()
	{
		return this.pdspatientgphistory;
	}
	public void setPDSPatientGPHistory(ims.core.vo.PDSPatientGPVoCollection value)
	{
		this.isValidated = false;
		this.pdspatientgphistory = value;
	}
	public boolean getSchoolIsNotNull()
	{
		return this.school != null;
	}
	public ims.core.resource.place.vo.SchoolRefVo getSchool()
	{
		return this.school;
	}
	public void setSchool(ims.core.resource.place.vo.SchoolRefVo value)
	{
		this.isValidated = false;
		this.school = value;
	}
	public boolean getOverseasVisitorIsNotNull()
	{
		return this.overseasvisitor != null;
	}
	public Boolean getOverseasVisitor()
	{
		return this.overseasvisitor;
	}
	public void setOverseasVisitor(Boolean value)
	{
		this.isValidated = false;
		this.overseasvisitor = value;
	}
	public boolean getOverseasClassificationIsNotNull()
	{
		return this.overseasclassification != null;
	}
	public ims.core.vo.lookups.OverseasVisitorStatusCassification getOverseasClassification()
	{
		return this.overseasclassification;
	}
	public void setOverseasClassification(ims.core.vo.lookups.OverseasVisitorStatusCassification value)
	{
		this.isValidated = false;
		this.overseasclassification = value;
	}
	public boolean getHasLivedUKIsNotNull()
	{
		return this.hasliveduk != null;
	}
	public Boolean getHasLivedUK()
	{
		return this.hasliveduk;
	}
	public void setHasLivedUK(Boolean value)
	{
		this.isValidated = false;
		this.hasliveduk = value;
	}
	public boolean getDecoupledIsNotNull()
	{
		return this.decoupled != null;
	}
	public Boolean getDecoupled()
	{
		return this.decoupled;
	}
	public void setDecoupled(Boolean value)
	{
		this.isValidated = false;
		this.decoupled = value;
	}
	public boolean getPDSDateLastCheckedIsNotNull()
	{
		return this.pdsdatelastchecked != null;
	}
	public ims.framework.utils.Date getPDSDateLastChecked()
	{
		return this.pdsdatelastchecked;
	}
	public void setPDSDateLastChecked(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.pdsdatelastchecked = value;
	}
	public boolean getSchoolOrCollegeIsNotNull()
	{
		return this.schoolorcollege != null;
	}
	public ims.emergency.vo.lookups.School getSchoolOrCollege()
	{
		return this.schoolorcollege;
	}
	public void setSchoolOrCollege(ims.emergency.vo.lookups.School value)
	{
		this.isValidated = false;
		this.schoolorcollege = value;
	}
	public boolean getIsChildInPublicCareIsNotNull()
	{
		return this.ischildinpubliccare != null;
	}
	public Boolean getIsChildInPublicCare()
	{
		return this.ischildinpubliccare;
	}
	public void setIsChildInPublicCare(Boolean value)
	{
		this.isValidated = false;
		this.ischildinpubliccare = value;
	}
	public boolean getPublicCareNeedIsNotNull()
	{
		return this.publiccareneed != null;
	}
	public ims.core.vo.lookups.PublicCareNeed getPublicCareNeed()
	{
		return this.publiccareneed;
	}
	public void setPublicCareNeed(ims.core.vo.lookups.PublicCareNeed value)
	{
		this.isValidated = false;
		this.publiccareneed = value;
	}
	public boolean getTxtOccupationIsNotNull()
	{
		return this.txtoccupation != null;
	}
	public String getTxtOccupation()
	{
		return this.txtoccupation;
	}
	public static int getTxtOccupationMaxLength()
	{
		return 255;
	}
	public void setTxtOccupation(String value)
	{
		this.isValidated = false;
		this.txtoccupation = value;
	}
	/**
	* getName - Gets the name from the collection of names by identifer type
	*/
	public ims.core.vo.PersonName getName(ims.core.vo.lookups.NameType nameType)
	{
		if (othernames == null) 
			return null;
	
		for (int i = 0; i < othernames.size(); i++)
		{
			ims.core.vo.PersonName name = othernames.get(i);		
			if (name != null && name.getNameType() != null && name.getNameType().equals(nameType))
			{
				return name;
			}
		}
	
		return null;
	}
	/**
	* getMaidenName - return the maiden name details from otherNames
	*/
	public ims.core.vo.PersonName getMaidenName()
	{
		return getName(ims.core.vo.lookups.NameType.MAIDEN);
	}
	/**
	* setMaidenName - sets the maiden name
	*/
	public void setMaidenName(String surname, String forename)
	{
		ims.core.vo.PersonName name = new PersonName();
		name.setSurname(surname);
		name.setForename(forename);
		setMaidenName(name);
	}
	/**
	* setMaidenName - if Maiden Name exists update details else add a miden name to otherNames
	*/
	public void setMaidenName(ims.core.vo.PersonName name)
	{
		if (name == null)
		{
			removeNameType(ims.core.vo.lookups.NameType.MAIDEN);
			return;
		}
		ims.core.vo.PersonName maidenName = getMaidenName();
		if (maidenName != null)
		{
			maidenName.setSurname(name.getSurname());
			maidenName.setForename(name.getForename());
		}
		else
		{
			if (othernames == null) othernames = new ims.core.vo.PersonNameCollection();
			
			name.setNameType(ims.core.vo.lookups.NameType.MAIDEN);
			othernames.add(name);
		}
	}
	/**
	* removeNameType
	*/
	public void removeNameType(ims.core.vo.lookups.NameType nameType)
	{
		if (othernames == null) 
			return;
		
		for (int i =0; i < othernames.size(); i++)
		{	
			ims.core.vo.PersonName name = othernames.get(i);
			if (name.getNameType()!=null && name.getNameType().equals(nameType))
			{
				othernames.remove(i);
				return;
			}
		}
	}
	/**
	* validateNTPFPatient : as it suggests very specific and only for NTPF
	*/
	public String[] validateNTPFPatient() 
	{
		java.util.ArrayList arrListErrors = new java.util.ArrayList();
	
		if (this.name != null)
		{
			if (this.name.surname == null)
				arrListErrors.add(new String("Surname is a mandatory field"));
			else if (this.name.surname.equals(""))
				arrListErrors.add(new String("Surname is a mandatory field"));
			
			if (this.name.forename == null)
				arrListErrors.add(new String("Forename is a mandatory field"));
			else if (this.name.forename.equals(""))
				arrListErrors.add(new String("Forename is a mandatory field"));
		}
	
		if (this.sex == null)
			arrListErrors.add(new String("Sex is a mandatory field"));
	
		Boolean bShowMessage = Boolean.FALSE;
		Boolean bShowDodMessage = Boolean.FALSE;
		if ((this.dob != null) && (this.dob.toString() != "__/__/____"))
		{
			if (this.dob.isDate())
			{
				if (this.dob.toDate().isGreaterThan(new ims.framework.utils.Date()))
					bShowMessage = Boolean.TRUE;
	
				if (this.dod != null)
				{
					if (this.dob.toDate().isGreaterThan(this.dod))
						bShowDodMessage = Boolean.TRUE;
				}
			}
			else
			{
				if (this.dob.getYear().intValue() > new ims.framework.utils.Date().getYear())
					bShowMessage = Boolean.TRUE;
				else if ((this.dob.getYear().intValue() == new ims.framework.utils.Date().getYear()) 
					&& (this.dob.getMonth() != null)
					&& (this.dob.getMonth().intValue() > new ims.framework.utils.Date().getMonth()))
					bShowMessage = Boolean.TRUE;
			}
		}
	
		if (bShowMessage.booleanValue())
			arrListErrors.add(new String("DOB cannot be in the future."));
		if (bShowDodMessage.booleanValue())
			arrListErrors.add(new String("DOD cannot be before DOB."));
	
		String[] arrErrors = new String[arrListErrors.toArray().length];
		for (int i = 0; i < arrListErrors.toArray().length; i++)
			arrErrors[i] = (String) arrListErrors.toArray()[i];
	
		String[] patErrors = this.validate();
		if (patErrors != null || arrErrors.length > 0)
		{
			int length = 0;
			if (patErrors != null)
				length = patErrors.length;
	
			String[] errors = new String[length + arrErrors.length];
	
			for (int i = 0; i < length; i++)
				errors[i] = patErrors[i];
	
			for (int i = 0; i < arrErrors.length; i++)
			{
				errors[length] = arrErrors[i];
				length += 1;
			}
	
			if (errors.length > 0)
				return errors;
			else
				return null;
		}
		return null;
	}
	/**
	* getPatientInfoButtonText : Return the string for the Info Button.
	*/
	public String getPatientInfoButtonText()
			{
				calculateAge();
		
				java.lang.StringBuffer sb = new java.lang.StringBuffer("");
		
				if (this.dod != null)
					sb.append(ims.configuration.ConfigFlag.UI.RIP_INFO_PREFIX.getValue());
		
				sb.append("<font color=\"#FF0000\"><b><u>Demographic Details</b></u></font><br><b>Name:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
				if (this.getName() != null)
					sb.append(this.getName().toString());
				sb.append("<br> <b>Address:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
				if (this.address != null)
					sb.append(this.address.toDisplayString());
				// WDEV-8205
				boolean homePhoneDisplayed = false;
				if (!ims.configuration.ConfigFlag.UI.DEMOGRAPHICS_TYPE.getValue().equals("UK") && (this.address != null) && (this.address.phone != null) && this.address.phone.trim().length() > 0)// WDEV-12085
				{
					sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><b>Home Tel:</b>&nbsp;&nbsp;&nbsp;&nbsp;");
					homePhoneDisplayed = true;// WDEV-12085
					sb.append(this.address.phone);
				}
		
				if (this.getCommChannels() != null)
				{
					for (int i = 0; i < this.getCommChannels().size(); i++)
					{
						ims.core.vo.CommChannelVo voComChannel = this.getCommChannels().get(i);
		
						if (voComChannel != null && voComChannel.getChannelType() != null && voComChannel.getCommValue() != null)
						{
							// WDEV-8205
							if (!homePhoneDisplayed || !voComChannel.channeltype.equals(ims.core.vo.lookups.ChannelType.HOME_PHONE))
							{
								sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><b>");
								sb.append(voComChannel.getChannelType().toString());
								sb.append(":</b>&nbsp;&nbsp;&nbsp;");
								sb.append(voComChannel.getCommValue());
							}
						}
					}
				}
				sb.append("<br><b>Sex:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
				if (this.sex != null)
					sb.append(this.sex.toString());
				else
					sb.append(" Sex Unknown ");
				sb.append("<br><b>DOB:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
				if (this.dob != null)
					sb.append(dob.toString(ims.framework.utils.DateFormat.STANDARD));
				else
					sb.append("DOB Unknown ");
	
				//WDEV-19701
				if (this.dod != null)
				{
					sb.append("<br><b>DOD:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
					sb.append(dod.toString(ims.framework.utils.DateFormat.STANDARD));
				}
	
				sb.append("<br><b>Age:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
				if (this.dob != null)
					sb.append(calculateAgeText());
		
				sb.append("<br><br><font color=\"#FF0000\"><b><u>Identifiers</u></b></font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
				if (this.getIdentifiers() != null)
				{
					for (int i = 0; i < this.getIdentifiers().size(); i++)
					{
						ims.core.vo.PatientId id2 = this.getIdentifiers().get(i);
		
						if (id2 != null && id2.getType() != null && id2.getValue() != null)
						{
							sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><b>");
							sb.append(id2.getType().toString());
							sb.append(":</b>&nbsp;&nbsp;&nbsp;");
							sb.append(id2.getValue());
						}
					}
				}
		
				sb.append("<br><br><font color=\"#FF0000\"><b><u>Registered GP:</u></b></font><br><b>Name:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
				if ((this.gp != null) && (this.gp.name != null))
					sb.append(this.gp.name.toString());
		
				sb.append("<br><b>National Code:</b>&nbsp;&nbsp;&nbsp;");
				if ((this.gp != null) && (this.gp.getNationalCode() != null))
					sb.append(this.gp.getNationalCode());
		
				if (Boolean.FALSE.equals(ims.configuration.gen.ConfigFlag.DOM.GP_USE_SURGERIES.getValue()))
				{
					OrganisationWithSitesVo gpPractice = this.practice;
		
					if ((this.practice == null) && (this.gp != null) && (this.gp.practices != null) &&  (this.gp.practices.size() > 0))
					{
						gpPractice = this.gp.practices.get(0).getPractice();
					}
		
					if (gpPractice != null)
					{
						sb.append("<br><b>Practice Address:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
						sb.append(gpPractice.getAddress() == null ? "" : gpPractice.getAddress().toDisplayString());
					}
		
					if (this.gp != null)
					{
						if (this.gp.commchannels != null)
						{
							CommChannelVo gpGenPhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.GEN_PHONE);
							CommChannelVo gpHomePhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.HOME_PHONE);
							CommChannelVo gpWorkPhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.WORK_PHONE);
							CommChannelVo gpMobilePhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.MOBILE);
							CommChannelVo gpFaxPhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.FAX);
		
							if (gpGenPhone != null)
							{
								sb.append("<br><b>GP General Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpGenPhone.toString());
							}
							else if (gpPractice != null && gpPractice.getCommChannelsIsNotNull())
							{
								CommChannelVo practiceGeneralPhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.GEN_PHONE);
		
								if (practiceGeneralPhone != null)
								{
									sb.append("<br><b>Practice General Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(practiceGeneralPhone.toString());
								}
							}
		
							if (gpHomePhone != null)
							{
								sb.append("<br><b>GP Home Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpHomePhone.toString());
							}
							else if (gpPractice != null && gpPractice.getCommChannelsIsNotNull())
							{
								CommChannelVo practiceHomePhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.HOME_PHONE);
		
								if (practiceHomePhone != null)
								{
									sb.append("<br><b>Practice Home Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(practiceHomePhone.toString());
								}
							}
		
							if (gpMobilePhone != null)
							{
								sb.append("<br><b>GP Mobile Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpMobilePhone.toString());
							}
							else if (gpPractice != null && gpPractice.getCommChannelsIsNotNull())
							{
								CommChannelVo practiceMobilePhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.MOBILE);
		
								if (practiceMobilePhone != null)
								{
									sb.append("<br><b>Practice Mobile Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(practiceMobilePhone.toString());
								}
							}
		
							if (gpWorkPhone != null)
							{
								sb.append("<br><b>GP Work Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpWorkPhone.toString());
							}
							else if (gpPractice != null && gpPractice.getCommChannelsIsNotNull())
							{
								CommChannelVo practiceWorkPhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.WORK_PHONE);
		
								if (practiceWorkPhone != null)
								{
									sb.append("<br><b>Practice Work Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(practiceWorkPhone.toString());
								}
							}
		
							if (gpFaxPhone != null)
							{
								sb.append("<br><b>GP Fax Number:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpFaxPhone);
							}
							else if (gpPractice != null && gpPractice.getCommChannelsIsNotNull())
							{
								CommChannelVo practiceFaxPhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.FAX);
		
								if (practiceFaxPhone != null)
								{
									sb.append("<br><b>Practice Fax Number:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(practiceFaxPhone.toString());
								}
							}
						}
						else if (gpPractice != null && gpPractice.getCommChannelsIsNotNull())
						{
							CommChannelVo practiceGeneralPhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.GEN_PHONE);
							CommChannelVo practiceHomePhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.HOME_PHONE);
							CommChannelVo practiceWorkPhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.WORK_PHONE);
							CommChannelVo practiceMobilePhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.MOBILE);
							CommChannelVo practiceFaxPhone = gpPractice.getCommunicationChannel(ims.core.vo.lookups.ChannelType.FAX);
		
							if (practiceGeneralPhone != null)
							{
								sb.append("<br><b>Practice General Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(practiceGeneralPhone.toString());
							}
		
							if (practiceHomePhone != null)
							{
								sb.append("<br><b>Practice Home Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(practiceHomePhone.toString());
							}
		
							if (practiceMobilePhone != null)
							{
								sb.append("<br><b>Practice Mobile Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(practiceMobilePhone.toString());
							}
		
							if (practiceWorkPhone != null)
							{
								sb.append("<br><b>Practice Work Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(practiceWorkPhone.toString());
							}
		
							if (practiceFaxPhone != null)
							{
								sb.append("<br><b>Practice Fax Number:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(practiceFaxPhone.toString());
							}
						}
					}
				}
				else
				{
					if (this.gpsurgery != null)
					{
						sb.append("<br><b>Surgery Address:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
						sb.append(this.gpsurgery.address == null ? "" : this.gpsurgery.address.toDisplayString());
					}
		
					if (this.gp != null)
					{
						if (this.gp.commchannels != null)
						{
							CommChannelVo gpGenPhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.GEN_PHONE);
							CommChannelVo gpHomePhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.HOME_PHONE);
							CommChannelVo gpWorkPhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.WORK_PHONE);
							CommChannelVo gpMobilePhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.MOBILE);
							CommChannelVo gpFaxPhone = this.gp.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.FAX);
		
							if (gpGenPhone != null)
							{
								sb.append("<br><b>GP General Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpGenPhone.toString());
							}
							else if (this.gpsurgery != null && this.gpsurgery.commchannels != null)
							{
								CommChannelVo surgeryGeneralPhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.GEN_PHONE);
		
								if (surgeryGeneralPhone != null)
								{
									sb.append("<br><b>Surgery General Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(surgeryGeneralPhone.toString());
								}
							}
		
							if (gpHomePhone != null)
							{
								sb.append("<br><b>GP Home Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpHomePhone.toString());
							}
							else if (this.gpsurgery != null && this.gpsurgery.commchannels != null)
							{
								CommChannelVo surgeryHomePhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.HOME_PHONE);
		
								if (surgeryHomePhone != null)
								{
									sb.append("<br><b>Surgery Home Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(surgeryHomePhone.toString());
								}
							}
		
							if (gpMobilePhone != null)
							{
								sb.append("<br><b>GP Mobile Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpMobilePhone.toString());
							}
							else if (this.gpsurgery != null && this.gpsurgery.commchannels != null)
							{
								CommChannelVo surgeryMobilePhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.MOBILE);
		
								if (surgeryMobilePhone != null)
								{
									sb.append("<br><b>Surgery Mobile Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(surgeryMobilePhone.toString());
								}
							}
		
							if (gpWorkPhone != null)
							{
								sb.append("<br><b>GP Work Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpWorkPhone.toString());
							}
							else if (this.gpsurgery != null && this.gpsurgery.commchannels != null)
							{
								CommChannelVo surgeryWorkPhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.WORK_PHONE);
		
								if (surgeryWorkPhone != null)
								{
									sb.append("<br><b>Surgery Work Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(surgeryWorkPhone.toString());
								}
							}
		
							if (gpFaxPhone != null)
							{
								sb.append("<br><b>GP Fax Number:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(gpFaxPhone);
							}
							else if (this.gpsurgery != null && this.gpsurgery.commchannels != null)
							{
								CommChannelVo surgeryFaxPhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.FAX);
		
								if (surgeryFaxPhone != null)
								{
									sb.append("<br><b>Surgery Fax Number:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
									sb.append(surgeryFaxPhone.toString());
								}
							}
						}
						else if (this.gpsurgery != null && this.gpsurgery.commchannels != null)
						{
							CommChannelVo surgeryGeneralPhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.GEN_PHONE);
							CommChannelVo surgeryHomePhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.HOME_PHONE);
							CommChannelVo surgeryWorkPhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.WORK_PHONE);
							CommChannelVo surgeryMobilePhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.MOBILE);
							CommChannelVo surgeryFaxPhone = this.gpsurgery.commchannels.getCommunicationChannel(ims.core.vo.lookups.ChannelType.FAX);
		
							if (surgeryGeneralPhone != null)
							{
								sb.append("<br><b>Surgery General Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(surgeryGeneralPhone.toString());
							}
		
							if (surgeryHomePhone != null)
							{
								sb.append("<br><b>Surgery Home Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(surgeryHomePhone.toString());
							}
		
							if (surgeryMobilePhone != null)
							{
								sb.append("<br><b>Surgery Mobile Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(surgeryMobilePhone.toString());
							}
		
							if (surgeryWorkPhone != null)
							{
								sb.append("<br><b>Surgery Work Phone:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(surgeryWorkPhone.toString());
							}
		
							if (surgeryFaxPhone != null)
							{
								sb.append("<br><b>Surgery Fax Number:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
								sb.append(surgeryFaxPhone.toString());
							}
						}
					}
				}
		
				return sb.toString();
			}
	
	/**
	* upperCaseIdentifierValues
	*/
	public void upperCaseIdentifierValues()
	{
		for(int i=0; this.identifiers != null && i<this.identifiers.size();i++)
		{
			this.identifiers.get(i).setValue(this.identifiers.get(i).getIdValue().toUpperCase());
		}
	}
	/**
	* toPatientLite_IdentifiersVo()
	*/
	public PatientLite_IdentifiersVo toPatientLite_IdentifiersVo()
	{
		PatientLite_IdentifiersVo patient = new PatientLite_IdentifiersVo(id, version);
	
		patient.name						= this.name;
		patient.sex							= this.sex;
		patient.dob							= this.dob;
		patient.isactive					= this.isactive;
		patient.isquickregistrationpatient	= this.isquickregistrationpatient;
			
		patient.identifiers					= this.identifiers;
		patient.age							= this.age;
		patient.agetext						= this.agetext;
			
		patient.dod							= this.dod;
		patient.patientcategory				= this.patientcategory;
	
		patient.hasalerts					= this.hasalerts;
		patient.associatedpatient			= this.associatedpatient;
		patient.ward						= this.ward;
		patient.isselfadmitpatient			= this.isselfadmitpatient;
			
		if (this.patientalerts != null)
		{
			patient.patientalerts = new ims.core.clinical.vo.PatientAlertRefVoCollection();
				
			for (int i = 0; i < this.patientalerts.size(); i++)
			{
				patient.patientalerts.add(this.patientalerts.get(i));
			}
		}
	
		return patient;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.name != null)
		{
			if(!this.name.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.address != null)
		{
			if(!this.address.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.ward != null)
		{
			if(!this.ward.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.identifiers != null)
		{
			if(!this.identifiers.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.associatedpatient != null)
		{
			if(!this.associatedpatient.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.commchannels != null)
		{
			if(!this.commchannels.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.pdspatientgp != null)
		{
			if(!this.pdspatientgp.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.nok != null)
		{
			if(!this.nok.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.othernames != null)
		{
			if(!this.othernames.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.addresses != null)
		{
			if(!this.addresses.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.patientalerts != null)
		{
			if(!this.patientalerts.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.photo != null)
		{
			if(!this.photo.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.currentmedicalinsurance != null)
		{
			if(!this.currentmedicalinsurance.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.nationalhealthcover != null)
		{
			if(!this.nationalhealthcover.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.alternativecontact != null)
		{
			if(!this.alternativecontact.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.pdsrelatives != null)
		{
			if(!this.pdsrelatives.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.pdspatientupdate != null)
		{
			if(!this.pdspatientupdate.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.pdspatientgphistory != null)
		{
			if(!this.pdspatientgphistory.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.name != null)
		{
			String[] listOfOtherErrors = this.name.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.address != null)
		{
			String[] listOfOtherErrors = this.address.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.ward != null)
		{
			String[] listOfOtherErrors = this.ward.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.identifiers != null)
		{
			String[] listOfOtherErrors = this.identifiers.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.associatedpatient != null)
		{
			String[] listOfOtherErrors = this.associatedpatient.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.commchannels != null)
		{
			String[] listOfOtherErrors = this.commchannels.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.pdspatientgp != null)
		{
			String[] listOfOtherErrors = this.pdspatientgp.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.nok != null)
		{
			String[] listOfOtherErrors = this.nok.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.othernames != null)
		{
			String[] listOfOtherErrors = this.othernames.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.addresses != null)
		{
			String[] listOfOtherErrors = this.addresses.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.patientalerts != null)
		{
			String[] listOfOtherErrors = this.patientalerts.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.photo != null)
		{
			String[] listOfOtherErrors = this.photo.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.currentmedicalinsurance != null)
		{
			String[] listOfOtherErrors = this.currentmedicalinsurance.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.nationalhealthcover != null)
		{
			String[] listOfOtherErrors = this.nationalhealthcover.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.alternativecontact != null)
		{
			String[] listOfOtherErrors = this.alternativecontact.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.pdsrelatives != null)
		{
			String[] listOfOtherErrors = this.pdsrelatives.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.pdspatientupdate != null)
		{
			String[] listOfOtherErrors = this.pdspatientupdate.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.pdspatientgphistory != null)
		{
			String[] listOfOtherErrors = this.pdspatientgphistory.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.txtoccupation != null)
			if(this.txtoccupation.length() > 255)
				listOfErrors.add("The length of the field [txtoccupation] in the value object [ims.core.vo.Patient] is too big. It should be less or equal to 255");
		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;
	
		Patient clone = new Patient(this.id, this.version);
		
		if(this.name == null)
			clone.name = null;
		else
			clone.name = (ims.core.vo.PersonName)this.name.clone();
		if(this.sex == null)
			clone.sex = null;
		else
			clone.sex = (ims.core.vo.lookups.Sex)this.sex.clone();
		clone.age = this.age;
		clone.agetext = this.agetext;
		if(this.address == null)
			clone.address = null;
		else
			clone.address = (ims.core.vo.PersonAddress)this.address.clone();
		if(this.dob == null)
			clone.dob = null;
		else
			clone.dob = (ims.framework.utils.PartialDate)this.dob.clone();
		if(this.dod == null)
			clone.dod = null;
		else
			clone.dod = (ims.framework.utils.Date)this.dod.clone();
		if(this.ward == null)
			clone.ward = null;
		else
			clone.ward = (ims.core.vo.LocationLiteVo)this.ward.clone();
		if(this.religion == null)
			clone.religion = null;
		else
			clone.religion = (ims.core.vo.lookups.Religion)this.religion.clone();
		clone.hasallergies = this.hasallergies;
		clone.hasalerts = this.hasalerts;
		if(this.identifiers == null)
			clone.identifiers = null;
		else
			clone.identifiers = (ims.core.vo.PatientIdCollection)this.identifiers.clone();
		clone.isactive = this.isactive;
		if(this.associatedpatient == null)
			clone.associatedpatient = null;
		else
			clone.associatedpatient = (ims.core.vo.PatientShort)this.associatedpatient.clone();
		if(this.commchannels == null)
			clone.commchannels = null;
		else
			clone.commchannels = (ims.core.vo.CommChannelVoCollection)this.commchannels.clone();
		if(this.ethnicorigin == null)
			clone.ethnicorigin = null;
		else
			clone.ethnicorigin = (ims.core.vo.lookups.EthnicOrigin)this.ethnicorigin.clone();
		if(this.maritalstatus == null)
			clone.maritalstatus = null;
		else
			clone.maritalstatus = (ims.core.vo.lookups.MaritalStatus)this.maritalstatus.clone();
		clone.scn = this.scn;
		if(this.sourceofinformation == null)
			clone.sourceofinformation = null;
		else
			clone.sourceofinformation = (ims.core.vo.lookups.RegistrationSourceOfInfo)this.sourceofinformation.clone();
		if(this.sysinfo == null)
			clone.sysinfo = null;
		else
			clone.sysinfo = (ims.vo.SystemInformation)this.sysinfo.clone();
		clone.hasactivealerts = this.hasactivealerts;
		if(this.timeofdeath == null)
			clone.timeofdeath = null;
		else
			clone.timeofdeath = (ims.framework.utils.Time)this.timeofdeath.clone();
		clone.isquickregistrationpatient = this.isquickregistrationpatient;
		if(this.ocsnotification == null)
			clone.ocsnotification = null;
		else
			clone.ocsnotification = (ims.core.vo.PatientNotificationsFillerOnlyVo)this.ocsnotification.clone();
		clone.currentresponsibleconsultant = this.currentresponsibleconsultant;
		if(this.dementiabreachdatetime == null)
			clone.dementiabreachdatetime = null;
		else
			clone.dementiabreachdatetime = (ims.framework.utils.DateTime)this.dementiabreachdatetime.clone();
		if(this.dementiaworkliststatus == null)
			clone.dementiaworkliststatus = null;
		else
			clone.dementiaworkliststatus = (ims.core.vo.lookups.DementiaWorklistStatus)this.dementiaworkliststatus.clone();
		if(this.mrnstatus == null)
			clone.mrnstatus = null;
		else
			clone.mrnstatus = (ims.core.vo.lookups.MRNStatus)this.mrnstatus.clone();
		clone.hasscannedcasenotefolders = this.hasscannedcasenotefolders;
		clone.isconfidential = this.isconfidential;
		if(this.timeofbirth == null)
			clone.timeofbirth = null;
		else
			clone.timeofbirth = (ims.framework.utils.Time)this.timeofbirth.clone();
		clone.isselfadmitpatient = this.isselfadmitpatient;
		if(this.patientcategory == null)
			clone.patientcategory = null;
		else
			clone.patientcategory = (ims.core.vo.lookups.PatientStatus)this.patientcategory.clone();
		if(this.pdspatientgp == null)
			clone.pdspatientgp = null;
		else
			clone.pdspatientgp = (ims.core.vo.PDSPatientGPVo)this.pdspatientgp.clone();
		clone.hasalertcategory1 = this.hasalertcategory1;
		clone.hasalertcategory2 = this.hasalertcategory2;
		clone.hasalertcategory3 = this.hasalertcategory3;
		clone.hasalertcategory4 = this.hasalertcategory4;
		clone.hasalertcategoryother = this.hasalertcategoryother;
		clone.futureapptscancelonmarkdeceasedanswer = this.futureapptscancelonmarkdeceasedanswer;
		if(this.gp == null)
			clone.gp = null;
		else
			clone.gp = (ims.core.vo.GpShortVo)this.gp.clone();
		if(this.occupation == null)
			clone.occupation = null;
		else
			clone.occupation = (ims.core.vo.lookups.Occupation)this.occupation.clone();
		if(this.language == null)
			clone.language = null;
		else
			clone.language = (ims.core.vo.lookups.Language)this.language.clone();
		if(this.nok == null)
			clone.nok = null;
		else
			clone.nok = (ims.core.vo.NextOfKin)this.nok.clone();
		if(this.othernames == null)
			clone.othernames = null;
		else
			clone.othernames = (ims.core.vo.PersonNameCollection)this.othernames.clone();
		if(this.addresses == null)
			clone.addresses = null;
		else
			clone.addresses = (ims.core.vo.PersonAddressCollection)this.addresses.clone();
		if(this.gpsurgery == null)
			clone.gpsurgery = null;
		else
			clone.gpsurgery = (ims.core.vo.LocSiteShortVo)this.gpsurgery.clone();
		if(this.patientalerts == null)
			clone.patientalerts = null;
		else
			clone.patientalerts = (ims.core.vo.PatientAlertLiteVoCollection)this.patientalerts.clone();
		clone.clientparent = this.clientparent;
		if(this.photo == null)
			clone.photo = null;
		else
			clone.photo = (ims.core.vo.AppDBImageVo)this.photo.clone();
		clone.savealias = this.savealias;
		clone.cancelsd_appts = this.cancelsd_appts;
		if(this.homefolderlocation == null)
			clone.homefolderlocation = null;
		else
			clone.homefolderlocation = (ims.core.vo.lookups.HomeFolderLocation)this.homefolderlocation.clone();
		clone.harccode = this.harccode;
		if(this.prefcommlanguage == null)
			clone.prefcommlanguage = null;
		else
			clone.prefcommlanguage = (ims.core.vo.lookups.PDSPreferredCommunicationLanguage)this.prefcommlanguage.clone();
		if(this.practice == null)
			clone.practice = null;
		else
			clone.practice = (ims.core.vo.OrganisationWithSitesVo)this.practice.clone();
		clone.copypatientoncorrespondence = this.copypatientoncorrespondence;
		if(this.copypatientoncorrespondencedate == null)
			clone.copypatientoncorrespondencedate = null;
		else
			clone.copypatientoncorrespondencedate = (ims.framework.utils.Date)this.copypatientoncorrespondencedate.clone();
		if(this.currentmedicalinsurance == null)
			clone.currentmedicalinsurance = null;
		else
			clone.currentmedicalinsurance = (ims.core.vo.PatientMedicalInsuranceVo)this.currentmedicalinsurance.clone();
		if(this.nationalhealthcover == null)
			clone.nationalhealthcover = null;
		else
			clone.nationalhealthcover = (ims.core.vo.NationalHealthCoverVo)this.nationalhealthcover.clone();
		if(this.alternativecontact == null)
			clone.alternativecontact = null;
		else
			clone.alternativecontact = (ims.core.vo.PatientContactPreferenceVo)this.alternativecontact.clone();
		if(this.healthboard == null)
			clone.healthboard = null;
		else
			clone.healthboard = (ims.core.vo.lookups.HealthBoard)this.healthboard.clone();
		if(this.supportnetworkfamily == null)
			clone.supportnetworkfamily = null;
		else
			clone.supportnetworkfamily = (ims.core.vo.SupportNetworkFamilyCollection)this.supportnetworkfamily.clone();
		if(this.pdsdeathnotificationstatus == null)
			clone.pdsdeathnotificationstatus = null;
		else
			clone.pdsdeathnotificationstatus = (ims.admin.vo.lookups.PDSDeathNotificationStatus)this.pdsdeathnotificationstatus.clone();
		clone.pdsinterpreterrequired = this.pdsinterpreterrequired;
		if(this.pdsrelatives == null)
			clone.pdsrelatives = null;
		else
			clone.pdsrelatives = (ims.core.vo.PatRelativeCollection)this.pdsrelatives.clone();
		if(this.pdspatientupdate == null)
			clone.pdspatientupdate = null;
		else
			clone.pdspatientupdate = (ims.core.vo.PDSPatientUpdateVo)this.pdspatientupdate.clone();
		if(this.pdspatientgphistory == null)
			clone.pdspatientgphistory = null;
		else
			clone.pdspatientgphistory = (ims.core.vo.PDSPatientGPVoCollection)this.pdspatientgphistory.clone();
		clone.school = this.school;
		clone.overseasvisitor = this.overseasvisitor;
		if(this.overseasclassification == null)
			clone.overseasclassification = null;
		else
			clone.overseasclassification = (ims.core.vo.lookups.OverseasVisitorStatusCassification)this.overseasclassification.clone();
		clone.hasliveduk = this.hasliveduk;
		clone.decoupled = this.decoupled;
		if(this.pdsdatelastchecked == null)
			clone.pdsdatelastchecked = null;
		else
			clone.pdsdatelastchecked = (ims.framework.utils.Date)this.pdsdatelastchecked.clone();
		if(this.schoolorcollege == null)
			clone.schoolorcollege = null;
		else
			clone.schoolorcollege = (ims.emergency.vo.lookups.School)this.schoolorcollege.clone();
		clone.ischildinpubliccare = this.ischildinpubliccare;
		if(this.publiccareneed == null)
			clone.publiccareneed = null;
		else
			clone.publiccareneed = (ims.core.vo.lookups.PublicCareNeed)this.publiccareneed.clone();
		clone.txtoccupation = this.txtoccupation;
		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 (!(Patient.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A Patient object cannot be compared an Object of type " + obj.getClass().getName());
		}
		Patient compareObj = (Patient)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getName() == null && compareObj.getName() != null)
				return -1;
			if(this.getName() != null && compareObj.getName() == null)
				return 1;
			if(this.getName() != null && compareObj.getName() != null)
				retVal = this.getName().compareTo(compareObj.getName());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = super.countFieldsWithValue();
		if(this.gp != null)
			count++;
		if(this.occupation != null)
			count++;
		if(this.language != null)
			count++;
		if(this.nok != null)
			count++;
		if(this.othernames != null)
			count++;
		if(this.addresses != null)
			count++;
		if(this.gpsurgery != null)
			count++;
		if(this.patientalerts != null)
			count++;
		if(this.clientparent != null)
			count++;
		if(this.photo != null)
			count++;
		if(this.savealias != null)
			count++;
		if(this.cancelsd_appts != null)
			count++;
		if(this.homefolderlocation != null)
			count++;
		if(this.harccode != null)
			count++;
		if(this.prefcommlanguage != null)
			count++;
		if(this.practice != null)
			count++;
		if(this.copypatientoncorrespondence != null)
			count++;
		if(this.copypatientoncorrespondencedate != null)
			count++;
		if(this.currentmedicalinsurance != null)
			count++;
		if(this.nationalhealthcover != null)
			count++;
		if(this.alternativecontact != null)
			count++;
		if(this.healthboard != null)
			count++;
		if(this.supportnetworkfamily != null)
			count++;
		if(this.pdsdeathnotificationstatus != null)
			count++;
		if(this.pdsinterpreterrequired != null)
			count++;
		if(this.pdsrelatives != null)
			count++;
		if(this.pdspatientupdate != null)
			count++;
		if(this.pdspatientgphistory != null)
			count++;
		if(this.school != null)
			count++;
		if(this.overseasvisitor != null)
			count++;
		if(this.overseasclassification != null)
			count++;
		if(this.hasliveduk != null)
			count++;
		if(this.decoupled != null)
			count++;
		if(this.pdsdatelastchecked != null)
			count++;
		if(this.schoolorcollege != null)
			count++;
		if(this.ischildinpubliccare != null)
			count++;
		if(this.publiccareneed != null)
			count++;
		if(this.txtoccupation != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return super.countValueObjectFields() + 38;
	}
	protected ims.core.vo.GpShortVo gp;
	protected ims.core.vo.lookups.Occupation occupation;
	protected ims.core.vo.lookups.Language language;
	protected ims.core.vo.NextOfKin nok;
	protected ims.core.vo.PersonNameCollection othernames;
	protected ims.core.vo.PersonAddressCollection addresses;
	protected ims.core.vo.LocSiteShortVo gpsurgery;
	protected ims.core.vo.PatientAlertLiteVoCollection patientalerts;
	protected ims.core.patient.vo.PatientRefVo clientparent;
	protected ims.core.vo.AppDBImageVo photo;
	protected String savealias;
	protected Boolean cancelsd_appts;
	protected ims.core.vo.lookups.HomeFolderLocation homefolderlocation;
	protected String harccode;
	protected ims.core.vo.lookups.PDSPreferredCommunicationLanguage prefcommlanguage;
	protected ims.core.vo.OrganisationWithSitesVo practice;
	protected Boolean copypatientoncorrespondence;
	protected ims.framework.utils.Date copypatientoncorrespondencedate;
	protected ims.core.vo.PatientMedicalInsuranceVo currentmedicalinsurance;
	protected ims.core.vo.NationalHealthCoverVo nationalhealthcover;
	protected ims.core.vo.PatientContactPreferenceVo alternativecontact;
	protected ims.core.vo.lookups.HealthBoard healthboard;
	protected ims.core.vo.SupportNetworkFamilyCollection supportnetworkfamily;
	protected ims.admin.vo.lookups.PDSDeathNotificationStatus pdsdeathnotificationstatus;
	protected Boolean pdsinterpreterrequired;
	protected ims.core.vo.PatRelativeCollection pdsrelatives;
	protected ims.core.vo.PDSPatientUpdateVo pdspatientupdate;
	protected ims.core.vo.PDSPatientGPVoCollection pdspatientgphistory;
	protected ims.core.resource.place.vo.SchoolRefVo school;
	protected Boolean overseasvisitor;
	protected ims.core.vo.lookups.OverseasVisitorStatusCassification overseasclassification;
	protected Boolean hasliveduk;
	protected Boolean decoupled;
	protected ims.framework.utils.Date pdsdatelastchecked;
	protected ims.emergency.vo.lookups.School schoolorcollege;
	protected Boolean ischildinpubliccare;
	protected ims.core.vo.lookups.PublicCareNeed publiccareneed;
	protected String txtoccupation;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
