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,136 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Apac\MotivoSaidaPermanencia;
use App\Models\Apac\SolicitacaoAutorizacao;
use App\Models\Cadastro\EtapaClinica;
use App\Models\Cadastro\Oci;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Cadastro\SujeitoAtencao\Paciente;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
use App\Models\Sigtap\Cid;
use App\Models\Sigtap\Ocupacao;
use App\Models\Sigtap\Procedimento;
class AcompanhamentoOci extends Model
{
protected $table = 'ambulatorio_acompanhamento_oci';
protected $casts = [
'iniciado_em' => 'datetime',
'finalizado_em' => 'datetime',
];
protected $fillable = [
'paciente_id',
'ocupacao_id',
'oci_id',
'etapa_clinica_atual_id',
'status_id',
'iniciado_em',
'iniciado_lotacao_id',
'finalizado_em',
'finalizado_lotacao_id',
'finalizado_motivo_encerramento_id',
'finalizado_observacao',
'motivo_saida_permanencia_id',
'procedimento_oci_data',
'procedimento_oci_procedimento_id',
'procedimento_oci_cid_id',
'procedimento_oci_quantidade',
'procedimento_oci_ocupacao_id',
'procedimento_oci_usuario_id',
'apac_solicitacao_autorizacao_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function paciente()
{
return $this->belongsTo(Paciente::class);
}
public function ocupacao()
{
return $this->belongsTo(Ocupacao::class);
}
public function oci()
{
return $this->belongsTo(Oci::class);
}
public function status()
{
return $this->belongsTo(AcompanhamentoOciStatus::class);
}
public function etapaClinicaAtual()
{
return $this->belongsTo(EtapaClinica::class);
}
public function iniciadoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function finalizadoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function motivoSaidaPermanencia()
{
return $this->belongsTo(MotivoSaidaPermanencia::class);
}
public function finalizadoMotivoEncerramento()
{
return $this->belongsTo(AcompanhamentoOciMotivoEncerramento::class);
}
public function procedimentoOciProcedimento()
{
return $this->belongsTo(Procedimento::class);
}
public function procedimentoOciCid()
{
return $this->belongsTo(Cid::class);
}
public function procedimentoOciOcupacao()
{
return $this->belongsTo(Ocupacao::class);
}
public function procedimentoOciUsuario()
{
return $this->belongsTo(Usuario::class);
}
public function apacSolicitacaoAutorizacao()
{
return $this->belongsTo(SolicitacaoAutorizacao::class);
}
public function etapasClinicasConcluidas()
{
return $this->hasMany(AcompanhamentoOciEtapaClinicaConcluida::class);
}
public function procedimentosRealizados()
{
return $this->hasMany(AcompanhamentoOciProcedimentoRealizado::class);
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\EtapaClinica;
use App\Models\Model;
use App\Models\Regulacao\Solicitacao;
class AcompanhamentoOciEtapaClinicaConcluida extends Model
{
protected $table = 'ambulatorio_acompanhamento_oci_etapa_clinica_concluida';
protected $fillable = [
'acompanhamento_oci_id',
'etapa_clinica_id',
'soap_id',
'regulacao_solicitacao_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function acompanhamentoOci()
{
return $this->belongsTo(AcompanhamentoOci::class);
}
public function etapaClinica()
{
return $this->belongsTo(EtapaClinica::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function regulacaoSolicitacao()
{
return $this->belongsTo(Solicitacao::class);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AcompanhamentoOciMotivoEncerramento extends Model
{
protected $table = 'ambulatorio_acompanhamento_oci_motivo_encerramento';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function acompanhamentosOcis()
{
return $this->hasMany(AcompanhamentoOci::class, 'finalizado_motivo_encerramento_id');
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Apac\SolicitacaoAutorizacaoProcedimentoSecundario;
use App\Models\Cadastro\Estabelecimento\Unidade;
use App\Models\Model;
use App\Models\Sigtap\Ocupacao;
use App\Models\Sigtap\Procedimento;
class AcompanhamentoOciProcedimentoRealizado extends Model
{
protected $table = 'ambulatorio_acompanhamento_oci_procedimento_realizado';
protected $casts = [
'data_executada' => 'datetime:d/m/Y',
];
protected $fillable = [
'acompanhamento_oci_id',
'soap_id',
'procedimento_id',
'data_executada',
'unidade_executora_id',
'ocupacao_executora_id',
'usuario_executor_nome',
'apac_procedimento_secundario_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function acompanhamentoOci()
{
return $this->belongsTo(AcompanhamentoOci::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function procedimento()
{
return $this->belongsTo(Procedimento::class);
}
public function unidadeExecutora()
{
return $this->belongsTo(Unidade::class);
}
public function ocupacaoExecutora()
{
return $this->belongsTo(Ocupacao::class);
}
public function apacProcedimentoSecundario()
{
return $this->belongsTo(SolicitacaoAutorizacaoProcedimentoSecundario::class);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AcompanhamentoOciStatus extends Model
{
protected $table = 'ambulatorio_acompanhamento_oci_status';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function acompanhamentosOcis()
{
return $this->hasMany(AcompanhamentoOci::class, 'status_id');
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\SujeitoAtencao\Paciente;
use App\Models\Model;
use App\Models\Regulacao\Solicitacao as RegulacaoSolicitacao;
use App\Models\Sms\SmsEnvio;
class Agendamento extends Model
{
protected $table = 'ambulatorio_agendamento';
protected $casts = [
'horario' => 'datetime:H:i',
];
protected $fillable = [
'agendamento_anterior_id',
'jornada_id',
'tipo_id',
'horario',
'paciente_id',
'status_id',
'observacao',
'motivo_cancelamento',
'motivo_agendamento_excedente',
'sms_envio_id',
'regulacao_solicitacao_id',
'origem_agendamento',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function jornada()
{
return $this->belongsTo(Jornada::class);
}
public function tipo()
{
return $this->belongsTo(AgendamentoTipo::class);
}
public function paciente()
{
return $this->belongsTo(Paciente::class);
}
public function status()
{
return $this->belongsTo(AgendamentoStatus::class);
}
public function smsEnvio()
{
return $this->belongsTo(SmsEnvio::class);
}
public function regulacaoSolicitacao()
{
return $this->belongsTo(RegulacaoSolicitacao::class);
}
public function atendimento()
{
return $this->hasOne(Atendimento::class);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AgendamentoStatus extends Model
{
protected $table = 'ambulatorio_agendamento_status';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function agendamentos()
{
return $this->hasMany(Agendamento::class, 'status_id');
}
}

View File

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

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models\Ambulatorio;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AmbulatorioEncaminhamentoCaraterInternacao extends Model
{
use HasFactory;
protected $table = 'ambulatorio_encaminhamento_carater_internacao';
protected $fillable = [
'id',
'nome'
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models\Ambulatorio;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AmbulatorioEncaminhamentoCausaExterna extends Model
{
use HasFactory;
protected $table = 'ambulatorio_encaminhamento_causa_externa';
protected $fillable = [
'id',
'nome'
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models\Ambulatorio;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AmbulatorioEncaminhamentoClinica extends Model
{
use HasFactory;
protected $table = 'ambulatorio_encaminhamento_clinica';
protected $fillable = [
'id',
'nome'
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models\Ambulatorio;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AmbulatorioEncaminhamentoVinculoPrevidencia extends Model
{
use HasFactory;
protected $table = 'ambulatorio_encaminhamento_vinculo_previdencia';
protected $fillable = [
'id',
'nome'
];
protected $hidden = [
'created_at',
'updated_at',
];
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class ArcadaDentaria extends Model
{
protected $table = 'ambulatorio_arcada_dentaria';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function dentes()
{
return $this->hasMany(Dente::class, 'arcada_id');
}
}

View File

@@ -0,0 +1,190 @@
<?php
namespace App\Models\Ambulatorio;
use App\Enums\Ambulatorio\DemandaTipo;
use App\Models\AtencaoBasica\AtendimentoIndividual\TipoAtendimento;
use App\Models\Cadastro\Especialidade;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
use App\Models\PainelSenha\Fila;
use App\Models\Sigtap\Ocupacao;
class Atendimento extends Model
{
protected $table = 'ambulatorio_atendimento';
protected $casts = [
'finalizado_em' => 'datetime:d/m/Y H:i:s',
'pos_consulta' => 'boolean',
];
protected $fillable = [
'atendimento_tipo_id',
'fila_id',
'paciente_id',
'agendamento_id',
'demanda_espontanea_id',
'responsavel_atual_usuario_id',
'responsavel_atual_ocupacao_id',
'responsavel_atual_especialidade_id',
'responsavel_encaminhamento_atual_lotacao_id',
'finalizado_em',
'finalizado_lotacao_id',
'pos_consulta',
'tempo_atendimento'
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function fila()
{
return $this->belongsTo(Fila::class);
}
public function agendamento()
{
return $this->belongsTo(Agendamento::class);
}
public function demandaEspontanea()
{
return $this->belongsTo(DemandaEspontanea::class);
}
public function responsavelAtualUsuario()
{
return $this->belongsTo(Usuario::class);
}
public function responsavelAtualOcupacao()
{
return $this->belongsTo(Ocupacao::class);
}
public function responsavelAtualEspecialidade()
{
return $this->belongsTo(Especialidade::class);
}
public function responsavelEncaminhamentoAtualLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function finalizadoLotacao()
{
return $this->belongsTo(Lotacao::class);
}
public function servicos()
{
return $this->belongsToMany(Servico::class, 'ambulatorio_atendimento_servico')
->using(AtendimentoServico::class)
->as('atendimentoServico')
->withTimestamps();
}
public function preAtendimento()
{
return $this->hasOne(AtendimentoPreAtendimento::class);
}
public function raas()
{
return $this->hasOne(AtendimentoRaas::class);
}
public function soaps()
{
return $this->hasMany(AtendimentoSoap::class);
}
public function posConsultas()
{
return $this->hasMany(AtendimentoPosConsulta::class);
}
public function antropometrias()
{
return $this->hasMany(AtendimentoAntropometria::class);
}
public function sinaisVitais()
{
return $this->hasMany(AtendimentoSinalVital::class);
}
public function glicemiasCapilares()
{
return $this->hasMany(AtendimentoGlicemiaCapilar::class);
}
public function procedimentos()
{
return $this->hasMany(AtendimentoProcedimento::class);
}
public function declaracoesComparecimento()
{
return $this->hasMany(AtendimentoDeclaracaoComparecimento::class);
}
public function getFinalizadoAttribute()
{
return !is_null($this->finalizado_em);
}
public function getDemandaTipoAttribute()
{
return is_null($this->agendamento_id) ? DemandaTipo::ESPONTANEA : DemandaTipo::AGENDADA;
}
public function getIsDemandaEspontaneaAttribute()
{
return $this->demanda_tipo === DemandaTipo::ESPONTANEA;
}
public function getPacienteAttribute()
{
return ($this->agendamento ?? $this->demandaEspontanea)->paciente;
}
public function getOcupacaoAttribute()
{
return $this->responsavelAtualOcupacao ?? ($this->agendamento->jornada->lotacao ?? $this->demandaEspontanea)->ocupacao;
}
public function getEspecialidadeAttribute()
{
return $this->responsavelAtualEspecialidade ?? ($this->agendamento->jornada ?? $this->demandaEspontanea)->especialidade;
}
public function getUsuarioAttribute()
{
return $this->responsavelAtualUsuario ?? ($this->agendamento->jornada->lotacao ?? $this->demandaEspontanea)->usuario;
}
public function getJornadaAttribute()
{
return $this->demandaEspontanea->jornada;
}
public function getInfraestruturaAttribute()
{
return ($this->agendamento->jornada->lotacao ?? $this->demandaEspontanea->createdLotacao)->infraestrutura;
}
public function atendimentoTipo()
{
return $this->belongsTo(TipoAtendimento::class);
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoAntropometria extends Model
{
protected $table = 'ambulatorio_atendimento_antropometria';
protected $casts = [
'medido_em' => 'datetime:d/m/Y',
];
protected $fillable = [
'atendimento_id',
'pre_atendimento_id',
'pos_consulta_id',
'soap_id',
'medido_em',
'peso',
'altura',
'perimetro_cefalico',
'circunferencia_abdominal',
'perimetro_panturrilha',
'comprimento_pe_direito',
'largura_pe_direito',
'circunferencia_pe_direito',
'comprimento_pe_esquerdo',
'largura_pe_esquerdo',
'circunferencia_pe_esquerdo',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function preAtendimento()
{
return $this->belongsTo(AtendimentoPreAtendimento::class);
}
public function posConsulta()
{
return $this->belongsTo(AtendimentoPosConsulta::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function soapObjetivoAntropometria()
{
return $this->hasOne(AtendimentoSoapObjetivoAntropometria::class);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Turno;
use App\Models\Model;
class AtendimentoDeclaracaoComparecimento extends Model
{
protected $table = 'ambulatorio_atendimento_declaracao_comparecimento';
protected $casts = [
'entrada' => 'datetime:H:i',
'saida' => 'datetime:H:i',
];
protected $fillable = [
'atendimento_id',
'pre_atendimento_id',
'soap_id',
'nome_acompanhante',
'motivo_comparecimento',
'turno_id',
'entrada',
'saida',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function preAtendimento()
{
return $this->belongsTo(AtendimentoPreAtendimento::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function turno()
{
return $this->belongsTo(Turno::class);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoGlicemiaCapilar extends Model
{
protected $table = 'ambulatorio_atendimento_glicemia_capilar';
protected $fillable = [
'atendimento_id',
'pre_atendimento_id',
'pos_consulta_id',
'soap_id',
'valor',
'momento_coleta_id',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function preAtendimento()
{
return $this->belongsTo(AtendimentoPreAtendimento::class);
}
public function posConsulta()
{
return $this->belongsTo(AtendimentoPosConsulta::class);
}
public function momentoColeta()
{
return $this->belongsTo(GlicemiaCapilarMomentoColeta::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function soapObjetivoGlicemiaCapilar()
{
return $this->hasOne(AtendimentoSoapObjetivoGlicemiaCapilar::class);
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Model;
class AtendimentoImpressaoLog extends Model
{
protected $table = 'ambulatorio_atendimento_impressao_log';
protected $casts = [
'impresso_em' => 'datetime:d/m/Y H:i:s',
];
protected $fillable = [
'atendimento_id',
'impressao_tipo_id',
'lotacao_id',
'impresso_em',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function impressaoTipo()
{
return $this->belongsTo(AtendimentoImpressaoTipo::class);
}
public function lotacao()
{
return $this->belongsTo(Lotacao::class);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoImpressaoTipo extends Model
{
protected $table = 'ambulatorio_atendimento_impressao_tipo';
protected $fillable = [
'id',
'nome',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function atendimentosImpressoesLogs()
{
return $this->hasMany(AtendimentoImpressaoLog::class, 'impressao_tipo_id');
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Almoxarifado\SaidaItem;
use App\Models\Model;
class AtendimentoMedicamento extends Model
{
protected $table = 'ambulatorio_atendimento_medicamento';
protected $fillable = [
'atendimento_id',
'pre_atendimento_id',
'saida_item_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function preAtendimento()
{
return $this->belongsTo(AtendimentoPreAtendimento::class);
}
public function almoxarifadoSaidaItem()
{
return $this->belongsTo(SaidaItem::class, 'saida_item_id');
}
}

View File

@@ -0,0 +1,131 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\LocalAtendimento;
use App\Models\AtencaoBasica\Parametrizacao\Equipe;
use App\Models\AtencaoBasica\Procedimento\ViaAdministracao;
use App\Models\Geral\Turno;
use App\Models\Model;
class AtendimentoPosConsulta extends Model
{
protected $table = 'ambulatorio_atendimento_pos_consulta';
protected $casts = [
'orientacao_individual_em_saude' => 'boolean',
'paciente_liberado' => 'boolean',
];
protected $fillable = [
'atendimento_id',
'observacoes',
'equipe_id',
'atencao_basica_local_atendimento_id',
'turno_id',
'orientacao_individual_em_saude',
'paciente_liberado',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function equipe()
{
return $this->belongsTo(Equipe::class);
}
public function atencaoBasicaLocalAtendimento()
{
return $this->belongsTo(LocalAtendimento::class);
}
public function turno()
{
return $this->belongsTo(Turno::class);
}
public function testesRapidos()
{
return $this->belongsToMany(
TesteRapido::class,
'ambulatorio_atendimento_pos_consulta_teste_rapido',
'pos_consulta_id',
'teste_rapido_id'
)
->using(AtendimentoPosConsultaTesteRapido::class)
->as('posConsultaTesteRapido')
->withPivot(['resultado'])
->withTimestamps();
}
public function administracoesMedicamentos()
{
return $this->belongsToMany(
ViaAdministracao::class,
'ambulatorio_atendimento_pos_consulta_admin_medicamento',
'pos_consulta_id',
'via_administracao_id'
)
->using(AtendimentoPosConsultaAdministracaoMedicamento::class)
->as('posConsultaAdministracaoMedicamento')
->withTimestamps();
}
public function outrosProcedimentos()
{
return $this->belongsToMany(
OutroProcedimento::class,
'ambulatorio_atendimento_pos_consulta_outro_procedimento',
'pos_consulta_id',
'outro_procedimento_id'
)
->using(AtendimentoPosConsultaOutroProcedimento::class)
->as('posConsultaOutroProcedimento')
->withTimestamps();
}
public function coletasMateriais()
{
return $this->belongsToMany(
ColetaMaterial::class,
'ambulatorio_atendimento_pos_consulta_coleta_material',
'pos_consulta_id',
'coleta_material_id'
)
->using(AtendimentoPosConsultaColetaMaterial::class)
->as('posConsultaColetaMaterial')
->withTimestamps();
}
public function procedimentos()
{
return $this->hasMany(AtendimentoProcedimento::class, 'pos_consulta_id');
}
public function antropometria()
{
return $this->hasOne(AtendimentoAntropometria::class, 'pos_consulta_id');
}
public function sinalVital()
{
return $this->hasOne(AtendimentoSinalVital::class, 'pos_consulta_id');
}
public function glicemiaCapilar()
{
return $this->hasOne(AtendimentoGlicemiaCapilar::class, 'pos_consulta_id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPosConsultaAdministracaoMedicamento 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPosConsultaColetaMaterial 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPosConsultaOutroProcedimento 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPosConsultaTesteRapido 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,169 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\AtencaoBasica\AtendimentoIndividual\TipoAtendimento;
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\LocalAtendimento;
use App\Models\AtencaoBasica\Parametrizacao\Equipe;
use App\Models\AtencaoBasica\Procedimento\ViaAdministracao;
use App\Models\Geral\Ciap;
use App\Models\Geral\Turno;
use App\Models\Model;
class AtendimentoPreAtendimento extends Model
{
protected $table = 'ambulatorio_atendimento_pre_atendimento';
protected $casts = [
'vacinacao_em_dia' => 'boolean',
'dum' => 'datetime:d/m/Y',
'orientacao_individual_em_saude' => 'boolean',
'paciente_mantido_fila' => 'boolean',
'paciente_liberado' => 'boolean',
'pos_consulta' => 'boolean',
];
protected $fillable = [
'atendimento_id',
'atendimento_tipo_id',
'equipe_id',
'atencao_basica_local_atendimento_id',
'turno_id',
'ciap_id',
'motivo_atendimento',
'vacinacao_em_dia',
'dum',
'classificacao_risco_id',
'orientacao_individual_em_saude',
'paciente_mantido_fila',
'paciente_liberado',
'pos_consulta',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function atendimentoTipo()
{
return $this->belongsTo(TipoAtendimento::class);
}
public function equipe()
{
return $this->belongsTo(Equipe::class);
}
public function atencaoBasicaLocalAtendimento()
{
return $this->belongsTo(LocalAtendimento::class);
}
public function turno()
{
return $this->belongsTo(Turno::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function classificacaoRisco()
{
return $this->belongsTo(ClassificacaoRisco::class);
}
public function antropometria()
{
return $this->hasOne(AtendimentoAntropometria::class, 'pre_atendimento_id');
}
public function sinalVital()
{
return $this->hasOne(AtendimentoSinalVital::class, 'pre_atendimento_id');
}
public function glicemiaCapilar()
{
return $this->hasOne(AtendimentoGlicemiaCapilar::class, 'pre_atendimento_id');
}
public function declaracaoComparecimento()
{
return $this->hasOne(AtendimentoDeclaracaoComparecimento::class, 'pre_atendimento_id');
}
public function testesRapidos()
{
return $this->belongsToMany(
TesteRapido::class,
'ambulatorio_atendimento_pre_atendimento_teste_rapido',
'pre_atendimento_id',
'teste_rapido_id'
)
->using(AtendimentoPreAtendimentoTesteRapido::class)
->as('preAtendimentoTesteRapido')
->withPivot(['resultado'])
->withTimestamps();
}
public function administracoesMedicamentos()
{
return $this->belongsToMany(
ViaAdministracao::class,
'ambulatorio_atendimento_pre_atendimento_admin_medicamento',
'pre_atendimento_id',
'via_administracao_id'
)
->using(AtendimentoPreAtendimentoAdministracaoMedicamento::class)
->as('preAtendimentoAdministracaoMedicamento')
->withTimestamps();
}
public function outrosProcedimentos()
{
return $this->belongsToMany(
OutroProcedimento::class,
'ambulatorio_atendimento_pre_atendimento_outro_procedimento',
'pre_atendimento_id',
'outro_procedimento_id'
)
->using(AtendimentoPreAtendimentoOutroProcedimento::class)
->as('preAtendimentoOutroProcedimento')
->withTimestamps();
}
public function coletasMateriais()
{
return $this->belongsToMany(
ColetaMaterial::class,
'ambulatorio_atendimento_pre_atendimento_coleta_material',
'pre_atendimento_id',
'coleta_material_id'
)
->using(AtendimentoPreAtendimentoColetaMaterial::class)
->as('preAtendimentoColetaMaterial')
->withTimestamps();
}
public function procedimentos()
{
return $this->hasMany(AtendimentoProcedimento::class, 'pre_atendimento_id');
}
public function medicamentos()
{
return $this->hasMany(AtendimentoMedicamento::class, 'pre_atendimento_id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPreAtendimentoAdministracaoMedicamento 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPreAtendimentoColetaMaterial 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPreAtendimentoOutroProcedimento 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoPreAtendimentoTesteRapido 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,133 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Almoxarifado\SaidaItem;
use App\Models\Apac\SolicitacaoAutorizacao;
use App\Models\Bpa\Procedimento as BpaProcedimento;
use App\Models\Cadastro\Especialidade;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Model;
use App\Models\Raas\AtendimentoProcedimento as RaasAtendimentoProcedimento;
use App\Models\Sigtap\Cid;
use App\Models\Sigtap\Ocupacao;
use App\Models\Sigtap\Procedimento;
class AtendimentoProcedimento extends Model
{
protected $table = 'ambulatorio_atendimento_procedimento';
protected $casts = [
'automatico' => 'boolean',
];
protected $fillable = [
'atendimento_id',
'pre_atendimento_id',
'soap_id',
'pos_consulta_id',
'bpa_procedimento_id',
'raas_atendimento_procedimento_id',
'apac_solicitacao_autorizacao_id',
'apac_procedimento_secundario_id',
'ocupacao_id',
'especialidade_id',
'usuario_id',
'procedimento_id',
'cid_id',
'saida_item_id',
'quantidade',
'automatico',
'local_curativo',
'acompanhamento_oci_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function preAtendimento()
{
return $this->belongsTo(AtendimentoPreAtendimento::class);
}
public function posConsulta()
{
return $this->belongsTo(AtendimentoPosConsulta::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function raasAtendimentoProcedimento()
{
return $this->belongsTo(RaasAtendimentoProcedimento::class);
}
public function apacSolicitacaoAutorizacao()
{
return $this->belongsTo(SolicitacaoAutorizacao::class);
}
public function bpaProcedimento()
{
return $this->belongsTo(BpaProcedimento::class);
}
public function ocupacao()
{
return $this->belongsTo(Ocupacao::class);
}
public function especialidade()
{
return $this->belongsTo(Especialidade::class);
}
public function usuario()
{
return $this->belongsTo(Usuario::class);
}
public function procedimento()
{
return $this->belongsTo(Procedimento::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function soapProcedimentoClinico()
{
return $this->hasOne(AtendimentoSoapProcedimentoClinico::class);
}
public function soapProcedimentoAdministrativo()
{
return $this->hasOne(AtendimentoSoapProcedimentoAdministrativo::class);
}
public function almoxarifadoSaidaItem()
{
return $this->belongsTo(SaidaItem::class, 'saida_item_id');
}
public function materiais()
{
return $this->hasMany(AtendimentoSoapFeridaMaterial::class, 'atendimento_procedimento_id');
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
use App\Models\Raas\CaraterAtendimento;
use App\Models\Raas\DestinoPaciente;
use App\Models\Raas\LocalRealizacaoExame;
use App\Models\Raas\MotivoSaidaPermanencia;
use App\Models\Raas\OrigemPaciente;
use App\Models\Sigtap\Classificacao;
class AtendimentoRaas extends Model
{
protected $table = 'ambulatorio_atendimento_raas';
protected $fillable = [
'atendimento_id',
'origem_paciente_id',
'destino_paciente_id',
'motivo_saida_permanencia_id',
'carater_atendimento_id',
'numero_autorizacao',
'classificacao_id',
'local_realizacao_exame_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function origemPaciente()
{
return $this->belongsTo(OrigemPaciente::class);
}
public function destinoPaciente()
{
return $this->belongsTo(DestinoPaciente::class);
}
public function motivoSaidaPermanencia()
{
return $this->belongsTo(MotivoSaidaPermanencia::class);
}
public function caraterAtendimento()
{
return $this->belongsTo(CaraterAtendimento::class);
}
public function classificacao()
{
return $this->belongsTo(Classificacao::class);
}
public function localRealizacaoExame()
{
return $this->belongsTo(LocalRealizacaoExame::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoServico 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,56 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSinalVital extends Model
{
protected $table = 'ambulatorio_atendimento_sinal_vital';
protected $fillable = [
'atendimento_id',
'pre_atendimento_id',
'pos_consulta_id',
'soap_id',
'pressao_arterial',
'frequencia_respiratoria',
'frequencia_cardiaca',
'temperatura',
'saturacao_o2',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function preAtendimento()
{
return $this->belongsTo(AtendimentoPreAtendimento::class);
}
public function posConsulta()
{
return $this->belongsTo(AtendimentoPosConsulta::class);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function soapObjetivoSinalVital()
{
return $this->hasOne(AtendimentoSoapObjetivoSinalVital::class);
}
}

View File

@@ -0,0 +1,612 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoapTriagemNeonatal;
use App\Models\Apac\MotivoSaidaPermanencia;
use App\Models\AtencaoBasica\AtendimentoDomiciliar\AtendimentoDomiciliarCondicaoAvaliada;
use App\Models\AtencaoBasica\AtendimentoDomiciliar\CondutaDesfecho;
use App\Models\AtencaoBasica\AtendimentoIndividual\AleitamentoMaterno;
use App\Models\AtencaoBasica\AtendimentoIndividual\CondicaoAvaliada;
use App\Models\AtencaoBasica\AtendimentoIndividual\Conduta;
use App\Models\AtencaoBasica\AtendimentoIndividual\DoencaTransmissivel;
use App\Models\AtencaoBasica\AtendimentoIndividual\ExameSolicitadoAvaliado;
use App\Models\AtencaoBasica\AtendimentoIndividual\ModalidadeAtencaoDomiciliar;
use App\Models\AtencaoBasica\AtendimentoIndividual\RacionalidadeSaude;
use App\Models\AtencaoBasica\AtendimentoIndividual\Rastreamento;
use App\Models\AtencaoBasica\AtendimentoIndividual\TipoAtendimento;
use App\Models\AtencaoBasica\AtendimentoIndividual\TriagemNeonatal;
use App\Models\AtencaoBasica\AtendimentoOdontologico\TipoConsulta;
use App\Models\AtencaoBasica\Avaliacao\Conclusao;
use App\Models\AtencaoBasica\Avaliacao\Cuidador;
use App\Models\AtencaoBasica\Avaliacao\JustificativaConclusao;
use App\Models\AtencaoBasica\Avaliacao\Procedencia;
use App\Models\AtencaoBasica\CadastroPerfilEpidemiologico;
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\LocalAtendimento;
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\MarcadorConsumoAlimentar;
use App\Models\AtencaoBasica\Parametrizacao\Equipe;
use App\Models\Cadastro\EtapaClinica;
use App\Models\Cadastro\Oci;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Geral\Turno;
use App\Models\Model;
class AtendimentoSoap extends Model
{
protected $table = 'ambulatorio_atendimento_soap';
protected $casts = [
'dum' => 'datetime:d/m/Y',
'pre_natal_desfecho_em' => 'datetime:d/m/Y',
'vacinacao_em_dia' => 'boolean',
'paciente_com_necessidade_especial' => 'boolean',
'paciente_liberado' => 'boolean',
'pos_consulta' => 'boolean',
'pre_natal_movimentacao_fetal' => 'boolean',
'pre_natal_gravidez_planejada' => 'boolean',
'is_rascunho' => 'boolean',
'is_atendimento_enfermagem' => 'boolean',
'is_atendimento_saude_bucal' => 'boolean',
'is_atendimento_pre_natal' => 'boolean',
'is_atendimento_puericultura' => 'boolean',
'is_atendimento_idoso' => 'boolean',
'is_tratamento_concluido' => 'boolean',
'saude_bucal_necessidade_protese_inferior_superior' => 'boolean',
'is_atendimento_soap_assinado' => 'boolean',
'orientacao_individual_em_saude' => 'boolean',
];
protected $fillable = [
'atendimento_id',
'is_rascunho',
'tempo_atendimento',
'is_atendimento_enfermagem',
'is_atendimento_saude_bucal',
'is_atendimento_pre_natal',
'is_atendimento_puericultura',
'is_atendimento_idoso',
'is_tratamento_concluido',
'equipe_id',
'atencao_basica_local_atendimento_id',
'turno_id',
'subjetivo_descricao',
'objetivo_descricao',
'dum',
'pre_natal_gravidez_tipo_id',
'pre_natal_altura_uterina',
'pre_natal_edema_id',
'pre_natal_movimentacao_fetal',
'pre_natal_gravidez_planejada',
'pre_natal_batimento_cardiaco_fetal',
'pre_natal_desfecho_em',
'puericultura_gravidez_tipo_id',
'puericultura_parto_tipo_id',
'puericultura_idade_gestacional_semanas',
'puericultura_idade_gestacional_dias',
'puericultura_apgar_primeiro_minuto',
'puericultura_apgar_quinto_minuto',
'puericultura_apgar_decimo_minuto',
'puericultura_peso',
'puericultura_comprimento',
'puericultura_perimetro_cefalico',
'puericultura_aleitamento_tipo_id',
'saude_bucal_necessidade_protese_inferior_superior',
'saude_bucal_consulta_tipo_id',
'vacinacao_em_dia',
'paciente_com_necessidade_especial',
'avaliacao_descricao',
'plano_descricao',
'atendimento_tipo_id',
'atendimento_compartilhado_usuario_id',
'racionalidade_saude_id',
'paciente_liberado',
'pos_consulta',
'emad_conduta_desfecho_id',
'emad_modalidade_id',
'emad_tipo_atendimento_id',
'emad_cid_primario_id',
'emad_cuidador_id',
'emad_cns_cuidador',
'emad_cpf_cuidador',
'emad_conclusao_id',
'emad_procedencia_id',
'is_atendimento_soap_assinado',
'oci_id',
'acompanhamento_oci_id',
'oci_desfecho_etapa_clinica_id',
'apac_motivo_saida_permanencia_id',
'orientacao_individual_em_saude',
'observacao_perfil_epidemiologico',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimento()
{
return $this->belongsTo(Atendimento::class);
}
public function equipe()
{
return $this->belongsTo(Equipe::class);
}
public function atencaoBasicaLocalAtendimento()
{
return $this->belongsTo(LocalAtendimento::class);
}
public function turno()
{
return $this->belongsTo(Turno::class);
}
public function preNatalGravidezTipo()
{
return $this->belongsTo(GravidezTipo::class);
}
public function preNatalEdema()
{
return $this->belongsTo(GravidezEdema::class);
}
public function atendimentoTipo()
{
return $this->belongsTo(TipoAtendimento::class);
}
public function emadCondutaDesfecho()
{
return $this->belongsTo(CondutaDesfecho::class);
}
public function emadTipoAtendimento() {
return $this->belongsTo(TipoAtendimento::class);
}
public function emadModalidade() {
return $this->belongsTo(ModalidadeAtencaoDomiciliar::class);
}
public function emadCuidador() {
return $this->belongsTo(Cuidador::class);
}
public function emadConclusao() {
return $this->belongsTo(Conclusao::class);
}
public function emadProcedencia() {
return $this->belongsTo(Procedencia::class);
}
public function atendimentoCompartilhadoUsuario()
{
return $this->belongsTo(Usuario::class);
}
public function racionalidadeSaude()
{
return $this->belongsTo(RacionalidadeSaude::class);
}
public function saudeBucalConsultaTipo()
{
return $this->belongsTo(TipoConsulta::class);
}
public function oci()
{
return $this->belongsTo(Oci::class);
}
public function acompanhamentoOci()
{
return $this->belongsTo(AcompanhamentoOci::class);
}
public function ociDesfechoEtapaClinica()
{
return $this->belongsTo(EtapaClinica::class);
}
public function apacMotivoSaidaPermanencia()
{
return $this->belongsTo(MotivoSaidaPermanencia::class);
}
public function atendimentoSoapExameSolicitado()
{
return $this->hasOne(AtendimentoSoapExameSolicitado::class, 'soap_id');
}
public function atendimentoSoapTriagemNeonatalSolicitado()
{
return $this->hasOne(AtendimentoSoapTriagemNeonatalSolicitado::class, 'soap_id');
}
public function casosSuspeitos()
{
return $this->belongsToMany(
CasoSuspeito::class,
'ambulatorio_atendimento_soap_caso_suspeito',
'soap_id',
'caso_suspeito_id'
)
->using(AtendimentoSoapCasoSuspeito::class)
->as('soapCasoSuspeito')
->withTimestamps();
}
public function saudeBucalVigilancias()
{
return $this->belongsToMany(
SaudeBucalVigilancia::class,
'ambulatorio_atendimento_soap_saude_bucal_vigilancia',
'soap_id',
'vigilancia_id'
)
->using(AtendimentoSoapSaudeBucalVigilancia::class)
->as('soapSaudeBucalVigilancia')
->withTimestamps();
}
public function saudeBucalFornecimentos()
{
return $this->belongsToMany(
SaudeBucalFornecimento::class,
'ambulatorio_atendimento_soap_saude_bucal_fornecimento',
'soap_id',
'fornecimento_id'
)
->using(AtendimentoSoapSaudeBucalFornecimento::class)
->as('soapSaudeBucalFornecimento')
->withTimestamps();
}
public function testesRapidos()
{
return $this->belongsToMany(
TesteRapido::class,
'ambulatorio_atendimento_soap_teste_rapido',
'soap_id',
'teste_rapido_id'
)
->using(AtendimentoSoapTesteRapido::class)
->as('soapTesteRapido')
->withPivot(['resultado'])
->withTimestamps();
}
public function examesAvaliados()
{
return $this->belongsToMany(
ExameSolicitadoAvaliado::class,
'ambulatorio_atendimento_soap_exame_avaliado',
'soap_id',
'exame_solicitado_avaliado_id'
)
->using(AtendimentoSoapExameAvaliado::class)
->as('soapExameAvaliado')
->withPivot(['solicitado_em', 'realizado_em', 'resultado_em', 'resultado'])
->withTimestamps();
}
public function triagensNeonatal()
{
return $this->belongsToMany(
TriagemNeonatal::class,
'ambulatorio_atendimento_soap_triagem_neonatal',
'soap_id',
'triagem_neonatal_id'
)
->using(AtendimentoSoapTriagemNeonatal::class)
->as('soapTriagemNeonatal')
->withPivot(['solicitado_em', 'realizado_em', 'resultado_em', 'resultado'])
->withTimestamps();
}
public function condicoesAvaliadas()
{
return $this->belongsToMany(
CondicaoAvaliada::class,
'ambulatorio_atendimento_soap_condicao_avaliada',
'soap_id',
'condicao_avaliada_id'
)
->using(AtendimentoSoapCondicaoAvaliada::class)
->as('soapCondicaoAvaliada')
->withTimestamps();
}
public function condicoesEmad()
{
return $this->belongsToMany(
AtendimentoDomiciliarCondicaoAvaliada::class,
'ambulatorio_atendimento_soap_condicao_avaliada_emad',
'soap_id',
'condicao_id'
)
->using(AtendimentoSoapCondicaoEmad::class)
->as('soapCondicao')
->withTimestamps();
}
public function justificativaEmad()
{
return $this->belongsToMany(
JustificativaConclusao::class,
'ambulatorio_atendimento_soap_justificativa_emad',
'soap_id',
'justificativa_id'
)
->using(AtendimentoSoapJustificativaEmad::class)
->as('soapJustificativa')
->withTimestamps();
}
public function procedimentosEmad()
{
return $this->hasMany(AtendimentoSoapProcedimentoEmad::class, 'soap_id');
}
public function doencasTransmissiveis()
{
return $this->belongsToMany(
DoencaTransmissivel::class,
'ambulatorio_atendimento_soap_doenca_transmissivel',
'soap_id',
'doenca_transmissivel_id'
)
->using(AtendimentoSoapDoencaTransmissivel::class)
->as('soapDoencaTransmissivel')
->withTimestamps();
}
public function rastreamentos()
{
return $this->belongsToMany(
Rastreamento::class,
'ambulatorio_atendimento_soap_rastreamento',
'soap_id',
'rastreamento_id'
)
->using(AtendimentoSoapRastreamento::class)
->as('soapRastreamento')
->withTimestamps();
}
public function condutas()
{
return $this->belongsToMany(Conduta::class, 'ambulatorio_atendimento_soap_conduta', 'soap_id', 'conduta_id')
->using(AtendimentoSoapConduta::class)
->as('soapConduta')
->withTimestamps();
}
public function antecedente()
{
return $this->hasOne(AtendimentoSoapAntecedente::class, 'soap_id');
}
public function objetivoAntropometria()
{
return $this->hasOne(AtendimentoSoapObjetivoAntropometria::class, 'soap_id');
}
public function objetivoSinalVital()
{
return $this->hasOne(AtendimentoSoapObjetivoSinalVital::class, 'soap_id');
}
public function objetivoGlicemiaCapilar()
{
return $this->hasOne(AtendimentoSoapObjetivoGlicemiaCapilar::class, 'soap_id');
}
public function triaHistorio()
{
return $this->hasMany(AtendimentoSoapTriaHistorio::class, 'soap_id');
}
public function prescricoesMedicamentos()
{
return $this->hasMany(AtendimentoSoapPrescricaoMedicamento::class, 'soap_id');
}
public function marcadorConsumoAlimentarPerguntasRespostas()
{
return $this->hasMany(AtendimentoSoapMarcadorConsumoAlimentar::class, 'soap_id');
}
public function atencaoBasicaMarcadorConsumoAlimentar()
{
return $this->hasOne(MarcadorConsumoAlimentar::class, 'soap_id');
}
public function odontograma()
{
return $this->hasOne(AtendimentoSoapOdontograma::class, 'soap_id');
}
public function puericulturaGravidezTipo()
{
return $this->belongsTo(GravidezTipo::class);
}
public function puericulturaPartoTipo()
{
return $this->belongsTo(PartoTipo::class);
}
public function puericulturaAleitamentoTipo()
{
return $this->belongsTo(AleitamentoMaterno::class);
}
public function puericulturaAlteracoesFenotipicas()
{
return $this->hasMany(AtendimentoSoapPuericulturaAlteracaoFenotipica::class, 'soap_id');
}
public function puericulturaFatoresRisco()
{
return $this->hasMany(AtendimentoSoapPuericulturaFatorRisco::class, 'soap_id');
}
public function puericulturaMarcosDesenvolvimento()
{
return $this->hasMany(AtendimentoSoapPuericulturaMarcoDesenvolvimento::class, 'soap_id');
}
public function antropometrias()
{
return $this->hasMany(AtendimentoAntropometria::class, 'soap_id');
}
public function sinaisVitais()
{
return $this->hasMany(AtendimentoSinalVital::class, 'soap_id');
}
public function glicemiasCapilares()
{
return $this->hasMany(AtendimentoGlicemiaCapilar::class, 'soap_id');
}
public function motivos()
{
return $this->hasMany(AtendimentoSoapMotivo::class, 'soap_id');
}
public function resultadosExames()
{
return $this->hasMany(AtendimentoSoapResultadoExame::class, 'soap_id');
}
public function problemasCondicoes()
{
return $this->hasMany(AtendimentoSoapProblemaCondicao::class, 'soap_id');
}
public function intervencoes()
{
return $this->hasMany(AtendimentoSoapIntervencao::class, 'soap_id');
}
public function declaracoesComparecimento()
{
return $this->hasMany(AtendimentoDeclaracaoComparecimento::class, 'soap_id');
}
public function procedimentos()
{
return $this->hasMany(AtendimentoProcedimento::class, 'soap_id');
}
public function procedimentosClinicos()
{
return $this->hasMany(AtendimentoSoapProcedimentoClinico::class, 'soap_id');
}
public function procedimentosAdministrativos()
{
return $this->hasMany(AtendimentoSoapProcedimentoAdministrativo::class, 'soap_id');
}
public function solicitacoesExames()
{
return $this->hasMany(AtendimentoSoapSolicitacaoExame::class, 'soap_id');
}
public function solicitacoesProcedimentosCirurgicos()
{
return $this->hasMany(AtendimentoSoapSolicitacaoProcedimentoCirurgico::class, 'soap_id');
}
public function atestados()
{
return $this->hasMany(AtendimentoSoapAtestado::class, 'soap_id');
}
public function orientacoes()
{
return $this->hasMany(AtendimentoSoapOrientacao::class, 'soap_id');
}
public function cartasMedicas()
{
return $this->hasMany(AtendimentoSoapCartaMedica::class, 'soap_id');
}
public function encaminhamentos()
{
return $this->hasMany(AtendimentoSoapEncaminhamento::class, 'soap_id');
}
public function compartilhamentosCuidado()
{
return $this->hasMany(AtendimentoSoapCompartilhamentoCuidado::class, 'soap_id');
}
public function alergias()
{
return $this->hasMany(AtendimentoSoapAlergia::class, 'soap_id');
}
public function prescricaoMedicamentoTratamentosInterrompidos()
{
return $this->hasMany(AtendimentoSoapPrescricaoMedicamentoItem::class, 'tratamento_interrompido_soap_id');
}
public function feridas()
{
return $this->hasMany(AtendimentoSoapFerida::class, 'soap_id');
}
public function perfisEpidemiologicos()
{
return $this->belongsToMany(
CadastroPerfilEpidemiologico::class,
'ambulatorio_atendimento_soap_perfil_epidemiologico',
'soap_id',
'perfil_epidemiologico_id'
)
->using(AtendimentoSoapPerfilEpidemiologico::class)
->as('soapPerfilEpidemiologico')
->withTimestamps();
}
public function ociProcedimentosRealizados()
{
return $this->hasMany(AtendimentoSoapOciProcedimentoRealizado::class, 'soap_id');
}
public function puericulturaQuestionarioMChatR()
{
return $this->hasMany(AtendimentoSoapPuericulturaQuestionarioMChatR::class, 'soap_id');
}
public function ivcf()
{
return $this->hasOne(AtendimentoSoapIvcf::class, 'soap_id');
}
public function riscoCardiovascularFramingham()
{
return $this->hasOne(AtendimentoSoapRiscoCardiovascularFramingham::class, 'soap_id');
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\SujeitoAtencao\Alergia;
use App\Models\Cadastro\SujeitoAtencao\AlergiaCriticidade;
use App\Models\Model;
class AtendimentoSoapAlergia extends Model
{
protected $table = 'ambulatorio_atendimento_soap_alergia';
protected $fillable = [
'soap_id',
'alergia_id',
'criticidade_id',
'reacoes_observacoes',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function alergia()
{
return $this->belongsTo(Alergia::class);
}
public function criticidade()
{
return $this->belongsTo(AlergiaCriticidade::class);
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapAntecedente extends Model
{
protected $table = 'ambulatorio_atendimento_soap_antecedente';
protected $casts = [
'desfecho_gestacao_aconteceu_menos_um_ano' => 'boolean',
];
protected $fillable = [
'soap_id',
'descricao',
'descricao_familiar',
'gestas_previas',
'abortos',
'desfecho_gestacao_aconteceu_menos_um_ano',
'partos_realizados',
'partos_vaginais',
'partos_cesareas',
'partos_domiciliares',
'nascidos_vivos',
'nascidos_mortos',
'recem_nascidos_com_menos2500_gramas',
'recem_nascidos_com_mais4500_gramas',
'nascidos_vivos_vivem',
'nascidos_vivos_mortos_primeira_semana',
'nascidos_vivos_mortos_depois_primeira_semana',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function problemasCondicoes()
{
return $this->hasMany(AtendimentoSoapAntecedenteProblemaCondicao::class, 'antecedente_id');
}
public function cirurgiasInternacoes()
{
return $this->hasMany(AtendimentoSoapAntecedenteCirurgiaInternacao::class, 'antecedente_id');
}
public function problemasFamiliares()
{
return $this->hasMany(AtendimentoSoapAntecedenteProblemaFamiliar::class, 'antecedente_id');
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapAntecedenteCirurgiaInternacao extends Model
{
protected $table = 'ambulatorio_atendimento_soap_antecedente_cirurgia_internacao';
protected $casts = [
'realizada_em' => 'datetime:d/m/Y',
];
protected $fillable = [
'antecedente_id',
'descricao',
'realizada_em',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function antecedente()
{
return $this->belongsTo(AtendimentoSoapAntecedente::class);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapAntecedenteProblemaCondicao extends Model
{
protected $table = 'ambulatorio_atendimento_soap_antecedente_problema_condicao';
protected $casts = [
'inicio' => 'datetime:d/m/Y',
'fim' => 'datetime:d/m/Y',
];
protected $fillable = [
'antecedente_id',
'ciap_id',
'cid_id',
'situacao_id',
'inicio',
'fim',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function antecedente()
{
return $this->belongsTo(AtendimentoSoapAntecedente::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function situacao()
{
return $this->belongsTo(ProblemaCondicaoSituacao::class);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Ciap;
use App\Models\Model;
class AtendimentoSoapAntecedenteProblemaFamiliar extends Model
{
protected $table = 'ambulatorio_atendimento_soap_antecedente_problema_familiar';
protected $fillable = [
'antecedente_id',
'ciap_id',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function antecedente()
{
return $this->belongsTo(AtendimentoSoapAntecedente::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\DocumentoTipo;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapAtestado extends Model
{
protected $table = 'ambulatorio_atendimento_soap_atestado';
protected $casts = [
'data' => 'datetime:d/m/Y',
'horario' => 'datetime:H:i',
'horario_inicial' => 'datetime:H:i',
];
protected $fillable = [
'soap_id',
'modelo_id',
'descricao',
'nome_acompanhante',
'documento_tipo_id',
'cpf',
'cns',
'data',
'horario',
'dias',
'quantidade_horas',
'horario_inicial',
'cid_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function getIsAtestadoAcompanhanteAttribute()
{
return !is_null($this->nome_acompanhante);
}
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function modelo()
{
return $this->belongsTo(AtestadoModelo::class);
}
public function documentoTipo()
{
return $this->belongsTo(DocumentoTipo::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapCartaMedica extends Model
{
protected $table = 'ambulatorio_atendimento_soap_carta_medica';
protected $fillable = [
'soap_id',
'descricao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapCasoSuspeito 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,63 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\Especialidade;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapCompartilhamentoCuidado extends Model
{
protected $table = 'ambulatorio_atendimento_soap_compartilhamento_cuidado';
protected $fillable = [
'soap_id',
'especialidade_id',
'usuario_id',
'ciap_id',
'cid_id',
'classificacao_risco_id',
'discussao_caso_clinico',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function especialidade()
{
return $this->belongsTo(Especialidade::class);
}
public function usuario()
{
return $this->belongsTo(Usuario::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function classificacaoRisco()
{
return $this->belongsTo(ClassificacaoRisco::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapCondicaoAvaliada 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapCondicaoEmad 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapConduta 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapDoencaTransmissivel 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,165 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\AmbulatorioEncaminhamentoVinculoPrevidencia;
use App\Models\AtencaoBasica\AtendimentoIndividual\Encaminhamento;
use App\Models\Cadastro\Especialidade;
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
use App\Models\Cadastro\Estabelecimento\Unidade;
use App\Models\Cadastro\SujeitoAtencao\Usuario;
use App\Models\Geral\Ciap;
use App\Models\Geral\DocumentoTipo;
use App\Models\Model;
use App\Models\ProntoAtendimento\Aih\CaraterInternacao;
use App\Models\ProntoAtendimento\Aih\CausaExterna;
use App\Models\ProntoAtendimento\Aih\Clinica;
use App\Models\Sigtap\Cid;
use App\Models\Sigtap\Procedimento;
class AtendimentoSoapEncaminhamento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_encaminhamento';
protected $fillable = [
'soap_id',
'tipo_id',
'servico_especializado_especialidade_id',
'servico_especializado_complemento',
'servico_especializado_cid_id',
'servico_especializado_ciap_id',
'servico_especializado_classificacao_risco_id',
'servico_especializado_motivo',
'servico_especializado_observacao',
'intersetorial_infraestrutura_id',
'internacao_hospitalar_cid_principal_id',
'internacao_hospitalar_cid_secundario_id',
'internacao_hospitalar_cid_causas_associadas_id',
'internacao_hospitalar_unidade_solicitante_id',
'internacao_hosp_principais_resultados_de_provas_diagnosticas',
'internacao_hosp_condicoes_que_justificam_internacao',
'internacao_hosp_principais_sinais_sintomas_clinicos',
'internacao_hospitalar_procedimento_solicitado_id',
'internacao_hospitalar_data_solicitacao',
'internacao_hospitalar_clinica_id',
'internacao_hospitalar_carater_internacao_id',
'internacao_hospitalar_profissional_solicitante_assistente_id',
'internacao_hospitalar_profissional_solicitante_documento_tipo_id',
'internacao_hospitalar_profissional_solicitante_documento_numero',
'internacao_hospitalar_causa_externa_id',
'internacao_hospitalar_cnpj_seguradora',
'internacao_hospitalar_numero_bilhete',
'internacao_hospitalar_serie',
'internacao_hospitalar_cnpj_empresa',
'internacao_hospitalar_cnae_empresa',
'internacao_hospitalar_cbor',
'internacao_hospitalar_vinculo_previdencia_id',
'internacao_hospitalar_profissional_autorizador_id',
'internacao_hospitalar_data_autorizacao',
'internacao_hospitalar_codigo_orgao_emissor',
'internacao_hospitalar_profissional_autorizador_documento_numero',
'internacao_hospitalar_profissional_autorizador_documento_tipo_id',
'unidade_usuario_id',
'infraestrutura_usuario_id',
'ocupacao_usuario_id',
'lotaca_usuario_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function tipo()
{
return $this->belongsTo(Encaminhamento::class);
}
public function servicoEspecializadoEspecialidade()
{
return $this->belongsTo(Especialidade::class);
}
public function servicoEspecializadoCid()
{
return $this->belongsTo(Cid::class);
}
public function servicoEspecializadoCiap()
{
return $this->belongsTo(Ciap::class);
}
public function servicoEspecializadoClassificacaoRisco()
{
return $this->belongsTo(ClassificacaoRisco::class);
}
public function intersetorialInfraestrutura()
{
return $this->belongsTo(Infraestrutura::class);
}
public function internacaoHospitalarCidPrincipal(){
return $this->belongsTo(Cid::class, 'internacao_hospitalar_cid_principal_id');
}
public function internacaoHospitalarCidSecundario(){
return $this->belongsTo(Cid::class, 'internacao_hospitalar_cid_secundario_id');
}
public function internacaoHospitalarCidCausasAssociadas(){
return $this->belongsTo(Cid::class, 'internacao_hospitalar_cid_causas_associadas_id');
}
public function internacaoHospitalarUnidadeSolicitante(){
return $this->belongsTo(Unidade::class, 'internacao_hospitalar_unidade_solicitante_id');
}
public function internacaoHospitalarProcedimentoSolicitado(){
return $this->belongsTo(Procedimento::class, 'internacao_hospitalar_procedimento_solicitado_id');
}
public function internacaoHospitalarProfissionalSolicitanteAssistente(){
return $this->belongsTo(Usuario::class, 'internacao_hospitalar_profissional_solicitante_assistente_id');
}
public function internacaoHospitalarProfissionalAutorizador(){
return $this->belongsTo(Usuario::class, 'internacao_hospitalar_profissional_autorizador_id');
}
public function internacaoHospitalarClinica(){
return $this->belongsTo(AmbulatorioEncaminhamentoClinica::class, 'internacao_hospitalar_clinica_id');
}
public function internacaoHospitalarProfissionalSolicitanteDocumentoTipo(){
return $this->belongsTo(DocumentoTipo::class, 'internacao_hospitalar_profissional_solicitante_documento_tipo_id');
}
public function internacaoHospitalarCaraterInternacao(){
return $this->belongsTo(AmbulatorioEncaminhamentoCaraterInternacao::class, 'internacao_hospitalar_carater_internacao_id');
}
public function internacaoHospitalarCausaExterna(){
return $this->belongsTo(AmbulatorioEncaminhamentoCausaExterna::class, 'internacao_hospitalar_causa_externa_id');
}
public function internacaoHospitalarVinculoPrevidencia(){
return $this->belongsTo(AmbulatorioEncaminhamentoVinculoPrevidencia::class, 'internacao_hospitalar_vinculo_previdencia_id');
}
public function internacaoHospitalarProfissionalAutorizadorDocumentoTipo(){
return $this->belongsTo(DocumentoTipo::class, 'internacao_hospitalar_profissional_autorizador_documento_tipo_id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapExameAvaliado 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,59 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoapExameSolicitadoItem;
use App\Models\AtencaoBasica\AtendimentoIndividual\ExameSolicitadoAvaliado;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapExameSolicitado extends Model
{
protected $table = 'ambulatorio_atendimento_soap_exame_solicitado';
protected $fillable = [
'soap_id',
'cid_id',
'ciap_id',
'justificativa',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function examesSolicitados()
{
return $this->belongsToMany(
ExameSolicitadoAvaliado::class,
'ambulatorio_atendimento_soap_exame_solicitado_item',
'soap_exame_solicitado_id',
'exame_solicitado_avaliado_id'
)
->using(AtendimentoSoapExameSolicitadoItem::class)
->as('soapExameSolicitado')
->withTimestamps();
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapExameSolicitadoItem 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,90 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoap;
use App\Models\Cadastro\Ferida;
use App\Models\Cadastro\FeridaExsudato;
use App\Models\Cadastro\FeridaNecrose;
use App\Models\Cadastro\Lado;
use App\Models\Cadastro\LocalAnatomico;
use App\Models\Cadastro\LocalAnatomicoRegiao;
use App\Models\Model;
class AtendimentoSoapFerida extends Model
{
protected $table = 'ambulatorio_atendimento_soap_ferida';
protected $casts = [
'data' => 'date',
'cicatrizada' => 'boolean',
];
protected $fillable = [
'soap_id',
'id_old',
'ferida_id',
'local_anatomico_id',
'local_anatomico_regiao_id',
'lado_id',
'ferida_exsudato_id',
'ferida_necrose',
'data',
'cicatrizada',
'comprimento',
'largura',
'profundidade',
'dor',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function ferida()
{
return $this->belongsTo(Ferida::class);
}
public function localAnatomico()
{
return $this->belongsTo(LocalAnatomico::class);
}
public function localAnatomicoRegiao()
{
return $this->belongsTo(LocalAnatomicoRegiao::class);
}
public function exsudato()
{
return $this->belongsTo(FeridaExsudato::class);
}
public function necrose()
{
return $this->belongsTo(FeridaNecrose::class);
}
public function procedimentos()
{
return $this->hasMany(AtendimentoSoapFeridaProcedimento::class, 'soap_ferida_id', 'id');
}
public function images()
{
return $this->hasMany(AtendimentoSoapFeridaImagem::class, 'soap_ferida_id', 'id');
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapFeridaImagem extends Model
{
protected $table = 'ambulatorio_atendimento_soap_ferida_imagem';
protected $fillable = [
'soap_ferida_id',
'arquivo',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function atendimentoSoapFerida()
{
return $this->belongsTo(AtendimentoSoapFerida::class);
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Almoxarifado\SaidaItem;
use App\Models\Ambulatorio\AtendimentoProcedimento;
use App\Models\Cadastro\Material\Material;
use App\Models\Model;
class AtendimentoSoapFeridaMaterial extends Model
{
protected $table = 'ambulatorio_atendimento_soap_ferida_material';
protected $fillable = [
'material_id',
'atendimento_procedimento_id',
'saida_item_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function material()
{
return $this->belongsTo(Material::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
public function almoxarifadoSaidaItem()
{
return $this->belongsTo(SaidaItem::class, 'saida_item_id');
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoProcedimento;
use App\Models\Ambulatorio\AtendimentoSoap;
use App\Models\Model;
class AtendimentoSoapFeridaProcedimento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_ferida_procedimento';
protected $fillable = [
'soap_id',
'soap_ferida_id',
'atendimento_procedimento_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function atendimentoSoapFerida()
{
return $this->belongsTo(AtendimentoSoapFerida::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Ciap;
use App\Models\Model;
class AtendimentoSoapIntervencao extends Model
{
protected $table = 'ambulatorio_atendimento_soap_intervencao';
protected $fillable = [
'soap_id',
'ciap_id',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoap;
use App\Models\Model;
class AtendimentoSoapIvcf extends Model
{
protected $table = 'ambulatorio_atendimento_soap_ivcf';
protected $fillable = [
'soap_id',
'estado_saude_geral',
'limitacao_compras',
'limitacao_gestao_financeira',
'limitacao_tarefas_domesticas',
'banho_independencia',
'relato_esquecimento_por_terceiros',
'esquecimento_piorando',
'esquecimento_impacta_atividades',
'humor_tristeza_desanimo',
'perda_interesse_atividades',
'limitacao_elevar_bracos',
'limitacao_motricidade_fina',
'perda_peso_nao_intencional',
'imc_abaixo_22',
'panturrilha_abaixo_31',
'marcha_lenta_4m_maior_5s',
'dificuldade_caminhar_impacto_atividades',
'quedas_recorrentes',
'incontinencia',
'problema_visao_impacto_atividades',
'problema_audicao_impacto_atividades',
'doencas_cronicas_multiplas',
'polifarmacia_5_ou_mais_medicamentos',
'internacao_ultimos_6_meses',
];
protected $casts = [
'limitacao_compras' => 'boolean',
'limitacao_gestao_financeira' => 'boolean',
'limitacao_tarefas_domesticas' => 'boolean',
'banho_independencia' => 'boolean',
'relato_esquecimento_por_terceiros' => 'boolean',
'esquecimento_piorando' => 'boolean',
'esquecimento_impacta_atividades' => 'boolean',
'humor_tristeza_desanimo' => 'boolean',
'perda_interesse_atividades' => 'boolean',
'limitacao_elevar_bracos' => 'boolean',
'limitacao_motricidade_fina' => 'boolean',
'perda_peso_nao_intencional' => 'boolean',
'imc_abaixo_22' => 'boolean',
'panturrilha_abaixo_31' => 'boolean',
'marcha_lenta_4m_maior_5s' => 'boolean',
'dificuldade_caminhar_impacto_atividades' => 'boolean',
'quedas_recorrentes' => 'boolean',
'incontinencia' => 'boolean',
'problema_visao_impacto_atividades' => 'boolean',
'problema_audicao_impacto_atividades' => 'boolean',
'doencas_cronicas_multiplas' => 'boolean',
'polifarmacia_5_ou_mais_medicamentos' => 'boolean',
'internacao_ultimos_6_meses' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapJustificativaEmad 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,42 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\MarcadorConsumoAlimentarPergunta;
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\MarcadorConsumoAlimentarResposta;
use App\Models\Model;
class AtendimentoSoapMarcadorConsumoAlimentar extends Model
{
protected $table = 'ambulatorio_atendimento_soap_marcador_consumo_alimentar';
protected $fillable = [
'soap_id',
'pergunta_id',
'resposta_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function pergunta()
{
return $this->belongsTo(MarcadorConsumoAlimentarPergunta::class);
}
public function resposta()
{
return $this->belongsTo(MarcadorConsumoAlimentarResposta::class);
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapMotivo extends Model
{
protected $table = 'ambulatorio_atendimento_soap_motivo';
protected $fillable = [
'soap_id',
'ciap_id',
'cid_id',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapObjetivoAntropometria extends Model
{
protected $table = 'ambulatorio_atendimento_soap_objetivo_antropometria';
protected $fillable = [
'soap_id',
'atendimento_antropometria_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function atendimentoAntropometria()
{
return $this->belongsTo(AtendimentoAntropometria::class);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapObjetivoGlicemiaCapilar extends Model
{
protected $table = 'ambulatorio_atendimento_soap_objetivo_glicemia_capilar';
protected $fillable = [
'soap_id',
'atendimento_glicemia_capilar_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function atendimentoGlicemiaCapilar()
{
return $this->belongsTo(AtendimentoGlicemiaCapilar::class);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapObjetivoSinalVital extends Model
{
protected $table = 'ambulatorio_atendimento_soap_objetivo_sinal_vital';
protected $fillable = [
'soap_id',
'atendimento_sinal_vital_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function atendimentoSinalVital()
{
return $this->belongsTo(AtendimentoSinalVital::class);
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\Estabelecimento\Unidade;
use App\Models\Model;
use App\Models\Sigtap\Ocupacao;
use App\Models\Sigtap\Procedimento;
class AtendimentoSoapOciProcedimentoRealizado extends Model
{
protected $table = 'ambulatorio_atendimento_soap_oci_procedimento_realizado';
protected $casts = [
'data_executada' => 'datetime:d/m/Y',
];
protected $fillable = [
'soap_id',
'procedimento_id',
'data_executada',
'unidade_executora_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',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function procedimento()
{
return $this->belongsTo(Procedimento::class);
}
public function unidadeExecutora()
{
return $this->belongsTo(Unidade::class);
}
public function ocupacaoExecutora()
{
return $this->belongsTo(Ocupacao::class);
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontograma extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma';
protected $casts = [
'possui_aparelho' => 'boolean',
'possui_contencao' => 'boolean',
];
protected $fillable = [
'soap_id',
'possui_aparelho',
'possui_contencao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function odontogramaArcadas()
{
return $this->hasMany(AtendimentoSoapOdontogramaArcada::class, 'odontograma_id');
}
public function dentesSupranumerarios()
{
return $this->hasMany(AtendimentoSoapOdontogramaDenteSupranumerario::class, 'odontograma_id');
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontogramaArcada extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_arcada';
protected $casts = [
'possui_protese_total' => 'boolean',
];
protected $fillable = [
'odontograma_id',
'arcada_id',
'possui_protese_total',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function odontograma()
{
return $this->belongsTo(AtendimentoSoapOdontograma::class);
}
public function arcada()
{
return $this->belongsTo(ArcadaDentaria::class);
}
public function odontogramaArcadaDentes()
{
return $this->hasMany(AtendimentoSoapOdontogramaArcadaDente::class, 'odontograma_arcada_id');
}
public function atendimentoProcedimentos()
{
return $this->hasMany(AtendimentoSoapOdontogramaArcadaProcedimento::class, 'odontograma_arcada_id');
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontogramaArcadaDente extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_arcada_dente';
protected $casts = [
'is_fragmento_esquerda_tratado' => 'boolean',
'is_fragmento_cima_tratado' => 'boolean',
'is_fragmento_direita_tratado' => 'boolean',
'is_fragmento_baixo_tratado' => 'boolean',
'is_fragmento_centro_tratado' => 'boolean',
];
protected $fillable = [
'odontograma_arcada_id',
'dente_id',
'is_fragmento_esquerda_tratado',
'is_fragmento_cima_tratado',
'is_fragmento_direita_tratado',
'is_fragmento_baixo_tratado',
'is_fragmento_centro_tratado',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function odontogramaArcada()
{
return $this->belongsTo(AtendimentoSoapOdontogramaArcada::class);
}
public function dente()
{
return $this->belongsTo(Dente::class);
}
public function problemasCondicoes()
{
return $this->belongsToMany(
SaudeBucalDenteProblemaCondicao::class,
'ambulatorio_atendimento_soap_odontograma_arcada_dente_probema',
'odontograma_arcada_dente_id',
'problema_condicao_id'
)
->using(AtendimentoSoapOdontogramaArcadaDenteProblemaCondicao::class)
->as('denteProblemaCondicao')
->withTimestamps();
}
public function atendimentoProcedimentos()
{
return $this->hasMany(AtendimentoSoapOdontogramaArcadaDenteProcedimento::class, 'odontograma_arcada_dente_id');
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapOdontogramaArcadaDenteProblemaCondicao extends Pivot
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_arcada_dente_probema';
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,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontogramaArcadaDenteProcedimento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_arcada_dente_proc';
protected $fillable = [
'odontograma_arcada_dente_id',
'atendimento_procedimento_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function odontogramaArcadaDente()
{
return $this->belongsTo(AtendimentoSoapOdontogramaArcadaDente::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontogramaArcadaProcedimento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_arcada_procedimento';
protected $fillable = [
'odontograma_arcada_id',
'atendimento_procedimento_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function odontogramaArcada()
{
return $this->belongsTo(AtendimentoSoapOdontogramaArcada::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontogramaDenteSupranumerario extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_dente_supranumerario';
protected $fillable = [
'odontograma_id',
'local',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function odontograma()
{
return $this->belongsTo(AtendimentoSoapOdontograma::class);
}
public function atendimentoProcedimentos()
{
return $this->hasMany(AtendimentoSoapOdontogramaDenteSupranumerarioProcedimento::class, 'dente_supranumerario_id');
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOdontogramaDenteSupranumerarioProcedimento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_odontograma_dente_supranum_proc';
protected $fillable = [
'dente_supranumerario_id',
'atendimento_procedimento_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function denteSupranumerario()
{
return $this->belongsTo(AtendimentoSoapOdontogramaDenteSupranumerario::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapOrientacao extends Model
{
protected $table = 'ambulatorio_atendimento_soap_orientacao';
protected $fillable = [
'soap_id',
'descricao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapPerfilEpidemiologico 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,46 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapPrescricaoMedicamento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_prescricao_medicamento';
protected $casts = [
'solicitacao_fechada' => 'boolean',
];
protected $fillable = [
'soap_id',
'solicitacao_fechada',
'anamnese',
'diagnostico',
'tratamento_previo_status',
'tratamento_previo_relatar',
'unidade_usuario_id',
'infraestrutura_usuario_id',
'ocupacao_usuario_id',
'lotaca_usuario_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function itens()
{
return $this->hasMany(AtendimentoSoapPrescricaoMedicamentoItem::class, 'prescricao_medicamento_id');
}
}

View File

@@ -0,0 +1,226 @@
<?php
namespace App\Models\Ambulatorio;
use App\Enums\Ambulatorio\PrescricaoFrequenciaDose;
use App\Enums\Geral\MedidaTempo as MedidaTempoEnum;
use App\Models\Cadastro\Material\Material;
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
use App\Models\Cadastro\UnidadeMedida;
use App\Models\Geral\MedidaTempo;
use App\Models\Geral\Turno;
use App\Models\Model;
use Carbon\Carbon;
use Illuminate\Support\Str;
class AtendimentoSoapPrescricaoMedicamentoItem extends Model
{
protected $table = 'ambulatorio_atendimento_soap_prescricao_medicamento_item';
protected $casts = [
'inicio' => 'datetime:d/m/Y',
'tratamento_interrompido_em' => 'datetime:d/m/Y',
'is_dose_unica' => 'boolean',
'is_uso_continuo' => 'boolean',
'is_imprimir_separado' => 'boolean',
'is_remover_impressao' => 'boolean',
'tratamento_interrompido_from_rascunho' => 'boolean',
];
protected $fillable = [
'prescricao_medicamento_id',
'receita_tipo_id',
'descricao',
'justificativa',
'material_id',
'dose',
'unidade_medida_id',
'is_dose_unica',
'is_uso_continuo',
'is_imprimir_separado',
'is_remover_impressao',
'frequencia_vezes',
'turno_id',
'intervalo',
'intervalo_medida_tempo_id',
'inicio',
'duracao',
'duracao_medida_tempo_id',
'recomendacoes',
'tratamento_interrompido_from_rascunho',
'tratamento_interrompido_em',
'tratamento_interrompido_justificativa',
'tratamento_interrompido_soap_id',
'prescricao_medicamento_item_anterior_id',
];
protected $appends = [
'conclusao'
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function getIsManualAttribute()
{
return !is_null($this->descricao);
}
public function getIsTratamentoConcluidoAttribute()
{
return !$this->is_tratamento_interrompido
&& !is_null($this->conclusao)
&& Carbon::today()->isAfter($this->conclusao);
}
public function getIsTratamentoInterrompidoAttribute()
{
return !$this->tratamento_interrompido_from_rascunho && !is_null($this->tratamento_interrompido_em);
}
public function getPosologiaAttribute()
{
if ($this->is_manual) {
return null;
}
$posologia = '';
if ($this->is_dose_unica) {
$posologia .= ", dose única";
}
else {
$posologia .= $this->unidadeMedida ? " {$this->unidadeMedida->nome}" : " (dose)";
if (!is_null($this->frequencia_vezes)) {
$posologia .= ", {$this->frequencia_vezes} vez(es)";
if ($this->intervalo === 1 && $this->intervaloMedidaTempo->id === MedidaTempoEnum::DIAS) {
$posologia .= ' ao dia';
}
else {
$posologia .= " a cada {$this->intervalo} {$this->intervaloMedidaTempo->nome}";
}
}
else if (!is_null($this->turno_id)) {
$posologia .= ", pela {$this->turno->nome}";
if (!($this->intervalo === 1 && $this->intervaloMedidaTempo->id === MedidaTempoEnum::DIAS)) {
$posologia .= " a cada {$this->intervalo} {$this->intervaloMedidaTempo->nome}";
}
}
else {
$intervaloDescricao = $this->intervaloMedidaTempo->id === MedidaTempoEnum::HORAS
? ($this->intervalo > 1 ? "{$this->intervalo} {$this->intervaloMedidaTempo->nome}" : ' hora')
: "{$this->intervalo} {$this->intervaloMedidaTempo->nome}";
$posologia .= ", a cada {$intervaloDescricao}";
}
}
return "{$this->dose}" . Str::lower($posologia);
}
public function getFrequenciaDoseAttribute()
{
if (!is_null($this->frequencia_vezes)) {
return PrescricaoFrequenciaDose::FREQUENCIA;
}
else if (!is_null($this->turno_id)) {
return PrescricaoFrequenciaDose::TURNO;
}
else {
return PrescricaoFrequenciaDose::INTERVALO;
}
}
public function getConclusaoAttribute()
{
if ($this->is_dose_unica) {
return $this->inicio->copy();
}
switch ($this->duracao_medida_tempo_id) {
case MedidaTempoEnum::DIAS: {
return $this->inicio->copy()->addDays($this->duracao);
}
case MedidaTempoEnum::SEMANAS: {
return $this->inicio->copy()->addWeeks($this->duracao);
}
case MedidaTempoEnum::MESES: {
return $this->inicio->copy()->addMonths($this->duracao);
}
default: {
return null;
}
}
}
public function prescricaoMedicamento()
{
return $this->belongsTo(AtendimentoSoapPrescricaoMedicamento::class);
}
public function material()
{
return $this->belongsTo(Material::class);
}
public function turno()
{
return $this->belongsTo(Turno::class);
}
public function unidadeMedida()
{
return $this->belongsTo(UnidadeMedida::class);
}
public function intervaloMedidaTempo()
{
return $this->belongsTo(MedidaTempo::class);
}
public function duracaoMedidaTempo()
{
return $this->belongsTo(MedidaTempo::class);
}
public function tratamentoInterrompidoSoap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function prescricaoMedicamentoItemAnterior()
{
return $this->belongsTo(AtendimentoSoapPrescricaoMedicamentoItem::class);
}
public function lotacao()
{
return $this->belongsTo(lotacao::class, 'created_lotacao_id');
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\SujeitoAtencao\PacienteGestacao;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapProblemaCondicao extends Model
{
protected $table = 'ambulatorio_atendimento_soap_problema_condicao';
protected $casts = [
'inicio' => 'datetime:d/m/Y',
'fim' => 'datetime:d/m/Y',
'automatico' => 'boolean',
'resolvido_automaticamente' => 'boolean',
];
protected $fillable = [
'soap_id',
'ciap_id',
'cid_id',
'situacao_id',
'inicio',
'fim',
'observacao',
'paciente_gestacao_id',
'problema_condicao_anterior_id',
'automatico',
'resolvido_automaticamente',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function situacao()
{
return $this->belongsTo(ProblemaCondicaoSituacao::class);
}
public function pacienteGestacao()
{
return $this->belongsTo(PacienteGestacao::class);
}
public function problemaCondicaoAnterior()
{
return $this->belongsTo(AtendimentoSoapProblemaCondicao::class);
}
public function problemaCondicaoPosterior()
{
return $this->hasOne(AtendimentoSoapProblemaCondicao::class, 'problema_condicao_anterior_id');
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapProcedimentoAdministrativo extends Model
{
protected $table = 'ambulatorio_atendimento_soap_procedimento_administrativo';
protected $fillable = [
'soap_id',
'atendimento_procedimento_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapProcedimentoClinico extends Model
{
protected $table = 'ambulatorio_atendimento_soap_procedimento_clinico';
protected $fillable = [
'soap_id',
'atendimento_procedimento_id',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function atendimentoProcedimento()
{
return $this->belongsTo(AtendimentoProcedimento::class);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoap;
use App\Models\Model;
use App\Models\Sigtap\Procedimento;
class AtendimentoSoapProcedimentoEmad extends Model
{
protected $table = 'ambulatorio_atendimento_soap_procedimentos_emad';
protected $fillable = [
'soap_id',
'codigo_procedimento',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function procedimento() {
return $this->belongsTo(Procedimento::class, 'codigo_procedimento', 'codigo');
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapPuericulturaAlteracaoFenotipica extends Model
{
protected $table = 'ambulatorio_atendimento_soap_puericultura_alteracao_fenotipica';
protected $casts = [
'is_presente' => 'boolean',
];
protected $fillable = [
'soap_id',
'alteracao_fenotipica_id',
'is_presente',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function alteracaoFenotipica()
{
return $this->belongsTo(PuericulturaAlteracaoFenotipica::class);
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapPuericulturaFatorRisco extends Model
{
protected $table = 'ambulatorio_atendimento_soap_puericultura_fator_risco';
protected $casts = [
'is_presente' => 'boolean',
];
protected $fillable = [
'soap_id',
'fator_risco_id',
'is_presente',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function fatorRisco()
{
return $this->belongsTo(PuericulturaFatorRisco::class);
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapPuericulturaMarcoDesenvolvimento extends Model
{
protected $table = 'ambulatorio_atendimento_soap_puericultura_marco_desenvolvimento';
protected $casts = [
'is_presente' => 'boolean',
];
protected $fillable = [
'soap_id',
'marco_desenvolvimento_id',
'is_presente',
'alcancado_com_anos',
'alcancado_com_meses',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function marcoDesenvolvimento()
{
return $this->belongsTo(PuericulturaMarcoDesenvolvimento::class);
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapPuericulturaQuestionarioMChatR extends Model
{
protected $table = 'ambulatorio_atendimento_soap_puericultura_questionario_m_chat_r';
protected $fillable = [
'soap_id',
'questionario_m_chat_r_id',
'resposta',
];
protected $casts = [
'resposta' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function questionarioMChatR()
{
return $this->belongsTo(PuericulturaQuestionarioMChatR::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapRastreamento 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,56 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
use App\Models\Parametrizacao\Exame\Exame;
class AtendimentoSoapResultadoExame extends Model
{
protected $table = 'ambulatorio_atendimento_soap_resultado_exame';
protected $casts = [
'solicitado_em' => 'datetime:d/m/Y',
'realizado_em' => 'datetime:d/m/Y',
'resultado_em' => 'datetime:d/m/Y',
'dpp_eco' => 'datetime:d/m/Y',
];
protected $fillable = [
'soap_id',
'exame_id',
'solicitado_em',
'realizado_em',
'resultado_em',
'resultado',
'percentual',
'idade_gestacional_semanas_eco',
'idade_gestacional_dias_eco',
'dpp_eco',
'resultado_tipo_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function exame()
{
return $this->belongsTo(Exame::class);
}
public function resultadoTipo()
{
return $this->belongsTo(ExameResultadoTipo::class);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoap;
use App\Models\Model;
class AtendimentoSoapRiscoCardiovascularFramingham extends Model
{
protected $table = 'ambulatorio_atendimento_soap_risco_cardiovascular_framingham';
protected $fillable = [
'soap_id',
'colesterol_total',
'colesterol_hdl',
'toma_remedio_hipertensao',
'tabagista',
'diabetico',
];
protected $casts = [
'toma_remedio_hipertensao' => 'boolean',
'tabagista' => 'boolean',
'diabetico' => 'boolean',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapSaudeBucalFornecimento 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\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapSaudeBucalVigilancia 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,64 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapSolicitacaoExame extends Model
{
protected $table = 'ambulatorio_atendimento_soap_solicitacao_exame';
protected $casts = [
'alto_custo' => 'boolean',
];
protected $fillable = [
'soap_id',
'cid_id',
'ciap_id',
'justificativa',
'observacao',
'classificacao_risco_id',
'alto_custo',
'unidade_usuario_id',
'infraestrutura_usuario_id',
'ocupacao_usuario_id',
'lotaca_usuario_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function classificacaoRisco()
{
return $this->belongsTo(ClassificacaoRisco::class);
}
public function itens()
{
return $this->hasMany(AtendimentoSoapSolicitacaoExameItem::class, 'solicitacao_exame_id');
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Cadastro\Estabelecimento\Unidade;
use App\Models\Model;
use App\Models\Parametrizacao\Exame\Exame;
class AtendimentoSoapSolicitacaoExameItem extends Model
{
protected $table = 'ambulatorio_atendimento_soap_solicitacao_exame_item';
protected $casts = [
'descartado_exame_laboratorial' => 'boolean',
'agendado_exame_laboratorial' => 'boolean',
'data_agendada' => 'datetime:d/m/Y',
'descartado_exame_imagem' => 'boolean',
'agendado_exame_imagem' => 'boolean',
'faz_parte_oci' => 'boolean',
];
protected $fillable = [
'solicitacao_exame_id',
'exame_id',
'descartado_exame_laboratorial',
'agendado_exame_laboratorial',
'status_id',
'data_agendada',
'unidade_executora_id',
'ocupacao_executora_id',
'usuario_executor_nome',
'descartado_exame_imagem',
'agendado_exame_imagem',
'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 solicitacaoExame()
{
return $this->belongsTo(AtendimentoSoapSolicitacaoExame::class);
}
public function exame()
{
return $this->belongsTo(Exame::class);
}
public function status()
{
return $this->belongsTo(AtendimentoSoapSolicitacaoExameItemStatus::class);
}
public function unidadeExecutora()
{
return $this->belongsTo(Unidade::class);
}
}

View File

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

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapSolicitacaoProcedimentoCirurgico extends Model
{
protected $table = 'ambulatorio_atendimento_soap_solicitacao_proc_cirurgico';
protected $fillable = [
'soap_id',
'cid_id',
'ciap_id',
'classificacao_risco_id',
'justificativa',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function classificacaoRisco()
{
return $this->belongsTo(ClassificacaoRisco::class);
}
public function itens()
{
return $this->hasMany(AtendimentoSoapSolicitacaoProcedimentoCirurgicoItem::class, 'solicitacao_proc_cirurgico_id');
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
use App\Models\Parametrizacao\ProcedimentoCirurgico;
class AtendimentoSoapSolicitacaoProcedimentoCirurgicoItem extends Model
{
protected $table = 'ambulatorio_atendimento_soap_solicitacao_proc_cirurgico_item';
protected $fillable = [
'solicitacao_proc_cirurgico_id',
'procedimento_cirurgico_id',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function solicitacaoProcedimentoCirurgico()
{
return $this->belongsTo(AtendimentoSoapSolicitacaoProcedimentoCirurgico::class, 'solicitacao_proc_cirurgico_id');
}
public function procedimentoCirurgico()
{
return $this->belongsTo(ProcedimentoCirurgico::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapTesteRapido 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,37 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Model;
class AtendimentoSoapTriaHistorio extends Model
{
protected $table = 'ambulatorio_atendimento_soap_tria_historio';
protected $casts = [
'alimentos_acabaram' => 'boolean',
'comeu_alguns_alimentos' => 'boolean',
'data_atualizacao_tria' => 'date',
];
protected $fillable = [
'soap_id',
'alimentos_acabaram',
'comeu_alguns_alimentos',
'data_atualizacao_tria',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Pivot;
class AtendimentoSoapTriagemNeonatal 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,59 @@
<?php
namespace App\Models\Ambulatorio;
use App\Models\Ambulatorio\AtendimentoSoapTriagemNeonatalSolicitadoItem;
use App\Models\AtencaoBasica\AtendimentoIndividual\TriagemNeonatal;
use App\Models\Geral\Ciap;
use App\Models\Model;
use App\Models\Sigtap\Cid;
class AtendimentoSoapTriagemNeonatalSolicitado extends Model
{
protected $table = 'ambulatorio_atendimento_soap_triagem_neonatal_solicitado';
protected $fillable = [
'soap_id',
'cid_id',
'ciap_id',
'justificativa',
'observacao',
];
protected $hidden = [
'created_at',
'created_lotacao_id',
'created_centro_custo_id',
'updated_at',
'updated_lotacao_id',
'updated_centro_custo_id',
];
public function soap()
{
return $this->belongsTo(AtendimentoSoap::class);
}
public function cid()
{
return $this->belongsTo(Cid::class);
}
public function ciap()
{
return $this->belongsTo(Ciap::class);
}
public function triagensNeonatalSolicitados()
{
return $this->belongsToMany(
TriagemNeonatal::class,
'ambulatorio_atendimento_soap_triagem_neonatal_solicitado_item',
'soap_triagem_neonatal_id',
'triagem_neonatal_id'
)
->using(AtendimentoSoapTriagemNeonatalSolicitadoItem::class)
->as('soapTriagemNeonatalSolicitado')
->withTimestamps();
}
}

View File

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

Some files were not shown because too many files have changed in this diff Show More