src/Entity/ExamenOrden.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ExamenOrdenRepository;
  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=ExamenOrdenRepository::class)
  11.  * @ORM\HasLifecycleCallbacks
  12.  */
  13. class ExamenOrden
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="boolean")
  23.      */
  24.     private $estado;
  25.     /**
  26.      * @ORM\Column(type="integer")
  27.      */
  28.     private $cantidad;
  29.     /**
  30.      * @ORM\Column(type="decimal", precision=10, scale=4)
  31.      */
  32.     private $valor;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $observaciom;
  37.     /**
  38.      * @ORM\Column(type="float")
  39.      */
  40.     private $descuento;
  41.     /**
  42.      * @ORM\Column(type="float")
  43.      */
  44.     private $descuento_valor;
  45.     /**
  46.      * @ORM\Column(type="float")
  47.      */
  48.     private $recargo;
  49.     /**
  50.      * @ORM\Column(type="float")
  51.      */
  52.     private $recargo_valor;
  53.     /**
  54.      * @ORM\Column(type="float")
  55.      */
  56.     private $total_valor;
  57.     /**
  58.      * @ORM\Column(type="datetime")
  59.      */
  60.     private $fecha_orden;
  61.     /**
  62.      * @ORM\Column(type="string", length=50)
  63.      */
  64.     private $ip_crea;
  65.     /**
  66.      * @ORM\Column(type="string", length=50)
  67.      */
  68.     private $ip_modifica;
  69.     /**
  70.      * @ORM\Column(type="integer")
  71.      */
  72.     private $user_crea;
  73.     /**
  74.      * @ORM\Column(type="integer")
  75.      */
  76.     private $user_modifica;
  77.     /**
  78.      * @ORM\Column(type="datetime")
  79.      */
  80.     private $created_at;
  81.     /**
  82.      * @ORM\Column(type="datetime")
  83.      */
  84.     private $updated_at;
  85.     /**
  86.      * @ORM\OneToMany(targetEntity=ExamenDetalle::class, mappedBy="examen_orden")
  87.      */
  88.     private $examenDetalles;
  89.     /**
  90.      * @ORM\ManyToOne(targetEntity=SeguroPrivado::class, inversedBy="examenOrdens")
  91.      * @ORM\JoinColumn(nullable=false)
  92.      */
  93.     private $seguro;
  94.     /**
  95.      * @ORM\ManyToOne(targetEntity=Paciente::class, inversedBy="examenOrdens")
  96.      * @ORM\JoinColumn(nullable=false)
  97.      */
  98.     private $paciente;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity=HistoriaClinica::class, inversedBy="examenOrdens")
  101.      * @ORM\JoinColumn(nullable=false)
  102.      */
  103.     private $historia;
  104.     /**
  105.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="examenOrdens")
  106.      * @ORM\JoinColumn(nullable=false)
  107.      */
  108.     private $doctor;
  109.     /**
  110.      * @ORM\Column(type="boolean", options={"default":0})
  111.      */
  112.     private $agendado;
  113.     /**
  114.      * @ORM\Column(type="datetime", nullable=true)
  115.      */
  116.     private $fecha_agenda;
  117.     /**
  118.      * @ORM\OneToMany(targetEntity=ExamenOrdenResultado::class, mappedBy="orden")
  119.      */
  120.     private $examenOrdenResultados;
  121.     public function __construct()
  122.     {
  123.         $this->examenDetalles = new ArrayCollection();
  124.         $this->examenOrdenResultados = new ArrayCollection();
  125.     }
  126.     public function getId(): ?int
  127.     {
  128.         return $this->id;
  129.     }
  130.     public function getEstado(): ?bool
  131.     {
  132.         return $this->estado;
  133.     }
  134.     public function setEstado(bool $estado): self
  135.     {
  136.         $this->estado $estado;
  137.         return $this;
  138.     }
  139.     public function getCantidad(): ?int
  140.     {
  141.         return $this->cantidad;
  142.     }
  143.     public function setCantidad(int $cantidad): self
  144.     {
  145.         $this->cantidad $cantidad;
  146.         return $this;
  147.     }
  148.     public function getValor(): ?float
  149.     {
  150.         return $this->valor;
  151.     }
  152.     public function setValor(float $valor): self
  153.     {
  154.         $this->valor $valor;
  155.         return $this;
  156.     }
  157.     public function getObservaciom(): ?string
  158.     {
  159.         return $this->observaciom;
  160.     }
  161.     public function setObservaciom(?string $observaciom): self
  162.     {
  163.         $this->observaciom $observaciom;
  164.         return $this;
  165.     }
  166.     public function getDescuento(): ?float
  167.     {
  168.         return $this->descuento;
  169.     }
  170.     public function setDescuento(float $descuento): self
  171.     {
  172.         $this->descuento $descuento;
  173.         return $this;
  174.     }
  175.     public function getDescuentoValor(): ?float
  176.     {
  177.         return $this->descuento_valor;
  178.     }
  179.     public function setDescuentoValor(float $descuento_valor): self
  180.     {
  181.         $this->descuento_valor $descuento_valor;
  182.         return $this;
  183.     }
  184.     public function getRecargo(): ?float
  185.     {
  186.         return $this->recargo;
  187.     }
  188.     public function setRecargo(float $recargo): self
  189.     {
  190.         $this->recargo $recargo;
  191.         return $this;
  192.     }
  193.     public function getRecargoValor(): ?float
  194.     {
  195.         return $this->recargo_valor;
  196.     }
  197.     public function setRecargoValor(float $recargo_valor): self
  198.     {
  199.         $this->recargo_valor $recargo_valor;
  200.         return $this;
  201.     }
  202.     public function getTotalValor(): ?float
  203.     {
  204.         return $this->total_valor;
  205.     }
  206.     public function setTotalValor(float $total_valor): self
  207.     {
  208.         $this->total_valor $total_valor;
  209.         return $this;
  210.     }
  211.     public function getFechaOrden(): ?\DateTimeInterface
  212.     {
  213.         return $this->fecha_orden;
  214.     }
  215.     public function setFechaOrden(?\DateTimeInterface $fecha_orden): self
  216.     {
  217.         $this->fecha_orden $fecha_orden;
  218.         return $this;
  219.     }
  220.     public function getIpCrea(): ?string
  221.     {
  222.         return $this->ip_crea;
  223.     }
  224.     public function setIpCrea(string $ip_crea): self
  225.     {
  226.         $this->ip_crea $ip_crea;
  227.         return $this;
  228.     }
  229.     public function getIpModifica(): ?string
  230.     {
  231.         return $this->ip_modifica;
  232.     }
  233.     public function setIpModifica(string $ip_modifica): self
  234.     {
  235.         $this->ip_modifica $ip_modifica;
  236.         return $this;
  237.     }
  238.     public function getUserCrea(): ?int
  239.     {
  240.         return $this->user_crea;
  241.     }
  242.     public function setUserCrea(int $user_crea): self
  243.     {
  244.         $this->user_crea $user_crea;
  245.         return $this;
  246.     }
  247.     public function getUserModifica(): ?int
  248.     {
  249.         return $this->user_modifica;
  250.     }
  251.     public function setUserModifica(int $user_modifica): self
  252.     {
  253.         $this->user_modifica $user_modifica;
  254.         return $this;
  255.     }
  256.     public function getCreatedAt(): ?\DateTimeInterface
  257.     {
  258.         return $this->created_at;
  259.     }
  260.     public function setCreatedAt(\DateTimeInterface $created_at): self
  261.     {
  262.         $this->created_at $created_at;
  263.         return $this;
  264.     }
  265.     public function getUpdatedAt(): ?\DateTimeInterface
  266.     {
  267.         return $this->updated_at;
  268.     }
  269.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  270.     {
  271.         $this->updated_at $updated_at;
  272.         return $this;
  273.     }
  274.     /**
  275.      * @return Collection|ExamenDetalle[]
  276.      */
  277.     public function getExamenDetalles(): Collection
  278.     {
  279.         return $this->examenDetalles;
  280.     }
  281.     
  282.     public function getExamenDetalles_By($examen)
  283.     {
  284.         $criteria Criteria::create()
  285.             ->andWhere(Criteria::expr()->eq('examen'$examen))
  286.             //->orderBy(['createdAt' => 'DESC'])
  287.         ;
  288.         return $this->examenDetalles->matching($criteria);
  289.         /*foreach ($this->getExamenDetalles() as $detalle) {
  290.             //dd($detalle,$examen);
  291.             if($detalle->getExamen()==$examen){
  292.                 return $examen; 
  293.             }
  294.         }
  295.         
  296.         return null;*/
  297.         //return $this->examenDetalles;
  298.     }
  299.     public function addExamenDetalle(ExamenDetalle $examenDetalle): self
  300.     {
  301.         if (!$this->examenDetalles->contains($examenDetalle)) {
  302.             $this->examenDetalles[] = $examenDetalle;
  303.             $examenDetalle->setExamenOrden($this);
  304.         }
  305.         return $this;
  306.     }
  307.     public function removeExamenDetalle(ExamenDetalle $examenDetalle): self
  308.     {
  309.         if ($this->examenDetalles->removeElement($examenDetalle)) {
  310.             // set the owning side to null (unless already changed)
  311.             if ($examenDetalle->getExamenOrden() === $this) {
  312.                 $examenDetalle->setExamenOrden(null);
  313.             }
  314.         }
  315.         return $this;
  316.     }
  317.     public function getSeguro(): ?SeguroPrivado
  318.     {
  319.         return $this->seguro;
  320.     }
  321.     public function setSeguro(?SeguroPrivado $seguro): self
  322.     {
  323.         $this->seguro $seguro;
  324.         return $this;
  325.     }
  326.     public function getPaciente(): ?Paciente
  327.     {
  328.         return $this->paciente;
  329.     }
  330.     public function setPaciente(?Paciente $paciente): self
  331.     {
  332.         $this->paciente $paciente;
  333.         return $this;
  334.     }
  335.     public function getHistoria(): ?HistoriaClinica
  336.     {
  337.         return $this->historia;
  338.     }
  339.     public function setHistoria(?HistoriaClinica $historia): self
  340.     {
  341.         $this->historia $historia;
  342.         return $this;
  343.     }
  344.     public function getDoctor(): ?User
  345.     {
  346.         return $this->doctor;
  347.     }
  348.     public function setDoctor(?User $doctor): self
  349.     {
  350.         $this->doctor $doctor;
  351.         return $this;
  352.     }
  353.     /**
  354.      * @ORM\PrePersist
  355.      * @ORM\PreUpdate
  356.      */
  357.     public function updatedTimestamps(): void
  358.     {
  359.         $dateTimeNow = new DateTime('now');
  360.         $this->setUpdatedAt($dateTimeNow);
  361.         if ($this->getCreatedAt() === null) {
  362.             $this->setCreatedAt($dateTimeNow);
  363.         }
  364.     }
  365.     public function getAgendado()
  366.     {
  367.         return $this->agendado;
  368.     }
  369.     public function setAgendado($agendado): self
  370.     {
  371.         $this->agendado $agendado;
  372.         return $this;
  373.     }
  374.     public function getFechaAgenda(): ?\DateTimeInterface
  375.     {
  376.         return $this->fecha_agenda;
  377.     }
  378.     public function setFechaAgenda(?\DateTimeInterface $fecha_agenda): self
  379.     {
  380.         $this->fecha_agenda $fecha_agenda;
  381.         return $this;
  382.     }
  383.     /**
  384.      * @return Collection|ExamenOrdenResultado[]
  385.      */
  386.     public function getExamenOrdenResultados(): Collection
  387.     {
  388.         $criteria Criteria::create()
  389.             ->andWhere(Criteria::expr()->eq('estado'1))
  390.             ->orderBy(['examen' => 'ASC''id' => 'ASC'])
  391.         ;
  392.         return $this->examenOrdenResultados->matching($criteria);
  393.     }
  394.     public function getExamenOrdenResultadosOK(): Collection
  395.     {
  396.         
  397.         $criteria Criteria::create()
  398.             ->andWhere(Criteria::expr()->neq('resultado'null))
  399.             ->andWhere(Criteria::expr()->eq('estado'1))
  400.             //->orderBy(['createdAt' => 'DESC'])
  401.         ;
  402.         return $this->examenOrdenResultados->matching($criteria);
  403.     }
  404.     
  405.     /**
  406.      * @return Collection|ExamenOrdenResultado[]
  407.      */
  408.     public function getExamenOrdenResultadosTodos(): Collection
  409.     {
  410.         $criteria Criteria::create()
  411.             //->andWhere(Criteria::expr()->eq('estado', 1))
  412.             ->orderBy(['examen' => 'ASC''id' => 'ASC'])
  413.         ;
  414.         return $this->examenOrdenResultados->matching($criteria);
  415.     }
  416.     
  417.      /**
  418.      * @return Collection|ExamenOrdenResultado[]
  419.      */
  420.     public function getExamenOrdenResultadosTodos_examen($examen): Collection
  421.     {
  422.         $criteria Criteria::create()
  423.             ->andWhere(Criteria::expr()->eq('examen'$examen))
  424.             ->andWhere(Criteria::expr()->eq('estado'1))
  425.             ->orderBy(['examen' => 'ASC''id' => 'ASC'])
  426.         ;
  427.         return $this->examenOrdenResultados->matching($criteria);
  428.     }
  429.     public function addExamenOrdenResultado(ExamenOrdenResultado $examenOrdenResultado): self
  430.     {
  431.         if (!$this->examenOrdenResultados->contains($examenOrdenResultado)) {
  432.             $this->examenOrdenResultados[] = $examenOrdenResultado;
  433.             $examenOrdenResultado->setOrden($this);
  434.         }
  435.         return $this;
  436.     }
  437.     public function removeExamenOrdenResultado(ExamenOrdenResultado $examenOrdenResultado): self
  438.     {
  439.         if ($this->examenOrdenResultados->removeElement($examenOrdenResultado)) {
  440.             // set the owning side to null (unless already changed)
  441.             if ($examenOrdenResultado->getOrden() === $this) {
  442.                 $examenOrdenResultado->setOrden(null);
  443.             }
  444.         }
  445.         return $this;
  446.     }
  447. }