This commit is contained in:
71
api/app/Models/Regulacao/SolicitacaoItem.php
Normal file
71
api/app/Models/Regulacao/SolicitacaoItem.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user