src/Entity/HdSolicitud.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\HdSolicitudRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\Criteria;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**** TALIS AGREGAR ESTO EN TODAS LAS ENTIDADES QUE CREAMOS ****/
  9. use DateTime;
  10. /**
  11.  * @ORM\Entity(repositoryClass=HdSolicitudRepository::class)
  12.  * @ORM\HasLifecycleCallbacks                  //<======ESTO TAMBIEN TALIS
  13.  */
  14. class HdSolicitud
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Paciente::class, inversedBy="hdSolicituds")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $paciente;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=HdMaestroPasos::class, inversedBy="hdSolicituds")
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $hd_maestro_pasos;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity=Agenda::class, inversedBy="hdSolicituds")
  34.      * @ORM\JoinColumn(nullable=true)
  35.      */
  36.     private $agenda;
  37.     /**
  38.      * @ORM\Column(type="string", length=50)
  39.      */
  40.     private $ip_crea;
  41.     /**
  42.      * @ORM\Column(type="string", length=50)
  43.      */
  44.     private $ip_modifica;
  45.     /**
  46.      * @ORM\Column(type="integer")
  47.      */
  48.     private $user_crea;
  49.     /**
  50.      * @ORM\Column(type="integer")
  51.      */
  52.     private $user_modifica;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=HdArchivos::class, mappedBy="hd_solicitud")
  55.      */
  56.     private $hdArchivos;
  57.     /**
  58.      * @ORM\Column(type="datetime")
  59.      */
  60.     private $fecha_ingreso;
  61.     /**
  62.      * @ORM\Column(type="boolean")
  63.      */
  64.     private $estado;
  65.     /**
  66.      * @ORM\Column(type="boolean")
  67.      */
  68.     private $en_proceso;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=HdPaso::class, mappedBy="hd_solicitud")
  71.      */
  72.     private $hdPasos;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=HdOrdenes::class, mappedBy="hd_solicitud")
  75.      */
  76.     private $hdOrdenes;
  77.     /**
  78.      * @ORM\ManyToOne(targetEntity=SeguroPrivado::class, inversedBy="hdSolicituds")
  79.      * @ORM\JoinColumn(nullable=false)
  80.      */
  81.     private $seguro;
  82.     /**
  83.      * @ORM\Column(type="string", length=100, nullable=true)
  84.      */
  85.     private $referido;
  86.     /**
  87.      * @ORM\Column(type="string", length=100, nullable=true)
  88.      */
  89.     private $avisar;
  90.     /**
  91.      * @ORM\Column(type="string", length=100, nullable=true)
  92.      */
  93.     private $parentesco;
  94.     /**
  95.      * @ORM\Column(type="string", length=100, nullable=true)
  96.      */
  97.     private $llegada;
  98.     /**
  99.      * @ORM\Column(type="string", length=100, nullable=true)
  100.      */
  101.     private $fuente_info;
  102.     /**
  103.      * @ORM\Column(type="string", length=100, nullable=true)
  104.      */
  105.     private $institucion_entrega;
  106.     /**
  107.      * @ORM\OneToMany(targetEntity=HdEmergencia::class, mappedBy="hd_solicitud")
  108.      */
  109.     private $hdEmergencias;
  110.     /**
  111.      * @ORM\Column(type="datetime")
  112.      */
  113.     private $created_at;
  114.     /**
  115.      * @ORM\Column(type="datetime")
  116.      */
  117.     private $updated_at;
  118.     /**
  119.      * @ORM\Column(type="string", length=25, nullable=true)
  120.      */
  121.     private $edad;
  122.     /**
  123.      * @ORM\Column(type="string", length=100, nullable=true)
  124.      */
  125.     private $telefono_institucion;
  126.     /**
  127.      * @ORM\OneToMany(targetEntity=HdSolicitudDiagnosticos::class, mappedBy="HdSolicitud")
  128.      */
  129.     private $hdSolicitudDiagnosticos;
  130.     public function __construct()
  131.     {
  132.         $this->hdArchivos = new ArrayCollection();
  133.         $this->hdPasos = new ArrayCollection();
  134.         $this->hdOrdenes = new ArrayCollection();
  135.         $this->hdEmergencias = new ArrayCollection();
  136.         $this->hdSolicitudDiagnosticos = new ArrayCollection();
  137.     }
  138.     public function getId(): ?int
  139.     {
  140.         return $this->id;
  141.     }
  142.     public function getIdPaciente(): ?string
  143.     {
  144.         return $this->id_paciente;
  145.     }
  146.     public function getPaciente(): ?Paciente
  147.     {
  148.         return $this->paciente;
  149.     }
  150.     public function setPaciente(?Paciente $paciente): self
  151.     {
  152.         $this->paciente $paciente;
  153.         return $this;
  154.     }
  155.     public function getHdMaestroPasos(): ?HdMaestroPasos
  156.     {
  157.         return $this->hd_maestro_pasos;
  158.     }
  159.     public function setHdMaestroPasos(?HdMaestroPasos $hd_maestro_pasos): self
  160.     {
  161.         $this->hd_maestro_pasos $hd_maestro_pasos;
  162.         return $this;
  163.     }
  164.     public function getAgenda(): ?Agenda
  165.     {
  166.         return $this->agenda;
  167.     }
  168.     public function setAgenda(?Agenda $agenda): self
  169.     {
  170.         $this->agenda $agenda;
  171.         return $this;
  172.     }
  173.     public function getIpCrea(): ?string
  174.     {
  175.         return $this->ip_crea;
  176.     }
  177.     public function setIpCrea(string $ip_crea): self
  178.     {
  179.         $this->ip_crea $ip_crea;
  180.         return $this;
  181.     }
  182.     public function getIpModifica(): ?string
  183.     {
  184.         return $this->ip_modifica;
  185.     }
  186.     public function setIpModifica(string $ip_modifica): self
  187.     {
  188.         $this->ip_modifica $ip_modifica;
  189.         return $this;
  190.     }
  191.     public function getUserCrea(): ?int
  192.     {
  193.         return $this->user_crea;
  194.     }
  195.     public function setUserCrea(int $user_crea): self
  196.     {
  197.         $this->user_crea $user_crea;
  198.         return $this;
  199.     }
  200.     public function getUserModifica(): ?int
  201.     {
  202.         return $this->user_modifica;
  203.     }
  204.     public function setUserModifica(int $user_modifica): self
  205.     {
  206.         $this->user_modifica $user_modifica;
  207.         return $this;
  208.     }
  209.     
  210.     /**
  211.      * @return Collection|HdArchivos[]
  212.      */
  213.     public function getHdArchivos(): Collection
  214.     {
  215.         return $this->hdArchivos;
  216.     }
  217.     public function addHdArchivo(HdArchivos $hdArchivo): self
  218.     {
  219.         if (!$this->hdArchivos->contains($hdArchivo)) {
  220.             $this->hdArchivos[] = $hdArchivo;
  221.             $hdArchivo->setHdSolicitud($this);
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeHdArchivo(HdArchivos $hdArchivo): self
  226.     {
  227.         if ($this->hdArchivos->removeElement($hdArchivo)) {
  228.             // set the owning side to null (unless already changed)
  229.             if ($hdArchivo->getHdSolicitud() === $this) {
  230.                 $hdArchivo->setHdSolicitud(null);
  231.             }
  232.         }
  233.         return $this;
  234.     }
  235.     public function getFechaIngreso(): ?\DateTimeInterface
  236.     {
  237.         return $this->fecha_ingreso;
  238.     }
  239.     public function setFechaIngreso(\DateTimeInterface $fecha_ingreso): self
  240.     {
  241.         $this->fecha_ingreso $fecha_ingreso;
  242.         return $this;
  243.     }
  244.     public function getEstado(): ?bool
  245.     {
  246.         return $this->estado;
  247.     }
  248.     public function setEstado(bool $estado): self
  249.     {
  250.         $this->estado $estado;
  251.         return $this;
  252.     }
  253.     public function getEnProceso(): ?bool
  254.     {
  255.         return $this->en_proceso;
  256.     }
  257.     public function setEnProceso(bool $en_proceso): self
  258.     {
  259.         $this->en_proceso $en_proceso;
  260.         return $this;
  261.     }
  262.     /**
  263.      * @return Collection|HdPaso[]
  264.      */
  265.     public function getHdPasos(): Collection
  266.     {
  267.         return $this->hdPasos;
  268.     }
  269.     public function addHdPaso(HdPaso $hdPaso): self
  270.     {
  271.         if (!$this->hdPasos->contains($hdPaso)) {
  272.             $this->hdPasos[] = $hdPaso;
  273.             $hdPaso->setHdSolicitud($this);
  274.         }
  275.         return $this;
  276.     }
  277.     public function removeHdPaso(HdPaso $hdPaso): self
  278.     {
  279.         if ($this->hdPasos->removeElement($hdPaso)) {
  280.             // set the owning side to null (unless already changed)
  281.             if ($hdPaso->getHdSolicitud() === $this) {
  282.                 $hdPaso->setHdSolicitud(null);
  283.             }
  284.         }
  285.         return $this;
  286.     }
  287.     /**
  288.      * @return Collection|HdOrdenes[]
  289.      */
  290.     public function getHdOrdenes(): Collection
  291.     {
  292.         return $this->hdOrdenes;
  293.     }
  294.     public function addHdOrdene(HdOrdenes $hdOrdene): self
  295.     {
  296.         if (!$this->hdOrdenes->contains($hdOrdene)) {
  297.             $this->hdOrdenes[] = $hdOrdene;
  298.             $hdOrdene->setHdSolicitud($this);
  299.         }
  300.         return $this;
  301.     }
  302.     public function removeHdOrdene(HdOrdenes $hdOrdene): self
  303.     {
  304.         if ($this->hdOrdenes->removeElement($hdOrdene)) {
  305.             // set the owning side to null (unless already changed)
  306.             if ($hdOrdene->getHdSolicitud() === $this) {
  307.                 $hdOrdene->setHdSolicitud(null);
  308.             }
  309.         }
  310.         return $this;
  311.     }
  312.     public function getSeguro(): ?SeguroPrivado
  313.     {
  314.         return $this->seguro;
  315.     }
  316.     public function setSeguro(?SeguroPrivado $seguro): self
  317.     {
  318.         $this->seguro $seguro;
  319.         return $this;
  320.     }
  321.     public function getReferido(): ?string
  322.     {
  323.         return $this->referido;
  324.     }
  325.     public function setReferido(?string $referido): self
  326.     {
  327.         $this->referido $referido;
  328.         return $this;
  329.     }
  330.     public function getAvisar(): ?string
  331.     {
  332.         return $this->avisar;
  333.     }
  334.     public function setAvisar(?string $avisar): self
  335.     {
  336.         $this->avisar $avisar;
  337.         return $this;
  338.     }
  339.     public function getParentesco(): ?string
  340.     {
  341.         return $this->parentesco;
  342.     }
  343.     public function setParentesco(?string $parentesco): self
  344.     {
  345.         $this->parentesco $parentesco;
  346.         return $this;
  347.     }
  348.     public function getLlegada(): ?string
  349.     {
  350.         return $this->llegada;
  351.     }
  352.     public function setLlegada(?string $llegada): self
  353.     {
  354.         $this->llegada $llegada;
  355.         return $this;
  356.     }
  357.     public function getFuenteInfo(): ?string
  358.     {
  359.         return $this->fuente_info;
  360.     }
  361.     public function setFuenteInfo(?string $fuente_info): self
  362.     {
  363.         $this->fuente_info $fuente_info;
  364.         return $this;
  365.     }
  366.     public function getInstitucionEntrega(): ?string
  367.     {
  368.         return $this->institucion_entrega;
  369.     }
  370.     public function setInstitucionEntrega(?string $institucion_entrega): self
  371.     {
  372.         $this->institucion_entrega $institucion_entrega;
  373.         return $this;
  374.     }
  375.     /**
  376.      * @return Collection|HdEmergencia[]
  377.      */
  378.     public function getHdEmergencias(): Collection
  379.     {
  380.         return $this->hdEmergencias;
  381.     }
  382.     public function addHdEmergencia(HdEmergencia $hdEmergencia): self
  383.     {
  384.         if (!$this->hdEmergencias->contains($hdEmergencia)) {
  385.             $this->hdEmergencias[] = $hdEmergencia;
  386.             $hdEmergencia->setHdSolicitud($this);
  387.         }
  388.         return $this;
  389.     }
  390.     public function removeHdEmergencia(HdEmergencia $hdEmergencia): self
  391.     {
  392.         if ($this->hdEmergencias->removeElement($hdEmergencia)) {
  393.             // set the owning side to null (unless already changed)
  394.             if ($hdEmergencia->getHdSolicitud() === $this) {
  395.                 $hdEmergencia->setHdSolicitud(null);
  396.             }
  397.         }
  398.         return $this;
  399.     }
  400.     public function getCreatedAt(): ?\DateTimeInterface
  401.     {
  402.         return $this->created_at;
  403.     }
  404.     public function setCreatedAt(\DateTimeInterface $created_at): self
  405.     {
  406.         $this->created_at $created_at;
  407.         return $this;
  408.     }
  409.     public function getUpdatedAt(): ?\DateTimeInterface
  410.     {
  411.         return $this->updated_at;
  412.     }
  413.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  414.     {
  415.         $this->updated_at $updated_at;
  416.         return $this;
  417.     }
  418.     /**** TALIS AGREGAR ESTO EN TODAS LAS ENTIDADES QUE CREAMOS ****/
  419.      /**
  420.      * @ORM\PrePersist
  421.      * @ORM\PreUpdate
  422.      */
  423.     public function updatedTimestamps(): void
  424.     {
  425.         $dateTimeNow = new DateTime('now');
  426.         $this->setUpdatedAt($dateTimeNow);
  427.         if ($this->getCreatedAt() === null) {
  428.             $this->setCreatedAt($dateTimeNow);
  429.         }
  430.     }
  431.     public function getEdad(): ?string
  432.     {
  433.         return $this->edad;
  434.     }
  435.     public function setEdad(string $edad): self
  436.     {
  437.         $this->edad $edad;
  438.         return $this;
  439.     }
  440.     public function getTelefonoInstitucion(): ?string
  441.     {
  442.         return $this->telefono_institucion;
  443.     }
  444.     public function setTelefonoInstitucion(?string $telefono_institucion): self
  445.     {
  446.         $this->telefono_institucion $telefono_institucion;
  447.         return $this;
  448.     }
  449.     /**
  450.      * @return Collection|HdSolicitudDiagnosticos[]
  451.      */
  452.     public function getHdSolicitudDiagnosticos(): Collection
  453.     {
  454.         return $this->hdSolicitudDiagnosticos;
  455.     }
  456.     public function addHdSolicitudDiagnostico(HdSolicitudDiagnosticos $hdSolicitudDiagnostico): self
  457.     {
  458.         if (!$this->hdSolicitudDiagnosticos->contains($hdSolicitudDiagnostico)) {
  459.             $this->hdSolicitudDiagnosticos[] = $hdSolicitudDiagnostico;
  460.             $hdSolicitudDiagnostico->setHdSolicitud($this);
  461.         }
  462.         return $this;
  463.     }
  464.     public function removeHdSolicitudDiagnostico(HdSolicitudDiagnosticos $hdSolicitudDiagnostico): self
  465.     {
  466.         if ($this->hdSolicitudDiagnosticos->removeElement($hdSolicitudDiagnostico)) {
  467.             // set the owning side to null (unless already changed)
  468.             if ($hdSolicitudDiagnostico->getHdSolicitud() === $this) {
  469.                 $hdSolicitudDiagnostico->setHdSolicitud(null);
  470.             }
  471.         }
  472.         return $this;
  473.     }
  474.     public function getPaso($codigo): Collection
  475.     {
  476.         $criteria Criteria::create()
  477.             ->andWhere(Criteria::expr()->eq('hd_maestro_pasos'$codigo));
  478.             
  479.         return $this->hdPasos->matching($criteria);
  480.     }
  481.     
  482. }