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