<?php

namespace RxConnexionBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use RxConnexionBundle\Entity\Base\BaseEntity;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\MaxDepth;

/**
 * @ORM\Entity(repositoryClass="RxConnexionBundle\Repository\PatientRepository")
 * @ORM\Table(name="patient", indexes={@ORM\Index(name="IDX_FOR_AUTOCOMPLETE", columns={"full_name", "is_active"}), @ORM\Index(name="IDX_FOR_SEARCH_1", columns={"is_active"})})
 */

class PatientEntity extends BaseEntity
{
    const GENDER_MALE = 'Male';
    const GENDER_FEMALE = 'Female';

    /**
     * @ORM\Column(name="first_name", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $firstName;

    /**
     * @ORM\Column(name="middle_name", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $middleName;

    /**
     * @ORM\Column(name="last_name", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $lastName;

    /**
     * @ORM\Column(name="full_name", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $fullName;

    /**
     * @ORM\Column(name="gender", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $gender;

    /**
     * @ORM\Column(name="referral_date", type="datetime", nullable=true)
     * @Groups("forAudit")
     */
    protected $referralDate;

    /**
     * @ORM\Column(name="receive_date", type="datetime", nullable=true)
     * @Groups("forAudit")
     */
    protected $receivedDate;

    /**
     * @ORM\Column(name="alberta_health_card_no", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $albertaHealthCardNo;

    /**
     * @ORM\Column(name="personal_health_no", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $personalHealthNo;

    /**
     * @ORM\Column(name="birth_date", type="datetime", nullable=true)
     * @Groups("forAudit")
     */
    protected $birthDate;

    /**
     * @ORM\Column(type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $address;

    /**
     * @ORM\Column(type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $street;

    /**
     * @ORM\Column(name="mobile_no", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $mobileNo;

    /**
     * @ORM\Column(name="mobile_no_two", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $mobileNoTwo;

    /**
     * @ORM\Column(name="mobile_no_three", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $mobileNoThree;

    /**
     * @ORM\Column(name="phone_no", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $phoneNo;

    /**
     * @ORM\Column(name="phone_no_two", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $phoneNoTwo;

    /**
     * @ORM\Column(name="phone_no_three", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $phoneNoThree;

    /**
     * @ORM\Column(name="email", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $email;

    /**
     * @ORM\Column(name="email_two", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $emailTwo;

    /**
     * @ORM\Column(name="email_three", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $emailThree;

    /**
     * @ORM\Column(name="photo_description", type="string", nullable=true)
     */
    protected $photoDescription;

    /**
     * @ORM\Column(name="parsed_photo_description", type="string", nullable=true)
     */
    protected $parsedPhotoDescription;

    /**
     * @ORM\Column(name="map_image_description", type="string", nullable=true)
     */
    protected $mapImageDescription;

    /**
     * @ORM\Column(name="parsed_map_image_description", type="string", nullable=true)
     */
    protected $parsedMapImageDescription;

    /**
     * @ORM\Column(name="old_sys_id", type="string", nullable=true)
     */
    protected $oldSysId;

    /**
     * @ORM\Column(name="geo_lat", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $geoLat;

    /**
     * @ORM\Column(name="geo_long", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $geoLong;

    /**
     * @ORM\Column(name="is_active", type="boolean", nullable=true)
     * @Groups("forAudit")
     */
    protected $isActive;

    /**
     * @ORM\Column(name="is_not_count_as_referral", type="boolean", nullable=true)
     * @Groups("forAudit")
     */
    protected $isNotCountAsReferral;

    /**
     * @ORM\Column(name="is_deleted", type="boolean")
     */
    protected $isDeleted;

    /**
     * @ORM\Column(name="is_endorsed", type="boolean", nullable=true)
     * @Groups("forAudit")
     */
    protected $isEndorsed;

    /**
     * @ORM\Column(name="is_specialist", type="boolean", nullable=true)
     * @Groups("forAudit")
     */
    protected $isSpecialist;

    /**
     * @ORM\Column(name="endorsed_by", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $endorsedBy;

    /**
     * @ORM\Column(name="referred_by_name", type="string", nullable=true)
     * @Groups("forAudit")
     */
    protected $referredByName;

    /**
     * @ORM\Column(name="is_duplicate", type="boolean")
     * @Groups("forAudit")
     */
    protected $isDuplicate;

    /**
     * @ORM\Column(name="is_test_patient", type="boolean")
     * @Groups("forAudit")
     */
    protected $isTestPatient;

    /**
     * @ORM\ManyToOne(targetEntity="GeneralUserEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="general_user_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $generalUser;

    /**
     * @ORM\ManyToOne(targetEntity="AccountEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="account_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $account;

    /**
     * @ORM\ManyToOne(targetEntity="CityEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="city_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $city;

    /**
     * @ORM\ManyToOne(targetEntity="PostalCodeEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="postal_code_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $postalCode;

    /**
     * @ORM\ManyToOne(targetEntity="PatientTypeEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="patient_type_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $patientType;

    /**
     * @ORM\ManyToOne(targetEntity="ProviderEntity", inversedBy="patientPrimaryProviders")
     * @ORM\JoinColumn(name="primary_provider_id", referencedColumnName="id", nullable=true)
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $primaryProvider;

    /**
     * @ORM\ManyToOne(targetEntity="RxConnexionBundle\Entity\MarketingStaffEntity", inversedBy="patientPrimaryMarketingStaffs")
     * @ORM\JoinColumn(name="primary_marketing_staff_id", referencedColumnName="id", nullable=true)
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $primaryMarketingStaff;

    /**
     * @ORM\OneToOne(targetEntity="RxConnexionBundle\Entity\MarketingStaffEntity", inversedBy="patient")
     * @ORM\JoinColumn(name="marketing_staff_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $marketingStaff;

    /**
     * @ORM\OneToMany(targetEntity="ScheduleEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $schedules;

    /**
     * @ORM\OneToMany(targetEntity="ScheduleQueuedEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $schedulesQueued;

    /**
     * @ORM\OneToMany(targetEntity="PatientChartEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $charts;

    /**
     * @ORM\OneToMany(targetEntity="PatientDiagnosisEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $diagnoses;

    /**
     * @ORM\OneToMany(targetEntity="PatientFileEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $files;

    /**
     * @ORM\OneToMany(targetEntity="PatientInsuranceEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientInsurances;

    /**
     * @ORM\OneToMany(targetEntity="PatientNoteEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientNotes;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientLetters;

    /**
     * @ORM\OneToMany(targetEntity="AppointmentNoticeFaxEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $appointmentNoticeFaxes;

    /**
     * @ORM\OneToMany(targetEntity="PatientReferringHealthFacilityEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientReferringHealthFacilities;

    /**
     * @ORM\OneToMany(targetEntity="PatientReferringProviderEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientReferringProviders;

    /**
     * @ORM\OneToMany(targetEntity="PatientBillingEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientBillings;

    /**
     * @ORM\OneToMany(targetEntity="PatientPaymentEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientPayments;

    /**
     * @ORM\OneToMany(targetEntity="PatientTicketEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientTickets;

    /**
     * @ORM\OneToMany(targetEntity="PatientRedFlagEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientRedFlags;

    /**
     * @ORM\OneToMany(targetEntity="FaxTranEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $faxTrans;

    /**
     * @ORM\OneToMany(targetEntity="PatientBillingRefundEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientBillingRefunds;

    /**
     * @ORM\OneToMany(targetEntity="PatientServiceEntity", mappedBy="patient", cascade={"persist", "remove"}, orphanRemoval=true)
     */
    protected $patientServices;

    /**
     * @ORM\OneToMany(targetEntity="PatientRentalEntity", mappedBy="patient", cascade={"persist", "remove"}, orphanRemoval=true)
     */
    protected $patientRentals;

    /**
     * @ORM\OneToMany(targetEntity="PatientTreatmentConsiderationEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientTreatmentConsiderations;

    /**
     * @ORM\OneToMany(targetEntity="PatientTreatmentPlanEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientTreatmentPlans;

    /**
     * @ORM\OneToMany(targetEntity="ReferredByPatientEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $referredByPatients;

    /**
     * @ORM\OneToMany(targetEntity="MarketingStaffScheduleQueuedEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $marketingStaffSchedulesQueued;

    /**
     * @ORM\OneToOne(targetEntity="ReferralEntity", inversedBy="patient")
     * @ORM\JoinColumn(name="referral_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $referral;

    /**
     * @ORM\ManyToOne(targetEntity="SourceEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="source_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $source;

    /**
     * @ORM\OneToOne(targetEntity="ProviderEntity", inversedBy="patient")
     * @ORM\JoinColumn(name="provider_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $provider;

    /**
     * @ORM\ManyToOne(targetEntity="HealthFacilityEntity", inversedBy="patients")
     * @ORM\JoinColumn(name="health_facility_id", referencedColumnName="id")
     * @Groups("forAudit")
     */
    protected $healthFacility;

    /**
     * @ORM\OneToMany(targetEntity="PatientHealthFacilityEntity", mappedBy="patient")
     * @ORM\OrderBy({"startDate" = "DESC"})
     */
    protected $patientHealthFacilities;

    /**
     * @ORM\OneToMany(targetEntity="PatientSpecialistEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $patientSpecialists;

    /**
     * @ORM\OneToMany(targetEntity="AccountUserReminderRefPatientEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $accountUserReminderRefPatients;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\FaxingOptionEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $faxingOptions;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\MarketingStaffScheduleEntity", mappedBy="patient", cascade={"remove"})
     */
    protected $marketingStaffSchedules;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\ClinicmasterFileEntity", mappedBy="patient")
     */
    protected $clinicmasterFiles;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\PatientEmailEntity", mappedBy="patient")
     */
    protected $patientEmails;


    public function __construct()
    {
        $this->schedules = new ArrayCollection();
        $this->schedulesQueued = new ArrayCollection();
        $this->charts = new ArrayCollection();
        $this->diagnoses = new ArrayCollection();
        $this->files = new ArrayCollection();
        $this->patientInsurances = new ArrayCollection();
        $this->patientNotes = new ArrayCollection();
        $this->patientLetters = new ArrayCollection();
        $this->patientReferringProviders = new ArrayCollection();
        $this->patientReferringHealthFacilities = new ArrayCollection();
        $this->patientBillings = new ArrayCollection();
        $this->patientPayments = new ArrayCollection();
        $this->appointmentNoticeFaxes = new ArrayCollection();
        $this->patientTickets = new ArrayCollection();
        $this->patientHealthFacilities = new ArrayCollection();
        $this->patientSpecialists = new ArrayCollection();
        $this->accountUserReminderRefPatients = new ArrayCollection();
        $this->patientServices = new ArrayCollection();
        $this->patientBillingRefunds = new ArrayCollection();
        $this->patientTreatmentConsiderations = new ArrayCollection();
        $this->patientTreatmentPlans = new ArrayCollection();
        $this->referredByPatients = new ArrayCollection();
        $this->faxingOptions = new ArrayCollection();
        $this->clinicmasterFiles = new ArrayCollection();
        $this->marketingStaffSchedules = new ArrayCollection();
        $this->marketingStaffSchedulesQueued = new ArrayCollection();
        $this->patientEmails = new ArrayCollection();
    }

    /**
     * Set createdAt
     *
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
        $this->fullName = ucfirst($this->firstName) . ' ' . ucfirst($this->lastName);
        $this->updateAddress();
        $this->isDeleted = 0;
    }

    /**
     * Set updatedAt
     *
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        parent::setUpdatedAtValue();
        $this->fullName = ucfirst($this->firstName) . ' ' . ucfirst($this->lastName);
        $this->updateAddress();
    }

    /**
     * Remove the photo from the disk
     *
     * @ORM\PreRemove
     */
    public function removePhoto() {

        $file = $this->getUploadRootDir() . '/' . $this->parsedPhotoDescription;
        if(!empty($this->parsedPhotoDescription) && file_exists($file)) unlink($file);
    }

    /**
     * Remove the photo from the disk
     *
     * @ORM\PreRemove
     */
    public function removeGoogleMapsImage() {

        $file = $this->getUploadRootDirForGoogleMaps() . '/' . $this->parsedMapImageDescription;
        if(!empty($this->parsedMapImageDescription) && file_exists($file)) unlink($file);
    }

    /**
     * Concatenate address
     */
    public function updateAddress() {
        $this->address = $this->street . ' ' . ($this->city ? $this->city->getDescription() . ', ' . ($this->city->getProvince() != null ? $this->city->getProvince()->getDescription() : '') . ' ' . ($this->city->getProvince() != null ? $this->city->getProvince()->getCountry()->getDescription() : '')  . ' ' : '') . ($this->getPostalCode() ? $this->getPostalCode()->getDescription() : '');
    }


    /*--------------------------------------------------------------------------------------------------------*/
    /*					Use Defined Setters and Getters														  */
    /*--------------------------------------------------------------------------------------------------------*/

    /**
     * Get uploadDir
     *
     * @return string
     */
    public function getUploadDir() {

        return 'uploads/patient/photo';
    }

    /**
     * Get uploadRootDir
     *
     * @return string
     */
    public function getUploadRootDir() {

        return __DIR__ . '/../../../web/' . $this->getUploadDir();
    }

    /**
     * get photoWebPath
     *
     * @return string
     */
    public function getPhotoWebPath() {

        $parsedDesc = $this->parsedPhotoDescription;
        $file = $this->getUploadRootDir() . '/' . $parsedDesc;

        if(!empty($parsedDesc) && file_exists($file)) {
            return '/' . $this->getUploadDir() . '/' . $parsedDesc;
        } else {
            return '';
        }
    }

    /**
     * Get uploadDirForGoogleMaps
     *
     * @return string
     */
    public function getUploadDirForGoogleMaps() {

        return 'uploads/patient/map';
    }

    /**
     * Get uploadRootDir
     *
     * @return string
     */
    public function getUploadRootDirForGoogleMaps() {

        return __DIR__ . '/../../../web/' . $this->getUploadDirForGoogleMaps();
    }

    /**
     * get imageGoogleMaps
     *
     * @return string
     */
    public function getImageGoogleMaps() {

        $parsedDesc = $this->mapImageDescription;
        $file = $this->getUploadRootDirForGoogleMaps() . '/' . $parsedDesc;

        if(!empty($parsedDesc) && file_exists($file)) {
            return '/' . $this->getUploadDirForGoogleMaps() . '/' . $parsedDesc;
        } else {
            return '';
        }
    }

    /**
     * Get age
     *
     * @return integer
     */
    public function getAge()
    {
        $dateTimeToStringTransformer = new DateTimeToStringTransformer();
        $year = date('Y');
        $month = date('m');
        $day = date('d');
        $birth_date_long = strtotime($dateTimeToStringTransformer->transform($this->birthDate));
        $birth_date_year = date('Y', $birth_date_long);
        $birth_date_month = date('m', $birth_date_long);
        $birth_date_day = date('d', $birth_date_long);
        $age = $year - $birth_date_year;
        if($month<$birth_date_month || ($month==$birth_date_month && $day < $birth_date_day))
            $age--;
        return $age;
    }

    /**
     * Get concatenatedMobileNo
     *
     * return string
     */
    public function getConcatenatedMobileNo() {

        $mobileNos = '';
        if(!empty($this->mobileNo)) $mobileNos .= (!empty($mobileNos) ? ', ' : '') . $this->mobileNo;
        if(!empty($this->mobileNoTwo)) $mobileNos .= (!empty($mobileNos) ? ', ' : '') . $this->mobileNoTwo;
        if(!empty($this->mobileNoThree)) $mobileNos .= (!empty($mobileNos) ? ', ' : '') . $this->mobileNoThree;

        return $mobileNos;
    }

    /**
     * Get concatenatedPhoneNo
     *
     * return string
     */
    public function getConcatenatedPhoneNo() {

        $phoneNos = '';
        if(!empty($this->phoneNo)) $phoneNos .= (!empty($phoneNos) ? ', ' : '') . $this->phoneNo;
        if(!empty($this->phoneNoTwo)) $phoneNos .= (!empty($phoneNos) ? ', ' : '') . $this->phoneNoTwo;
        if(!empty($this->phoneNoThree)) $phoneNos .= (!empty($phoneNos) ? ', ' : '') . $this->phoneNoThree;

        return $phoneNos;
    }

    /**
     * Get concatenatedEmail
     *
     * return string
     */
    public function getConcatenatedEmail() {

        $emails = '';
        if(!empty($this->email)) $emails .= (!empty($emails) ? ', ' : '') . $this->email;
        if(!empty($this->emailTwo)) $emails .= (!empty($emails) ? ', ' : '') . $this->emailTwo;
        if(!empty($this->emailThree)) $emails .= (!empty($emails) ? ', ' : '') . $this->emailThree;

        return $emails;
    }

    /**
     * Get concatenatedInsurance
     *
     * return string
     */
    public function getConcatenatedInsurance() {

        $insurances = '';
        foreach ($this->getPatientInsurances() as $patientInsurance){
            $insurances .= (!empty($insurances) ? ', ' : '') . $patientInsurance->getInsurance()->getDescription();
        }

        return $insurances;
    }

    /**
     * Get birthDateAsString
     *
     * @return string
     */
    public function getBirthDateAsString() {

        $dttst = new DateTimeToStringTransformer();
        return !empty($this->birthDate) ? date('m/d/Y', strtotime($dttst->transform($this->birthDate))) : '';
    }

    /**
     * Get referralDateAsString
     *
     * @return string
     */
    public function getReferralDateAsString() {

        $dttst = new DateTimeToStringTransformer();
        return !empty($this->referralDate) ? date('m/d/Y', strtotime($dttst->transform($this->referralDate))) : '';
    }

    /**
     * Get receivedDateAsString
     *
     * @return string
     */
    public function getReceivedDateAsString() {

        $dttst = new DateTimeToStringTransformer();
        return !empty($this->receivedDate) ? date('m/d/Y', strtotime($dttst->transform($this->receivedDate))) : '';
    }

    /**
     * Get concatenatedPatientInsurance
     *
     * return string
     */
    public function getConcatenatedPatientInsurance() {

        $insurances = '';
        $ctr = count($this->getPatientInsurances()) - 1;
        foreach ($this->getPatientInsurances() AS $key => $patientInsurance){
            $insurances .= $patientInsurance->getInsurance()->getDescription() . ( $key == $ctr ? '' : ', ') ;
        }

        return $insurances;
    }

    /**
     * Get activePatientInsurance
     *
     * @return \RxConnexionBundle\Entity\PatientInsuranceEntity|null
     */
    public function getActivePatientInsurance() {

        if($this->patientInsurances->count()) {

            $dt = strtotime(date('m/d/Y'));
            foreach($this->patientInsurances as $patientInsurance) {
                $sDT = $patientInsurance->getStartDateAsTime();
                $eDT = $patientInsurance->getEndDateAsTime();
                if($dt >= $sDT && ($eDT === 0 || $eDT >= $dt)) {
                    return $patientInsurance;
                }
            }
        }

        return null;
    }

    /**
     * Get activePatientHealthFacility
     *
     * @return \RxConnexionBundle\Entity\PatientHealthFacilityEntity|null
     */
    public function getActivePatientHealthFacility() {
       /* if($this->patientHealthFacilities->count()) {
            $dt = strtotime(date('m/d/Y H:i:s'));
            foreach($this->patientHealthFacilities as $patientHealthFacility) {
                $sDT = $patientHealthFacility->getStartDateAsTime();
                $eDT = $patientHealthFacility->getEndDateAsTime();
                if($dt >= $sDT && ($eDT === 0 || $eDT >= $dt)) {
                    return $patientHealthFacility;
                }
            }
        }
        return null;*/
       /**@var PatientHealthFacilityEntity $patientHealthFacility*/
        foreach($this->patientHealthFacilities as $patientHealthFacility) {
            if(!$patientHealthFacility->getEndDate()){
                return $patientHealthFacility;
            }
        }
        return null;
    }

    /**
     * Get activePatientHealthFacilityArray
     *
     * @return \RxConnexionBundle\Entity\PatientHealthFacilityEntity|null
     */
    public function getActivePatientHealthFacilityArray() {
        $branches = array();
        if($this->patientHealthFacilities->count()) {
            $dt = strtotime(date('m/d/Y H:i:s'));
            foreach($this->patientHealthFacilities as $patientHealthFacility) {
                $sDT = $patientHealthFacility->getStartDateAsTime();
                $eDT = $patientHealthFacility->getEndDateAsTime();
                if($dt >= $sDT && ($eDT === 0 || $eDT >= $dt)) {
                    $branches[] = $patientHealthFacility;
                }
            }
        }
        return $branches;
    }

    /**
     * Get referredByPatient
     *
     * @return \RxConnexionBundle\Entity\ReferredByPatientEntity|null
     */
    public function getReferredByPatient() {
        if($this->referredByPatients->count()) {
            foreach($this->referredByPatients as $patientReferredBy) {
                return $patientReferredBy;
            }
        }
        return null;
    }

    /**
     * Get activeHealthFacility
     *
     * @return \RxConnexionBundle\Entity\HealthFacilityEntity|null
     */
    public function getActiveHealthFacility() {
        if($this->patientHealthFacilities->count()) {
            $dt = strtotime(date('m/d/Y H:i:s'));
            foreach($this->patientHealthFacilities as $patientHealthFacility) {
                $sDT = $patientHealthFacility->getStartDateAsTime();
                $eDT = $patientHealthFacility->getEndDateAsTime();
                if($dt >= $sDT && ($eDT === 0 || $eDT >= $dt)) {
                    return $patientHealthFacility->getHealthFacility();
                }
            }
        }
        return null;
    }

    /**
     * Get patientServiceByServiceId
     *
     * @param $serviceId
     * @return \RxConnexionBundle\Entity\PatientServiceEntity|null
     */
    public function getPatientServiceByServiceId($serviceId) {
        if($this->patientServices->count()){
            foreach ($this->patientServices as $patientService){
                if($patientService->getService()->getId() == $serviceId){
                    return $patientService;
                }
            }
        }
        return null;
    }


    /*--------------------------------------------------------------------------------------------------------*/
    /*					Setters and Getters																	  */
    /*--------------------------------------------------------------------------------------------------------*/

    /**
     * Set firstName
     *
     * @param string $firstName
     *
     * @return PatientEntity
     */
    public function setFirstName($firstName)
    {
        $this->firstName = $firstName;

        return $this;
    }

    /**
     * Get firstName
     *
     * @return string
     */
    public function getFirstName()
    {
        return $this->firstName;
    }

    /**
     * Set middleName
     *
     * @param string $middleName
     *
     * @return PatientEntity
     */
    public function setMiddleName($middleName)
    {
        $this->middleName = $middleName;

        return $this;
    }

    /**
     * Get middleName
     *
     * @return string
     */
    public function getMiddleName()
    {
        return $this->middleName;
    }

    /**
     * Set lastName
     *
     * @param string $lastName
     *
     * @return PatientEntity
     */
    public function setLastName($lastName)
    {
        $this->lastName = $lastName;

        return $this;
    }

    /**
     * Get lastName
     *
     * @return string
     */
    public function getLastName()
    {
        return $this->lastName;
    }

    /**
     * Set fullName
     *
     * @param string $fullName
     *
     * @return PatientEntity
     */
    public function setFullName($fullName)
    {
        $this->fullName = $fullName;

        return $this;
    }

    /**
     * Get fullName
     *
     * @return string
     */
    public function getFullName()
    {
        return $this->fullName;
    }

    /**
     * Set gender
     *
     * @param string $gender
     *
     * @return PatientEntity
     */
    public function setGender($gender)
    {
        $this->gender = $gender;

        return $this;
    }

    /**
     * Get gender
     *
     * @return string
     */
    public function getGender()
    {
        return $this->gender;
    }

    /**
     * Set birthDate
     *
     * @param \DateTime $birthDate
     *
     * @return PatientEntity
     */
    public function setBirthDate($birthDate)
    {
        $birthDateExploded = explode('/', $birthDate);
        if((count($birthDateExploded) == 3 && !checkdate($birthDateExploded[0], $birthDateExploded[1], $birthDateExploded[2])) || empty($birthDate)){
            $this->birthDate = NULL;
        }else{
            $this->birthDate = new \DateTime($birthDate);
        }

        return $this;
    }

    /**
     * Get birthDate
     *
     * @return \DateTime
     */
    public function getBirthDate()
    {
        return $this->birthDate;
    }

    /**
     * Set address
     *
     * @param string $address
     *
     * @return PatientEntity
     */
    public function setAddress($address)
    {
        $this->address = $address;

        return $this;
    }

    /**
     * Get address
     *
     * @return string
     */
    public function getAddress()
    {
        return $this->address;
    }

    /**
     * Set street
     *
     * @param string $street
     *
     * @return PatientEntity
     */
    public function setStreet($street)
    {
        $this->street = $street;

        return $this;
    }

    /**
     * Get street
     *
     * @return string
     */
    public function getStreet()
    {
        return $this->street;
    }

    /**
     * Set mobileNo
     *
     * @param string $mobileNo
     *
     * @return PatientEntity
     */
    public function setMobileNo($mobileNo)
    {
        $this->mobileNo = $mobileNo;

        return $this;
    }

    /**
     * Get mobileNo
     *
     * @return string
     */
    public function getMobileNo()
    {
        return $this->mobileNo;
    }

    /**
     * Set mobileNoTwo
     *
     * @param string $mobileNoTwo
     *
     * @return PatientEntity
     */
    public function setMobileNoTwo($mobileNoTwo)
    {
        $this->mobileNoTwo = $mobileNoTwo;

        return $this;
    }

    /**
     * Get mobileNoTwo
     *
     * @return string
     */
    public function getMobileNoTwo()
    {
        return $this->mobileNoTwo;
    }

    /**
     * Set mobileNoThree
     *
     * @param string $mobileNoThree
     *
     * @return PatientEntity
     */
    public function setMobileNoThree($mobileNoThree)
    {
        $this->mobileNoThree = $mobileNoThree;

        return $this;
    }

    /**
     * Get mobileNoThree
     *
     * @return string
     */
    public function getMobileNoThree()
    {
        return $this->mobileNoThree;
    }

    /**
     * Set phoneNo
     *
     * @param string $phoneNo
     *
     * @return PatientEntity
     */
    public function setPhoneNo($phoneNo)
    {
        $this->phoneNo = $phoneNo;

        return $this;
    }

    /**
     * Get phoneNo
     *
     * @return string
     */
    public function getPhoneNo()
    {
        return $this->phoneNo;
    }

    /**
     * Set phoneNoTwo
     *
     * @param string $phoneNoTwo
     *
     * @return PatientEntity
     */
    public function setPhoneNoTwo($phoneNoTwo)
    {
        $this->phoneNoTwo = $phoneNoTwo;

        return $this;
    }

    /**
     * Get phoneNoTwo
     *
     * @return string
     */
    public function getPhoneNoTwo()
    {
        return $this->phoneNoTwo;
    }

    /**
     * Set phoneNoThree
     *
     * @param string $phoneNoThree
     *
     * @return PatientEntity
     */
    public function setPhoneNoThree($phoneNoThree)
    {
        $this->phoneNoThree = $phoneNoThree;

        return $this;
    }

    /**
     * Get phoneNoThree
     *
     * @return string
     */
    public function getPhoneNoThree()
    {
        return $this->phoneNoThree;
    }

    /**
     * Set email
     *
     * @param string $email
     *
     * @return PatientEntity
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set emailTwo
     *
     * @param string $emailTwo
     *
     * @return PatientEntity
     */
    public function setEmailTwo($emailTwo)
    {
        $this->emailTwo = $emailTwo;

        return $this;
    }

    /**
     * Get emailTwo
     *
     * @return string
     */
    public function getEmailTwo()
    {
        return $this->emailTwo;
    }

    /**
     * Set emailThree
     *
     * @param string $emailThree
     *
     * @return PatientEntity
     */
    public function setEmailThree($emailThree)
    {
        $this->emailThree = $emailThree;

        return $this;
    }

    /**
     * Get emailThree
     *
     * @return string
     */
    public function getEmailThree()
    {
        return $this->emailThree;
    }

    /**
     * Set photoDescription
     *
     * @param string $photoDescription
     *
     * @return PatientEntity
     */
    public function setPhotoDescription($photoDescription)
    {
        $this->photoDescription = $photoDescription;

        return $this;
    }

    /**
     * Get photoDescription
     *
     * @return string
     */
    public function getPhotoDescription()
    {
        return $this->photoDescription;
    }

    /**
     * Set parsedPhotoDescription
     *
     * @param string $parsedPhotoDescription
     *
     * @return PatientEntity
     */
    public function setParsedPhotoDescription($parsedPhotoDescription)
    {
        $this->parsedPhotoDescription = $parsedPhotoDescription;

        return $this;
    }

    /**
     * Get parsedPhotoDescription
     *
     * @return string
     */
    public function getParsedPhotoDescription()
    {
        return $this->parsedPhotoDescription;
    }

    /**
     * Set generalUser
     *
     * @param \RxConnexionBundle\Entity\GeneralUserEntity $generalUser
     *
     * @return PatientEntity
     */
    public function setGeneralUser(\RxConnexionBundle\Entity\GeneralUserEntity $generalUser = null)
    {
        $this->generalUser = $generalUser;

        return $this;
    }

    /**
     * Get generalUser
     *
     * @return \RxConnexionBundle\Entity\GeneralUserEntity
     */
    public function getGeneralUser()
    {
        return $this->generalUser;
    }

    /**
     * Set account
     *
     * @param \RxConnexionBundle\Entity\AccountEntity $account
     *
     * @return PatientEntity
     */
    public function setAccount(\RxConnexionBundle\Entity\AccountEntity $account = null)
    {
        $this->account = $account;

        return $this;
    }

    /**
     * Get account
     *
     * @return \RxConnexionBundle\Entity\AccountEntity
     */
    public function getAccount()
    {
        return $this->account;
    }

    /**
     * Set city
     *
     * @param \RxConnexionBundle\Entity\CityEntity $city
     *
     * @return PatientEntity
     */
    public function setCity(\RxConnexionBundle\Entity\CityEntity $city = null)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return \RxConnexionBundle\Entity\CityEntity
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * Add schedule
     *
     * @param \RxConnexionBundle\Entity\ScheduleEntity $schedule
     *
     * @return PatientEntity
     */
    public function addSchedule(\RxConnexionBundle\Entity\ScheduleEntity $schedule)
    {
        $this->schedules[] = $schedule;

        return $this;
    }

    /**
     * Remove schedule
     *
     * @param \RxConnexionBundle\Entity\ScheduleEntity $schedule
     */
    public function removeSchedule(\RxConnexionBundle\Entity\ScheduleEntity $schedule)
    {
        $this->schedules->removeElement($schedule);
    }

    /**
     * Get schedules
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getSchedules()
    {
        return $this->schedules;
    }

    /**
     * Add schedulesQueued
     *
     * @param \RxConnexionBundle\Entity\ScheduleQueuedEntity $schedulesQueued
     *
     * @return PatientEntity
     */
    public function addSchedulesQueued(\RxConnexionBundle\Entity\ScheduleQueuedEntity $schedulesQueued)
    {
        $this->schedulesQueued[] = $schedulesQueued;

        return $this;
    }

    /**
     * Remove schedulesQueued
     *
     * @param \RxConnexionBundle\Entity\ScheduleQueuedEntity $schedulesQueued
     */
    public function removeSchedulesQueued(\RxConnexionBundle\Entity\ScheduleQueuedEntity $schedulesQueued)
    {
        $this->schedulesQueued->removeElement($schedulesQueued);
    }

    /**
     * Get schedulesQueued
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getSchedulesQueued()
    {
        return $this->schedulesQueued;
    }

    /**
     * Add chart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $chart
     *
     * @return PatientEntity
     */
    public function addChart(\RxConnexionBundle\Entity\PatientChartEntity $chart)
    {
        $this->charts[] = $chart;

        return $this;
    }

    /**
     * Remove chart
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $chart
     */
    public function removeChart(\RxConnexionBundle\Entity\PatientChartEntity $chart)
    {
        $this->charts->removeElement($chart);
    }

    /**
     * Get charts
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCharts()
    {
        return $this->charts;
    }

    /**
     * Add diagnosis
     *
     * @param \RxConnexionBundle\Entity\PatientDiagnosisEntity $diagnosis
     *
     * @return PatientEntity
     */
    public function addDiagnosis(\RxConnexionBundle\Entity\PatientDiagnosisEntity $diagnosis)
    {
        $this->diagnoses[] = $diagnosis;

        return $this;
    }

    /**
     * Remove diagnosis
     *
     * @param \RxConnexionBundle\Entity\PatientDiagnosisEntity $diagnosis
     */
    public function removeDiagnosis(\RxConnexionBundle\Entity\PatientDiagnosisEntity $diagnosis)
    {
        $this->diagnoses->removeElement($diagnosis);
    }

    /**
     * Get diagnoses
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDiagnoses()
    {
        return $this->diagnoses;
    }

    /**
     * Add file
     *
     * @param \RxConnexionBundle\Entity\PatientFileEntity $file
     *
     * @return PatientEntity
     */
    public function addFile(\RxConnexionBundle\Entity\PatientFileEntity $file)
    {
        $this->files[] = $file;

        return $this;
    }

    /**
     * Remove file
     *
     * @param \RxConnexionBundle\Entity\PatientFileEntity $file
     */
    public function removeFile(\RxConnexionBundle\Entity\PatientFileEntity $file)
    {
        $this->files->removeElement($file);
    }

    /**
     * Get files
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFiles()
    {
        return $this->files;
    }

    /**
     * Set patientType
     *
     * @param \RxConnexionBundle\Entity\PatientTypeEntity $patientType
     *
     * @return PatientEntity
     */
    public function setPatientType(\RxConnexionBundle\Entity\PatientTypeEntity $patientType = null)
    {
        $this->patientType = $patientType;

        return $this;
    }

    /**
     * Get patientType
     *
     * @return \RxConnexionBundle\Entity\PatientTypeEntity
     */
    public function getPatientType()
    {
        return $this->patientType;
    }

    /**
     * Add patientInsurance
     *
     * @param \RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance
     *
     * @return PatientEntity
     */
    public function addPatientInsurance(\RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance)
    {
        $this->patientInsurances[] = $patientInsurance;

        return $this;
    }

    /**
     * Remove patientInsurance
     *
     * @param \RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance
     */
    public function removePatientInsurance(\RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance)
    {
        $this->patientInsurances->removeElement($patientInsurance);
    }

    /**
     * Get patientInsurances
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientInsurances()
    {
        return $this->patientInsurances;
    }

    /**
     * Set referral
     *
     * @param \RxConnexionBundle\Entity\ReferralEntity $referral
     *
     * @return PatientEntity
     */
    public function setReferral(\RxConnexionBundle\Entity\ReferralEntity $referral = null)
    {
        $this->referral = $referral;

        return $this;
    }

    /**
     * Get referral
     *
     * @return \RxConnexionBundle\Entity\ReferralEntity
     */
    public function getReferral()
    {
        return $this->referral;
    }

    /**
     * Add patientNote
     *
     * @param \RxConnexionBundle\Entity\PatientNoteEntity $patientNote
     *
     * @return PatientEntity
     */
    public function addPatientNote(\RxConnexionBundle\Entity\PatientNoteEntity $patientNote)
    {
        $this->patientNotes[] = $patientNote;

        return $this;
    }

    /**
     * Remove patientNote
     *
     * @param \RxConnexionBundle\Entity\PatientNoteEntity $patientNote
     */
    public function removePatientNote(\RxConnexionBundle\Entity\PatientNoteEntity $patientNote)
    {
        $this->patientNotes->removeElement($patientNote);
    }

    /**
     * Get patientNotes
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientNotes()
    {
        return $this->patientNotes;
    }

    /**
     * Set postalCode
     *
     * @param \RxConnexionBundle\Entity\PostalCodeEntity $postalCode
     *
     * @return PatientEntity
     */
    public function setPostalCode(\RxConnexionBundle\Entity\PostalCodeEntity $postalCode = null)
    {
        $this->postalCode = $postalCode;

        return $this;
    }

    /**
     * Get postalCode
     *
     * @return \RxConnexionBundle\Entity\PostalCodeEntity
     */
    public function getPostalCode()
    {
        return $this->postalCode;
    }

    /**
     * Set oldSysId
     *
     * @param string $oldSysId
     *
     * @return PatientEntity
     */
    public function setOldSysId($oldSysId)
    {
        $this->oldSysId = $oldSysId;

        return $this;
    }

    /**
     * Get oldSysId
     *
     * @return string
     */
    public function getOldSysId()
    {
        return $this->oldSysId;
    }

    /**
     * Set geoLat
     *
     * @param string $geoLat
     *
     * @return PatientEntity
     */
    public function setGeoLat($geoLat)
    {
        $this->geoLat = $geoLat;

        return $this;
    }

    /**
     * Get geoLat
     *
     * @return string
     */
    public function getGeoLat()
    {
        return $this->geoLat;
    }

    /**
     * Set geoLong
     *
     * @param string $geoLong
     *
     * @return PatientEntity
     */
    public function setGeoLong($geoLong)
    {
        $this->geoLong = $geoLong;

        return $this;
    }

    /**
     * Get geoLong
     *
     * @return string
     */
    public function getGeoLong()
    {
        return $this->geoLong;
    }

    /**
     * Add patientReferringHealthFacility
     *
     * @param \RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility
     *
     * @return PatientEntity
     */
    public function addPatientReferringHealthFacility(\RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility)
    {
        $this->patientReferringHealthFacilities[] = $patientReferringHealthFacility;

        return $this;
    }

    /**
     * Remove patientReferringHealthFacility
     *
     * @param \RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility
     */
    public function removePatientReferringHealthFacility(\RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility)
    {
        $this->patientReferringHealthFacilities->removeElement($patientReferringHealthFacility);
    }

    /**
     * Get patientReferringHealthFacilities
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientReferringHealthFacilities()
    {
        return $this->patientReferringHealthFacilities;
    }

    /**
     * Add patientReferringProvider
     *
     * @param \RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider
     *
     * @return PatientEntity
     */
    public function addPatientReferringProvider(\RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider)
    {
        $this->patientReferringProviders[] = $patientReferringProvider;

        return $this;
    }

    /**
     * Remove patientReferringProvider
     *
     * @param \RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider
     */
    public function removePatientReferringProvider(\RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider)
    {
        $this->patientReferringProviders->removeElement($patientReferringProvider);
    }

    /**
     * Get patientReferringProviders
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientReferringProviders()
    {
        return $this->patientReferringProviders;
    }

    /**
     * Set albertaHealthCardNo
     *
     * @param string $albertaHealthCardNo
     *
     * @return PatientEntity
     */
    public function setAlbertaHealthCardNo($albertaHealthCardNo)
    {
        $this->albertaHealthCardNo = $albertaHealthCardNo;

        return $this;
    }

    /**
     * Get albertaHealthCardNo
     *
     * @return string
     */
    public function getAlbertaHealthCardNo()
    {
        return $this->albertaHealthCardNo;
    }

    /**
     * Set personalHealthNo
     *
     * @param string $personalHealthNo
     *
     * @return PatientEntity
     */
    public function setPersonalHealthNo($personalHealthNo)
    {
        $this->personalHealthNo = $personalHealthNo;

        return $this;
    }

    /**
     * Get personalHealthNo
     *
     * @return string
     */
    public function getPersonalHealthNo()
    {
        return $this->personalHealthNo;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return PatientEntity
     */
    public function setCreatedBy($createdBy)
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    /**
     * Get createdBy
     *
     * @return string
     */
    public function getCreatedBy()
    {
        return $this->createdBy;
    }

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     *
     * @return PatientEntity
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedBy
     *
     * @param string $updatedBy
     *
     * @return PatientEntity
     */
    public function setUpdatedBy($updatedBy)
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

    /**
     * Get updatedBy
     *
     * @return string
     */
    public function getUpdatedBy()
    {
        return $this->updatedBy;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     *
     * @return PatientEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Add patientLetter
     *
     * @param \RxConnexionBundle\Entity\PatientLetterEntity $patientLetter
     *
     * @return PatientEntity
     */
    public function addPatientLetter(\RxConnexionBundle\Entity\PatientLetterEntity $patientLetter)
    {
        $this->patientLetters[] = $patientLetter;

        return $this;
    }

    /**
     * Remove patientLetter
     *
     * @param \RxConnexionBundle\Entity\PatientLetterEntity $patientLetter
     */
    public function removePatientLetter(\RxConnexionBundle\Entity\PatientLetterEntity $patientLetter)
    {
        $this->patientLetters->removeElement($patientLetter);
    }

    /**
     * Get patientLetters
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientLetters()
    {
        return $this->patientLetters;
    }

    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return PatientEntity
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    /**
     * Add patientBilling
     *
     * @param \RxConnexionBundle\Entity\PatientBillingEntity $patientBilling
     *
     * @return PatientEntity
     */
    public function addPatientBilling(\RxConnexionBundle\Entity\PatientBillingEntity $patientBilling)
    {
        $this->patientBillings[] = $patientBilling;
    }

    /**
     * Add appointmentNoticeFax
     *
     * @param \RxConnexionBundle\Entity\AppointmentNoticeFaxEntity $appointmentNoticeFax
     *
     * @return PatientEntity
     */
    public function addAppointmentNoticeFax(\RxConnexionBundle\Entity\AppointmentNoticeFaxEntity $appointmentNoticeFax)
    {
        $this->appointmentNoticeFaxes[] = $appointmentNoticeFax;

        return $this;
    }

    /**
     * Remove patientBilling
     *
     * @param \RxConnexionBundle\Entity\PatientBillingEntity $patientBilling
     */
    public function removePatientBilling(\RxConnexionBundle\Entity\PatientBillingEntity $patientBilling)
    {
        $this->patientBillings->removeElement($patientBilling);
    }

    /**
     * Get patientBillings
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientBillings()
    {
        return $this->patientBillings;
    }

    /**
     * Remove appointmentNoticeFax
     *
     * @param \RxConnexionBundle\Entity\AppointmentNoticeFaxEntity $appointmentNoticeFax
     */
    public function removeAppointmentNoticeFax(\RxConnexionBundle\Entity\AppointmentNoticeFaxEntity $appointmentNoticeFax)
    {
        $this->appointmentNoticeFaxes->removeElement($appointmentNoticeFax);
    }

    /**
     * Get appointmentNoticeFaxes
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAppointmentNoticeFaxes()
    {
        return $this->appointmentNoticeFaxes;
    }

    /**
     * Add patientPayment
     *
     * @param \RxConnexionBundle\Entity\PatientPaymentEntity $patientPayment
     *
     * @return PatientEntity
     */
    public function addPatientPayment(\RxConnexionBundle\Entity\PatientPaymentEntity $patientPayment)
    {
        $this->patientPayments[] = $patientPayment;

        return $this;
    }

    /**
     * Remove patientPayment
     *
     * @param \RxConnexionBundle\Entity\PatientPaymentEntity $patientPayment
     */
    public function removePatientPayment(\RxConnexionBundle\Entity\PatientPaymentEntity $patientPayment)
    {
        $this->patientPayments->removeElement($patientPayment);
    }

    /**
     * Get patientPayments
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientPayments()
    {
        return $this->patientPayments;
    }

    /**
     * Set isEndorsed
     *
     * @param boolean $isEndorsed
     *
     * @return PatientEntity
     */
    public function setIsEndorsed($isEndorsed)
    {
        $this->isEndorsed = $isEndorsed;

        return $this;
    }

    /**
     * Get isEndorsed
     *
     * @return boolean
     */
    public function getIsEndorsed()
    {
        return $this->isEndorsed;
    }

    /**
     * Set endorsedBy
     *
     * @param string $endorsedBy
     *
     * @return PatientEntity
     */
    public function setEndorsedBy($endorsedBy)
    {
        $this->endorsedBy = $endorsedBy;

        return $this;
    }

    /**
     * Get endorsedBy
     *
     * @return string
     */
    public function getEndorsedBy()
    {
        return $this->endorsedBy;
    }

    /**
     * Set isDeleted
     *
     * @param boolean $isDeleted
     *
     * @return PatientEntity
     */
    public function setIsDeleted($isDeleted)
    {
        $this->isDeleted = $isDeleted;

        return $this;
    }

    /**
     * Get isDeleted
     *
     * @return boolean
     */
    public function getIsDeleted()
    {
        return $this->isDeleted;
    }

    /**
     * Add patientTicket
     *
     * @param \RxConnexionBundle\Entity\PatientTicketEntity $patientTicket
     *
     * @return PatientEntity
     */
    public function addPatientTicket(\RxConnexionBundle\Entity\PatientTicketEntity $patientTicket)
    {
        $this->patientTickets[] = $patientTicket;

        return $this;
    }

    /**
     * Remove patientTicket
     *
     * @param \RxConnexionBundle\Entity\PatientTicketEntity $patientTicket
     */
    public function removePatientTicket(\RxConnexionBundle\Entity\PatientTicketEntity $patientTicket)
    {
        $this->patientTickets->removeElement($patientTicket);
    }

    /**
     * Get patientTickets
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientTickets()
    {
        return $this->patientTickets;
    }

    /**
     * Add patientRedFlag
     *
     * @param \RxConnexionBundle\Entity\PatientRedFlagEntity $patientRedFlag
     *
     * @return PatientEntity
     */
    public function addPatientRedFlag(\RxConnexionBundle\Entity\PatientRedFlagEntity $patientRedFlag)
    {
        $this->patientRedFlags[] = $patientRedFlag;

        return $this;
    }

    /**
     * Remove patientRedFlag
     *
     * @param \RxConnexionBundle\Entity\PatientRedFlagEntity $patientRedFlag
     */
    public function removePatientRedFlag(\RxConnexionBundle\Entity\PatientRedFlagEntity $patientRedFlag)
    {
        $this->patientRedFlags->removeElement($patientRedFlag);
    }

    /**
     * Get patientRedFlags
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientRedFlags()
    {
        return $this->patientRedFlags;
    }

    /**
     * Set referralDate
     *
     * @param \DateTime $referralDate
     *
     * @return PatientEntity
     */
    public function setReferralDate($referralDate)
    {
        $this->referralDate = empty($referralDate) ? NULL : new \DateTime($referralDate);

        return $this;
    }

    /**
     * Get referralDate
     *
     * @return \DateTime
     */
    public function getReferralDate()
    {
        return $this->referralDate;
    }

    /**
     * Set mapImageDescription
     *
     * @param string $mapImageDescription
     *
     * @return PatientEntity
     */
    public function setMapImageDescription($mapImageDescription)
    {
        $this->mapImageDescription = $mapImageDescription;

        return $this;
    }

    /**
     * Get mapImageDescription
     *
     * @return string
     */
    public function getMapImageDescription()
    {
        return $this->mapImageDescription;
    }

    /**
     * Set parsedMapImageDescription
     *
     * @param string $parsedMapImageDescription
     *
     * @return PatientEntity
     */
    public function setParsedMapImageDescription($parsedMapImageDescription)
    {
        $this->parsedMapImageDescription = $parsedMapImageDescription;

        return $this;
    }

    /**
     * Get parsedMapImageDescription
     *
     * @return string
     */
    public function getParsedMapImageDescription()
    {
        return $this->parsedMapImageDescription;
    }

    /**
     * Add faxTran
     *
     * @param \RxConnexionBundle\Entity\FaxTranEntity $faxTran
     *
     * @return PatientEntity
     */
    public function addFaxTran(\RxConnexionBundle\Entity\FaxTranEntity $faxTran)
    {
        $this->faxTrans[] = $faxTran;

        return $this;
    }

    /**
     * Remove faxTran
     *
     * @param \RxConnexionBundle\Entity\FaxTranEntity $faxTran
     */
    public function removeFaxTran(\RxConnexionBundle\Entity\FaxTranEntity $faxTran)
    {
        $this->faxTrans->removeElement($faxTran);
    }

    /**
     * Get faxTrans
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFaxTrans()
    {
        return $this->faxTrans;
    }

    /**
     * Set receivedDate
     *
     * @param \DateTime $receivedDate
     *
     * @return PatientEntity
     */
    public function setReceivedDate($receivedDate)
    {
        $this->receivedDate = empty($receivedDate) ? NULL : new \DateTime($receivedDate);

        return $this;
    }

    /**
     * Get receivedDate
     *
     * @return \DateTime
     */
    public function getReceivedDate()
    {
        return $this->receivedDate;
    }

    /**
     * Set isDuplicate
     *
     * @param boolean $isDuplicate
     *
     * @return PatientEntity
     */
    public function setIsDuplicate($isDuplicate)
    {
        $this->isDuplicate = $isDuplicate;

        return $this;
    }

    /**
     * Get isDuplicate
     *
     * @return boolean
     */
    public function getIsDuplicate()
    {
        return $this->isDuplicate;
    }

    /**
     * Set source
     *
     * @param \RxConnexionBundle\Entity\SourceEntity $source
     *
     * @return PatientEntity
     */
    public function setSource(\RxConnexionBundle\Entity\SourceEntity $source = null)
    {
        $this->source = $source;

        return $this;
    }

    /**
     * Get source
     *
     * @return \RxConnexionBundle\Entity\SourceEntity
     */
    public function getSource()
    {
        return $this->source;
    }

    /**
     * Add patientHealthFacility
     *
     * @param \RxConnexionBundle\Entity\PatientHealthFacilityEntity $patientHealthFacility
     *
     * @return PatientEntity
     */
    public function addPatientHealthFacility(\RxConnexionBundle\Entity\PatientHealthFacilityEntity $patientHealthFacility)
    {
        $this->patientHealthFacilities[] = $patientHealthFacility;

        return $this;
    }

    /**
     * Remove patientHealthFacility
     *
     * @param \RxConnexionBundle\Entity\PatientHealthFacilityEntity $patientHealthFacility
     */
    public function removePatientHealthFacility(\RxConnexionBundle\Entity\PatientHealthFacilityEntity $patientHealthFacility)
    {
        $this->patientHealthFacilities->removeElement($patientHealthFacility);
    }

    /**
     * Get patientHealthFacilities
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientHealthFacilities()
    {
        return $this->patientHealthFacilities;
    }

    /**
     * Set healthFacility
     *
     * @param \RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility
     *
     * @return PatientEntity
     */
    public function setHealthFacility(\RxConnexionBundle\Entity\HealthFacilityEntity $healthFacility = null)
    {
        $this->healthFacility = $healthFacility;

        return $this;
    }

    /**
     * Get healthFacility
     *
     * @return \RxConnexionBundle\Entity\HealthFacilityEntity
     */
    public function getHealthFacility()
    {
        return $this->healthFacility;
    }

    /**
     * Add patientSpecialist
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $patientSpecialist
     *
     * @return PatientEntity
     */
    public function addPatientSpecialist(\RxConnexionBundle\Entity\PatientChartEntity $patientSpecialist)
    {
        $this->patientSpecialists[] = $patientSpecialist;

        return $this;
    }

    /**
     * Remove patientSpecialist
     *
     * @param \RxConnexionBundle\Entity\PatientChartEntity $patientSpecialist
     */
    public function removePatientSpecialist(\RxConnexionBundle\Entity\PatientChartEntity $patientSpecialist)
    {
        $this->patientSpecialists->removeElement($patientSpecialist);
    }

    /**
     * Get patientSpecialists
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientSpecialists()
    {
        return $this->patientSpecialists;
    }

    /**
     * Set isSpecialist
     *
     * @param boolean $isSpecialist
     *
     * @return PatientEntity
     */
    public function setIsSpecialist($isSpecialist)
    {
        $this->isSpecialist = $isSpecialist;

        return $this;
    }

    /**
     * Get isSpecialist
     *
     * @return boolean
     */
    public function getIsSpecialist()
    {
        return $this->isSpecialist;
    }


    /**
     * Add accountUserReminderRefPatient
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderRefPatientEntity $accountUserReminderRefPatient
     *
     * @return PatientEntity
     */
    public function addAccountUserReminderRefPatient(\RxConnexionBundle\Entity\AccountUserReminderRefPatientEntity $accountUserReminderRefPatient)
    {
        $this->accountUserReminderRefPatients[] = $accountUserReminderRefPatient;
        return $this;
    }

    /**
     * Add patientService
     *
     * @param \RxConnexionBundle\Entity\PatientServiceEntity $patientService
     *
     * @return PatientEntity
     */
    public function addPatientService(\RxConnexionBundle\Entity\PatientServiceEntity $patientService)
    {
        $patientService->setPatient($this);
        $this->patientServices[] = $patientService;

        return $this;
    }

    /**
     * Remove accountUserReminderRefPatient
     *
     * @param \RxConnexionBundle\Entity\AccountUserReminderRefPatientEntity $accountUserReminderRefPatient
     */
    public function removeAccountUserReminderRefPatient(\RxConnexionBundle\Entity\AccountUserReminderRefPatientEntity $accountUserReminderRefPatient)
    {
        $this->accountUserReminderRefPatients->removeElement($accountUserReminderRefPatient);
    }

    /**
     * Get accountUserReminderRefPatients
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAccountUserReminderRefPatients()
    {
        return $this->accountUserReminderRefPatients;
    }

    /**
     * Remove patientService
     *
     * @param \RxConnexionBundle\Entity\PatientServiceEntity $patientService
     */
    public function removePatientService(\RxConnexionBundle\Entity\PatientServiceEntity $patientService)
    {
        $this->patientServices->removeElement($patientService);
    }

    /**
     * Get patientServices
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientServices()
    {
        return $this->patientServices;
    }

    /**
     * Set isTestPatient
     *
     * @param boolean $isTestPatient
     *
     * @return PatientEntity
     */
    public function setIsTestPatient($isTestPatient)
    {
        $this->isTestPatient = $isTestPatient;

        return $this;
    }

    /**
     * Get isTestPatient
     *
     * @return boolean
     */
    public function getIsTestPatient()
    {
        return $this->isTestPatient;
    }

    /**
     * Set provider
     *
     * @param \RxConnexionBundle\Entity\ProviderEntity $provider
     *
     * @return PatientEntity
     */
    public function setProvider(\RxConnexionBundle\Entity\ProviderEntity $provider = null)
    {
        $this->provider = $provider;

        return $this;
    }

    /**
     * Get provider
     *
     * @return \RxConnexionBundle\Entity\ProviderEntity
     */
    public function getProvider()
    {
        return $this->provider;
    }

    /**
     * Add patientBillingRefund
     *
     * @param \RxConnexionBundle\Entity\PatientBillingRefundEntity $patientBillingRefund
     *
     * @return PatientEntity
     */
    public function addPatientBillingRefund(\RxConnexionBundle\Entity\PatientBillingRefundEntity $patientBillingRefund)
    {
        $this->patientBillingRefunds[] = $patientBillingRefund;

        return $this;
    }

    /**
     * Remove patientBillingRefund
     *
     * @param \RxConnexionBundle\Entity\PatientBillingRefundEntity $patientBillingRefund
     */
    public function removePatientBillingRefund(\RxConnexionBundle\Entity\PatientBillingRefundEntity $patientBillingRefund)
    {
        $this->patientBillingRefunds->removeElement($patientBillingRefund);
    }

    /**
     * Get patientBillingRefunds
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientBillingRefunds()
    {
        return $this->patientBillingRefunds;
    }

    /**
     * Set primaryProvider
     *
     * @param \RxConnexionBundle\Entity\ProviderEntity $primaryProvider
     *
     * @return PatientEntity
     */
    public function setPrimaryProvider(\RxConnexionBundle\Entity\ProviderEntity $primaryProvider = null)
    {
        $this->primaryProvider = $primaryProvider;

        return $this;
    }

    /**
     * Get primaryProvider
     *
     * @return \RxConnexionBundle\Entity\ProviderEntity
     */
    public function getPrimaryProvider()
    {
        return $this->primaryProvider;
    }

    /**
     * Add patientRental
     *
     * @param \RxConnexionBundle\Entity\PatientRentalEntity $patientRental
     *
     * @return PatientEntity
     */
    public function addPatientRental(\RxConnexionBundle\Entity\PatientRentalEntity $patientRental)
    {
        $this->patientRentals[] = $patientRental;

        return $this;
    }

    /**
     * Remove patientRental
     *
     * @param \RxConnexionBundle\Entity\PatientRentalEntity $patientRental
     */
    public function removePatientRental(\RxConnexionBundle\Entity\PatientRentalEntity $patientRental)
    {
        $this->patientRentals->removeElement($patientRental);
    }

    /**
     * Get patientRentals
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientRentals()
    {
        return $this->patientRentals;
    }

    /**
     * Add patientTreatmentConsideration
     *
     * @param \RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentConsideration
     *
     * @return PatientEntity
     */
    public function addPatientTreatmentConsideration(\RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentConsideration)
    {
        $this->patientTreatmentConsiderations[] = $patientTreatmentConsideration;

        return $this;
    }

    /**
     * Remove patientTreatmentConsideration
     *
     * @param \RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentConsideration
     */
    public function removePatientTreatmentConsideration(\RxConnexionBundle\Entity\PatientTreatmentConsiderationEntity $patientTreatmentConsideration)
    {
        $this->patientTreatmentConsiderations->removeElement($patientTreatmentConsideration);
    }

    /**
     * Get patientTreatmentConsiderations
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientTreatmentConsiderations()
    {
        return $this->patientTreatmentConsiderations;
    }

    /**
     * Add patientTreatmentPlan
     *
     * @param \RxConnexionBundle\Entity\PatientTreatmentPlanEntity $patientTreatmentPlan
     *
     * @return PatientEntity
     */
    public function addPatientTreatmentPlan(\RxConnexionBundle\Entity\PatientTreatmentPlanEntity $patientTreatmentPlan)
    {
        $this->patientTreatmentPlans[] = $patientTreatmentPlan;

        return $this;
    }

    /**
     * Remove patientTreatmentPlan
     *
     * @param \RxConnexionBundle\Entity\PatientTreatmentPlanEntity $patientTreatmentPlan
     */
    public function removePatientTreatmentPlan(\RxConnexionBundle\Entity\PatientTreatmentPlanEntity $patientTreatmentPlan)
    {
        $this->patientTreatmentPlans->removeElement($patientTreatmentPlan);
    }

    /**
     * Get patientTreatmentPlans
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientTreatmentPlans()
    {
        return $this->patientTreatmentPlans;
    }

    /**
     * Set referredBy
     *
     * @param string $referredBy
     *
     * @return PatientEntity
     */
    public function setReferredBy($referredBy)
    {
        $this->referredBy = $referredBy;

        return $this;
    }

    /**
     * Get referredBy
     *
     * @return string
     */
    public function getReferredBy()
    {
        return $this->referredBy;
    }

    /**
     * Add referredByPatient
     *
     * @param \RxConnexionBundle\Entity\ReferredByPatientEntity $referredByPatient
     *
     * @return PatientEntity
     */
    public function addReferredByPatient(\RxConnexionBundle\Entity\ReferredByPatientEntity $referredByPatient)
    {
        $this->referredByPatients[] = $referredByPatient;

        return $this;
    }

    /**
     * Remove referredByPatient
     *
     * @param \RxConnexionBundle\Entity\ReferredByPatientEntity $referredByPatient
     */
    public function removeReferredByPatient(\RxConnexionBundle\Entity\ReferredByPatientEntity $referredByPatient)
    {
        $this->referredByPatients->removeElement($referredByPatient);
    }

    /**
     * Get referredByPatients
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getReferredByPatients()
    {
        return $this->referredByPatients;
    }

    /**
     * Set referredByName
     *
     * @param string $referredByName
     *
     * @return PatientEntity
     */
    public function setReferredByName($referredByName)
    {
        $this->referredByName = $referredByName;

        return $this;
    }

    /**
     * Get referredByName
     *
     * @return string
     */
    public function getReferredByName()
    {
        return $this->referredByName;
    }

    /**
     * Add faxingOption
     *
     * @param \RxConnexionBundle\Entity\FaxingOptionEntity $faxingOption
     *
     * @return PatientEntity
     */
    public function addFaxingOption(\RxConnexionBundle\Entity\FaxingOptionEntity $faxingOption)
    {
        $this->faxingOptions[] = $faxingOption;

        return $this;
    }

    /**
     * Remove faxingOption
     *
     * @param \RxConnexionBundle\Entity\FaxingOptionEntity $faxingOption
     */
    public function removeFaxingOption(\RxConnexionBundle\Entity\FaxingOptionEntity $faxingOption)
    {
        $this->faxingOptions->removeElement($faxingOption);
    }

    /**
     * Get faxingOptions
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFaxingOptions()
    {
        return $this->faxingOptions;
    }

    /**
     * Set isNotCountAsReferral
     *
     * @param boolean $isNotCountAsReferral
     *
     * @return PatientEntity
     */
    public function setIsNotCountAsReferral($isNotCountAsReferral)
    {
        $this->isNotCountAsReferral = $isNotCountAsReferral;

        return $this;
    }

    /**
     * Get isNotCountAsReferral
     *
     * @return boolean
     */
    public function getIsNotCountAsReferral()
    {
        return $this->isNotCountAsReferral;
    }

    /**
     * Add clinicmasterFile
     *
     * @param \RxConnexionBundle\Entity\ClinicmasterFileEntity $clinicmasterFile
     *
     * @return PatientEntity
     */
    public function addClinicmasterFile(\RxConnexionBundle\Entity\ClinicmasterFileEntity $clinicmasterFile)
    {
        $this->clinicmasterFiles[] = $clinicmasterFile;

        return $this;
    }

    /**
     * Remove clinicmasterFile
     *
     * @param \RxConnexionBundle\Entity\ClinicmasterFileEntity $clinicmasterFile
     */
    public function removeClinicmasterFile(\RxConnexionBundle\Entity\ClinicmasterFileEntity $clinicmasterFile)
    {
        $this->clinicmasterFiles->removeElement($clinicmasterFile);
    }

    /**
     * Get clinicmasterFiles
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getClinicmasterFiles()
    {
        return $this->clinicmasterFiles;
    }

    /**
     * Set primaryMarketingStaff
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffEntity $primaryMarketingStaff
     *
     * @return PatientEntity
     */
    public function setPrimaryMarketingStaff(\RxConnexionBundle\Entity\MarketingStaffEntity $primaryMarketingStaff = null)
    {
        $this->primaryMarketingStaff = $primaryMarketingStaff;

        return $this;
    }

    /**
     * Get primaryMarketingStaff
     *
     * @return \RxConnexionBundle\Entity\MarketingStaffEntity
     */
    public function getPrimaryMarketingStaff()
    {
        return $this->primaryMarketingStaff;
    }

    /**
     * Set marketingStaff
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffEntity $marketingStaff
     *
     * @return PatientEntity
     */
    public function setMarketingStaff(\RxConnexionBundle\Entity\MarketingStaffEntity $marketingStaff = null)
    {
        $this->marketingStaff = $marketingStaff;

        return $this;
    }

    /**
     * Get marketingStaff
     *
     * @return \RxConnexionBundle\Entity\MarketingStaffEntity
     */
    public function getMarketingStaff()
    {
        return $this->marketingStaff;
    }

    /**
     * Add marketingStaffSchedule
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffScheduleEntity $marketingStaffSchedule
     *
     * @return PatientEntity
     */
    public function addMarketingStaffSchedule(\RxConnexionBundle\Entity\MarketingStaffScheduleEntity $marketingStaffSchedule)
    {
        $this->marketingStaffSchedules[] = $marketingStaffSchedule;

        return $this;
    }

    /**
     * Remove marketingStaffSchedule
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffScheduleEntity $marketingStaffSchedule
     */
    public function removeMarketingStaffSchedule(\RxConnexionBundle\Entity\MarketingStaffScheduleEntity $marketingStaffSchedule)
    {
        $this->marketingStaffSchedules->removeElement($marketingStaffSchedule);
    }

    /**
     * Get marketingStaffSchedules
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMarketingStaffSchedules()
    {
        return $this->marketingStaffSchedules;
    }

    /**
     * Add marketingStaffSchedulesQueued
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffScheduleQueuedEntity $marketingStaffSchedulesQueued
     *
     * @return PatientEntity
     */
    public function addMarketingStaffSchedulesQueued(\RxConnexionBundle\Entity\MarketingStaffScheduleQueuedEntity $marketingStaffSchedulesQueued)
    {
        $this->marketingStaffSchedulesQueued[] = $marketingStaffSchedulesQueued;

        return $this;
    }

    /**
     * Remove marketingStaffSchedulesQueued
     *
     * @param \RxConnexionBundle\Entity\MarketingStaffScheduleQueuedEntity $marketingStaffSchedulesQueued
     */
    public function removeMarketingStaffSchedulesQueued(\RxConnexionBundle\Entity\MarketingStaffScheduleQueuedEntity $marketingStaffSchedulesQueued)
    {
        $this->marketingStaffSchedulesQueued->removeElement($marketingStaffSchedulesQueued);
    }

    /**
     * Get marketingStaffSchedulesQueued
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getMarketingStaffSchedulesQueued()
    {
        return $this->marketingStaffSchedulesQueued;
    }

    /**
     * Add patientEmail
     *
     * @param \RxConnexionBundle\Entity\PatientEmailEntity $patientEmail
     *
     * @return PatientEntity
     */
    public function addPatientEmail(\RxConnexionBundle\Entity\PatientEmailEntity $patientEmail)
    {
        $this->patientEmails[] = $patientEmail;

        return $this;
    }

    /**
     * Remove patientEmail
     *
     * @param \RxConnexionBundle\Entity\PatientEmailEntity $patientEmail
     */
    public function removePatientEmail(\RxConnexionBundle\Entity\PatientEmailEntity $patientEmail)
    {
        $this->patientEmails->removeElement($patientEmail);
    }

    /**
     * Get patientEmails
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPatientEmails()
    {
        return $this->patientEmails;
    }
}
