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