<?php
namespace App\Entity;
use App\Repository\AgendaRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use DateTime;
/**
* @ORM\Entity(repositoryClass=AgendaRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class Agenda
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $inicio;
/**
* @ORM\Column(type="datetime")
*/
private $fin;
/**
* @ORM\ManyToOne(targetEntity=Paciente::class, inversedBy="agendas")
*/
private $paciente;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="agendas")
*/
private $doctor;
/**
* @ORM\ManyToOne(targetEntity=Sala::class, inversedBy="agendas")
*/
private $sala;
/**
* @ORM\Column(type="smallint")
*/
private $estado;
/**
* @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\Column(type="datetime")
*/
private $created_at;
/**
* @ORM\Column(type="datetime")
*/
private $updated_at;
/**
* @ORM\ManyToOne(targetEntity=SeguroPrivado::class, inversedBy="agendas")
* @ORM\JoinColumn(nullable=false)
*/
private $seguro;
/**
* @ORM\ManyToOne(targetEntity=Especialidad::class, inversedBy="agendas")
* @ORM\JoinColumn(nullable=false)
*/
private $especialidad;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $observacion;
/**
* @ORM\Column(type="smallint")
*/
private $estado_agenda;
/**
* @ORM\OneToMany(targetEntity=LogAgenda::class, mappedBy="agenda")
*/
private $logAgendas;
/**
* @ORM\OneToOne(targetEntity=Preparacion::class, mappedBy="agenda", cascade={"persist", "remove"})
*/
private $preparacion;
/**
* @ORM\OneToOne(targetEntity=HistoriaClinica::class, mappedBy="agenda", cascade={"persist", "remove"})
*/
private $historiaClinica;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $archivo053;
/**
* @ORM\ManyToOne(targetEntity=Procedimientos::class, inversedBy="agendas")
* @ORM\JoinColumn(nullable=false, columnDefinition="INT NOT NULL DEFAULT 1")
*/
private $procedimiento;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $tipo_consulta;
/**
* @ORM\OneToMany(targetEntity=HdSolicitud::class, mappedBy="agenda")
*/
private $hdSolicituds;
/**
* @ORM\OneToMany(targetEntity=HdPaso::class, mappedBy="agenda")
*/
private $hdPasos;
/**
* @ORM\OneToMany(targetEntity=HdOrdenes::class, mappedBy="agenda")
*/
private $hdOrdenes;
/**
* @ORM\OneToMany(targetEntity=OdontogramaProcedimiento::class, mappedBy="agenda")
*/
private $odontogramaProcedimientos;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $origen;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $fecha_consulta;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $doctor_consulta;
/**
* @ORM\OneToMany(targetEntity=DatosCirugia::class, mappedBy="agenda")
*/
private $datosCirugias;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $cie10_recep;
/**
* @ORM\ManyToOne(targetEntity=Especialidad::class)
*/
private $origen_especialidad;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $validacion;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $cobrado;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $factura;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $fecha_factura;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $fecha_pago;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $verificado;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $confirma = false;
/**
* @ORM\OneToMany(targetEntity=AgendaProcedimiento::class, mappedBy="agenda")
*/
private $agenda_procedimientos;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $anestesiologo;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $corte_seguro;
/**
* @ORM\OneToMany(targetEntity=OrdenProcedimiento::class, mappedBy="agenda")
*/
private $ordenProcedimientos;
/**
* @ORM\ManyToOne(targetEntity=User::class)
*/
private $recomendado;
/**
* @ORM\ManyToOne(targetEntity=RedSocial::class, inversedBy="agendas")
* @ORM\JoinColumn(nullable=false)
*/
private $redsocial;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $salud_producto;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $salud_nropersona;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $salud_nivel;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $documentos = false;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $wid;
/**
* @ORM\ManyToOne(targetEntity=Agenda::class)
* @ORM\JoinColumn(name="referencia_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
private $referencia;
/**
* @ORM\OneToMany(targetEntity=Agenda::class, mappedBy="referencia")
*/
private $agendasReferenciadas;
public function __construct()
{
$this->logAgendas = new ArrayCollection();
$this->hdSolicituds = new ArrayCollection();
$this->hdPasos = new ArrayCollection();
$this->hdOrdenes = new ArrayCollection();
$this->odontogramaProcedimientos = new ArrayCollection();
$this->datosCirugias = new ArrayCollection();
$this->agenda_procedimientos = new ArrayCollection();
$this->agendasReferenciadas = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getInicio(): ?\DateTimeInterface
{
return $this->inicio;
}
public function setInicio(\DateTimeInterface $inicio): self
{
$this->inicio = $inicio;
return $this;
}
public function getFin(): ?\DateTimeInterface
{
return $this->fin;
}
public function setFin(\DateTimeInterface $fin): self
{
$this->fin = $fin;
return $this;
}
public function getPaciente(): ?Paciente
{
return $this->paciente;
}
public function setPaciente(?Paciente $paciente): self
{
$this->paciente = $paciente;
return $this;
}
public function getDoctor(): ?User
{
return $this->doctor;
}
public function setDoctor(?User $doctor): self
{
$this->doctor = $doctor;
return $this;
}
public function getSala(): ?Sala
{
return $this->sala;
}
public function setSala(?Sala $sala): self
{
$this->sala = $sala;
return $this;
}
public function getEstado(): ?int
{
return $this->estado;
}
public function setEstado(int $estado): self
{
$this->estado = $estado;
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;
}
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;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps(): void
{
$dateTimeNow = new DateTime('now');
$this->setUpdatedAt($dateTimeNow);
if ($this->getCreatedAt() === null) {
$this->setCreatedAt($dateTimeNow);
}
}
public function getSeguro(): ?SeguroPrivado
{
return $this->seguro;
}
public function setSeguro(?SeguroPrivado $seguro): self
{
$this->seguro = $seguro;
return $this;
}
public function getEspecialidad(): ?Especialidad
{
return $this->especialidad;
}
public function setEspecialidad(?Especialidad $especialidad): self
{
$this->especialidad = $especialidad;
return $this;
}
public function getObservacion(): ?string
{
return $this->observacion;
}
public function setObservacion(?string $observacion): self
{
$this->observacion = $observacion;
return $this;
}
public function getEstadoAgenda(): ?int
{
return $this->estado_agenda;
}
public function setEstadoAgenda(int $estado_agenda): self
{
$this->estado_agenda = $estado_agenda;
return $this;
}
/**
* @return Collection|LogAgenda[]
*/
public function getLogAgendas(): Collection
{
return $this->logAgendas;
}
public function addLogAgenda(LogAgenda $logAgenda): self
{
if (!$this->logAgendas->contains($logAgenda)) {
$this->logAgendas[] = $logAgenda;
$logAgenda->setAgenda($this);
}
return $this;
}
public function removeLogAgenda(LogAgenda $logAgenda): self
{
if ($this->logAgendas->removeElement($logAgenda)) {
// set the owning side to null (unless already changed)
if ($logAgenda->getAgenda() === $this) {
$logAgenda->setAgenda(null);
}
}
return $this;
}
public function getPreparacion(): ?Preparacion
{
return $this->preparacion;
}
public function setPreparacion(Preparacion $preparacion): self
{
$this->preparacion = $preparacion;
// set the owning side of the relation if necessary
if ($preparacion->getAgenda() !== $this) {
$preparacion->setAgenda($this);
}
return $this;
}
public function getHistoriaClinica(): ?HistoriaClinica
{
return $this->historiaClinica;
}
public function setHistoriaClinica(HistoriaClinica $historiaClinica): self
{
$this->historiaClinica = $historiaClinica;
// set the owning side of the relation if necessary
if ($historiaClinica->getAgenda() !== $this) {
$historiaClinica->setAgenda($this);
}
return $this;
}
public function getArchivo053(): ?string
{
return $this->archivo053;
}
public function setArchivo053(?string $archivo053): self
{
$this->archivo053 = $archivo053;
return $this;
}
public function getProcedimiento(): ?Procedimientos
{
return $this->procedimiento;
}
public function setProcedimiento(?Procedimientos $procedimiento): self
{
$this->procedimiento = $procedimiento;
return $this;
}
public function getTipoConsulta(): ?string
{
return $this->tipo_consulta;
}
public function setTipoConsulta(?string $tipo_consulta): self
{
$this->tipo_consulta = $tipo_consulta;
return $this;
}
/**
* @return Collection|HdSolicitud[]
*/
public function getHdSolicituds(): Collection
{
return $this->hdSolicituds;
}
public function addHdSolicitud(HdSolicitud $hdSolicitud): self
{
if (!$this->hdSolicituds->contains($hdSolicitud)) {
$this->hdSolicituds[] = $hdSolicitud;
$hdSolicitud->setAgenda($this);
}
return $this;
}
public function removeHdSolicitud(HdSolicitud $hdSolicitud): self
{
if ($this->hdSolicituds->removeElement($hdSolicitud)) {
// set the owning side to null (unless already changed)
if ($hdSolicitud->getAgenda() === $this) {
$hdSolicitud->setAgenda(null);
}
}
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->setAgenda($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->getAgenda() === $this) {
$hdPaso->setAgenda(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->setAgenda($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->getAgenda() === $this) {
$hdOrdene->setAgenda(null);
}
}
return $this;
}
/**
* @return Collection|OdontogramaProcedimiento[]
*/
public function getOdontogramaProcedimientos(): Collection
{
return $this->odontogramaProcedimientos;
}
public function addOdontogramaProcedimiento(OdontogramaProcedimiento $odontogramaProcedimiento): self
{
if (!$this->odontogramaProcedimientos->contains($odontogramaProcedimiento)) {
$this->odontogramaProcedimientos[] = $odontogramaProcedimiento;
$odontogramaProcedimiento->setAgenda($this);
}
return $this;
}
public function removeOdontogramaProcedimiento(OdontogramaProcedimiento $odontogramaProcedimiento): self
{
if ($this->odontogramaProcedimientos->removeElement($odontogramaProcedimiento)) {
// set the owning side to null (unless already changed)
if ($odontogramaProcedimiento->getAgenda() === $this) {
$odontogramaProcedimiento->setAgenda(null);
}
}
return $this;
}
/**
* @return Collection|DatosCirugia[]
*/
public function getDatosCirugias(): Collection
{
return $this->datosCirugias;
}
public function addDatosCirugia(DatosCirugia $datosCirugia): self
{
if (!$this->datosCirugias->contains($datosCirugia)) {
$this->datosCirugias[] = $datosCirugia;
$datosCirugia->setAgenda($this);
}
return $this;
}
public function removeDatosCirugia(DatosCirugia $datosCirugia): self
{
if ($this->datosCirugias->removeElement($datosCirugia)) {
// set the owning side to null (unless already changed)
if ($datosCirugia->getAgenda() === $this) {
$datosCirugia->setAgenda(null);
}
}
return $this;
}
public function getOrigen(): ?string
{
return $this->origen;
}
public function setOrigen(?string $origen): self
{
$this->origen = $origen;
return $this;
}
public function getFechaConsulta(): ?\DateTimeInterface
{
return $this->fecha_consulta;
}
public function setFechaConsulta(?\DateTimeInterface $fecha_consulta): self
{
$this->fecha_consulta = $fecha_consulta;
return $this;
}
public function getDoctorConsulta(): ?User
{
return $this->doctor_consulta;
}
public function setDoctorConsulta(?User $doctor_consulta): self
{
$this->doctor_consulta = $doctor_consulta;
return $this;
}
public function getCie10Recep(): ?string
{
return $this->cie10_recep;
}
public function setCie10Recep(?string $cie10_recep): self
{
$this->cie10_recep = $cie10_recep;
return $this;
}
public function getOrigenEspecialidad(): ?Especialidad
{
return $this->origen_especialidad;
}
public function setOrigenEspecialidad(?Especialidad $origen_especialidad): self
{
$this->origen_especialidad = $origen_especialidad;
return $this;
}
public function getValidacion(): ?string
{
return $this->validacion;
}
public function setValidacion(?string $validacion): self
{
$this->validacion = $validacion;
return $this;
}
public function getCobrado(): ?int
{
return $this->cobrado;
}
public function setCobrado(int $cobrado): self
{
$this->cobrado = $cobrado;
return $this;
}
public function getFactura(): ?string
{
return $this->factura;
}
public function setFactura(?string $factura): self
{
$this->factura = $factura;
return $this;
}
public function getFechaFactura(): ?string
{
return $this->fecha_factura;
}
public function setFechaFactura(?string $fecha_factura): self
{
$this->fecha_factura = $fecha_factura;
return $this;
}
public function getFechaPago(): ?string
{
return $this->fecha_pago;
}
public function setFechaPago(?string $fecha_pago): self
{
$this->fecha_pago = $fecha_pago;
return $this;
}
public function getVerificado(): ?string
{
return $this->verificado;
}
public function setVerificado(?string $verificado): self
{
$this->verificado = $verificado;
return $this;
}
public function getConfirma(): ?bool
{
return $this->confirma;
}
public function setConfirma(bool $confirma): self
{
$this->confirma = $confirma;
return $this;
}
/**
* @return Collection|AgendaProcedimiento[]
*/
public function getAgendaProcedimientos(): Collection
{
return $this->agenda_procedimientos;
}
public function getAnestesiologo(): ?User
{
return $this->anestesiologo;
}
public function setAnestesiologo(?User $anestesiologo): self
{
$this->anestesiologo = $anestesiologo;
return $this;
}
public function getCorteSeguro(): ?string
{
return $this->corte_seguro;
}
public function setCorteSeguro(?string $corte_seguro): self
{
$this->corte_seguro = $corte_seguro;
return $this;
}
/**
* @return Collection|OrdeProcedimiento[]
*/
public function getOrdenProcedimientos(): Collection
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('estado', '1'))
//->orderBy(['createdAt' => 'DESC'])
;
return $this->ordenProcedimientos->matching($criteria);
}
public function getRecomendado(): ?User
{
return $this->recomendado;
}
public function setRecomendado(?User $recomendado): self
{
$this->recomendado = $recomendado;
return $this;
}
public function getRedsocial(): ?RedSocial
{
return $this->redsocial;
}
public function setRedsocial(?RedSocial $redsocial): self
{
$this->redsocial = $redsocial;
return $this;
}
public function getSaludProducto(): ?string
{
return $this->salud_producto;
}
public function setSaludProducto(?string $salud_producto): self
{
$this->salud_producto = $salud_producto;
return $this;
}
public function getSaludNropersona(): ?string
{
return $this->salud_nropersona;
}
public function setSaludNropersona(?string $salud_nropersona): self
{
$this->salud_nropersona = $salud_nropersona;
return $this;
}
public function getSaludNivel(): ?string
{
return $this->salud_nivel;
}
public function setSaludNivel(?string $salud_nivel): self
{
$this->salud_nivel = $salud_nivel;
return $this;
}
public function getDocumentos(): ?bool
{
return $this->documentos;
}
public function setDocumentos(bool $documentos): self
{
$this->documentos = $documentos;
return $this;
}
public function getWid(): ?string
{
return $this->wid;
}
public function setWid(?string $wid): self
{
$this->wid = $wid;
return $this;
}
public function getReferencia(): ?self
{
return $this->referencia;
}
public function setReferencia(?self $referencia): self
{
$this->referencia = $referencia;
return $this;
}
/**
* @return Collection|Agenda[]
*/
public function getAgendasReferenciadas(): Collection
{
return $this->agendasReferenciadas;
}
}