This commit is contained in:
187
api/app/Models/ProntoAtendimento/Atendimento/Atendimento.php
Normal file
187
api/app/Models/ProntoAtendimento/Atendimento/Atendimento.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
use App\Models\PainelSenha\Fila;
|
||||
use App\Models\ProntoAtendimento\AssistenciaSocial\AssistenciaSocial;
|
||||
use App\Models\ProntoAtendimento\AssistenciaSocial\AssistenciaSocialHistorico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Historico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ExameImagem\AtendimentoExameImagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\FaaReabertura;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\FormularioDorToracica;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\PedidoExame;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Atendimento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento';
|
||||
|
||||
protected $fillable = [
|
||||
'faa_id',
|
||||
'fila_id',
|
||||
'dor_toracica',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'dor_toracica' => 'boolean',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function pedidosExames()
|
||||
{
|
||||
return $this->hasMany(PedidoExame::class);
|
||||
}
|
||||
|
||||
public function faa()
|
||||
{
|
||||
return $this->belongsTo(Faa::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function fila()
|
||||
{
|
||||
return $this->belongsTo(Fila::class);
|
||||
}
|
||||
|
||||
public function encaminhamentosHospitalar()
|
||||
{
|
||||
return $this->hasMany(EncaminhamentoHospitalar::class);
|
||||
}
|
||||
|
||||
public function recepcao()
|
||||
{
|
||||
return $this->hasOne(Recepcao::class);
|
||||
}
|
||||
|
||||
public function atendimentosTriagem()
|
||||
{
|
||||
return $this->hasMany(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function atendimentosMedico()
|
||||
{
|
||||
return $this->hasMany(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentosEnfermagem()
|
||||
{
|
||||
return $this->hasMany(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function atendimentosExameImagem()
|
||||
{
|
||||
return $this->hasMany(AtendimentoExameImagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacoes()
|
||||
{
|
||||
return $this->hasMany(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function avaliacoesAntropometricas()
|
||||
{
|
||||
return $this->hasMany(AvaliacaoAntropometrica::class);
|
||||
}
|
||||
|
||||
public function cids()
|
||||
{
|
||||
return $this->hasMany(Cid::class);
|
||||
}
|
||||
|
||||
public function classificacoesRisco()
|
||||
{
|
||||
return $this->hasMany(ClassificacaoRisco::class);
|
||||
}
|
||||
|
||||
public function gestacoes()
|
||||
{
|
||||
return $this->hasMany(Gestacao::class);
|
||||
}
|
||||
|
||||
public function historicosEnfermagem()
|
||||
{
|
||||
return $this->hasMany(Historico::class);
|
||||
}
|
||||
|
||||
public function medicamentosUso()
|
||||
{
|
||||
return $this->hasMany(MedicamentoUso::class);
|
||||
}
|
||||
|
||||
public function observacoes()
|
||||
{
|
||||
return $this->hasMany(Observacao::class);
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class);
|
||||
}
|
||||
|
||||
public function updatedLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class, 'updated_lotacao_id');
|
||||
}
|
||||
|
||||
public function assistenciaSocial()
|
||||
{
|
||||
return $this->hasMany(AssistenciaSocial::class);
|
||||
}
|
||||
|
||||
public function assistenciaSocialHistorico()
|
||||
{
|
||||
return $this->hasMany(AssistenciaSocialHistorico::class);
|
||||
}
|
||||
|
||||
public function formularioDorToracica()
|
||||
{
|
||||
return $this->belongsTo(FormularioDorToracica::class);
|
||||
}
|
||||
|
||||
public function faaReabertura()
|
||||
{
|
||||
return $this->belongsTo(FaaReabertura::class, 'faa_id');
|
||||
}
|
||||
|
||||
public function sinaisVitais()
|
||||
{
|
||||
return $this->hasMany(SinalVital::class);
|
||||
}
|
||||
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'atendimentosMedico',
|
||||
'avaliacoesAntropometricas',
|
||||
'cids',
|
||||
'classificacoesRisco',
|
||||
'pedidosExames',
|
||||
'gestacoes',
|
||||
'historicosEnfermagem',
|
||||
'medicamentosUso',
|
||||
'observacoes',
|
||||
'procedimentos',
|
||||
'recepcao',
|
||||
'sinaisVitais',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Cadastro\UnidadeMedida;
|
||||
use App\Models\Geral\TipoMedidaAltura;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Services\Geral\ImcService;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AvaliacaoAntropometrica extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_avaliacao_antropometrica';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'massa',
|
||||
'massa_unidade_medida_id',
|
||||
'altura_tipo_medida_id',
|
||||
'altura',
|
||||
'altura_unidade_medida_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'imc'
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function massaUnidadeMedida()
|
||||
{
|
||||
return $this->belongsTo(UnidadeMedida::class);
|
||||
}
|
||||
|
||||
public function alturaTipoMedida()
|
||||
{
|
||||
return $this->belongsTo(TipoMedidaAltura::class);
|
||||
}
|
||||
|
||||
public function alturaUnidadeMedida()
|
||||
{
|
||||
return $this->belongsTo(UnidadeMedida::class);
|
||||
}
|
||||
|
||||
public function getImcAttribute()
|
||||
{
|
||||
if (!is_null($this->massa) && !is_null($this->altura)) {
|
||||
|
||||
return ImcService::calculate(
|
||||
$this->massa_unidade_medida_id,
|
||||
$this->massa,
|
||||
$this->altura_unidade_medida_id,
|
||||
$this->altura
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
42
api/app/Models/ProntoAtendimento/Atendimento/Cat.php
Normal file
42
api/app/Models/ProntoAtendimento/Atendimento/Cat.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Cat extends Model
|
||||
{
|
||||
use SoftDeletes, CascadeSoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_cat';
|
||||
|
||||
protected $casts = [
|
||||
'paciente_sofreu_acidente_trabalho' => 'boolean',
|
||||
'paciente_portador_doenca_ocupacional' => 'boolean',
|
||||
'paciente_precisa_internacao' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'raat_id',
|
||||
'empresa_ocupacao_paciente',
|
||||
'paciente_sofreu_acidente_trabalho',
|
||||
'paciente_portador_doenca_ocupacional',
|
||||
'paciente_precisa_internacao',
|
||||
'dias_afastamento',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
}
|
||||
52
api/app/Models/ProntoAtendimento/Atendimento/Cid.php
Normal file
52
api/app/Models/ProntoAtendimento/Atendimento/Cid.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\Sigtap\Cid as SigtapCid;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Cid extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_cid';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_medico_id',
|
||||
'cid_id'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function cid()
|
||||
{
|
||||
return $this->belongsTo(SigtapCid::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\ClassificacaoRisco\ClassificacaoRisco as ProntoAtendimentoClassificacaoRisco;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ClassificacaoRisco extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_classificacao_risco';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'classificacao_risco_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function classificacaoRisco()
|
||||
{
|
||||
return $this->belongsTo(ProntoAtendimentoClassificacaoRisco::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
25
api/app/Models/ProntoAtendimento/Atendimento/Desfecho.php
Normal file
25
api/app/Models/ProntoAtendimento/Atendimento/Desfecho.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Desfecho extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_faa_desfecho';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function faas()
|
||||
{
|
||||
return $this->hasMany(Faa::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EncaminhamentoEspecialidade extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_encaminhamento_especialidade';
|
||||
|
||||
protected $fillable = [
|
||||
'ocupacao_id'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Unidade;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\Sigtap\Cid;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class EncaminhamentoHospitalar extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_encaminhamento_hospitalar';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'usuario_id',
|
||||
'unidade_id',
|
||||
'unidade_nome',
|
||||
'quarto',
|
||||
'leito',
|
||||
'cid_id',
|
||||
'medico_hospitalar',
|
||||
'observacoes',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function unidade()
|
||||
{
|
||||
return $this->belongsTo(Unidade::class);
|
||||
}
|
||||
|
||||
public function cid()
|
||||
{
|
||||
return $this->belongsTo(Cid::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
|
||||
class Anotacao extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem_anotacao';
|
||||
|
||||
protected $casts = [
|
||||
'anotado_em' => 'datetime:Y-m-d H:i',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_enfermagem_id',
|
||||
'anotado_em',
|
||||
'descricao'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\AvaliacaoAntropometrica;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ClassificacaoRisco;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Avaliacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Diagnostico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Historico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Implementacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Planejamento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\EscalaComaGlasgow;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Gestacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\MedicamentoUso;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\PrescricaoInternaAplicacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Procedimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ServicoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\SinalVital;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Item;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Laudo;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\PedidoExame;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AtendimentoEnfermagem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem';
|
||||
|
||||
protected $casts = [
|
||||
'simples' => 'boolean',
|
||||
'automatico' => 'boolean',
|
||||
'is_faa_assinada' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'plantao_id',
|
||||
'automatico',
|
||||
'is_faa_assinada',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function plantao()
|
||||
{
|
||||
return $this->belongsTo(Plantao::class);
|
||||
}
|
||||
|
||||
public function pedidosExames()
|
||||
{
|
||||
return $this->hasMany(PedidoExame::class);
|
||||
}
|
||||
|
||||
public function pedidoExameItems()
|
||||
{
|
||||
return $this->hasMany(Item::class);
|
||||
}
|
||||
|
||||
public function pedidoExameLaudos()
|
||||
{
|
||||
return $this->hasMany(Laudo::class);
|
||||
}
|
||||
|
||||
public function prescricaoInternaAplicacoes()
|
||||
{
|
||||
return $this->hasMany(PrescricaoInternaAplicacao::class);
|
||||
}
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function servicosEnfermagem()
|
||||
{
|
||||
return $this->hasMany(ServicoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function encaminhamentos()
|
||||
{
|
||||
return $this->hasMany(Encaminhamento::class);
|
||||
}
|
||||
|
||||
public function avaliacaoAntropometrica()
|
||||
{
|
||||
return $this->hasOne(AvaliacaoAntropometrica::class);
|
||||
}
|
||||
|
||||
public function classificacaoRisco()
|
||||
{
|
||||
return $this->hasOne(ClassificacaoRisco::class);
|
||||
}
|
||||
|
||||
public function medicamentoUso()
|
||||
{
|
||||
return $this->hasOne(MedicamentoUso::class);
|
||||
}
|
||||
|
||||
public function gestacao()
|
||||
{
|
||||
return $this->hasOne(Gestacao::class);
|
||||
}
|
||||
|
||||
public function observacao()
|
||||
{
|
||||
return $this->hasOne(Observacao::class);
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class);
|
||||
}
|
||||
|
||||
public function sinaisVitais()
|
||||
{
|
||||
return $this->hasMany(SinalVital::class);
|
||||
}
|
||||
|
||||
public function anotacoes()
|
||||
{
|
||||
return $this->hasMany(Anotacao::class);
|
||||
}
|
||||
|
||||
public function historico()
|
||||
{
|
||||
return $this->hasOne(Historico::class);
|
||||
}
|
||||
|
||||
public function diagnostico()
|
||||
{
|
||||
return $this->hasOne(Diagnostico::class);
|
||||
}
|
||||
|
||||
public function planejamento()
|
||||
{
|
||||
return $this->hasOne(Planejamento::class);
|
||||
}
|
||||
|
||||
public function implementacao()
|
||||
{
|
||||
return $this->hasOne(Implementacao::class);
|
||||
}
|
||||
|
||||
public function avaliacao()
|
||||
{
|
||||
return $this->hasOne(Avaliacao::class);
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class);
|
||||
}
|
||||
|
||||
public function escalasComaGlasgow()
|
||||
{
|
||||
return $this->hasMany(EscalaComaGlasgow::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'pedidosExames',
|
||||
'pedidoExameItems',
|
||||
'pedidoExameLaudos',
|
||||
'encaminhamentos',
|
||||
'avaliacaoAntropometrica',
|
||||
'classificacaoRisco',
|
||||
'gestacao',
|
||||
'procedimentos',
|
||||
'sinaisVitais',
|
||||
'anotacoes',
|
||||
'historico',
|
||||
'diagnostico',
|
||||
'planejamento',
|
||||
'implementacao',
|
||||
'avaliacao',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Avaliacao extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem_avaliacao';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Diagnostico extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem_diagnostico';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Historico extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Implementacao extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem_implementacao';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Enfermagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Planejamento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_enfermagem_planejamento';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Geral\GlasgowAberturaOcular;
|
||||
use App\Models\Geral\GlasgowReatividadePupilar;
|
||||
use App\Models\Geral\GlasgowRespostaMotora;
|
||||
use App\Models\Geral\GlasgowRespostaVerbal;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
|
||||
class EscalaComaGlasgow extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_escala_coma_glasgow';
|
||||
|
||||
protected $fillable = [
|
||||
'paciente_observacao_id',
|
||||
'abertura_ocular_id',
|
||||
'resposta_verbal_id',
|
||||
'resposta_motora_id',
|
||||
'reatividade_pupilar_id',
|
||||
'observacao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function aberturaOcular()
|
||||
{
|
||||
return $this->belongsTo(GlasgowAberturaOcular::class);
|
||||
}
|
||||
|
||||
public function respostaVerbal()
|
||||
{
|
||||
return $this->belongsTo(GlasgowRespostaVerbal::class);
|
||||
}
|
||||
|
||||
public function respostaMotora()
|
||||
{
|
||||
return $this->belongsTo(GlasgowRespostaMotora::class);
|
||||
}
|
||||
|
||||
public function reatividadePupilar()
|
||||
{
|
||||
return $this->belongsTo(GlasgowReatividadePupilar::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\ExameImagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Procedimento;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Item;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Laudo;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\PedidoExame;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AtendimentoExameImagem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_exame_imagem';
|
||||
|
||||
protected $casts = [
|
||||
'is_observacao' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'is_observacao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function observacao()
|
||||
{
|
||||
return $this->hasOne(Observacao::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pedidosExames()
|
||||
{
|
||||
return $this->hasMany(PedidoExame::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pedidoExameItems()
|
||||
{
|
||||
return $this->hasMany(Item::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pedidoExameLaudos()
|
||||
{
|
||||
return $this->hasMany(Laudo::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'observacao',
|
||||
'pedidosExames',
|
||||
'pedidoExameItems',
|
||||
'pedidoExameLaudos'
|
||||
]);
|
||||
}
|
||||
}
|
||||
114
api/app/Models/ProntoAtendimento/Atendimento/Faa.php
Normal file
114
api/app/Models/ProntoAtendimento/Atendimento/Faa.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Faa extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_faa';
|
||||
|
||||
protected $casts = [
|
||||
'finalizado' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'numero',
|
||||
'paciente_id',
|
||||
'desfecho_id',
|
||||
'finalizado',
|
||||
'usuario_id',
|
||||
'lotacao_id',
|
||||
'data_hora_desfecho',
|
||||
'motivo_cancelamento_evasao',
|
||||
'motivo_cancelamento',
|
||||
'cancelado',
|
||||
'canceled_desfecho_lotacao_id'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->numero = DB::table('pronto_atendimento_faa')->max('numero') + 1;
|
||||
});
|
||||
|
||||
static::updating(function ($model) {
|
||||
if (!is_null($model->desfecho_id)) {
|
||||
$model->motivo_cancelamento_evasao = null;
|
||||
$model->finalizado = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function paciente()
|
||||
{
|
||||
return $this->belongsTo(Paciente::class);
|
||||
}
|
||||
|
||||
public function desfecho()
|
||||
{
|
||||
return $this->belongsTo(Desfecho::class);
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function lotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function raat()
|
||||
{
|
||||
return $this->hasOne(Raat::class);
|
||||
}
|
||||
|
||||
public function cat()
|
||||
{
|
||||
return $this->hasOne(Cat::class);
|
||||
}
|
||||
|
||||
public function atendimentos()
|
||||
{
|
||||
return $this->hasMany(Atendimento::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function getIsRaatAbertaAttribute()
|
||||
{
|
||||
return !is_null($this->raat);
|
||||
}
|
||||
|
||||
public function getIsCatAbertaAttribute()
|
||||
{
|
||||
return !is_null($this->cat);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Faa;
|
||||
|
||||
class FaaReabertura extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_faa_reabertura';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'faa_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function faa()
|
||||
{
|
||||
return $this->belongsTo(Faa::class);
|
||||
}
|
||||
}
|
||||
85
api/app/Models/ProntoAtendimento/Atendimento/Gestacao.php
Normal file
85
api/app/Models/ProntoAtendimento/Atendimento/Gestacao.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Services\Geral\GestacaoService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Gestacao extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_gestacao';
|
||||
|
||||
protected $casts = [
|
||||
'gestante' => 'boolean',
|
||||
'dum' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'gestante',
|
||||
'dum',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'idade_gestacional',
|
||||
'dpp'
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function getIdadeGestacionalAttribute()
|
||||
{
|
||||
if (!is_null($this->dum)) {
|
||||
|
||||
return GestacaoService::getIdadeGestacional($this->dum);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDppAttribute()
|
||||
{
|
||||
if (!is_null($this->dum)) {
|
||||
|
||||
$dum = GestacaoService::getDataPrevistaParto(Carbon::parse($this->dum))->toDateString();
|
||||
return Carbon::create($dum)->format('d/m/Y');
|
||||
}
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MedicamentoUso extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medicamento_uso';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\AvaliacaoAntropometrica;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Cid;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ClassificacaoRisco;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Desfecho;
|
||||
use App\Models\ProntoAtendimento\Atendimento\EncaminhamentoHospitalar;
|
||||
use App\Models\ProntoAtendimento\Atendimento\EscalaComaGlasgow;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Gestacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\MedicamentoUso;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\PrescricaoInterna;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Procedimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\RaatParecerMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ServicoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\SinalVital;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\PedidoExame;
|
||||
use App\Models\ProntoAtendimento\Plantao\Plantao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AtendimentoMedico extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medico';
|
||||
|
||||
protected $casts = [
|
||||
'simples' => 'boolean',
|
||||
'is_observacao' => 'boolean',
|
||||
'data_hora_proxima_reavaliacao' => 'datetime:d/m/Y H:i',
|
||||
'is_faa_assinada' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'plantao_id',
|
||||
'simples',
|
||||
'evolucao',
|
||||
'queixa_principal_duracao',
|
||||
'historia',
|
||||
'exame_fisico',
|
||||
'diagnostico',
|
||||
'conduta',
|
||||
'observacoes_enfermagem',
|
||||
'data_hora_proxima_reavaliacao',
|
||||
'atendimento_geral',
|
||||
'orientacoes',
|
||||
'desfecho_id',
|
||||
'is_observacao',
|
||||
'is_faa_assinada',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $append = [
|
||||
'solicitou_reavaliacao',
|
||||
];
|
||||
|
||||
public function plantao()
|
||||
{
|
||||
return $this->belongsTo(Plantao::class);
|
||||
}
|
||||
|
||||
public function desfecho()
|
||||
{
|
||||
return $this->belongsTo(Desfecho::class);
|
||||
}
|
||||
|
||||
public function pedidosExames()
|
||||
{
|
||||
return $this->hasMany(PedidoExame::class);
|
||||
}
|
||||
|
||||
public function servicosEnfermagem()
|
||||
{
|
||||
return $this->hasMany(ServicoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function raatParecerMedico()
|
||||
{
|
||||
return $this->hasOne(RaatParecerMedico::class);
|
||||
}
|
||||
|
||||
public function atestado()
|
||||
{
|
||||
return $this->hasOne(Atestado::class);
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class);
|
||||
}
|
||||
|
||||
public function encaminhamentos()
|
||||
{
|
||||
return $this->hasMany(Encaminhamento::class);
|
||||
}
|
||||
|
||||
public function receita()
|
||||
{
|
||||
return $this->hasOne(Receita::class);
|
||||
}
|
||||
|
||||
public function prescricoesInternas()
|
||||
{
|
||||
return $this->hasMany(PrescricaoInterna::class);
|
||||
}
|
||||
|
||||
public function avaliacaoAntropometrica()
|
||||
{
|
||||
return $this->hasOne(AvaliacaoAntropometrica::class);
|
||||
}
|
||||
|
||||
public function cid()
|
||||
{
|
||||
return $this->hasOne(Cid::class);
|
||||
}
|
||||
|
||||
public function classificacaoRisco()
|
||||
{
|
||||
return $this->hasOne(ClassificacaoRisco::class);
|
||||
}
|
||||
|
||||
public function gestacao()
|
||||
{
|
||||
return $this->hasOne(Gestacao::class);
|
||||
}
|
||||
|
||||
public function encaminhamentoHospitalar()
|
||||
{
|
||||
return $this->hasOne(EncaminhamentoHospitalar::class);
|
||||
}
|
||||
|
||||
public function medicamentosUso()
|
||||
{
|
||||
return $this->hasMany(MedicamentoUso::class);
|
||||
}
|
||||
|
||||
public function observacao()
|
||||
{
|
||||
return $this->hasOne(Observacao::class);
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class);
|
||||
}
|
||||
|
||||
public function sinaisVitais()
|
||||
{
|
||||
return $this->hasMany(SinalVital::class);
|
||||
}
|
||||
|
||||
public function getSolicitouReavaliacaoAttribute()
|
||||
{
|
||||
return $this->desfecho_id === null;
|
||||
}
|
||||
|
||||
public function escalasComaGlasgow()
|
||||
{
|
||||
return $this->hasMany(EscalaComaGlasgow::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'pedidosExames',
|
||||
'atestado',
|
||||
'avaliacaoAntropometrica',
|
||||
'cid',
|
||||
'classificacaoRisco',
|
||||
'declaracoesComparecimento',
|
||||
'encaminhamentos',
|
||||
'gestacao',
|
||||
'medicamentosUso',
|
||||
'observacao',
|
||||
'procedimentos',
|
||||
'raatParecerMedico',
|
||||
'receitas',
|
||||
'sinaisVitais',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoMedicoTipo extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Geral\DocumentoTipo;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Atestado extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_atestado';
|
||||
|
||||
protected $casts = [
|
||||
'imprime_cid' => 'boolean',
|
||||
'paciente' => 'boolean',
|
||||
'horario_inicial' => 'datetime:H:i',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'modelo_id',
|
||||
'imprime_cid',
|
||||
'dias',
|
||||
'quantidade_horas',
|
||||
'horario_inicial',
|
||||
'documento_tipo_id',
|
||||
'documento_numero',
|
||||
'paciente',
|
||||
'nome_acompanhante',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function documentoTipo()
|
||||
{
|
||||
return $this->belongsTo(DocumentoTipo::class);
|
||||
}
|
||||
|
||||
public function modelo()
|
||||
{
|
||||
return $this->belongsTo(AtestadoModelo::class, 'modelo_id');
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AtestadoModelo extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atestado_modelo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function atestados()
|
||||
{
|
||||
return $this->hasMany(Atestado::class, 'modelo_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Geral\DocumentoTipo;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ExameImagem\AtendimentoExameImagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Recepcao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DeclaracaoComparecimento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_declaracao_comparecimento';
|
||||
|
||||
protected $casts = [
|
||||
'de' => 'datetime:Y-m-d H:i:s',
|
||||
'ate' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'tipo_id',
|
||||
'nome',
|
||||
'documento_tipo_id',
|
||||
'documento_numero',
|
||||
'de',
|
||||
'ate',
|
||||
'motivo'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoExameImagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoExameImagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function recepcao()
|
||||
{
|
||||
return $this->belongsTo(Recepcao::class, 'atendimento_recepcao_id');
|
||||
}
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(DeclaracaoComparecimentoTipo::class);
|
||||
}
|
||||
|
||||
public function documentoTipo()
|
||||
{
|
||||
return $this->belongsTo(DocumentoTipo::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class DeclaracaoComparecimentoTipo extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_declaracao_comparecimento_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function declaracoesComparecimentos()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\Sigtap\Ocupacao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Encaminhamento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_encaminhamento';
|
||||
|
||||
protected $casts = [
|
||||
'urgente' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'urgente',
|
||||
'ocupacao_id',
|
||||
'motivo',
|
||||
'observacoes'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function ocupacao()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Cadastro\Medicamento\ReceitaTipo;
|
||||
use App\Models\Model;
|
||||
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Receita extends Model
|
||||
{
|
||||
use SoftDeletes, CascadeSoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_receita';
|
||||
|
||||
protected $cascadeDeletes = [
|
||||
'medicamentos'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'imprime_cid' => 'boolean',
|
||||
'is_assinada' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'tipo_id',
|
||||
'is_assinada',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'medicamentos',
|
||||
];
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(ReceitaTipo::class);
|
||||
}
|
||||
|
||||
public function medicamentos()
|
||||
{
|
||||
return $this->hasMany(ReceitaMedicamento::class);
|
||||
}
|
||||
|
||||
public function receitasAssinadas()
|
||||
{
|
||||
return $this->hasMany(ReceitaAssinada::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ReceitaAssinada extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_receita_assinada';
|
||||
|
||||
protected $fillable = [
|
||||
'ordem',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function receita()
|
||||
{
|
||||
return $this->belongsTo(Receita::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Medico;
|
||||
|
||||
use App\Enums\Cadastro\MedidaTempo as CadastroMedidaTempo;
|
||||
use App\Models\Cadastro\Medicamento\FormaFarmaceutica;
|
||||
use App\Models\Cadastro\Medicamento\Medicamento;
|
||||
use App\Models\Cadastro\Medicamento\ViaAdministracao;
|
||||
use App\Models\Geral\MedidaTempo;
|
||||
use App\Models\Geral\Turno;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ReceitaMedicamento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_medico_receita_medicamento';
|
||||
|
||||
protected $fillable = [
|
||||
'medicamento_id',
|
||||
'via_administracao_outras',
|
||||
'quantidade',
|
||||
'intervalo_tempo',
|
||||
'intervalo_medida_tempo_id',
|
||||
'turno_id',
|
||||
'durante_tempo',
|
||||
'durante_medida_tempo_id',
|
||||
'recomendacoes',
|
||||
'descricao',
|
||||
'medicamento_manual',
|
||||
'prescricao_manual',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'dose_unica',
|
||||
'posologia_por_frequencia',
|
||||
'posologia_por_turno',
|
||||
'posologia',
|
||||
'uso_continuo',
|
||||
'livre',
|
||||
];
|
||||
|
||||
public function receita()
|
||||
{
|
||||
return $this->belongsTo(Receita::class);
|
||||
}
|
||||
|
||||
public function medicamento()
|
||||
{
|
||||
return $this->belongsTo(Medicamento::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function viaAdministracao()
|
||||
{
|
||||
return $this->belongsTo(ViaAdministracao::class);
|
||||
}
|
||||
|
||||
public function formaFarmaceutica()
|
||||
{
|
||||
return $this->belongsTo(FormaFarmaceutica::class);
|
||||
}
|
||||
|
||||
public function intervaloMedidaTempo()
|
||||
{
|
||||
return $this->belongsTo(MedidaTempo::class);
|
||||
}
|
||||
|
||||
public function turno()
|
||||
{
|
||||
return $this->belongsTo(Turno::class);
|
||||
}
|
||||
|
||||
public function duranteMedidaTempo()
|
||||
{
|
||||
return $this->belongsTo(MedidaTempo::class);
|
||||
}
|
||||
|
||||
public function getLivreAttribute()
|
||||
{
|
||||
return !is_null($this->descricao);
|
||||
}
|
||||
|
||||
public function getDoseUnicaAttribute()
|
||||
{
|
||||
return !$this->livre
|
||||
&& !$this->posologia_por_frequencia
|
||||
&& !$this->posologia_por_turno
|
||||
&& is_null($this->durante_tempo)
|
||||
&& is_null($this->durante_medida_tempo_id);
|
||||
}
|
||||
|
||||
public function getPosologiaPorFrequenciaAttribute()
|
||||
{
|
||||
return !is_null($this->intervalo_tempo)
|
||||
&& !is_null($this->intervalo_medida_tempo_id);
|
||||
}
|
||||
|
||||
public function getPosologiaPorTurnoAttribute()
|
||||
{
|
||||
return !is_null($this->turno_id);
|
||||
}
|
||||
|
||||
public function getUsoContinuoAttribute()
|
||||
{
|
||||
return !$this->livre
|
||||
&& !$this->dose_unica
|
||||
&& is_null($this->durante_tempo)
|
||||
&& is_null($this->durante_medida_tempo_id);
|
||||
}
|
||||
|
||||
public function getQuantidadeAttribute($value)
|
||||
{
|
||||
return str_replace('.', ',', $value);
|
||||
}
|
||||
|
||||
public function getPosologiaAttribute()
|
||||
{
|
||||
$unidadeMedida = $this->medicamento ? $this->medicamento->unidadeMedida->nome : null;
|
||||
$posologia = "{$this->quantidade} {$unidadeMedida}";
|
||||
|
||||
if ($this->dose_unica) {
|
||||
|
||||
return $posologia;
|
||||
}
|
||||
|
||||
if ($this->posologia_por_frequencia) {
|
||||
|
||||
if ($this->intervaloMedidaTempo->id === CadastroMedidaTempo::MINUTOS || $this->intervaloMedidaTempo->id === CadastroMedidaTempo::HORAS) {
|
||||
|
||||
$posologia .= " a cada {$this->intervalo_tempo} {$this->intervaloMedidaTempo->nome}";
|
||||
}
|
||||
else if ($this->intervaloMedidaTempo->id === CadastroMedidaTempo::DIAS || $this->intervaloMedidaTempo->id === CadastroMedidaTempo::SEMANAS || $this->intervaloMedidaTempo->id === CadastroMedidaTempo::MESES) {
|
||||
|
||||
$posologia .= " {$this->intervalo_tempo} vez(es) ao {$this->intervaloMedidaTempo->nome}";
|
||||
}
|
||||
}
|
||||
else if ($this->posologia_por_turno) {
|
||||
|
||||
$posologia .= " pela {$this->turno->nome}";
|
||||
}
|
||||
|
||||
if (!$this->uso_continuo && !$this->livre && is_object($this->duranteMedidaTempo)) {
|
||||
$posologia .= " durante {$this->durante_tempo} {$this->duranteMedidaTempo->nome}";
|
||||
}
|
||||
|
||||
|
||||
return $posologia;
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
67
api/app/Models/ProntoAtendimento/Atendimento/Observacao.php
Normal file
67
api/app/Models/ProntoAtendimento/Atendimento/Observacao.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ExameImagem\AtendimentoExameImagem;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Observacao extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_observacao';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_recepcao_id',
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'exame_imagem_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoRecepcao()
|
||||
{
|
||||
return $this->belongsTo(Recepcao::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoExameImagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoExameImagem::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Observacao;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\AvaliacaoAntropometrica;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ClassificacaoRisco;
|
||||
use App\Models\ProntoAtendimento\Atendimento\EncaminhamentoHospitalar;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Anotacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Avaliacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Diagnostico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Historico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Implementacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Planejamento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\EscalaComaGlasgow;
|
||||
use App\Models\ProntoAtendimento\Atendimento\MedicamentoUso;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\PacienteTraumaStatus;
|
||||
use App\Models\ProntoAtendimento\Atendimento\PrescricaoInternaAplicacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Procedimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ServicoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\SinalVital;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Item;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Laudo;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\PedidoExame;
|
||||
use App\Models\ProntoAtendimento\Plantao\Plantao;
|
||||
|
||||
class PacienteObservacao extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_paciente_observacao';
|
||||
|
||||
protected $casts = [
|
||||
'aguardando_vaga_hospitalar' => 'boolean',
|
||||
'is_faa_assinada' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'plantao_id',
|
||||
'quarto',
|
||||
'leito',
|
||||
'aguardando_vaga_hospitalar',
|
||||
'hemorragia_externa_grave_trauma_status_id',
|
||||
'hemorragia_externa_grave_local',
|
||||
'vias_aerias_trauma_status_id',
|
||||
'vias_aerias_obstrucao_por',
|
||||
'oxigenacao_respiracao_ventilacao_trauma_status_id',
|
||||
'pulso_trauma_status_id',
|
||||
'pele_trauma_status_id',
|
||||
'pele_alteracao',
|
||||
'perfuracao_trauma_status_id',
|
||||
'perfuracao_lentificada',
|
||||
'sangramento_trauma_status_id',
|
||||
'sangramento_local',
|
||||
'pupilas_trauma_status_id',
|
||||
'paresias_trauma_status_id',
|
||||
'plegia_trauma_status_id',
|
||||
'exposicao_hipotermia_trauma_status_id',
|
||||
'exposicao_hipotermia_observacao',
|
||||
'avaliacao_cabeca_pescoco',
|
||||
'avaliacao_torax',
|
||||
'avaliacao_abdome',
|
||||
'avaliacao_mmss_mmii',
|
||||
'observacao',
|
||||
'is_faa_assinada',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function plantao()
|
||||
{
|
||||
return $this->belongsTo(Plantao::class);
|
||||
}
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function classificacaoRisco()
|
||||
{
|
||||
return $this->hasOne(ClassificacaoRisco::class);
|
||||
}
|
||||
|
||||
public function medicamentoUso()
|
||||
{
|
||||
return $this->hasOne(MedicamentoUso::class);
|
||||
}
|
||||
|
||||
public function pedidosExames()
|
||||
{
|
||||
return $this->hasMany(PedidoExame::class);
|
||||
}
|
||||
|
||||
public function pedidoExameItems()
|
||||
{
|
||||
return $this->hasMany(Item::class);
|
||||
}
|
||||
|
||||
public function pedidoExameLaudos()
|
||||
{
|
||||
return $this->hasMany(Laudo::class);
|
||||
}
|
||||
|
||||
public function escalasComaGlasgow()
|
||||
{
|
||||
return $this->hasMany(EscalaComaGlasgow::class);
|
||||
}
|
||||
|
||||
public function sinaisVitais()
|
||||
{
|
||||
return $this->hasMany(SinalVital::class);
|
||||
}
|
||||
|
||||
public function anotacoes()
|
||||
{
|
||||
return $this->hasMany(Anotacao::class);
|
||||
}
|
||||
|
||||
public function historico()
|
||||
{
|
||||
return $this->hasOne(Historico::class);
|
||||
}
|
||||
|
||||
public function diagnostico()
|
||||
{
|
||||
return $this->hasOne(Diagnostico::class);
|
||||
}
|
||||
|
||||
public function planejamento()
|
||||
{
|
||||
return $this->hasOne(Planejamento::class);
|
||||
}
|
||||
|
||||
public function implementacao()
|
||||
{
|
||||
return $this->hasOne(Implementacao::class);
|
||||
}
|
||||
|
||||
public function avaliacao()
|
||||
{
|
||||
return $this->hasOne(Avaliacao::class);
|
||||
}
|
||||
|
||||
public function prescricaoInternaAplicacoes()
|
||||
{
|
||||
return $this->hasMany(PrescricaoInternaAplicacao::class);
|
||||
}
|
||||
|
||||
public function avaliacaoAntropometrica()
|
||||
{
|
||||
return $this->hasOne(AvaliacaoAntropometrica::class);
|
||||
}
|
||||
|
||||
public function servicosEnfermagem()
|
||||
{
|
||||
return $this->hasMany(ServicoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class);
|
||||
}
|
||||
|
||||
public function hemorragiaExternaGrave()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'hemorragia_externa_grave_trauma_status_id');
|
||||
}
|
||||
|
||||
public function viasAerias()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'vias_aerias_trauma_status_id');
|
||||
}
|
||||
|
||||
public function oxigenacaoRespiracaoVentilacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'oxigenacao_respiracao_ventilacao_trauma_status_id');
|
||||
}
|
||||
|
||||
public function pulso()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'pulso_trauma_status_id');
|
||||
}
|
||||
|
||||
public function pele()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'pele_trauma_status_id');
|
||||
}
|
||||
|
||||
public function perfuracao()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'perfuracao_trauma_status_id');
|
||||
}
|
||||
|
||||
public function sangramento()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'sangramento_trauma_status_id');
|
||||
}
|
||||
|
||||
public function pupilas()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'pupilas_trauma_status_id');
|
||||
}
|
||||
|
||||
public function paresias()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'paresias_trauma_status_id');
|
||||
}
|
||||
|
||||
public function plegia()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'plegia_trauma_status_id');
|
||||
}
|
||||
|
||||
public function exposicaoHipotermia()
|
||||
{
|
||||
return $this->belongsTo(PacienteTraumaStatus::class, 'exposicao_hipotermia_trauma_status_id');
|
||||
}
|
||||
|
||||
public function encaminhamentoHospitalar()
|
||||
{
|
||||
return $this->hasOne(EncaminhamentoHospitalar::class);
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class OrigemEntrada extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_origem_entrada';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function recepcoes()
|
||||
{
|
||||
return $this->hasMany(Recepcao::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class PacienteTraumaStatus extends Model
|
||||
{
|
||||
protected $table = "pronto_atendimento_paciente_trauma_status";
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Geral\MedidaTempo;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\PrescricaoInternaAplicacao;
|
||||
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PrescricaoInterna extends Model
|
||||
{
|
||||
use SoftDeletes, CascadeSoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_prescricao_interna';
|
||||
|
||||
protected $cascadeDeletes = [
|
||||
'medicamentos'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_medico_id',
|
||||
'frequencia_quantidade_vezes',
|
||||
'frequencia_tempo',
|
||||
'frequencia_medida_tempo_id',
|
||||
'observacoes',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'medicamentos'
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'dose_unica'
|
||||
];
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function frequenciaMedidaTempo()
|
||||
{
|
||||
return $this->belongsTo(MedidaTempo::class);
|
||||
}
|
||||
|
||||
public function medicamentos()
|
||||
{
|
||||
return $this->hasMany(PrescricaoInternaMedicamento::class);
|
||||
}
|
||||
|
||||
public function aplicacoes()
|
||||
{
|
||||
return $this->hasMany(PrescricaoInternaAplicacao::class);
|
||||
}
|
||||
|
||||
public function getDoseUnicaAttribute()
|
||||
{
|
||||
return is_null($this->frequencia_quantidade_vezes)
|
||||
&& is_null($this->frequencia_tempo)
|
||||
&& is_null($this->frequencia_medida_tempo_id);
|
||||
}
|
||||
|
||||
public function getFrequenciaAttribute()
|
||||
{
|
||||
if ($this->dose_unica) {
|
||||
|
||||
return 'Dose única';
|
||||
}
|
||||
|
||||
$labelAplicacao = $this->frequencia_quantidade_vezes > 1 ? 'aplicações' : 'aplicação';
|
||||
$frequenciaNome = Str::lower($this->frequenciaMedidaTempo->nome);
|
||||
|
||||
if ($this->frequencia_tempo < 2) {
|
||||
|
||||
$frequenciaNome = str_replace('(s)', '', $frequenciaNome);
|
||||
}
|
||||
|
||||
return "{$this->frequencia_quantidade_vezes} {$labelAplicacao} uma a cada {$this->frequencia_tempo} "
|
||||
. "{$frequenciaNome}";
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
// Relations.
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class PrescricaoInternaAplicacao extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_prescricao_interna_aplicacao';
|
||||
|
||||
protected $fillable = [
|
||||
'prescricao_interna_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'status_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function prescricaoInterna()
|
||||
{
|
||||
return $this->belongsTo(PrescricaoInterna::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Cadastro\Medicamento\Medicamento;
|
||||
use App\Models\Cadastro\UnidadeMedida;
|
||||
|
||||
class PrescricaoInternaMedicamento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_prescricao_interna_medicamento';
|
||||
|
||||
protected $fillable = [
|
||||
'medicamento_id',
|
||||
'unidade_medida_id',
|
||||
'quantidade',
|
||||
'administracao'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function prescricaoInterna()
|
||||
{
|
||||
return $this->belongsTo(PrescricaoInterna::class);
|
||||
}
|
||||
|
||||
public function medicamento()
|
||||
{
|
||||
return $this->belongsTo(Medicamento::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function unidadeMedida()
|
||||
{
|
||||
return $this->belongsTo(UnidadeMedida::class);
|
||||
}
|
||||
|
||||
public function aplicacoes() {
|
||||
return $this->hasMany(PrescricaoInternaMedicamentoAplicacao::class);
|
||||
}
|
||||
|
||||
public function getQuantidadeAttribute($value)
|
||||
{
|
||||
return str_replace('.', ',', $value);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
// Relations.
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Parametrizacao\Exame\ExameStatus;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\PrescricaoInternaLocalAplicacao;
|
||||
|
||||
class PrescricaoInternaMedicamentoAplicacao extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_prescricao_interna_aplicacao';
|
||||
|
||||
protected $fillable = [
|
||||
'prescricao_interna_medicamento_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'status_id',
|
||||
'horario_aplicacao',
|
||||
'local_aplicacao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function prescricaoInternaMedicamento()
|
||||
{
|
||||
return $this->belongsTo(PrescricaoInternaMedicamento::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(ExameStatus::class);
|
||||
}
|
||||
|
||||
public function localAplicacao()
|
||||
{
|
||||
return $this->belongsTo(PrescricaoInternaLocalAplicacao::class);
|
||||
}
|
||||
}
|
||||
140
api/app/Models/ProntoAtendimento/Atendimento/Procedimento.php
Normal file
140
api/app/Models/ProntoAtendimento/Atendimento/Procedimento.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ExameImagem\AtendimentoExameImagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
use App\Models\ProntoAtendimento\Plantao\Plantao;
|
||||
use App\Models\Sigtap\Cid as SigtapCid;
|
||||
use App\Models\Sigtap\Procedimento as SigtapProcedimento;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Procedimento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_procedimento';
|
||||
|
||||
protected $casts = [
|
||||
'is_parametrizado' => 'boolean',
|
||||
'realizado_em' => 'date:d/m/Y'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'exame_imagem_id',
|
||||
'bpa_procedimento_id',
|
||||
'procedimento_id',
|
||||
'realizado_em',
|
||||
'lotacao_id',
|
||||
'cid_principal_id',
|
||||
'cid_secundario_id',
|
||||
'quantidade',
|
||||
'is_parametrizado',
|
||||
'plantao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function lotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoExameImagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoExameImagem::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function procedimento()
|
||||
{
|
||||
return $this->belongsTo(SigtapProcedimento::class);
|
||||
}
|
||||
|
||||
public function cidPrincipal()
|
||||
{
|
||||
return $this->belongsTo(SigtapCid::class);
|
||||
}
|
||||
|
||||
public function cidSecundario()
|
||||
{
|
||||
return $this->belongsTo(SigtapCid::class);
|
||||
}
|
||||
|
||||
public function plantao()
|
||||
{
|
||||
return $this->belongsTo(Plantao::class);
|
||||
}
|
||||
|
||||
public function getFromFechamentoFaaAttribute()
|
||||
{
|
||||
return is_null($this->atendimento_medico_id)
|
||||
&& is_null($this->atendimento_triagem_id)
|
||||
&& is_null($this->atendimento_enfermagem_id)
|
||||
&& is_null($this->paciente_observacao_id)
|
||||
&& is_null($this->exame_imagem_id);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
|
||||
if (is_null($model->realizado_em)) {
|
||||
|
||||
$model->realizado_em = Carbon::now();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
78
api/app/Models/ProntoAtendimento/Atendimento/Raat.php
Normal file
78
api/app/Models/ProntoAtendimento/Atendimento/Raat.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Raat\RegimeTrabalho;
|
||||
use App\Models\ProntoAtendimento\Raat\TipoAcidente;
|
||||
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Raat extends Model
|
||||
{
|
||||
use SoftDeletes, CascadeSoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_raat';
|
||||
|
||||
protected $cascadeDeletes = [
|
||||
'pareceresMedico'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'acidente_data' => 'datetime:Y-m-d',
|
||||
'acidente_hora' => 'datetime:H:i'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'faa_id',
|
||||
'tipo_formulario_acidente_trabalho',
|
||||
'empresa_nome',
|
||||
'empresa_ramo_atividade',
|
||||
'empresa_endereco',
|
||||
'empresa_telefone',
|
||||
'acidente_data',
|
||||
'acidente_hora',
|
||||
'acidente_tipo_id',
|
||||
'acidente_local',
|
||||
'acidente_descricao',
|
||||
'regime_trabalho_id',
|
||||
'regime_trabalho_outro'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function faa()
|
||||
{
|
||||
return $this->belongsTo(Faa::class);
|
||||
}
|
||||
|
||||
public function tipoAcidente()
|
||||
{
|
||||
return $this->belongsTo(TipoAcidente::class, 'acidente_tipo_id');
|
||||
}
|
||||
|
||||
public function regimeTrabalho()
|
||||
{
|
||||
return $this->belongsTo(RegimeTrabalho::class);
|
||||
}
|
||||
|
||||
public function pareceresMedico()
|
||||
{
|
||||
return $this->hasMany(RaatParecerMedico::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\Sigtap\Cid;
|
||||
use App\Models\ProntoAtendimento\Raat\Agente;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\ProntoAtendimento\Raat\Diagnostico;
|
||||
use App\Models\ProntoAtendimento\Raat\CausaAcidente;
|
||||
use App\Models\ProntoAtendimento\Raat\ParteCorpoAtingida;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Raat\ClassificacaoInicial;
|
||||
|
||||
class RaatParecerMedico extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_raat_parecer_medico';
|
||||
|
||||
protected $casts = [
|
||||
'afastado' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_medico_id',
|
||||
'agente_id',
|
||||
'parte_corpo_atingida_outras',
|
||||
'causa_acidente_outras',
|
||||
'diagnostico_outros',
|
||||
'observacao',
|
||||
'classificacao_inicial_id',
|
||||
'afastado',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
'pivot'
|
||||
];
|
||||
|
||||
public function raat()
|
||||
{
|
||||
return $this->belongsTo(Raat::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function agente()
|
||||
{
|
||||
return $this->belongsTo(Agente::class);
|
||||
}
|
||||
|
||||
public function partesCorpoAtingidas()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ParteCorpoAtingida::class,
|
||||
'pronto_atendimento_raat_parecer_medico_parte_corpo_atingida',
|
||||
'parecer_medico_id',
|
||||
'parte_corpo_atingida_id'
|
||||
)->using(RaatParecerMedicoParteCorpoAtingida::class)->withTimestamps();
|
||||
}
|
||||
|
||||
public function causasAcidente()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
CausaAcidente::class,
|
||||
'pronto_atendimento_raat_parecer_medico_causa_acidente',
|
||||
'parecer_medico_id',
|
||||
'causa_acidente_id'
|
||||
)->using(RaatParecerMedicoParteCorpoAtingida::class)->withTimestamps();
|
||||
}
|
||||
|
||||
public function diagnosticos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Diagnostico::class,
|
||||
'pronto_atendimento_raat_parecer_medico_diagnostico',
|
||||
'parecer_medico_id',
|
||||
'diagnostico_id'
|
||||
)->using(RaatParecerMedicoParteCorpoAtingida::class)->withTimestamps();
|
||||
}
|
||||
|
||||
public function classificacaoInicial()
|
||||
{
|
||||
return $this->belongsTo(ClassificacaoInicial::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'partesCorpoAtingidas',
|
||||
'causasAcidente',
|
||||
'diagnosticos',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class RaatParecerMedicoCausaAcidente extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class RaatParecerMedicoDiagnostico extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class RaatParecerMedicoParteCorpoAtingida extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
129
api/app/Models/ProntoAtendimento/Atendimento/Recepcao.php
Normal file
129
api/app/Models/ProntoAtendimento/Atendimento/Recepcao.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Enums\ProntoAtendimento\OrigemUnidadeEncaminhamento;
|
||||
use App\Models\Cadastro\Estabelecimento\Servico;
|
||||
use App\Models\Cadastro\Estabelecimento\Unidade;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
|
||||
use App\Models\ProntoAtendimento\Plantao\Plantao;
|
||||
use App\Models\Sigtap\Ocupacao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Recepcao extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_recepcao';
|
||||
|
||||
protected $casts = [
|
||||
'urgente' => 'boolean'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'plantao_id',
|
||||
'atendimento_id',
|
||||
'atendido_em',
|
||||
'urgente',
|
||||
'urgente_motivo',
|
||||
'origem_entrada_id',
|
||||
'medico_samu',
|
||||
'motivo_atendimento',
|
||||
'acompanhante',
|
||||
'unidade_encaminhamento_id',
|
||||
'unidade_externa_encaminhamento_id',
|
||||
'medico_solicitante_encaminhamento',
|
||||
'servico_id',
|
||||
'ocupacao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'is_encaminhamento',
|
||||
'origem_unidade_encaminhamento',
|
||||
];
|
||||
|
||||
public function plantao()
|
||||
{
|
||||
return $this->belongsTo(Plantao::class);
|
||||
}
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function origemEntrada()
|
||||
{
|
||||
return $this->belongsTo(OrigemEntrada::class);
|
||||
}
|
||||
|
||||
public function unidadeEncaminhamento()
|
||||
{
|
||||
return $this->belongsTo(Unidade::class);
|
||||
}
|
||||
|
||||
public function servico()
|
||||
{
|
||||
return $this->belongsTo(Servico::class);
|
||||
}
|
||||
|
||||
public function ocupacao()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function observacao()
|
||||
{
|
||||
return $this->hasOne(Observacao::class, 'atendimento_recepcao_id');
|
||||
}
|
||||
|
||||
public function lotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function getOrigemUnidadeEncaminhamentoAttribute()
|
||||
{
|
||||
if (!is_null($this->unidade_encaminhamento_id)) {
|
||||
|
||||
return OrigemUnidadeEncaminhamento::INTERNA;
|
||||
|
||||
}
|
||||
|
||||
if (!is_null($this->unidade_externa_encaminhamento_id)) {
|
||||
|
||||
return OrigemUnidadeEncaminhamento::EXTERNA;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class, 'atendimento_recepcao_id');
|
||||
}
|
||||
|
||||
public function getIsEncaminhamentoAttribute()
|
||||
{
|
||||
return !is_null($this->unidade_encaminhamento_id) || !is_null($this->unidade_externa_encaminhamento_id);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Parametrizacao\Exame\ExameStatus;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\Sigtap\Cid;
|
||||
use App\Models\Sigtap\Procedimento;
|
||||
|
||||
class ServicoEnfermagem extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_atendimento_servico_enfermagem';
|
||||
|
||||
protected $fillable = [
|
||||
'procedimento_id',
|
||||
'atendimento_medico_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'paciente_observacao_id',
|
||||
'status_id',
|
||||
'cid_id',
|
||||
'observacoes',
|
||||
'horario_realizacao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function procedimento()
|
||||
{
|
||||
return $this->belongsTo(Procedimento::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(ExameStatus::class);
|
||||
}
|
||||
|
||||
public function cid()
|
||||
{
|
||||
return $this->belongsTo(Cid::class);
|
||||
}
|
||||
}
|
||||
87
api/app/Models/ProntoAtendimento/Atendimento/SinalVital.php
Normal file
87
api/app/Models/ProntoAtendimento/Atendimento/SinalVital.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento;
|
||||
|
||||
use App\Models\Cadastro\UnidadeMedida;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\AtendimentoEnfermagem;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao\PacienteObservacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\AtendimentoTriagem;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SinalVital extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_sinal_vital';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_medico_id',
|
||||
'atendimento_triagem_id',
|
||||
'atendimento_enfermagem_id',
|
||||
'atendimento_exame_imagem_id',
|
||||
'paciente_observacao_id',
|
||||
'pa',
|
||||
'pa_unidade_medida_id',
|
||||
'glicemia',
|
||||
'temperatura',
|
||||
'pulso',
|
||||
'respiracao',
|
||||
'saturacao',
|
||||
'intensidade_dor',
|
||||
'cintura',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoEnfermagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoEnfermagem::class);
|
||||
}
|
||||
|
||||
public function atendimentoExameImagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoExameImagem::class);
|
||||
}
|
||||
|
||||
public function pacienteObservacao()
|
||||
{
|
||||
return $this->belongsTo(PacienteObservacao::class);
|
||||
}
|
||||
|
||||
public function paUnidadeMedida()
|
||||
{
|
||||
return $this->belongsTo(UnidadeMedida::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\AvaliacaoAntropometrica;
|
||||
use App\Models\ProntoAtendimento\Atendimento\ClassificacaoRisco;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Enfermagem\Historico;
|
||||
use App\Models\ProntoAtendimento\Atendimento\EscalaComaGlasgow;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Gestacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\MedicamentoUso;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Procedimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\SinalVital;
|
||||
use App\Models\ProntoAtendimento\Plantao\Plantao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AtendimentoTriagem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_triagem';
|
||||
|
||||
protected $casts = [
|
||||
'is_faa_assinada' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'plantao_id',
|
||||
'historico_individual_familiar',
|
||||
'outras_avaliacoes_condicoes',
|
||||
'is_faa_assinada',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function plantao()
|
||||
{
|
||||
return $this->belongsTo(Plantao::class);
|
||||
}
|
||||
|
||||
public function avaliacaoAntropometrica()
|
||||
{
|
||||
return $this->hasOne(AvaliacaoAntropometrica::class);
|
||||
}
|
||||
|
||||
public function classificacaoRisco()
|
||||
{
|
||||
return $this->hasOne(ClassificacaoRisco::class);
|
||||
}
|
||||
|
||||
public function gestacao()
|
||||
{
|
||||
return $this->hasOne(Gestacao::class);
|
||||
}
|
||||
|
||||
public function medicamentosUso()
|
||||
{
|
||||
return $this->hasMany(MedicamentoUso::class);
|
||||
}
|
||||
|
||||
public function observacao()
|
||||
{
|
||||
return $this->hasOne(Observacao::class);
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class);
|
||||
}
|
||||
|
||||
public function sinaisVitais()
|
||||
{
|
||||
return $this->hasMany(SinalVital::class);
|
||||
}
|
||||
|
||||
public function historico()
|
||||
{
|
||||
return $this->hasOne(Historico::class);
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class);
|
||||
}
|
||||
|
||||
public function escalasComaGlasgow()
|
||||
{
|
||||
return $this->hasMany(EscalaComaGlasgow::class);
|
||||
}
|
||||
|
||||
public function encaminhamentos()
|
||||
{
|
||||
return $this->hasMany(Encaminhamento::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'avaliacaoAntropometrica',
|
||||
'classificacaoRisco',
|
||||
'gestacao',
|
||||
'medicamentosUso',
|
||||
'observacao',
|
||||
'procedimentos',
|
||||
'sinaisVitais',
|
||||
'historico',
|
||||
'encaminhamentos',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DorToracicaSinalInstabilidade extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_dor_toracica_sinal_instabilidade';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Encaminhamento extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_triagem_encaminhamento';
|
||||
|
||||
protected $casts = [
|
||||
'urgente' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'infraestrutura_id',
|
||||
'urgente',
|
||||
'motivo',
|
||||
'observacoes'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'deleted_at',
|
||||
'deleted_lotacao_id',
|
||||
'deleted_centro_custo_id',
|
||||
];
|
||||
|
||||
public function atendimentoTriagem()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoTriagem::class);
|
||||
}
|
||||
|
||||
public function infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\RelacionadoFormularioDorToracica;
|
||||
|
||||
|
||||
class FormularioDorToracica extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_triagem_formulario_dor_toracica';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'atendimento_id',
|
||||
'dor_toracica_id',
|
||||
'dispneia',
|
||||
'hora_sintoma',
|
||||
'hora_ecg_admissao',
|
||||
'data_sintoma',
|
||||
'data_ecg_admissao',
|
||||
'protocolo_finalizado',
|
||||
'protocolo_finalizado_em',
|
||||
'protocolo_tem_prosseguimento',
|
||||
'tem_contra_indicacao_trombolitico',
|
||||
'contra_indicacao_trombolitico_motivo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'dispneia' => 'boolean',
|
||||
'protocolo_finalizado' => 'boolean',
|
||||
'protocolo_finalizado_em' => 'datetime:d/m/Y H:i:s',
|
||||
'protocolo_tem_prosseguimento' => 'boolean',
|
||||
'tem_contra_indicacao_trombolitico' => 'boolean',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'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 sinaisInstabilidade()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
DorToracicaSinalInstabilidade::class,
|
||||
'pronto_atendimento_triagem_formulario_dor_toracica_sinal_instabi',
|
||||
'formulario_dor_toracica_id',
|
||||
'sinal_instabilidade_id'
|
||||
)
|
||||
->using(FormularioDorToracicaSinalInstabilidade::class)
|
||||
->as('dorToracicaSinalInstabilidade')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function atendimentosMedico()
|
||||
{
|
||||
return $this->hasMany(AtendimentoMedico::class);
|
||||
}
|
||||
|
||||
public function formularioRelacionado()
|
||||
{
|
||||
return $this->belongsTo(RelacionadoFormularioDorToracica::class);
|
||||
}
|
||||
|
||||
public function resultadosEletrocardiograma()
|
||||
{
|
||||
return $this->hasMany(FormularioDorToracicaResultadoEletrocardiograma::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\AtendimentoMedico;
|
||||
|
||||
class FormularioDorToracicaResultadoEletrocardiograma extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_triagem_formulario_dor_toracica_result_eletro';
|
||||
|
||||
protected $fillable = [
|
||||
'formulario_dor_toracica_id',
|
||||
'atendimento_medico_id',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function formularioDorToracica()
|
||||
{
|
||||
return $this->belongsTo(FormularioDorToracica::class);
|
||||
}
|
||||
|
||||
public function atendimentoMedico()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoMedico::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class FormularioDorToracicaSinalInstabilidade extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OrigemDorToracica extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_status_formulario_dor_toracica';
|
||||
|
||||
protected $fillable = [
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\Triagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Triagem\FormularioDorToracica;
|
||||
|
||||
|
||||
class RelacionadoFormularioDorToracica extends Model
|
||||
{
|
||||
protected $table = 'pronto_atendimento_triagem_formulario_dor_toracica_relacionado';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'formulario_id',
|
||||
'atendimento_id',
|
||||
'dor_toracica_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'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 formulario()
|
||||
{
|
||||
return $this->belongsTo(FormularioDorToracica::class);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user