src/Entity/OrdenProcedimiento.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrdenProcedimientoRepository;
  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. use DateTime;
  9. /**
  10.  * @ORM\Entity(repositoryClass=OrdenProcedimientoRepository::class)
  11.  * @ORM\HasLifecycleCallbacks
  12.  */
  13. class OrdenProcedimiento
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=Agenda::class, inversedBy="ordenProcedimientos")
  23.      * @ORM\JoinColumn(nullable=false)
  24.      */
  25.     private $agenda;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Procedimientos::class, inversedBy="ordenProcedimientos")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $procedimiento;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private $observacion;
  35.     /**
  36.      * @ORM\Column(type="string", length=50)
  37.      */
  38.     private $ip_crea;
  39.     /**
  40.      * @ORM\Column(type="string", length=50)
  41.      */
  42.     private $ip_modifica;
  43.     /**
  44.      * @ORM\Column(type="integer")
  45.      */
  46.     private $user_crea;
  47.     /**
  48.      * @ORM\Column(type="integer")
  49.      */
  50.     private $user_modifica;
  51.     /**
  52.      * @ORM\Column(type="datetime")
  53.      */
  54.     private $created_at;
  55.     /**
  56.      * @ORM\Column(type="datetime")
  57.      */
  58.     private $updated_at;
  59.     
  60.     /**
  61.      * @ORM\Column(type="smallint")
  62.      */
  63.     private $estado;
  64.     
  65.     /**
  66.      * @ORM\ManyToOne(targetEntity=Paciente::class, inversedBy="ordenProcedimientos")
  67.      */
  68.     private $paciente;
  69.     /**
  70.      * @ORM\ManyToOne(targetEntity=Agenda::class, inversedBy="ordenProcedimientos")
  71.      * @ORM\JoinColumn(nullable=true)
  72.      */
  73.     private $agendado;
  74.      /**
  75.      * @ORM\ManyToOne(targetEntity=OrdenProcedimiento::class, inversedBy="ordenProcedimientos")
  76.      * @ORM\JoinColumn(nullable=true)
  77.      */
  78.     private $orden_procedimiento;
  79.       /**
  80.      * @ORM\Column(type="string", length=100, nullable=true)
  81.      */
  82.     private $tipo;
  83.     /**
  84.      * @ORM\OneToMany(targetEntity=OrdenProcedimiento::class, mappedBy="orden_procedimiento")
  85.      */
  86.     private $ordenProcedimientos;
  87.     /**
  88.      * @ORM\Column(type="smallint", options={"default": 1})
  89.      */
  90.     private $dia_receta;
  91.     public function getId(): ?int
  92.     {
  93.         return $this->id;
  94.     }
  95.     public function getAgenda(): ?Agenda
  96.     {
  97.         return $this->agenda;
  98.     }
  99.     public function setAgenda(?Agenda $agenda): self
  100.     {
  101.         $this->agenda $agenda;
  102.         return $this;
  103.     }
  104.     public function getProcedimiento(): ?Procedimientos
  105.     {
  106.         return $this->procedimiento;
  107.     }
  108.     public function setProcedimiento(?Procedimientos $procedimiento): self
  109.     {
  110.         $this->procedimiento $procedimiento;
  111.         return $this;
  112.     }
  113.     public function getObservacion(): ?string
  114.     {
  115.         return $this->observacion;
  116.     }
  117.     public function setObservacion(?string $observacion): self
  118.     {
  119.         $this->observacion $observacion;
  120.         return $this;
  121.     }
  122.     public function getIpCrea(): ?string
  123.     {
  124.         return $this->ip_crea;
  125.     }
  126.     public function setIpCrea(string $ip_crea): self
  127.     {
  128.         $this->ip_crea $ip_crea;
  129.         return $this;
  130.     }
  131.     public function getIpModifica(): ?string
  132.     {
  133.         return $this->ip_modifica;
  134.     }
  135.     public function setIpModifica(string $ip_modifica): self
  136.     {
  137.         $this->ip_modifica $ip_modifica;
  138.         return $this;
  139.     }
  140.     public function getUserCrea(): ?int
  141.     {
  142.         return $this->user_crea;
  143.     }
  144.     public function setUserCrea(int $user_crea): self
  145.     {
  146.         $this->user_crea $user_crea;
  147.         return $this;
  148.     }
  149.     public function getUserModifica(): ?int
  150.     {
  151.         return $this->user_modifica;
  152.     }
  153.     public function setUserModifica(int $user_modifica): self
  154.     {
  155.         $this->user_modifica $user_modifica;
  156.         return $this;
  157.     }
  158.     public function getCreatedAt(): ?\DateTimeInterface
  159.     {
  160.         return $this->created_at;
  161.     }
  162.     public function setCreatedAt(\DateTimeInterface $created_at): self
  163.     {
  164.         $this->created_at $created_at;
  165.         return $this;
  166.     }
  167.     public function getUpdatedAt(): ?\DateTimeInterface
  168.     {
  169.         return $this->updated_at;
  170.     }
  171.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  172.     {
  173.         $this->updated_at $updated_at;
  174.         return $this;
  175.     }
  176.     
  177.     /**
  178.      * @ORM\PrePersist
  179.      * @ORM\PreUpdate
  180.      */
  181.     public function updatedTimestamps(): void
  182.     {
  183.         $dateTimeNow = new DateTime('now');
  184.         $this->setUpdatedAt($dateTimeNow);
  185.         if ($this->getCreatedAt() === null) {
  186.             $this->setCreatedAt($dateTimeNow);
  187.         }
  188.     }
  189.     
  190.     public function getEstado(): ?int
  191.     {
  192.         return $this->estado;
  193.     }
  194.     public function setEstado(int $estado): self
  195.     {
  196.         $this->estado $estado;
  197.         return $this;
  198.     }
  199.     
  200.     public function getPaciente(): ?Paciente
  201.     {
  202.         return $this->paciente;
  203.     }
  204.     public function setPaciente(?Paciente $paciente): self
  205.     {
  206.         $this->paciente $paciente;
  207.         return $this;
  208.     }
  209.     public function getAgendado(): ?Agenda
  210.     {
  211.         return $this->agendado;
  212.     }
  213.     public function setAgendado(?Agenda $agendado): self
  214.     {
  215.         $this->agendado $agendado;
  216.         return $this;
  217.     }
  218.     public function getOrdenProcedimiento(): ?OrdenProcedimiento
  219.     {
  220.         return $this->orden_procedimiento;
  221.     }
  222.     public function setOrdenProcedimiento(?OrdenProcedimiento $orden_procedimiento): self
  223.     {
  224.         $this->orden_procedimiento $orden_procedimiento;
  225.         return $this;
  226.     }
  227.     public function getTipo(): ?string
  228.     {
  229.         return $this->tipo;
  230.     }
  231.     public function setTipo(?string $tipo): self
  232.     {
  233.         $this->tipo $tipo;
  234.         return $this;
  235.     }
  236.     /**
  237.      * @return Collection|OrdenProcedimiento[]
  238.      */
  239.     public function getOrdenProcedimientosPend(): Collection
  240.     {
  241.         $criteria Criteria::create()
  242.             ->andWhere(Criteria::expr()->eq('estado''1'))
  243.             //->orderBy(['createdAt' => 'DESC'])
  244.         ;
  245.         //dd($this);
  246.         
  247.         return $this->ordenProcedimientos->matching($criteria);
  248.     }
  249.     public function getDiaReceta(): ?int
  250.     {
  251.         return $this->dia_receta;
  252.     }
  253.     public function setDiaReceta(int $dia_receta): self
  254.     {
  255.         $this->dia_receta $dia_receta;
  256.         return $this;
  257.     }
  258.     
  259. }