<?php

namespace RxConnexionBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
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\PatientLetterRepository")
 * @ORM\Table(name="patient_letter", indexes={
 *     @ORM\Index(name="IDX_000AAA", columns={"created_by"}),
 *     })
 */

class PatientLetterEntity extends BaseEntity
{
	const LETTERS = [
		'Adherence Report (FRSC)'                                                                        => 'Adherence Report (FRSC)',
		'AISH Calgary and Edmonton (FRSC)'                                                               => 'AISH Calgary and Edmonton (FRSC)',
		'Appointment Status Update (Sleep or Adult Pulmonary Consultation) Letter'                       => 'Appointment Status Update (Sleep or Adult Pulmonary Consultation) Letter',
		'CPAP no book (FRSC)'                                                                            => 'CPAP no book (FRSC)',
		'CPAP no re-book (FRSC)'                                                                         => 'CPAP no re-book (FRSC)',
		'HSAT No Rebook (FRSC)'                                                                          => 'HSAT No Rebook (FRSC)',
		'HSAT Refuse to repeat HSAT (FRSC)'                                                              => 'HSAT Refuse to repeat HSAT (FRSC)',
		'HSAT Unable to Contact (FRSC)'                                                                  => 'HSAT Unable to Contact (FRSC)',
		'HST Refuse - Wants to speak with their Doctor first (FRSC)'                                     => 'HST Refuse - Wants to speak with their Doctor first (FRSC)',
		'HST Refuse - Had HSAT Already (FRSC)'                                                           => 'HST Refuse - Had HSAT Already (FRSC)',
		'HST Refuse - No Coverage-No Insurance (FRSC)'                                                   => 'HST Refuse - No Coverage-No Insurance (FRSC)',
		'Negative OSA (FRSC)'                                                                            => 'Negative OSA (FRSC)',
		'Negative OSA (No RDI) (FRSC)'                                                                   => 'Negative OSA (No RDI) (FRSC)',
		'Oximetry Inconclusive (FRSC)'                                                                   => 'Oximetry Inconclusive (FRSC)',
		'Oximetry Negative (FRSC)'                                                                       => 'Oximetry Negative (FRSC)',
		'FAX for Referral Acknowledgement (FRSC)'                                                        => 'FAX for Referral Acknowledgement (FRSC)',
		'Refusal of Care Against Medical Advice (FRSC)'                                                  => 'Refusal of Care Against Medical Advice (FRSC)',
		'No Booking Under 18 years of age (FSRC)'                                                        => 'No Booking Under 18 years of age (FSRC)',
		'Prescription (FRSC)'                                                                            => 'Prescription (FRSC)',
		'Prescription (FRSC) v2'                                                                         => 'Prescription (FRSC) v2',
		'Alice Night One (FRSC)'                                                                         => 'Alice Night One (FRSC)',
		'General Prescription (FRSC)'                                                                    => 'General Prescription (FRSC)',
		'Marketing Letter (FRSC)'                                                                        => 'Marketing Letter (FRSC)',
		'CPAP refused not interested (Severe to Very Severe) (FRSC)'                                     => 'CPAP refused not interested (Severe to Very Severe) (FRSC)',
		'Negative Inconclusive (FRSC)'                                                                   => 'Negative Inconclusive (FRSC)',
		'Fax Acknowledgement for PFT & HSAT Referral (FRSC)'                                             => 'Fax Acknowledgement for PFT & HSAT Referral (FRSC)',
		'Fax Acknowledgement for PFT Only (FRSC)'                                                        => 'Fax Acknowledgement for PFT Only (FRSC)',
		'Freedom Advantage Program After CPAP Set Up'                                                    => 'Freedom Advantage Program After CPAP Set Up',
		'Travel Letter (FRSC)'                                                                           => 'Travel Letter (FRSC)',
		'Appointment Notice (General) (FRSC)'                                                            => 'Appointment Notice (General) (FRSC)',
		'Appointment Status Update (General) (FRSC)'                                                     => 'Appointment Status Update (General) (FRSC)',
		'Specialist Referral (FRSC)'                                                                     => 'Specialist Referral (FRSC)',
		'Letter (General) (FRSC)'                                                                        => 'Letter (General) (FRSC)',
		'CPAP Quote (Pre-Determination for AISH) (FRSC)'                                                 => 'CPAP Quote (Pre-Determination for AISH) (FRSC)',
		'General Appointment Notice (Delay Booking) (FRSC)'                                              => 'General Appointment Notice (Delay Booking) (FRSC)',
		'Referral Declined (FRSC)'                                                                       => 'Referral Declined (FRSC)',
		'Acknowledgement of Referral (PSS)'                                                              => 'Acknowledgement of Referral (PSS)',
		'Prescription (PSS)'                                                                             => 'Prescription (PSS)',
		'Negative OSA (PSS)'                                                                             => 'Negative OSA (PSS)',
		'Negative Inconclusive (PSS)'                                                                    => 'Negative Inconclusive (PSS)',
		'HSAT Unable to Contact (PSS)'                                                                   => 'HSAT Unable to Contact (PSS)',
		'HSAT & PFT No Book Letter'                                                                      => 'HSAT & PFT No Book Letter',
		'HSAT & PFT NO SHOW Letter'                                                                      => 'HSAT & PFT NO SHOW Letter',
		//'HSAT No Book (PSS)'                                                                             => 'HSAT No Book (PSS)',
		//'HSAT - No Book (FRSC)'                                                                          => 'HSAT - No Book (FRSC)',
		'CPAP-refused not interested (Very Mild to Moderate) (PSS)'                                      => 'CPAP-refused not interested (Very Mild to Moderate) (PSS)',
		'CPAP No Book (PSS)'                                                                             => 'CPAP No Book (PSS)',
		'CPAP no book Trial (PSS)'                                                                       => 'CPAP no book Trial (PSS)',
		'Adherence Report (PSS)'                                                                         => 'Adherence Report (PSS)',
		'Alice Night One - Mixed Apnea (PSS)'                                                            => 'Alice Night One - Mixed Apnea (PSS)',
		'Alice Night One - OSA (PSS)'                                                                    => 'Alice Night One - OSA (PSS)',
		'General Appointment Notice (Delay Booking) (PSS)'                                               => 'General Appointment Notice (Delay Booking) (PSS)',
		'Referral Declined (PSS)'                                                                        => 'Referral Declined (PSS)',
		'Release of Health Information (PSS)'                                                            => 'Release of Health Information (PSS)',
		'Travel Letter (PSS)'                                                                            => 'Travel Letter (PSS)',
		'Adherence'                                                                                      => 'Adherence',
		'AISH (Cgy)'                                                                                     => 'AISH (Cgy)',
		'AISH (Edm)'                                                                                     => 'AISH (Edm)',
		// 'ALBERTA WORKS (Cgy)'             => 'ALBERTA WORKS (Cgy)',
		// 'ALBERTA WORKS (Edm)'             => 'ALBERTA WORKS (Edm)',
		'CPAP Pressure Change'                                                                           => 'CPAP Pressure Change',
		'CPAP refuse -- Medical issues'                                                                  => 'CPAP refuse -- Medical issues',
		'CPAP refuse -- No Funds-No Insurance-Note About Discussion Regarding Financing Options'         => 'CPAP refuse -- No Funds-No Insurance-Note About Discussion Regarding Financing Options',
		'CPAP refuse -- Wants alternative therapy -consult ENT'                                          => 'CPAP refuse -- Wants alternative therapy -consult ENT',
		'CPAP refuse -- Wants alternative therapy - Oral Appliance'                                      => 'CPAP refuse -- Wants alternative therapy - Oral Appliance',
		'CPAP refuse -- Wants to Talk to Dr. prior to starting therapy (Very Mild to Moderate)'          => 'CPAP refuse -- Wants to Talk to Dr. prior to starting therapy (Very Mild to Moderate)',
		'CPAP refuse -- Wants to Talk to Dr. prior to starting therapy (Severe & Very Severe)'           => 'CPAP refuse -- Wants to Talk to Dr. prior to starting therapy (Severe & Very Severe)',
		'CPAP refuse -- Wants to think about it (Severe & Very Severe)'                                  => 'CPAP refuse -- Wants to think about it (Severe & Very Severe)',
		'CPAP refuse -- Wants to think about it (Very Mild to Moderate)'                                 => 'CPAP refuse -- Wants to think about it (Very Mild to Moderate)',
		'CPAP -- refused not interested (Severe to Very Severe)'                                         => 'CPAP -- refused not interested (Severe to Very Severe)',
		'CPAP -- refused not interested (Very Mild to Moderate)'                                         => 'CPAP -- refused not interested (Very Mild to Moderate)',
		'CPAP no book'                                                                                   => 'CPAP no book',
		'CPAP no-rebook'                                                                                 => 'CPAP no-rebook',
		'HSAT Refuse -- Had HSAT already'                                                                => 'HSAT Refuse -- Had HSAT already',
		'HSAT Refuse -- No coverage-No Insurance'                                                        => 'HSAT Refuse -- No coverage-No Insurance',
		'HSAT Refuse -- Not interested at this time. Wants to go back and speak with their Doctor first' => 'HSAT Refuse -- Not interested at this time. Wants to go back and speak with their Doctor first',
		'HSAT Refuse to Repeat HSAT'                                                                     => 'HSAT Refuse to Repeat HSAT',
		'HSAT No Book'                                                                                   => 'HSAT No Book',
		'HSAT No Rebook'                                                                                 => 'HSAT No Rebook',
		'HSAT Unable to Contact'                                                                         => 'HSAT Unable to Contact',
		'HSAT & PFT Appointment Notice Letter'                                                           => 'HSAT & PFT Appointment Notice Letter',
		'HSAT & PFT Appointment Status Update Letter'                                                    => 'HSAT & PFT Appointment Status Update Letter',
		'HSAT and Sleep Consult Fax Acknowledgment- Edmonton Location'                                   => 'HSAT and Sleep Consult Fax Acknowledgment- Edmonton Location',
		'HSAT and Sleep Consult Fax Acknowledgment - Calgary Location'                                   => 'HSAT and Sleep Consult Fax Acknowledgment - Calgary Location',
		'Indian Affairs'                                                                                 => 'Indian Affairs',
		'Negative OSA (No RDI)'                                                                          => 'Negative OSA (No RDI)',
		'Negative OSA (RDI and AHI)'                                                                     => 'Negative OSA (RDI and AHI)',
		'Negative OSA'                                                                                   => 'Negative OSA',
		'Negative Inconclusive'                                                                          => 'Negative Inconclusive',
		'Oximetry Inconclusive'                                                                          => 'Oximetry Inconclusive',
		'Oximetry Negative'                                                                              => 'Oximetry Negative',
		'Oximetry Positive'                                                                              => 'Oximetry Positive',
		'Oximetry Refuse'                                                                                => 'Oximetry Refuse',
		'Oximetry No Book'                                                                               => 'Oximetry No Book',
		'Prescription'                                                                                   => 'Prescription',
		'PFT and Pulmonary Consult Fax Acknowledgment- Calgary Location'                                 => 'PFT and Pulmonary Consult Fax Acknowledgment- Calgary Location',
		'PFT and Pulmonary Consult Fax Acknowledgment - Edmonton Location'                               => 'PFT and Pulmonary Consult Fax Acknowledgment - Edmonton Location',
		'Return CPAP -- Buy Online'                                                                      => 'Return CPAP -- Buy Online',
		'Return CPAP -- No Funds'                                                                        => 'Return CPAP -- No Funds',
		'Return CPAP -- No Insurance'                                                                    => 'Return CPAP -- No Insurance',
		// 'Return CPAP -- Try alternative'      => 'Return CPAP -- Try alternative',
		'Return CPAP -- Unable to Tolerate'                                                              => 'Return CPAP -- Unable to Tolerate',
		'Return CPAP -- (No Stats) Buy online'                                                           => 'Return CPAP -- (No Stats) Buy online',
		'Return CPAP -- (No Stats) No insurance'                                                         => 'Return CPAP -- (No Stats) No insurance',
		'Return CPAP -- (No Stats) No Funds'                                                             => 'Return CPAP -- (No Stats) No Funds',
		'Return CPAP -- (No Stats) Try alternative treatment'                                            => 'Return CPAP -- (No Stats) Try alternative treatment',
		'Return CPAP -- (No Stats) Unable to tolerate (Severe to Very Severe)'                           => 'Return CPAP -- (No Stats) Unable to tolerate (Severe to Very Severe)',
		'Return CPAP -- (No Stats) Unable to tolerate (Very Mild to Moderate)'                           => 'Return CPAP -- (No Stats) Unable to tolerate (Very Mild to Moderate)',
		'Specialist Referral'                                                                            => 'Specialist Referral',
		// 'Oral Appliance'    => 'Oral Appliance',
		'Acknowledgement'                                                                                => 'Acknowledgement',
		// 'Devices and Pediatric Oximetry Letter'    => 'Devices and Pediatric Oximetry Letter',
		'Unable to Proceed HSAT Due to High BMI'                                                         => 'Unable to Proceed HSAT Due to High BMI',
	];
	const AFFILIATE_TYPE_INSURANCE = 'Insurance';
    const AFFILIATE_TYPE_REFERRING_HEALTH_FACILITY = 'Referring Affiliate';
    const AFFILIATE_TYPE_REFERRING_PROVIDER = 'Referring Physician';

    const FAX_COVER_SELECTION_1 = '1';
    const FAX_COVER_SELECTION_2 = '2';
    const FAX_COVER_SELECTION_3 = '3';
    const FAX_COVER_SELECTION_4 = '4';
    const FAX_BODY_SELECTION_1 = '1';
    const FAX_BODY_SELECTION_2 = '2';
    const FAX_BODY_SELECTION_3 = '3';
    const FAX_BODY_SELECTION_4 = '4';
    const FAX_BODY_SELECTION_5 = '5';
    const FAX_BRANCH_SELECTION_1 = 'Edmonton North Fax';
    const FAX_BRANCH_SELECTION_2 = 'Edmonton South Fax';
    const FAX_BRANCH_SELECTION_3 = 'Sherwood Park Fax';
    const FAX_BRANCH_SELECTION_4 = 'Calgary North Fax';
    const FAX_BRANCH_SELECTION_5 = 'Calgary South Fax';


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

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

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

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

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

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

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

    /**
     * @ORM\Column(name="fax_cover_selection", type="string", length = 20, nullable=true)
     */
    protected $faxCoverSelection;

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

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

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

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

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

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

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity="PatientEntity", inversedBy="patientLetters")
     * @ORM\JoinColumn(name="patient_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patient;

    /**
     * @ORM\Column(name="fax_branch_selection", type="string", length = 20, nullable=true)
     */
    protected $faxBranchSelection;

    /**
     * @ORM\ManyToOne(targetEntity="PatientReferringProviderEntity", inversedBy="patientLetters")
     * @ORM\JoinColumn(name="patient_referring_provider_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientReferringProvider;

    /**
     * @ORM\ManyToOne(targetEntity="PatientReferringHealthFacilityEntity", inversedBy="patientLetters")
     * @ORM\JoinColumn(name="patient_referring_health_facility_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientReferringHealthFacility;

    /**
     * @ORM\ManyToOne(targetEntity="PatientInsuranceEntity", inversedBy="patientLetters")
     * @ORM\JoinColumn(name="patient_insurance_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientInsurance;

    /**
     * @ORM\ManyToOne(targetEntity="PatientLetterStatusEntity", inversedBy="patientLetters")
     * @ORM\JoinColumn(name="patient_letter_status_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $patientLetterStatus;

    /**
     * @ORM\ManyToOne(targetEntity="AccountUserEntity", inversedBy="patientLetters")
     * @ORM\JoinColumn(name="account_user_id", referencedColumnName="id")
     * @Groups("forAudit")
     * @MaxDepth(1)
     */
    protected $accountUser;

    /**
     * @ORM\OneToMany(targetEntity="FaxTranOutboundEntity", mappedBy="patientLetter")
     */
    protected $faxTranOutbounds;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterNoteEntity", mappedBy="patientLetter")
     */
    protected $patientLetterNotes;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterCcEntity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterCcs;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterFileEntity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterFiles;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterPrescriptionEntity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterPrescriptions;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\PatientLetterPrescriptionFRSIv2Entity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterPrescriptionsV2;

    /**
     * @ORM\OneToMany(targetEntity="RxConnexionBundle\Entity\PatientLetterPrescriptionPSSEntity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterPrescriptionPsss;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterSpecialistReferralEntity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterSpecialistReferrals;

    /**
     * @ORM\OneToMany(targetEntity="PatientLetterAliceNightOneEntity", mappedBy="patientLetter", orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $patientLetterAliceNightOnes;

    /**
     * Set createdAt
     *
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        parent::setCreatedAtValue();
        $this->isDeleted = 0;
    }

    public function __construct()
    {
        $this->faxTranOutbounds = new ArrayCollection();
        $this->patientLetterNotes = new ArrayCollection();
    }

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

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

    /**
     * Remove the photo2 from the disk
     *
     * @ORM\PreRemove
     */
    public function removePhoto2() {

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

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

    /**
     * Get estimatedPage
     *
     * @return integer
    */
    public function getEstimatedPage(){
        if(!empty($this->page) && $this->page != 2){ // 2 was set default before, so if they changed the default then follow their changes
            return $this->page;
        }
        return 2 + (!is_null($this->photoDesc) ? 1 : 0) + (!is_null($this->photoDesc2) ? 1 : 0);
    }

    /**
     * Get patientLetterCcDescAsString
     * @var $glue string
     * @return string
    */
    public function getPatientLetterCcDescAsString(){
        $cc = array();
        /**@var PatientLetterCcEntity $patientLetterCc*/
        foreach ($this->getPatientLetterCcs() as $patientLetterCc){
            switch($patientLetterCc->getAffiliateType()){
                case 'Insurance':
                    $insurance = $patientLetterCc->getPatientInsurance()->getInsurance();
                    $faxNum = "";
                    if(!is_null($insurance->getFaxNo()) && !empty($insurance->getFaxNo())){
                        $faxNum = $insurance->getFaxNo();
                    } elseif(!is_null($insurance->getFaxNoTwo()) && !empty($insurance->getFaxNoTwo())){
                        $faxNum = $insurance->getFaxNoTwo();
                    }
                    $cc[] = $insurance->getDescription() . " ($faxNum)";
                    break;
                case 'Referring Provider':
                    $referringProvider = $patientLetterCc->getPatientReferringProvider()->getReferringProvider();
                    $faxNum = $patientLetterCc->getPatientReferringProvider()->getFaxNumberForLetter();
                    if(!is_null($faxNum) && !empty($faxNum)){
                        $cc[] = $referringProvider->getFullName() . " ($faxNum)";
                    }
                    break;
            }
        }
        return implode(',',$cc);
    }

    /**
     * Get patientLetterCcFaxNumForSrFax
     *
     * @return string
    */
    public function getPatientLetterCcFaxNumForSrFax(){
        $cc = array();
        /**@var PatientLetterCcEntity $patientLetterCc*/
        foreach ($this->getPatientLetterCcs() as $patientLetterCc){
            switch($patientLetterCc->getAffiliateType()){
                case 'Insurance':
                    $insurance = $patientLetterCc->getPatientInsurance()->getInsurance();
                    if(!is_null($insurance->getFaxNo()) && !empty($insurance->getFaxNo())){
                        $faxNum = preg_replace("/[^0-9]/", "", $insurance->getFaxNo());
                        if(strlen($faxNum) == 11){
                            $cc[] = $faxNum;
                        }
                    } elseif(!is_null($insurance->getFaxNoTwo()) && !empty($insurance->getFaxNoTwo())){
                        $faxNum = preg_replace("/[^0-9]/", "", $insurance->getFaxNoTwo());
                        if(strlen($faxNum) == 11){
                            $cc[] = $faxNum;
                        }
                    }
                    break;
                case 'Referring Provider':
                    $faxNum = preg_replace("/[^0-9]/", "", $patientLetterCc->getPatientReferringProvider()->getFaxNumberForLetter());
                    if(strlen($faxNum) == 11){
                        $cc[] = $faxNum;
                    }
                    break;
            }
        }
        return implode('|',$cc);
    }

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

        return __DIR__ . '/../../../web/uploads/patient/letters/tmp';
    }

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

        return '/../../../uploads/patient/letters/tmp';
    }

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

        return 'uploads/patient/letters/photo';
    }

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

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

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

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

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

    /**
     * get photoWebPath2
     *
     * @return string
     */
    public function getPhotoWebPath2() {

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

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

    /**
     * get photoAbsoluteWebPath
     *
     * @return string
     */
    public function getPhotoAbsoluteWebPath() {

        $parsedDesc = $this->parsedPhotoDesc;
        $file = $this->getTmpRootDir2() . '/' . $parsedDesc;

        if(!empty($parsedDesc) && file_exists($file)) {
            return  (isset($_SERVER['HTTPS']) ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/' . $this->getTmpRootDir2() . '/' . $parsedDesc;
        } else {
            return '';
        }
    }

    /**
     * get photo2AbsoluteWebPath
     *
     * @return string
     */
    public function getPhoto2AbsoluteWebPath() {

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

        if(!empty($parsedDesc) && file_exists($file)) {
            return  (isset($_SERVER['HTTPS']) ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/' . $this->getUploadDir() . '/' . $parsedDesc;
        } else {
            return '';
        }
    }

    /**
     * get photoTmpAbsoluteWebPath
     *
     * @return string
     */
    public function getPhotoTmpAbsoluteWebPath($fileName = null) {

        $file = $this->getTmpRootDir2() . '/' . $fileName;

        if(!empty($fileName)) {
            return  (isset($_SERVER['HTTPS']) ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/' . $this->getTmpRootDir2() . '/' . $fileName;
        } else {
            return '';
        }
    }

    /**
     * Get dateAsString
     *
     * @return string
     */
    public function getDateAsString() {

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

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

    /**
     * Set letterType
     *
     * @param string $letterType
     *
     * @return PatientLetterEntity
     */
    public function setLetterType($letterType)
    {
        $this->letterType = $letterType;

        return $this;
    }

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

    /**
     * Set patient
     *
     * @param \RxConnexionBundle\Entity\PatientEntity $patient
     *
     * @return PatientLetterEntity
     */
    public function setPatient(\RxConnexionBundle\Entity\PatientEntity $patient = null)
    {
        $this->patient = $patient;

        return $this;
    }

    /**
     * Get patient
     *
     * @return \RxConnexionBundle\Entity\PatientEntity
     */
    public function getPatient()
    {
        return $this->patient;
    }

    /**
     * Set patientReferringProvider
     *
     * @param \RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider
     *
     * @return PatientLetterEntity
     */
    public function setPatientReferringProvider(\RxConnexionBundle\Entity\PatientReferringProviderEntity $patientReferringProvider = null)
    {
        $this->patientReferringProvider = $patientReferringProvider;

        return $this;
    }

    /**
     * Get patientReferringProvider
     *
     * @return \RxConnexionBundle\Entity\PatientReferringProviderEntity
     */
    public function getPatientReferringProvider()
    {
        return $this->patientReferringProvider;
    }

    /**
     * Set patientReferringHealthFacility
     *
     * @param \RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility
     *
     * @return PatientLetterEntity
     */
    public function setPatientReferringHealthFacility(\RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity $patientReferringHealthFacility = null)
    {
        $this->patientReferringHealthFacility = $patientReferringHealthFacility;

        return $this;
    }

    /**
     * Get patientReferringHealthFacility
     *
     * @return \RxConnexionBundle\Entity\PatientReferringHealthFacilityEntity
     */
    public function getPatientReferringHealthFacility()
    {
        return $this->patientReferringHealthFacility;
    }

    /**
     * Set patientInsurance
     *
     * @param \RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance
     *
     * @return PatientLetterEntity
     */
    public function setPatientInsurance(\RxConnexionBundle\Entity\PatientInsuranceEntity $patientInsurance = null)
    {
        $this->patientInsurance = $patientInsurance;

        return $this;
    }

    /**
     * Get patientInsurance
     *
     * @return \RxConnexionBundle\Entity\PatientInsuranceEntity
     */
    public function getPatientInsurance()
    {
        return $this->patientInsurance;
    }

    /**
     * Set customBody
     *
     * @param string $customBody
     *
     * @return PatientLetterEntity
     */
    public function setCustomBody($customBody)
    {
        $this->customBody = $customBody;

        return $this;
    }

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

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

    /**
     * Set createdBy
     *
     * @param string $createdBy
     *
     * @return PatientLetterEntity
     */
    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 PatientLetterEntity
     */
    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 PatientLetterEntity
     */
    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 PatientLetterEntity
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

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

    /**
     * Set photoDesc
     *
     * @param string $photoDesc
     *
     * @return PatientLetterEntity
     */
    public function setPhotoDesc($photoDesc)
    {
        $this->photoDesc = $photoDesc;

        return $this;
    }

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

    /**
     * Set parsedPhotoDesc
     *
     * @param string $parsedPhotoDesc
     *
     * @return PatientLetterEntity
     */
    public function setParsedPhotoDesc($parsedPhotoDesc)
    {
        $this->parsedPhotoDesc = $parsedPhotoDesc;

        return $this;
    }

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

    /**
     * Set photoDesc2
     *
     * @param string $photoDesc2
     *
     * @return PatientLetterEntity
     */
    public function setPhotoDesc2($photoDesc2)
    {
        $this->photoDesc2 = $photoDesc2;

        return $this;
    }

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

    /**
     * Set parsedPhotoDesc2
     *
     * @param string $parsedPhotoDesc2
     *
     * @return PatientLetterEntity
     */
    public function setParsedPhotoDesc2($parsedPhotoDesc2)
    {
        $this->parsedPhotoDesc2 = $parsedPhotoDesc2;

        return $this;
    }

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

    /**
     * Add faxTranOutbound
     *
     * @param \RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound
     *
     * @return PatientLetterEntity
     */
    public function addFaxTranOutbound(\RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound)
    {
        $this->faxTranOutbounds[] = $faxTranOutbound;

        return $this;
    }

    /**
     * Remove faxTranOutbound
     *
     * @param \RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound
     */
    public function removeFaxTranOutbound(\RxConnexionBundle\Entity\FaxTranOutboundEntity $faxTranOutbound)
    {
        $this->faxTranOutbounds->removeElement($faxTranOutbound);
    }

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

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

        return $this;
    }

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

    /**
     * Set patientLetterStatus
     *
     * @param \RxConnexionBundle\Entity\PatientLetterStatusEntity $patientLetterStatus
     *
     * @return PatientLetterEntity
     */
    public function setPatientLetterStatus(\RxConnexionBundle\Entity\PatientLetterStatusEntity $patientLetterStatus = null)
    {
        $this->patientLetterStatus = $patientLetterStatus;

        return $this;
    }

    /**
     * Get patientLetterStatus
     *
     * @return \RxConnexionBundle\Entity\PatientLetterStatusEntity
     */
    public function getPatientLetterStatus()
    {
        return $this->patientLetterStatus;
    }

    /**
     * Set faxCoverSelection
     *
     * @param string $faxCoverSelection
     *
     * @return PatientLetterEntity
     */
    public function setFaxCoverSelection($faxCoverSelection)
    {
        $this->faxCoverSelection = $faxCoverSelection;

        return $this;
    }

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

    /**
     * Set faxBranchSelection
     *
     * @param string $faxBranchSelection
     *
     * @return PatientLetterEntity
     */
    public function setFaxBranchSelection($faxBranchSelection)
    {
        $this->faxBranchSelection = $faxBranchSelection;

        return $this;
    }

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

    /**
     * Set accountUser
     *
     * @param \RxConnexionBundle\Entity\AccountUserEntity $accountUser
     *
     * @return PatientLetterEntity
     */
    public function setAccountUser(\RxConnexionBundle\Entity\AccountUserEntity $accountUser = null)
    {
        $this->accountUser = $accountUser;

        return $this;
    }

    /**
     * Get accountUser
     *
     * @return \RxConnexionBundle\Entity\AccountUserEntity
     */
    public function getAccountUser()
    {
        return $this->accountUser;
    }

    /**
     * Set faxCoverCustomBody
     *
     * @param string $faxCoverCustomBody
     *
     * @return PatientLetterEntity
     */
    public function setFaxCoverCustomBody($faxCoverCustomBody)
    {
        $this->faxCoverCustomBody = $faxCoverCustomBody;

        return $this;
    }

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

    /**
     * Set attention
     *
     * @param string $attention
     *
     * @return PatientLetterEntity
     */
    public function setAttention($attention)
    {
        $this->attention = $attention;

        return $this;
    }

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

    /**
     * Set recipient
     *
     * @param string $recipient
     *
     * @return PatientLetterEntity
     */
    public function setRecipient($recipient)
    {
        $this->recipient = $recipient;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Set faxNo
     *
     * @param string $faxNo
     *
     * @return PatientLetterEntity
     */
    public function setFaxNo($faxNo)
    {
        $this->faxNo = $faxNo;

        return $this;
    }

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

    /**
     * Set name
     *
     * @param string $name
     *
     * @return PatientLetterEntity
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

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

    /**
     * Set page
     *
     * @param string $page
     *
     * @return PatientLetterEntity
     */
    public function setPage($page)
    {
        $this->page = $page;

        return $this;
    }

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

    /**
     * Set carbonCopy
     *
     * @param string $carbonCopy
     *
     * @return PatientLetterEntity
     */
    public function setCarbonCopy($carbonCopy)
    {
        $this->carbonCopy = $carbonCopy;

        return $this;
    }

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

    /**
     * Add patientLetterNote
     *
     * @param \RxConnexionBundle\Entity\PatientLetterNoteEntity $patientLetterNote
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterNote(\RxConnexionBundle\Entity\PatientLetterNoteEntity $patientLetterNote)
    {
        $this->patientLetterNotes[] = $patientLetterNote;

        return $this;
    }

    /**
     * Remove patientLetterNote
     *
     * @param \RxConnexionBundle\Entity\PatientLetterNoteEntity $patientLetterNote
     */
    public function removePatientLetterNote(\RxConnexionBundle\Entity\PatientLetterNoteEntity $patientLetterNote)
    {
        $this->patientLetterNotes->removeElement($patientLetterNote);
    }

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

    /**
     * Add patientLetterCc
     *
     * @param \RxConnexionBundle\Entity\PatientLetterCcEntity $patientLetterCc
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterCc(\RxConnexionBundle\Entity\PatientLetterCcEntity $patientLetterCc)
    {
        $patientLetterCc->setPatientLetter($this);
        $this->patientLetterCcs[] = $patientLetterCc;

        return $this;
    }

    /**
     * Remove patientLetterCc
     *
     * @param \RxConnexionBundle\Entity\PatientLetterCcEntity $patientLetterCc
     */
    public function removePatientLetterCc(\RxConnexionBundle\Entity\PatientLetterCcEntity $patientLetterCc)
    {
        $this->patientLetterCcs->removeElement($patientLetterCc);
    }

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

    /**
     * Add patientLetterFile
     *
     * @param \RxConnexionBundle\Entity\PatientLetterFileEntity $patientLetterFile
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterFile(\RxConnexionBundle\Entity\PatientLetterFileEntity $patientLetterFile)
    {
        $this->patientLetterFiles[] = $patientLetterFile;

        return $this;
    }

    /**
     * Remove patientLetterFile
     *
     * @param \RxConnexionBundle\Entity\PatientLetterFileEntity $patientLetterFile
     */
    public function removePatientLetterFile(\RxConnexionBundle\Entity\PatientLetterFileEntity $patientLetterFile)
    {
        $this->patientLetterFiles->removeElement($patientLetterFile);
    }

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

    /**
     * Add patientLetterPrescription
     *
     * @param \RxConnexionBundle\Entity\PatientLetterPrescriptionEntity $patientLetterPrescription
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterPrescription(\RxConnexionBundle\Entity\PatientLetterPrescriptionEntity $patientLetterPrescription)
    {
        $this->patientLetterPrescription[] = $patientLetterPrescription;

        return $this;
    }

    /**
     * Remove patientLetterPrescription
     *
     * @param \RxConnexionBundle\Entity\PatientLetterPrescriptionEntity $patientLetterPrescription
     */
    public function removePatientLetterPrescription(\RxConnexionBundle\Entity\PatientLetterPrescriptionEntity $patientLetterPrescription)
    {
        $this->patientLetterPrescription->removeElement($patientLetterPrescription);
    }

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

    /**
     * Add patientLetterSpecialistReferral
     *
     * @param \RxConnexionBundle\Entity\PatientLetterSpecialistReferralEntity $patientLetterSpecialistReferral
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterSpecialistReferral(\RxConnexionBundle\Entity\PatientLetterSpecialistReferralEntity $patientLetterSpecialistReferral)
    {
        $this->patientLetterSpecialistReferral[] = $patientLetterSpecialistReferral;

        return $this;
    }

    /**
     * Remove patientLetterSpecialistReferral
     *
     * @param \RxConnexionBundle\Entity\PatientLetterSpecialistReferralEntity $patientLetterSpecialistReferral
     */
    public function removePatientLetterSpecialistReferral(\RxConnexionBundle\Entity\PatientLetterSpecialistReferralEntity $patientLetterSpecialistReferral)
    {
        $this->patientLetterSpecialistReferral->removeElement($patientLetterSpecialistReferral);
    }

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

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

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

    /**
     * Add patientLetterPrescriptionPsss
     *
     * @param \RxConnexionBundle\Entity\PatientLetterPrescriptionPSSEntity $patientLetterPrescriptionPsss
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterPrescriptionPsss(\RxConnexionBundle\Entity\PatientLetterPrescriptionPSSEntity $patientLetterPrescriptionPsss)
    {
        $this->patientLetterPrescriptionPsss[] = $patientLetterPrescriptionPsss;

        return $this;
    }

    /**
     * Remove patientLetterPrescriptionPsss
     *
     * @param \RxConnexionBundle\Entity\PatientLetterPrescriptionPSSEntity $patientLetterPrescriptionPsss
     */
    public function removePatientLetterPrescriptionPsss(\RxConnexionBundle\Entity\PatientLetterPrescriptionPSSEntity $patientLetterPrescriptionPsss)
    {
        $this->patientLetterPrescriptionPsss->removeElement($patientLetterPrescriptionPsss);
    }

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

    /**
     * Add patientLetterPrescriptionsV2
     *
     * @param \RxConnexionBundle\Entity\PatientLetterPrescriptionFRSIv2Entity $patientLetterPrescriptionsV2
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterPrescriptionsV2(\RxConnexionBundle\Entity\PatientLetterPrescriptionFRSIv2Entity $patientLetterPrescriptionsV2)
    {
        $this->patientLetterPrescriptionsV2[] = $patientLetterPrescriptionsV2;

        return $this;
    }

    /**
     * Remove patientLetterPrescriptionsV2
     *
     * @param \RxConnexionBundle\Entity\PatientLetterPrescriptionFRSIv2Entity $patientLetterPrescriptionsV2
     */
    public function removePatientLetterPrescriptionsV2(\RxConnexionBundle\Entity\PatientLetterPrescriptionFRSIv2Entity $patientLetterPrescriptionsV2)
    {
        $this->patientLetterPrescriptionsV2->removeElement($patientLetterPrescriptionsV2);
    }

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

    /**
     * Add patientLetterAliceNightOne
     *
     * @param \RxConnexionBundle\Entity\PatientLetterAliceNightOneEntity $patientLetterAliceNightOne
     *
     * @return PatientLetterEntity
     */
    public function addPatientLetterAliceNightOne(\RxConnexionBundle\Entity\PatientLetterAliceNightOneEntity $patientLetterAliceNightOne)
    {
        $this->patientLetterAliceNightOnes[] = $patientLetterAliceNightOne;

        return $this;
    }

    /**
     * Remove patientLetterAliceNightOne
     *
     * @param \RxConnexionBundle\Entity\PatientLetterAliceNightOneEntity $patientLetterAliceNightOne
     */
    public function removePatientLetterAliceNightOne(\RxConnexionBundle\Entity\PatientLetterAliceNightOneEntity $patientLetterAliceNightOne)
    {
        $this->patientLetterAliceNightOnes->removeElement($patientLetterAliceNightOne);
    }

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