init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,129 @@
<?php
namespace App\Models\ProntoAtendimento\Atendimento;
use App\Enums\ProntoAtendimento\OrigemUnidadeEncaminhamento;
use App\Models\Cadastro\Estabelecimento\Servico;
use App\Models\Cadastro\Estabelecimento\Unidade;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Model;
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
use App\Models\ProntoAtendimento\Plantao\Plantao;
use App\Models\Sigtap\Ocupacao;
use Illuminate\Database\Eloquent\SoftDeletes;
class Recepcao extends Model
{
use SoftDeletes;
protected $table = 'pronto_atendimento_atendimento_recepcao';
protected $casts = [
'urgente' => 'boolean'
];
protected $fillable = [
'plantao_id',
'atendimento_id',
'atendido_em',
'urgente',
'urgente_motivo',
'origem_entrada_id',
'medico_samu',
'motivo_atendimento',
'acompanhante',
'unidade_encaminhamento_id',
'unidade_externa_encaminhamento_id',
'medico_solicitante_encaminhamento',
'servico_id',
'ocupacao_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
'deleted_at',
'deleted_lotacao_id',
'deleted_centro_custo_id',
];
protected $appends = [
'is_encaminhamento',
'origem_unidade_encaminhamento',
];
public function plantao()
{
return $this->belongsTo(Plantao::class);
}
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function origemEntrada()
{
return $this->belongsTo(OrigemEntrada::class);
}
public function unidadeEncaminhamento()
{
return $this->belongsTo(Unidade::class);
}
public function servico()
{
return $this->belongsTo(Servico::class);
}
public function ocupacao()
{
return $this->belongsTo(Ocupacao::class);
}
public function observacao()
{
return $this->hasOne(Observacao::class, 'atendimento_recepcao_id');
}
public function lotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function getOrigemUnidadeEncaminhamentoAttribute()
{
if (!is_null($this->unidade_encaminhamento_id)) {
return OrigemUnidadeEncaminhamento::INTERNA;
}
if (!is_null($this->unidade_externa_encaminhamento_id)) {
return OrigemUnidadeEncaminhamento::EXTERNA;
}
return null;
}
public function declaracoesComparecimento()
{
return $this->hasMany(DeclaracaoComparecimento::class, 'atendimento_recepcao_id');
}
public function getIsEncaminhamentoAttribute()
{
return !is_null($this->unidade_encaminhamento_id) || !is_null($this->unidade_externa_encaminhamento_id);
}
public function getIsAllowedToDeleteAttribute()
{
return true;
}
}