72 lines
1.5 KiB
PHP
72 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Regulacao;
|
|
|
|
use App\Models\Cadastro\Especialidade;
|
|
use App\Models\Model;
|
|
use App\Models\Parametrizacao\Exame\Exame;
|
|
use App\Models\Parametrizacao\ProcedimentoCirurgico;
|
|
|
|
class SolicitacaoItem extends Model
|
|
{
|
|
protected $table = 'regulacao_solicitacao_item';
|
|
|
|
protected $casts = [
|
|
'faz_parte_oci' => 'boolean',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'solicitacao_id',
|
|
'exame_id',
|
|
'procedimento_cirurgico_id',
|
|
'especialidade_id',
|
|
'soap_solicitacao_item_id',
|
|
'faz_parte_oci',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'created_at',
|
|
'created_lotacao_id',
|
|
'created_centro_custo_id',
|
|
'updated_at',
|
|
'updated_lotacao_id',
|
|
'updated_centro_custo_id',
|
|
];
|
|
|
|
public function solicitacao()
|
|
{
|
|
return $this->belongsTo(Solicitacao::class);
|
|
}
|
|
|
|
public function exame()
|
|
{
|
|
return $this->belongsTo(Exame::class);
|
|
}
|
|
|
|
public function procedimentoCirurgico()
|
|
{
|
|
return $this->belongsTo(ProcedimentoCirurgico::class);
|
|
}
|
|
|
|
public function especialidade()
|
|
{
|
|
return $this->belongsTo(Especialidade::class);
|
|
}
|
|
|
|
public function getOrigemAttribute()
|
|
{
|
|
if (!is_null($this->exame_id)) {
|
|
|
|
return 'exame';
|
|
}
|
|
else if (!is_null($this->procedimento_cirurgico_id)) {
|
|
|
|
return 'procedimento_cirurgico';
|
|
}
|
|
else if (!is_null($this->especialidade_id)) {
|
|
|
|
return 'especialidade';
|
|
}
|
|
}
|
|
}
|