This commit is contained in:
303
api/app/Models/Parametrizacao/Exame/Exame.php
Normal file
303
api/app/Models/Parametrizacao/Exame/Exame.php
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Ambulatorio\AtendimentoSoapResultadoExame;
|
||||
use App\Models\Ambulatorio\AtendimentoSoapSolicitacaoExameItem;
|
||||
use App\Models\AtencaoBasica\AtendimentoIndividual\AtendimentoIndividualOutroExame;
|
||||
use App\Models\Cadastro\Grupo\Grupo;
|
||||
use App\Models\Cadastro\Grupo\GrupoTipo;
|
||||
use App\Models\ExameImagem\Agendamento\AgendamentoExame as AgendamentoExameImagem;
|
||||
use App\Models\ExameImagem\Agendamento\AgendamentoHistoricoExclusao;
|
||||
use App\Models\ExameImagem\Fechamento\Faturamento;
|
||||
use App\Models\ExameLaboratorial\AgendamentoExame\AgendamentoExame as AgendamentoExameLaboratorial;
|
||||
use App\Models\ExameLaboratorial\AgendamentoExame\AgendamentoExameBloqueado;
|
||||
use App\Models\ExameLaboratorial\Parametrizacao\CotaExame;
|
||||
use App\Models\ExameLaboratorial\Parametrizacao\CotaExamePeriodo;
|
||||
use App\Models\Model;
|
||||
use App\Models\Parametrizacao\Exame\ExameComposicao;
|
||||
use App\Models\Parametrizacao\Exame\ExameTextoPronto;
|
||||
use App\Models\Parametrizacao\Exame\ExameTipo;
|
||||
use App\Models\Parametrizacao\KitExame\Item as KitExameItem;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Item as PedidoExameItem;
|
||||
use App\Models\Regulacao\ParametrizacaoPrestadorExterno;
|
||||
use App\Models\Regulacao\ParametrizacaoPrestadorExternoExame;
|
||||
use App\Models\Regulacao\ParametrizacaoPrestadorInterno;
|
||||
use App\Models\Regulacao\ParametrizacaoPrestadorInternoExame;
|
||||
use App\Models\Regulacao\ParametrizacaoRegulador;
|
||||
use App\Models\Regulacao\ParametrizacaoReguladorExame;
|
||||
use App\Models\Regulacao\ParametrizacaoSolicitanteRegulador;
|
||||
use App\Models\Regulacao\ParametrizacaoSolicitanteReguladorExame;
|
||||
use App\Models\Regulacao\Tipo as RegulacaoTipo;
|
||||
use App\Models\Sigtap\Procedimento;
|
||||
use App\Models\WebService\Laboratorio\Cliente\Exame as WebServiceLaboratorioClienteExame;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Exame extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'parametrizacao_exame';
|
||||
|
||||
protected $casts = [
|
||||
'ativo' => 'boolean',
|
||||
'outro_municipio' => 'boolean',
|
||||
'provisorio' => 'boolean',
|
||||
'sigilo' => 'boolean',
|
||||
'senha_supervisor' => 'boolean',
|
||||
'mapa_agrupado' => 'boolean',
|
||||
'valor_sigtap' => 'boolean',
|
||||
'exige_procedimento' => 'boolean',
|
||||
'is_ppi' => 'boolean',
|
||||
'permite_repeticao' => 'boolean',
|
||||
'exigir_peso_altura_circunferencia' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'tipo_id',
|
||||
'grupo_tipo_id',
|
||||
'codigo',
|
||||
'nome',
|
||||
'ativo',
|
||||
'observacao',
|
||||
'sigla_exame',
|
||||
'prazo_entrega',
|
||||
'validade',
|
||||
'valor',
|
||||
'quantidade_maxima',
|
||||
'outro_municipio',
|
||||
'provisorio',
|
||||
'sigilo',
|
||||
'senha_supervisor',
|
||||
'ultimo_resultado',
|
||||
'resultado',
|
||||
'mapa_agrupado',
|
||||
'posicao_mapa',
|
||||
'valor_sigtap',
|
||||
'exige_procedimento',
|
||||
'sexo_id',
|
||||
'quantidade_reagente',
|
||||
'regulacao_tipo_id',
|
||||
'is_ppi',
|
||||
'valor_ppi',
|
||||
'permite_repeticao',
|
||||
'exigir_peso_altura_circunferencia',
|
||||
'tempo_medio_previsto_atendimento_dias',
|
||||
];
|
||||
|
||||
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 = [
|
||||
'tipo',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'procedimento',
|
||||
'is_regulado',
|
||||
];
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(ExameTipo::class);
|
||||
}
|
||||
|
||||
public function grupo()
|
||||
{
|
||||
return $this->belongsTo(Grupo::class, 'grupo_tipo_id');
|
||||
}
|
||||
|
||||
public function grupoTipo()
|
||||
{
|
||||
return $this->belongsTo(GrupoTipo::class);
|
||||
}
|
||||
|
||||
public function regulacaoTipo()
|
||||
{
|
||||
return $this->belongsTo(RegulacaoTipo::class);
|
||||
}
|
||||
|
||||
public function exameLaboratorialCotasAnual()
|
||||
{
|
||||
return $this->hasMany(CotaExamePeriodo::class);
|
||||
}
|
||||
|
||||
public function exameComposicao()
|
||||
{
|
||||
return $this->hasMany(ExameComposicao::class);
|
||||
}
|
||||
|
||||
public function exameImagemFechamentoFaturamento()
|
||||
{
|
||||
return $this->hasMany(Faturamento::class);
|
||||
}
|
||||
|
||||
public function atendimentoSoapResultadoExame()
|
||||
{
|
||||
return $this->hasMany(AtendimentoSoapResultadoExame::class);
|
||||
}
|
||||
|
||||
public function pedidoExameItem()
|
||||
{
|
||||
return $this->hasMany(PedidoExameItem::class);
|
||||
}
|
||||
|
||||
public function agendamentoExameBloqueado()
|
||||
{
|
||||
return $this->hasMany(AgendamentoExameBloqueado::class);
|
||||
}
|
||||
|
||||
public function atendimentoIndividualOutroExame()
|
||||
{
|
||||
return $this->hasMany(AtendimentoIndividualOutroExame::class);
|
||||
}
|
||||
|
||||
public function atendimentoSoapSolicitacaoExameItem()
|
||||
{
|
||||
return $this->hasMany(AtendimentoSoapSolicitacaoExameItem::class);
|
||||
}
|
||||
|
||||
public function kitExameItem()
|
||||
{
|
||||
return $this->hasMany(KitExameItem::class);
|
||||
}
|
||||
|
||||
public function cotaExame()
|
||||
{
|
||||
return $this->hasMany(CotaExame::class);
|
||||
}
|
||||
|
||||
public function exameTextoPronto()
|
||||
{
|
||||
return $this->hasMany(ExameTextoPronto::class);
|
||||
}
|
||||
|
||||
public function agendamentoExameLaboratorial()
|
||||
{
|
||||
return $this->hasMany(AgendamentoExameLaboratorial::class);
|
||||
}
|
||||
|
||||
public function agendamentoExameImagem()
|
||||
{
|
||||
return $this->hasMany(AgendamentoExameImagem::class);
|
||||
}
|
||||
|
||||
public function AgendamentoHistoricoExclusao()
|
||||
{
|
||||
return $this->hasMany(AgendamentoHistoricoExclusao::class);
|
||||
}
|
||||
|
||||
public function regulacaoParametrizacoesPrestadoresExternos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ParametrizacaoPrestadorExterno::class,
|
||||
'regulacao_parametrizacao_prestador_externo_exame',
|
||||
'exame_id',
|
||||
'prestador_externo_id'
|
||||
)
|
||||
->using(ParametrizacaoPrestadorExternoExame::class)
|
||||
->as('pivotPrestadorExame')
|
||||
->withPivot(['observacoes', 'ativo'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function regulacaoParametrizacoesPrestadoresInternos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ParametrizacaoPrestadorInterno::class,
|
||||
'regulacao_parametrizacao_prestador_interno_exame',
|
||||
'exame_id',
|
||||
'prestador_interno_id'
|
||||
)
|
||||
->using(ParametrizacaoPrestadorInternoExame::class)
|
||||
->as('pivotPrestadorExame')
|
||||
->withPivot(['observacoes', 'ativo'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function regulacaoParametrizacoesReguladoresExames()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ParametrizacaoRegulador::class,
|
||||
'regulacao_parametrizacao_regulador_exame',
|
||||
'exame_id',
|
||||
'regulador_id'
|
||||
)
|
||||
->using(ParametrizacaoReguladorExame::class)
|
||||
->as('pivotReguladorExame')
|
||||
->withPivot(['ativo'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function regulacaoParametrizacoesSolicitantesReguladores()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ParametrizacaoSolicitanteRegulador::class,
|
||||
'regulacao_parametrizacao_solicitante_regulador_exame',
|
||||
'exame_id',
|
||||
'solicitante_regulador_id'
|
||||
)
|
||||
->using(ParametrizacaoSolicitanteReguladorExame::class)
|
||||
->as('pivotSolicitanteReguladorExame')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function getProcedimentoAttribute()
|
||||
{
|
||||
if (!$this->codigo) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return Procedimento::where('codigo', $this->codigo)
|
||||
->orderByDesc('competencia_id')
|
||||
->first();
|
||||
}
|
||||
|
||||
public function getIsReguladoAttribute()
|
||||
{
|
||||
return !is_null($this->regulacao_tipo_id);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'exameLaboratorialCotasAnual',
|
||||
'exameComposicao',
|
||||
'exameImagemFechamentoFaturamento',
|
||||
'atendimentoSoapResultadoExame',
|
||||
'pedidoExameItem',
|
||||
'agendamentoExameBloqueado',
|
||||
'atendimentoIndividualOutroExame',
|
||||
'atendimentoSoapSolicitacaoExameItem',
|
||||
'kitExameItem',
|
||||
'cotaExame',
|
||||
'exameTextoPronto',
|
||||
'agendamentoExameLaboratorial',
|
||||
'agendamentoExameImagem',
|
||||
'regulacaoParametrizacoesPrestadoresExternos',
|
||||
'regulacaoParametrizacoesPrestadoresInternos',
|
||||
'regulacaoParametrizacoesReguladoresExames',
|
||||
'regulacaoParametrizacoesSolicitantesReguladores',
|
||||
]);
|
||||
}
|
||||
|
||||
public function procedimento()
|
||||
{
|
||||
return $this->belongsTo(Procedimento::class, 'codigo', 'codigo')->whereNotNull('codigo');
|
||||
}
|
||||
|
||||
public function webServiceLaboratorioClienteExame()
|
||||
{
|
||||
return $this->hasMany(WebServiceLaboratorioClienteExame::class, 'conectasus_exame_id');
|
||||
}
|
||||
}
|
||||
80
api/app/Models/Parametrizacao/Exame/ExameComposicao.php
Normal file
80
api/app/Models/Parametrizacao/Exame/ExameComposicao.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Sexo;
|
||||
use App\Models\ExameLaboratorial\AgendamentoExame\AgendamentoExameResultado;
|
||||
use App\Models\Geral\MedidaTempo;
|
||||
use App\Models\Model;
|
||||
use App\Models\Parametrizacao\Exame\Exame;
|
||||
use App\Models\Parametrizacao\Exame\ExameComposicaoTipoResultado;
|
||||
|
||||
class ExameComposicao extends Model
|
||||
{
|
||||
|
||||
protected $table = 'parametrizacao_exame_composicao';
|
||||
|
||||
protected $casts = [
|
||||
'valor_absoluto' => 'boolean',
|
||||
'visivel' => 'boolean',
|
||||
'resultado' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'exame_id',
|
||||
'descricao',
|
||||
'limite_inferior',
|
||||
'limite_superior',
|
||||
'unidade_id',
|
||||
'referencia',
|
||||
'tipo_idade_id',
|
||||
'idade_inicial',
|
||||
'idade_final',
|
||||
'sexo_id',
|
||||
'tipo_resultado_id',
|
||||
'casa_decimal_id',
|
||||
'formula_id',
|
||||
'visivel',
|
||||
'valor_absoluto',
|
||||
'referencia_especial',
|
||||
'resultado',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function sexo()
|
||||
{
|
||||
return $this->belongsTo(Sexo::class);
|
||||
}
|
||||
|
||||
public function tipoIdade()
|
||||
{
|
||||
return $this->belongsTo(MedidaTempo::class);
|
||||
}
|
||||
|
||||
public function tipoResultado()
|
||||
{
|
||||
return $this->belongsTo(ExameComposicaoTipoResultado::class);
|
||||
}
|
||||
|
||||
public function unidade()
|
||||
{
|
||||
return $this->belongsTo(ExameComposicaoUnidade::class);
|
||||
}
|
||||
|
||||
public function exame()
|
||||
{
|
||||
return $this->belongsTo(Exame::class);
|
||||
}
|
||||
|
||||
public function agendamentoExameResultado()
|
||||
{
|
||||
return $this->belongsTo(AgendamentoExameResultado::class, 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameComposicaoCasaDecimal extends Model
|
||||
{
|
||||
protected $table = 'parametrizacao_exame_composicao_casa_decimal';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
43
api/app/Models/Parametrizacao/Exame/ExameComposicaoLista.php
Normal file
43
api/app/Models/Parametrizacao/Exame/ExameComposicaoLista.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
use App\Models\Model;
|
||||
use App\Models\Parametrizacao\Exame\ExameComposicao;
|
||||
use App\Models\Parametrizacao\Exame\ExameComposicaoSituacao;
|
||||
|
||||
class ExameComposicaoLista extends Model
|
||||
{
|
||||
|
||||
protected $table = 'parametrizacao_exame_composicao_lista';
|
||||
|
||||
protected $casts = [
|
||||
'padrao' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'composicao_id',
|
||||
'descricao',
|
||||
'ordem',
|
||||
'situacao_id',
|
||||
'padrao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function composicao()
|
||||
{
|
||||
return $this->belongsTo(ExameComposicao::class);
|
||||
}
|
||||
|
||||
public function situacao()
|
||||
{
|
||||
return $this->belongsTo(ExameComposicaoSituacao::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameComposicaoSituacao extends Model
|
||||
{
|
||||
protected $table = 'parametrizacao_exame_composicao_situacao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameComposicaoTipoResultado extends Model
|
||||
{
|
||||
protected $table = 'parametrizacao_exame_composicao_tipo_resultado';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameComposicaoUnidade extends Model
|
||||
{
|
||||
protected $table = 'parametrizacao_exame_composicao_unidade';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
use App\Models\ExameLaboratorial\FormulaExame\FormulaExameFator;
|
||||
use App\Models\Model;
|
||||
use App\Models\Parametrizacao\Exame\ExameComposicao;
|
||||
|
||||
class ExameComposicaoVariavel extends Model
|
||||
{
|
||||
|
||||
protected $table = 'parametrizacao_exame_composicao_variavel';
|
||||
|
||||
protected $fillable = [
|
||||
'composicao_id',
|
||||
'fator_id',
|
||||
'ordem',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function composicao()
|
||||
{
|
||||
return $this->belongsTo(ExameComposicao::class);
|
||||
}
|
||||
|
||||
public function fator()
|
||||
{
|
||||
return $this->belongsTo(FormulaExameFator::class);
|
||||
}
|
||||
}
|
||||
20
api/app/Models/Parametrizacao/Exame/ExameStatus.php
Normal file
20
api/app/Models/Parametrizacao/Exame/ExameStatus.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameStatus extends Model
|
||||
{
|
||||
protected $table = 'parametrizacao_exame_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Parametrizacao/Exame/ExameTextoPronto.php
Normal file
25
api/app/Models/Parametrizacao/Exame/ExameTextoPronto.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameTextoPronto extends Model
|
||||
{
|
||||
|
||||
protected $table = 'parametrizacao_exame_texto_pronto';
|
||||
|
||||
protected $fillable = [
|
||||
'exame_id',
|
||||
'codigo',
|
||||
'descricao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Parametrizacao/Exame/ExameTipo.php
Normal file
25
api/app/Models/Parametrizacao/Exame/ExameTipo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Parametrizacao\Exame;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ExameTipo extends Model
|
||||
{
|
||||
protected $table = 'parametrizacao_exame_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function exames()
|
||||
{
|
||||
return $this->hasMany(Exame::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user