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,118 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\Especialidade;
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
use App\Models\Cadastro\Grupo\Grupo;
use App\Models\Intranet\Estado;
use App\Models\Model;
use App\Models\Parametrizacao\ProcedimentoCirurgico;
class Parametrizacao extends Model
{
protected $table = 'regulacao_parametrizacao';
protected $casts = [
'numero_solicitacao_automatico' => 'boolean',
'solicitacao_automatica_ambulatorio' => 'boolean',
'permite_agendar_fora_ordem_posicao' => 'boolean',
'exibe_protocolo_cross' => 'boolean',
'obriga_protocolo_cross' => 'boolean',
'obriga_data_desejada' => 'boolean',
'encerra_solicitacao_automaticamente_ao_encerrar_protocolo_oci' => 'boolean',
'solicitacao_retroativa' => 'boolean',
'exames_nao_regulados' => 'boolean',
'sempre_alterar_unidade_solicitante' => 'boolean',
'exibe_assinatura_relatorio_solicitacao' => 'boolean',
];
protected $fillable = [
'numero_solicitacao_automatico',
'solicitacao_automatica_ambulatorio',
'permite_agendar_fora_ordem_posicao',
'opcao_retirada_protocolo_agendamento_id',
'mensagem_protocolo_solicitacao',
'mensagem_comprovante_agendamento',
'exibe_protocolo_cross',
'obriga_protocolo_cross',
'usuario_registro_estado_id',
'obriga_data_desejada',
'encerra_solicitacao_automaticamente_ao_encerrar_protocolo_oci',
'solicitacao_retroativa',
'exames_nao_regulados',
'sempre_alterar_unidade_solicitante',
'exibe_assinatura_relatorio_solicitacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function opcaoRetiradaProtocoloAgendamento()
{
return $this->belongsTo(ParametrizacaoOpcaoRetiradaProtocoloAgendamento::class);
}
public function usuarioRegistroEstado()
{
return $this->belongsTo(Estado::class);
}
public function dataDesejadaGruposExames()
{
return $this->belongsToMany(
Grupo::class,
'regulacao_parametrizacao_data_desejada_grupo_exame',
'parametrizacao_id',
'grupo_id'
)
->using(ParametrizacaoDataDesejadaGrupoExame::class)
->as('dataDesejadaGrupoExame')
->withTimestamps();
}
public function dataDesejadaProcedimentosCirurgicos()
{
return $this->belongsToMany(
ProcedimentoCirurgico::class,
'regulacao_parametrizacao_data_desejada_procedimento_cirurgico',
'parametrizacao_id',
'procedimento_cirurgico_id'
)
->using(ParametrizacaoDataDesejadaProcedimentoCirurgico::class)
->as('dataDesejadaProcedimentoCirurgico')
->withTimestamps();
}
public function dataDesejadaEspecialidades()
{
return $this->belongsToMany(
Especialidade::class,
'regulacao_parametrizacao_data_desejada_especialidade',
'parametrizacao_id',
'especialidade_id'
)
->using(ParametrizacaoDataDesejadaEspecialidade::class)
->as('dataDesejadaEspecialidade')
->withTimestamps();
}
public function dataDesejadaInfraestruturas()
{
return $this->belongsToMany(
Infraestrutura::class,
'regulacao_parametrizacao_data_desejada_infraestrutura',
'parametrizacao_id',
'infraestrutura_id'
)
->using(ParametrizacaoDataDesejadaInfraestrutura::class)
->as('dataDesejadaInfraestrutura')
->withTimestamps();
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDataDesejadaEspecialidade extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDataDesejadaGrupoExame extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDataDesejadaInfraestrutura extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDataDesejadaProcedimentoCirurgico extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class ParametrizacaoDivulgacao extends Model
{
protected $table = 'regulacao_parametrizacao_divulgacao';
protected $fillable = [
'modo_tempo_medio_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class ParametrizacaoDivulgacaoAba extends Model
{
protected $table = 'regulacao_parametrizacao_divulgacao_aba';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function colunas()
{
return $this->belongsToMany(
ParametrizacaoDivulgacaoColuna::class,
'regulacao_parametrizacao_divulgacao_aba_coluna',
'aba_id',
'coluna_id'
)
->using(ParametrizacaoDivulgacaoAbaColuna::class)
->withPivot(['visivel'])
->withTimestamps();
}
public function statusTipos()
{
return $this->belongsToMany(
StatusTipo::class,
'regulacao_parametrizacao_divulgacao_aba_status_tipo',
'aba_id',
'status_tipo_id'
)
->using(ParametrizacaoDivulgacaoAbaStatusTipo::class)
->withPivot(['visivel'])
->withTimestamps();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDivulgacaoAbaColuna extends Pivot
{
protected $casts = [
'visivel' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDivulgacaoAbaStatusTipo extends Pivot
{
protected $casts = [
'visivel' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class ParametrizacaoDivulgacaoColuna extends Model
{
protected $table = 'regulacao_parametrizacao_divulgacao_coluna';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class ParametrizacaoDivulgacaoModoTempoMedio extends Model
{
protected $table = 'regulacao_parametrizacao_divulgacao_modo_tempo_medio';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,89 @@
<?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 ParametrizacaoDivulgacaoRegulador extends Model
{
protected $table = 'regulacao_parametrizacao_divulgacao_regulador';
protected $casts = [
'ativo' => 'boolean',
];
protected $fillable = [
'regulacao_parametrizacao_regulador_id',
'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_divulgacao_regulador_exame',
'regulador_id',
'exame_id'
)
->using(ParametrizacaoReguladorExame::class)
->as('pivotReguladorExame')
->withPivot(['ativo'])
->withTimestamps();
}
public function procedimentosCirurgicos()
{
return $this->belongsToMany(
ProcedimentoCirurgico::class,
'regulacao_parametrizacao_divulgacao_regulador_cirurgico',
'regulador_id',
'procedimento_cirurgico_id'
)
->using(ParametrizacaoReguladorProcedimentoCirurgico::class)
->as('pivotprocedimentoCirurgico')
->withPivot(['ativo'])
->withTimestamps();
}
public function especialidades()
{
return $this->belongsToMany(
Especialidade::class,
'regulacao_parametrizacao_divulgacao_regulador_especialidade',
'regulador_id',
'especialidade_id'
)
->using(ParametrizacaoReguladorEspecialidade::class)
->as('pivotReguladorEspecialidade')
->withPivot(['ativo'])
->withTimestamps();
}
public function reguladorSolicitantes()
{
return $this->hasMany(ParametrizacaoSolicitanteRegulador::class, 'regulador_id');
}
public function solicitacoes()
{
return $this->hasMany(Solicitacao::class, 'regulador_id');
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDivulgacaoReguladorCirurgico extends Pivot
{
protected $table = 'regulacao_parametrizacao_divulgacao_regulador_cirurgico';
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDivulgacaoReguladorEspecialidade extends Pivot
{
protected $table = 'regulacao_parametrizacao_divulgacao_regulador_especialidade';
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoDivulgacaoReguladorExame extends Pivot
{
protected $table = 'regulacao_parametrizacao_divulgacao_regulador_exame';
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class ParametrizacaoOpcaoRetiradaProtocoloAgendamento extends Model
{
protected $table = 'regulacao_parametrizacao_opcao_retirada_protocolo_agendamento';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function parametrizacoes()
{
return $this->hasMany(Parametrizacao::class, 'opcao_retirada_protocolo_agendamento_id');
}
public function solicitacoes()
{
return $this->hasMany(Solicitacao::class, 'opcao_retirada_protocolo_agendamento_id');
}
}

View File

@@ -0,0 +1,82 @@
<?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;
use App\Models\TransportePaciente\Destino\Destino;
use Illuminate\Database\Eloquent\SoftDeletes;
class ParametrizacaoPrestadorExterno extends Model
{
protected $table = 'regulacao_parametrizacao_prestador_externo';
use SoftDeletes;
protected $casts = [
'ativo' => 'boolean',
'deleted_at' => 'datetime'
];
protected $fillable = [
'destino_id',
'ativo',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function destino()
{
return $this->belongsTo(Destino::class);
}
public function exames()
{
return $this->belongsToMany(
Exame::class,
'regulacao_parametrizacao_prestador_externo_exame',
'prestador_externo_id',
'exame_id'
)
->using(ParametrizacaoPrestadorExternoExame::class)
->as('pivotPrestadorExame')
->withPivot(['observacoes', 'ativo'])
->withTimestamps();
}
public function procedimentosCirurgicos()
{
return $this->belongsToMany(
ProcedimentoCirurgico::class,
'regulacao_parametrizacao_prestador_externo_proced_cirurgico',
'prestador_externo_id',
'procedimento_cirurgico_id'
)
->using(ParametrizacaoPrestadorExternoProcedimentoCirurgico::class)
->as('pivotPrestadorProcedimentoCirurgico')
->withPivot(['observacoes', 'ativo'])
->withTimestamps();
}
public function especialidades()
{
return $this->belongsToMany(
Especialidade::class,
'regulacao_parametrizacao_prestador_externo_especialidade',
'prestador_externo_id',
'especialidade_id'
)
->using(ParametrizacaoPrestadorExternoEspecialidade::class)
->as('pivotPrestadorEspecialidade')
->withPivot(['observacoes', 'ativo'])
->withTimestamps();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoPrestadorExternoEspecialidade extends Pivot
{
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoPrestadorExternoExame extends Pivot
{
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoPrestadorExternoProcedimentoCirurgico extends Pivot
{
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,81 @@
<?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();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoPrestadorInternoEspecialidade extends Pivot
{
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoPrestadorInternoExame extends Pivot
{
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoPrestadorInternoProcedimentoCirurgico extends Pivot
{
protected $casts = [
'ativo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,97 @@
<?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 ParametrizacaoRegulador extends Model
{
protected $table = 'regulacao_parametrizacao_regulador';
protected $casts = [
'solicitante_controla_protocolo_fechamento' => 'boolean',
'ativo' => 'boolean',
];
protected $fillable = [
'infraestrutura_id',
'tipo_id',
'solicitante_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 tipo()
{
return $this->belongsTo(ParametrizacaoReguladorTipo::class);
}
public function exames()
{
return $this->belongsToMany(
Exame::class,
'regulacao_parametrizacao_regulador_exame',
'regulador_id',
'exame_id'
)
->using(ParametrizacaoReguladorExame::class)
->as('pivotReguladorExame')
->withPivot(['ativo'])
->withTimestamps();
}
public function procedimentosCirurgicos()
{
return $this->belongsToMany(
ProcedimentoCirurgico::class,
'regulacao_parametrizacao_regulador_procedimento_cirurgico',
'regulador_id',
'procedimento_cirurgico_id'
)
->using(ParametrizacaoReguladorProcedimentoCirurgico::class)
->as('pivotprocedimentoCirurgico')
->withPivot(['ativo'])
->withTimestamps();
}
public function especialidades()
{
return $this->belongsToMany(
Especialidade::class,
'regulacao_parametrizacao_regulador_especialidade',
'regulador_id',
'especialidade_id'
)
->using(ParametrizacaoReguladorEspecialidade::class)
->as('pivotReguladorEspecialidade')
->withPivot(['ativo'])
->withTimestamps();
}
public function reguladorSolicitantes()
{
return $this->hasMany(ParametrizacaoSolicitanteRegulador::class, 'regulador_id');
}
public function solicitacoes()
{
return $this->hasMany(Solicitacao::class, 'regulador_id');
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoReguladorEspecialidade extends Pivot
{
protected $table = 'regulacao_parametrizacao_regulador_especialidade';
protected $casts = [
'ativo' => 'boolean',
'exige_documento_anexo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoReguladorExame extends Pivot
{
protected $table = 'regulacao_parametrizacao_regulador_exame';
protected $casts = [
'ativo' => 'boolean',
'exige_documento_anexo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoReguladorProcedimentoCirurgico extends Pivot
{
protected $table = 'regulacao_parametrizacao_regulador_procedimento_cirurgico';
protected $casts = [
'ativo' => 'boolean',
'exige_documento_anexo' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class ParametrizacaoReguladorTipo extends Model
{
protected $table = 'regulacao_parametrizacao_regulador_tipo';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function parametrizacaoReguladores()
{
return $this->hasMany(ParametrizacaoRegulador::class, 'tipo_id');
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
use App\Models\Model;
class ParametrizacaoSolicitante extends Model
{
protected $table = 'regulacao_parametrizacao_solicitante';
protected $casts = [
'atende_outro_municipio' => 'boolean',
'is_ppi' => 'boolean',
'atende_outro_municipio' => 'boolean',
];
protected $fillable = [
'atende_outro_municipio',
'infraestrutura_id',
'is_ppi',
'atende_outro_municipio',
];
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 solicitanteReguladores()
{
return $this->hasMany(ParametrizacaoSolicitanteRegulador::class, 'solicitante_id');
}
}

View File

@@ -0,0 +1,76 @@
<?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 ParametrizacaoSolicitanteRegulador extends Model
{
protected $table = 'regulacao_parametrizacao_solicitante_regulador';
protected $fillable = [
'solicitante_id',
'regulador_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function solicitante()
{
return $this->belongsTo(ParametrizacaoSolicitante::class);
}
public function regulador()
{
return $this->belongsTo(ParametrizacaoRegulador::class);
}
public function exames()
{
return $this->belongsToMany(
Exame::class,
'regulacao_parametrizacao_solicitante_regulador_exame',
'solicitante_regulador_id',
'exame_id'
)
->using(ParametrizacaoSolicitanteReguladorExame::class)
->as('pivotSolicitanteReguladorExame')
->withTimestamps();
}
public function procedimentosCirurgicos()
{
return $this->belongsToMany(
ProcedimentoCirurgico::class,
'regulacao_parametrizacao_solicitante_regulador_proced_cirurgico',
'solicitante_regulador_id',
'procedimento_cirurgico_id'
)
->using(ParametrizacaoSolicitanteReguladorProcedimentoCirurgico::class)
->as('pivotSolicitanteReguladorProcedimentoCirurgico')
->withTimestamps();
}
public function especialidades()
{
return $this->belongsToMany(
Especialidade::class,
'regulacao_parametrizacao_solicitante_regulador_especialidade',
'solicitante_regulador_id',
'especialidade_id'
)
->using(ParametrizacaoSolicitanteReguladorEspecialidade::class)
->as('pivotSolicitanteReguladorEspecialidade')
->withTimestamps();
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoSolicitanteReguladorEspecialidade extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoSolicitanteReguladorExame extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class ParametrizacaoSolicitanteReguladorProcedimentoCirurgico extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
class ParametrizacaoSupervisor extends Model
{
protected $table = 'regulacao_parametrizacao_supervisor';
protected $fillable = [
'usuario_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function usuario()
{
return $this->belongsTo(Usuario::class);
}
}

View File

@@ -0,0 +1,229 @@
<?php
namespace App\Models\Regulacao;
use App\Enums\Regulacao\Tipo;
use App\Models\Ambulatorio\AcompanhamentoOci;
use App\Models\Ambulatorio\AcompanhamentoOciEtapaClinicaConcluida;
use App\Models\Ambulatorio\Agendamento as AmbulatorioAgendamento;
use App\Models\Ambulatorio\AtendimentoSoap;
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Cadastro\SujeitoAtencao\Paciente;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\ExameImagem\Agendamento\Agendamento as ExameImagemAgendamento;
use App\Models\ExameLaboratorial\AgendamentoExame\Agendamento as ExameLaboratorialAgendamento;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class Solicitacao extends Model
{
protected $table = 'regulacao_solicitacao';
protected $casts = [
'data' => 'datetime:d/m/Y',
'data_desejada' => 'datetime:d/m/Y',
'confirmado_em' => 'datetime:d/m/Y H:i:s',
'cancelado_em' => 'datetime:d/m/Y H:i:s',
'data_agendada' => 'datetime:d/m/Y',
'hora_agendada' => 'datetime:H:i',
];
protected $fillable = [
'id',
'numero',
'posicao_municipal',
'posicao_regulador',
'posicao_portal',
'data',
'paciente_id',
'status_id',
'infraestrutura_solicitante_id',
'usuario_solicitante_id',
'usuario_solicitante_especialidade_id',
'regulador_id',
'prestador_interno_id',
'prestador_externo_id',
'cid_id',
'ciap_id',
'hipotese_diagnostica_justificativa',
'prioridade_id',
'observacao',
'data_desejada',
'peso',
'altura',
'confirmado_em',
'confirmado_lotacao_id',
'cancelado_em',
'cancelado_lotacao_id',
'justificativa_cancelamento',
'justificativa_reagendamento',
'justificativa_remarcacao',
'justificativa_devolucao',
'justificativa_reenvio',
'justificativa_falta',
'opcao_retirada_protocolo_agendamento_id',
'nome_pessoa_retirada_protocolo_agendamento',
'data_agendada',
'hora_agendada',
'motivo_alteracao_prioridade',
'soap_id',
'unidade_usuario_id',
'infraestrutura_usuario_id',
'ocupacao_usuario_id',
'lotaca_usuario_id',
'acompanhamento_oci_id',
'ocupacao_executora_id',
'usuario_executor_nome',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
protected $appends = [
'confirmado',
];
public function getConfirmadoAttribute()
{
return !is_null($this->confirmado_em);
}
public function getRegulacaoTipoIdAttribute()
{
$item = $this->itens->first();
if (!is_null($item->procedimentoCirurgico)) {
return Tipo::EXTERNO;
}
return isset($item->exame->regulacao_tipo_id)
? $item->exame->regulacao_tipo_id
: (isset($item->especialidade->regulacao_tipo_id)
? $item->especialidade->regulacao_tipo_id
: null);
}
public function paciente()
{
return $this->belongsTo(Paciente::class);
}
public function status()
{
return $this->belongsTo(Status::class);
}
public function infraestruturaSolicitante()
{
return $this->belongsTo(Infraestrutura::class);
}
public function usuarioSolicitante()
{
return $this->belongsTo(Usuario::class);
}
public function regulador()
{
return $this->belongsTo(ParametrizacaoRegulador::class);
}
public function prestadorInterno()
{
return $this->belongsTo(ParametrizacaoPrestadorInterno::class);
}
public function prestadorExterno()
{
return $this->belongsTo(ParametrizacaoPrestadorExterno::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function prioridade()
{
return $this->belongsTo(SolicitacaoPrioridade::class);
}
public function confirmadoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function canceladoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function opcaoRetiradaProtocoloAgendamento()
{
return $this->belongsTo(ParametrizacaoOpcaoRetiradaProtocoloAgendamento::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function lotacaUsuario()
{
return $this->belongsTo(Lotacao::class);
}
public function acompanhamentoOci()
{
return $this->belongsTo(AcompanhamentoOci::class);
}
public function ambulatorioAgendamentos()
{
return $this->hasMany(AmbulatorioAgendamento::class, 'regulacao_solicitacao_id');
}
public function exameImagemAgendamento()
{
return $this->hasOne(ExameImagemAgendamento::class, 'regulacao_solicitacao_id');
}
public function exameLaboratorialAgendamento()
{
return $this->hasOne(ExameLaboratorialAgendamento::class, 'regulacao_solicitacao_id');
}
public function acompanhamentoOciEtapaClincaConcluida()
{
return $this->hasOne(AcompanhamentoOciEtapaClinicaConcluida::class, 'regulacao_solicitacao_id');
}
public function tentativasContato()
{
return $this->hasMany(SolicitacaoTentativaContato::class);
}
public function itens()
{
return $this->hasMany(SolicitacaoItem::class);
}
public function historico()
{
return $this->hasMany(SolicitacaoHistorico::class);
}
}

View File

@@ -0,0 +1,178 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Ambulatorio\AcompanhamentoOci;
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Cadastro\SujeitoAtencao\Paciente;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class SolicitacaoHistorico extends Model
{
protected $table = 'regulacao_solicitacao_historico';
protected $casts = [
'data' => 'datetime:d/m/Y',
'data_desejada' => 'datetime:d/m/Y',
'confirmado_em' => 'datetime:d/m/Y H:i:s',
'cancelado_em' => 'datetime:d/m/Y H:i:s',
'data_agendada' => 'datetime:d/m/Y',
'hora_agendada' => 'datetime:H:i',
];
protected $fillable = [
'solicitacao_id',
'numero',
'posicao_municipal',
'posicao_regulador',
'posicao_portal',
'data',
'paciente_id',
'status_id',
'infraestrutura_solicitante_id',
'usuario_solicitante_id',
'regulador_id',
'prestador_interno_id',
'prestador_externo_id',
'cid_id',
'ciap_id',
'hipotese_diagnostica_justificativa',
'prioridade_id',
'observacao',
'data_desejada',
'peso',
'altura',
'confirmado_em',
'confirmado_lotacao_id',
'cancelado_em',
'cancelado_lotacao_id',
'justificativa_cancelamento',
'justificativa_reagendamento',
'justificativa_remarcacao',
'justificativa_devolucao',
'justificativa_reenvio',
'justificativa_falta',
'opcao_retirada_protocolo_agendamento_id',
'nome_pessoa_retirada_protocolo_agendamento',
'data_agendada',
'hora_agendada',
'motivo_alteracao_prioridade',
'acompanhamento_oci_id',
'ocupacao_executora_id',
'usuario_executor_nome',
'soap_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
protected $appends = [
'confirmado',
'cancelado',
];
public function getConfirmadoAttribute()
{
return !is_null($this->confirmado_em);
}
public function getCanceladoAttribute()
{
return !is_null($this->cancelado_em);
}
public function solicitacao()
{
return $this->belongsTo(Solicitacao::class);
}
public function paciente()
{
return $this->belongsTo(Paciente::class);
}
public function status()
{
return $this->belongsTo(Status::class);
}
public function infraestruturaSolicitante()
{
return $this->belongsTo(Infraestrutura::class);
}
public function usuarioSolicitante()
{
return $this->belongsTo(Usuario::class);
}
public function regulador()
{
return $this->belongsTo(ParametrizacaoRegulador::class);
}
public function prestadorInterno()
{
return $this->belongsTo(ParametrizacaoPrestadorInterno::class);
}
public function prestadorExterno()
{
return $this->belongsTo(ParametrizacaoPrestadorExterno::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function prioridade()
{
return $this->belongsTo(SolicitacaoPrioridade::class);
}
public function acompanhamentoOci()
{
return $this->belongsTo(AcompanhamentoOci::class);
}
public function confirmadoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function canceladoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function opcaoRetiradaProtocoloAgendamento()
{
return $this->belongsTo(ParametrizacaoOpcaoRetiradaProtocoloAgendamento::class);
}
public function tentativasContato()
{
return $this->hasMany(SolicitacaoTentativaContatoHistorico::class);
}
public function itens()
{
return $this->hasMany(SolicitacaoItemHistorico::class);
}
}

View 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';
}
}
}

View File

@@ -0,0 +1,65 @@
<?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 SolicitacaoItemHistorico extends Model
{
protected $table = 'regulacao_solicitacao_item_historico';
protected $fillable = [
'solicitacao_historico_id',
'exame_id',
'procedimento_cirurgico_id',
'especialidade_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function solicitacaoHistorico()
{
return $this->belongsTo(SolicitacaoHistorico::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';
}
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Model;
class SolicitacaoMovimentacao extends Model
{
protected $table = 'regulacao_solicitacao_movimentacao';
protected $casts = [
'movimentado_em' => 'datetime:d/m/Y H:i:s',
];
protected $fillable = [
'solicitacao_id',
'status_id',
'movimentado_em',
'lotacao_id',
];
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 status()
{
return $this->belongsTo(Status::class);
}
public function lotacao()
{
return $this->belongsTo(Lotacao::class);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class SolicitacaoPrioridade extends Model
{
protected $table = 'regulacao_solicitacao_prioridade';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function solicitacoes()
{
return $this->hasMany(Solicitacao::class, 'prioridade_id');
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
class SolicitacaoTentativaContato extends Model
{
protected $table = 'regulacao_solicitacao_tentativa_contato';
protected $casts = [
'data' => 'datetime:d/m/Y',
];
protected $fillable = [
'solicitacao_id',
'data',
'usuario_id',
'detalhes',
];
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 usuario()
{
return $this->belongsTo(Usuario::class);
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
class SolicitacaoTentativaContatoHistorico extends Model
{
protected $table = 'regulacao_solicitacao_tentativa_contato_historico';
protected $casts = [
'data' => 'datetime:d/m/Y',
];
protected $fillable = [
'solicitacao_historico_id',
'data',
'usuario_id',
'detalhes',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function solicitacaoHistorico()
{
return $this->belongsTo(SolicitacaoHistorico::class);
}
public function usuario()
{
return $this->belongsTo(Usuario::class);
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class Status extends Model
{
protected $table = 'regulacao_status';
protected $casts = [
'ativo' => 'boolean',
];
protected $fillable = [
'tipo_id',
'nome',
'ativo',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function tipo()
{
return $this->belongsTo(StatusTipo::class);
}
public function statusDe()
{
return $this->belongsToMany(
Status::class,
'regulacao_status_status',
'status_para_id',
'status_de_id',
)
->using(StatusStatus::class)
->withTimestamps();
}
public function statusPara()
{
return $this->belongsToMany(
Status::class,
'regulacao_status_status',
'status_de_id',
'status_para_id',
)
->using(StatusStatus::class)
->withTimestamps();
}
public function solicitacoes()
{
return $this->hasMany(Solicitacao::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Pivot;
class StatusStatus extends Pivot
{
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class StatusTipo extends Model
{
protected $table = 'regulacao_status_tipo';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function status()
{
return $this->hasMany(Status::class, 'tipo_id');
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Model;
class Tipo extends Model
{
protected $table = 'regulacao_tipo';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models\Regulacao;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
use App\Models\Regulacao\Solicitacao;
class Upload extends Model
{
protected $table = 'regulacao_solicitacao_upload';
protected $fillable = [
'id',
'solicitacao_id',
'usuario_id',
'arquivo',
'nome_arquivo_real',
'extensao_arquivo',
];
protected $hidden = [
'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 usuario()
{
return $this->belongsTo(Usuario::class);
}
}