This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Parametrizacao;
|
||||
|
||||
use App\Models\Sigtap\Procedimento as ProcedimentoSigtap;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AtendimentoMedico extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_parametrizacao_atendimento_medico';
|
||||
|
||||
protected $fillable = [
|
||||
'procedimento_padrao_codigo',
|
||||
];
|
||||
|
||||
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 = [
|
||||
'procedimento_padrao'
|
||||
];
|
||||
|
||||
public function getProcedimentoPadraoAttribute()
|
||||
{
|
||||
if (!$this->procedimento_padrao_codigo) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return ProcedimentoSigtap::where('codigo', $this->procedimento_padrao_codigo)
|
||||
->orderByDesc('competencia_id')
|
||||
->first();
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user