82 lines
2.3 KiB
PHP
82 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Regulacao;
|
|
|
|
use App\Models\Cadastro\Especialidade;
|
|
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
|
use App\Models\Model;
|
|
use App\Models\Parametrizacao\Exame\Exame;
|
|
use App\Models\Parametrizacao\ProcedimentoCirurgico;
|
|
|
|
class ParametrizacaoPrestadorInterno extends Model
|
|
{
|
|
protected $table = 'regulacao_parametrizacao_prestador_interno';
|
|
|
|
protected $casts = [
|
|
'controla_protocolo_fechamento' => 'boolean',
|
|
'ativo' => 'boolean',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'infraestrutura_id',
|
|
'controla_protocolo_fechamento',
|
|
'ativo',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'created_at',
|
|
'created_lotacao_id',
|
|
'created_centro_custo_id',
|
|
'updated_at',
|
|
'updated_lotacao_id',
|
|
'updated_centro_custo_id',
|
|
];
|
|
|
|
public function infraestrutura()
|
|
{
|
|
return $this->belongsTo(Infraestrutura::class);
|
|
}
|
|
|
|
public function exames()
|
|
{
|
|
return $this->belongsToMany(
|
|
Exame::class,
|
|
'regulacao_parametrizacao_prestador_interno_exame',
|
|
'prestador_interno_id',
|
|
'exame_id'
|
|
)
|
|
->using(ParametrizacaoPrestadorInternoExame::class)
|
|
->as('pivotPrestadorExame')
|
|
->withPivot(['observacoes', 'ativo'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function procedimentosCirurgicos()
|
|
{
|
|
return $this->belongsToMany(
|
|
ProcedimentoCirurgico::class,
|
|
'regulacao_parametrizacao_prestador_interno_proced_cirurgico',
|
|
'prestador_interno_id',
|
|
'procedimento_cirurgico_id'
|
|
)
|
|
->using(ParametrizacaoPrestadorInternoProcedimentoCirurgico::class)
|
|
->as('pivotPrestadorProcedimentoCirurgico')
|
|
->withPivot(['observacoes', 'ativo'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function especialidades()
|
|
{
|
|
return $this->belongsToMany(
|
|
Especialidade::class,
|
|
'regulacao_parametrizacao_prestador_interno_especialidade',
|
|
'prestador_interno_id',
|
|
'especialidade_id'
|
|
)
|
|
->using(ParametrizacaoPrestadorInternoEspecialidade::class)
|
|
->as('pivotPrestadorEspecialidade')
|
|
->withPivot(['observacoes', 'ativo'])
|
|
->withTimestamps();
|
|
}
|
|
}
|