<?php
namespace App\Entity;
use App\Repository\HdSolicitudRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
/**** TALIS AGREGAR ESTO EN TODAS LAS ENTIDADES QUE CREAMOS ****/
use DateTime;
/**
* @ORM\Entity(repositoryClass=HdSolicitudRepository::class)
* @ORM\HasLifecycleCallbacks //<======ESTO TAMBIEN TALIS
*/
class HdSolicitud
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Paciente::class, inversedBy="hdSolicituds")
* @ORM\JoinColumn(nullable=false)
*/
private $paciente;
/**
* @ORM\ManyToOne(targetEntity=HdMaestroPasos::class, inversedBy="hdSolicituds")
* @ORM\JoinColumn(nullable=false)
*/
private $hd_maestro_pasos;
/**
* @ORM\ManyToOne(targetEntity=Agenda::class, inversedBy="hdSolicituds")
* @ORM\JoinColumn(nullable=true)
*/
private $agenda;
/**
* @ORM\Column(type="string", length=50)
*/
private $ip_crea;
/**
* @ORM\Column(type="string", length=50)
*/
private $ip_modifica;
/**
* @ORM\Column(type="integer")
*/
private $user_crea;
/**
* @ORM\Column(type="integer")
*/
private $user_modifica;
/**
* @ORM\OneToMany(targetEntity=HdArchivos::class, mappedBy="hd_solicitud")
*/
private $hdArchivos;
/**
* @ORM\Column(type="datetime")
*/
private $fecha_ingreso;
/**
* @ORM\Column(type="boolean")
*/
private $estado;
/**
* @ORM\Column(type="boolean")
*/
private $en_proceso;
/**
* @ORM\OneToMany(targetEntity=HdPaso::class, mappedBy="hd_solicitud")
*/
private $hdPasos;
/**
* @ORM\OneToMany(targetEntity=HdOrdenes::class, mappedBy="hd_solicitud")
*/
private $hdOrdenes;
/**
* @ORM\ManyToOne(targetEntity=SeguroPrivado::class, inversedBy="hdSolicituds")
* @ORM\JoinColumn(nullable=false)
*/
private $seguro;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $referido;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $avisar;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $parentesco;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $llegada;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $fuente_info;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $institucion_entrega;
/**
* @ORM\OneToMany(targetEntity=HdEmergencia::class, mappedBy="hd_solicitud")
*/
private $hdEmergencias;
/**
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\Column(type="datetime")
*/
private $updated_at;
/**
* @ORM\Column(type="string", length=25, nullable=true)
*/
private $edad;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $telefono_institucion;
/**
* @ORM\OneToMany(targetEntity=HdSolicitudDiagnosticos::class, mappedBy="HdSolicitud")
*/
private $hdSolicitudDiagnosticos;
public function __construct()
{
$this->hdArchivos = new ArrayCollection();
$this->hdPasos = new ArrayCollection();
$this->hdOrdenes = new ArrayCollection();
$this->hdEmergencias = new ArrayCollection();
$this->hdSolicitudDiagnosticos = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getIdPaciente(): ?string
{
return $this->id_paciente;
}
public function getPaciente(): ?Paciente
{
return $this->paciente;
}
public function setPaciente(?Paciente $paciente): self
{
$this->paciente = $paciente;
return $this;
}
public function getHdMaestroPasos(): ?HdMaestroPasos
{
return $this->hd_maestro_pasos;
}
public function setHdMaestroPasos(?HdMaestroPasos $hd_maestro_pasos): self
{
$this->hd_maestro_pasos = $hd_maestro_pasos;
return $this;
}
public function getAgenda(): ?Agenda
{
return $this->agenda;
}
public function setAgenda(?Agenda $agenda): self
{
$this->agenda = $agenda;
return $this;
}
public function getIpCrea(): ?string
{
return $this->ip_crea;
}
public function setIpCrea(string $ip_crea): self
{
$this->ip_crea = $ip_crea;
return $this;
}
public function getIpModifica(): ?string
{
return $this->ip_modifica;
}
public function setIpModifica(string $ip_modifica): self
{
$this->ip_modifica = $ip_modifica;
return $this;
}
public function getUserCrea(): ?int
{
return $this->user_crea;
}
public function setUserCrea(int $user_crea): self
{
$this->user_crea = $user_crea;
return $this;
}
public function getUserModifica(): ?int
{
return $this->user_modifica;
}
public function setUserModifica(int $user_modifica): self
{
$this->user_modifica = $user_modifica;
return $this;
}
/**
* @return Collection|HdArchivos[]
*/
public function getHdArchivos(): Collection
{
return $this->hdArchivos;
}
public function addHdArchivo(HdArchivos $hdArchivo): self
{
if (!$this->hdArchivos->contains($hdArchivo)) {
$this->hdArchivos[] = $hdArchivo;
$hdArchivo->setHdSolicitud($this);
}
return $this;
}
public function removeHdArchivo(HdArchivos $hdArchivo): self
{
if ($this->hdArchivos->removeElement($hdArchivo)) {
// set the owning side to null (unless already changed)
if ($hdArchivo->getHdSolicitud() === $this) {
$hdArchivo->setHdSolicitud(null);
}
}
return $this;
}
public function getFechaIngreso(): ?\DateTimeInterface
{
return $this->fecha_ingreso;
}
public function setFechaIngreso(\DateTimeInterface $fecha_ingreso): self
{
$this->fecha_ingreso = $fecha_ingreso;
return $this;
}
public function getEstado(): ?bool
{
return $this->estado;
}
public function setEstado(bool $estado): self
{
$this->estado = $estado;
return $this;
}
public function getEnProceso(): ?bool
{
return $this->en_proceso;
}
public function setEnProceso(bool $en_proceso): self
{
$this->en_proceso = $en_proceso;
return $this;
}
/**
* @return Collection|HdPaso[]
*/
public function getHdPasos(): Collection
{
return $this->hdPasos;
}
public function addHdPaso(HdPaso $hdPaso): self
{
if (!$this->hdPasos->contains($hdPaso)) {
$this->hdPasos[] = $hdPaso;
$hdPaso->setHdSolicitud($this);
}
return $this;
}
public function removeHdPaso(HdPaso $hdPaso): self
{
if ($this->hdPasos->removeElement($hdPaso)) {
// set the owning side to null (unless already changed)
if ($hdPaso->getHdSolicitud() === $this) {
$hdPaso->setHdSolicitud(null);
}
}
return $this;
}
/**
* @return Collection|HdOrdenes[]
*/
public function getHdOrdenes(): Collection
{
return $this->hdOrdenes;
}
public function addHdOrdene(HdOrdenes $hdOrdene): self
{
if (!$this->hdOrdenes->contains($hdOrdene)) {
$this->hdOrdenes[] = $hdOrdene;
$hdOrdene->setHdSolicitud($this);
}
return $this;
}
public function removeHdOrdene(HdOrdenes $hdOrdene): self
{
if ($this->hdOrdenes->removeElement($hdOrdene)) {
// set the owning side to null (unless already changed)
if ($hdOrdene->getHdSolicitud() === $this) {
$hdOrdene->setHdSolicitud(null);
}
}
return $this;
}
public function getSeguro(): ?SeguroPrivado
{
return $this->seguro;
}
public function setSeguro(?SeguroPrivado $seguro): self
{
$this->seguro = $seguro;
return $this;
}
public function getReferido(): ?string
{
return $this->referido;
}
public function setReferido(?string $referido): self
{
$this->referido = $referido;
return $this;
}
public function getAvisar(): ?string
{
return $this->avisar;
}
public function setAvisar(?string $avisar): self
{
$this->avisar = $avisar;
return $this;
}
public function getParentesco(): ?string
{
return $this->parentesco;
}
public function setParentesco(?string $parentesco): self
{
$this->parentesco = $parentesco;
return $this;
}
public function getLlegada(): ?string
{
return $this->llegada;
}
public function setLlegada(?string $llegada): self
{
$this->llegada = $llegada;
return $this;
}
public function getFuenteInfo(): ?string
{
return $this->fuente_info;
}
public function setFuenteInfo(?string $fuente_info): self
{
$this->fuente_info = $fuente_info;
return $this;
}
public function getInstitucionEntrega(): ?string
{
return $this->institucion_entrega;
}
public function setInstitucionEntrega(?string $institucion_entrega): self
{
$this->institucion_entrega = $institucion_entrega;
return $this;
}
/**
* @return Collection|HdEmergencia[]
*/
public function getHdEmergencias(): Collection
{
return $this->hdEmergencias;
}
public function addHdEmergencia(HdEmergencia $hdEmergencia): self
{
if (!$this->hdEmergencias->contains($hdEmergencia)) {
$this->hdEmergencias[] = $hdEmergencia;
$hdEmergencia->setHdSolicitud($this);
}
return $this;
}
public function removeHdEmergencia(HdEmergencia $hdEmergencia): self
{
if ($this->hdEmergencias->removeElement($hdEmergencia)) {
// set the owning side to null (unless already changed)
if ($hdEmergencia->getHdSolicitud() === $this) {
$hdEmergencia->setHdSolicitud(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**** TALIS AGREGAR ESTO EN TODAS LAS ENTIDADES QUE CREAMOS ****/
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps(): void
{
$dateTimeNow = new DateTime('now');
$this->setUpdatedAt($dateTimeNow);
if ($this->getCreatedAt() === null) {
$this->setCreatedAt($dateTimeNow);
}
}
public function getEdad(): ?string
{
return $this->edad;
}
public function setEdad(string $edad): self
{
$this->edad = $edad;
return $this;
}
public function getTelefonoInstitucion(): ?string
{
return $this->telefono_institucion;
}
public function setTelefonoInstitucion(?string $telefono_institucion): self
{
$this->telefono_institucion = $telefono_institucion;
return $this;
}
/**
* @return Collection|HdSolicitudDiagnosticos[]
*/
public function getHdSolicitudDiagnosticos(): Collection
{
return $this->hdSolicitudDiagnosticos;
}
public function addHdSolicitudDiagnostico(HdSolicitudDiagnosticos $hdSolicitudDiagnostico): self
{
if (!$this->hdSolicitudDiagnosticos->contains($hdSolicitudDiagnostico)) {
$this->hdSolicitudDiagnosticos[] = $hdSolicitudDiagnostico;
$hdSolicitudDiagnostico->setHdSolicitud($this);
}
return $this;
}
public function removeHdSolicitudDiagnostico(HdSolicitudDiagnosticos $hdSolicitudDiagnostico): self
{
if ($this->hdSolicitudDiagnosticos->removeElement($hdSolicitudDiagnostico)) {
// set the owning side to null (unless already changed)
if ($hdSolicitudDiagnostico->getHdSolicitud() === $this) {
$hdSolicitudDiagnostico->setHdSolicitud(null);
}
}
return $this;
}
public function getPaso($codigo): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('hd_maestro_pasos', $codigo));
return $this->hdPasos->matching($criteria);
}
}