This commit is contained in:
152
api/app/Models/Cadastro/Estabelecimento/CentroCusto.php
Normal file
152
api/app/Models/Cadastro/Estabelecimento/CentroCusto.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Almoxarifado\Entrada;
|
||||
use App\Models\Almoxarifado\ParametrizacaoControleEstoqueGrupo;
|
||||
use App\Models\Almoxarifado\ParametrizacaoPortalDivulgacaoGrupo;
|
||||
use App\Models\Almoxarifado\ParametrizacaoDispensacaoUnidade;
|
||||
use App\Models\Almoxarifado\ParametrizacaoEstoque;
|
||||
use App\Models\Almoxarifado\Requisicao;
|
||||
use App\Models\Almoxarifado\RequisicaoPermissao;
|
||||
use App\Models\Almoxarifado\Saida;
|
||||
use App\Models\Almoxarifado\SaidaRequisicao;
|
||||
use App\Models\Almoxarifado\SaidaTransferencia;
|
||||
use App\Models\Farmacia\AltoCusto\Processo;
|
||||
use App\Models\Farmacia\ReceitaItemEntrega;
|
||||
use App\Models\Model;
|
||||
use App\Models\PainelSenha\Status;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CentroCusto extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_centro_custo';
|
||||
|
||||
protected $fillable = [
|
||||
'infraestrutura_id',
|
||||
'setor_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 infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function setor()
|
||||
{
|
||||
return $this->belongsTo(Setor::class);
|
||||
}
|
||||
|
||||
public function salas()
|
||||
{
|
||||
return $this->hasMany(Sala::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->hasMany(Status::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoEntradas()
|
||||
{
|
||||
return $this->hasMany(Entrada::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoSaidas()
|
||||
{
|
||||
return $this->hasMany(Saida::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoParametrizacoesControleEstoqueGrupo()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoControleEstoqueGrupo::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoParametrizacoesPortalDivulgacaoGrupo()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoPortalDivulgacaoGrupo::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoParametrizacaoDispensacaoUnidades()
|
||||
{
|
||||
return $this->hasOne(ParametrizacaoDispensacaoUnidade::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoParametrizacoesEstoque()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoEstoque::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoRequisicaoPermissoesRequisitante()
|
||||
{
|
||||
return $this->hasMany(RequisicaoPermissao::class, 'centro_custo_requisitante_id');
|
||||
}
|
||||
|
||||
public function almoxarifadoRequisicaoPermissoesAlmoxarifado()
|
||||
{
|
||||
return $this->hasMany(RequisicaoPermissao::class, 'created_centro_custo_id');
|
||||
}
|
||||
|
||||
public function almoxarifadoRequisicoes()
|
||||
{
|
||||
return $this->hasMany(Requisicao::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoRequisicoesRequisitante()
|
||||
{
|
||||
return $this->hasMany(Requisicao::class, 'created_centro_custo_id');
|
||||
}
|
||||
|
||||
public function almoxarifadoSaidaRequisicoes()
|
||||
{
|
||||
return $this->hasMany(SaidaRequisicao::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoSaidaTransferencias()
|
||||
{
|
||||
return $this->hasMany(SaidaTransferencia::class);
|
||||
}
|
||||
|
||||
public function farmaciaReceitaEntregas()
|
||||
{
|
||||
return $this->hasMany(ReceitaItemEntrega::class, 'created_centro_custo_id');
|
||||
}
|
||||
|
||||
public function farmaciaAltoCustoProcessos()
|
||||
{
|
||||
return $this->hasMany(Processo::class, 'created_centro_custo_id');
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'salas',
|
||||
'plantoes',
|
||||
'almoxarifadoEntradas',
|
||||
'almoxarifadoSaidas',
|
||||
'almoxarifadoParametrizacoesControleEstoqueGrupo',
|
||||
'almoxarifadoRequisicaoPermissoesRequisitante',
|
||||
'almoxarifadoRequisicaoPermissoesAlmoxarifado',
|
||||
'almoxarifadoRequisicoes',
|
||||
'almoxarifadoRequisicoesRequisitante',
|
||||
'almoxarifadoSaidaRequisicoes',
|
||||
'almoxarifadoSaidaTransferencias',
|
||||
'farmaciaReceitaEntregas',
|
||||
'farmaciaAltoCustoProcessos',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EsferaAdministrativa extends Model
|
||||
{
|
||||
protected $table = 'cadastro_esfera_administrativa';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao',
|
||||
'codigo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function unidades()
|
||||
{
|
||||
return $this->hasMany(Unidade::class);
|
||||
}
|
||||
}
|
||||
132
api/app/Models/Cadastro/Estabelecimento/Infraestrutura.php
Normal file
132
api/app/Models/Cadastro/Estabelecimento/Infraestrutura.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Ambulatorio\ParametrizacaoInfraestrutura as AmbulatorioParametrizacaoInfraestrutura;
|
||||
use App\Models\Cadastro\Localizacao\Endereco;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\ExameImagem\Agendamento\Agendamento;
|
||||
use App\Models\ExameImagem\CotaPrestador;
|
||||
use App\Models\ExameImagem\Jornada\Jornada;
|
||||
use App\Models\ExameImagem\Parametrizacao;
|
||||
use App\Models\ExameLaboratorial\Parametrizacao\Unidade as ExameLaboratorialUnidade;
|
||||
use App\Models\ExameLaboratorial\Parametrizacao\UnidadeSolicitanteExame;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Infraestrutura extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_infraestrutura';
|
||||
|
||||
protected $casts = [
|
||||
'principal' => 'boolean',
|
||||
'ativo' => 'boolean'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'infraestrutura_id',
|
||||
'principal',
|
||||
'nome',
|
||||
'telefone',
|
||||
'ativo',
|
||||
'endereco_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',
|
||||
'unidade_id',
|
||||
'endereco_id',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'endereco'
|
||||
];
|
||||
|
||||
public function parametrizacaoExameImagem()
|
||||
{
|
||||
return $this->hasOne(Parametrizacao::class);
|
||||
}
|
||||
|
||||
public function jornadaExameImagem()
|
||||
{
|
||||
return $this->hasMany(Jornada::class);
|
||||
}
|
||||
|
||||
public function cotaPrestadorExameImagem()
|
||||
{
|
||||
return $this->hasOne(CotaPrestador::class);
|
||||
}
|
||||
|
||||
public function unidade()
|
||||
{
|
||||
return $this->belongsTo(Unidade::class);
|
||||
}
|
||||
|
||||
public function infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function exameLaboratorialUnidade()
|
||||
{
|
||||
return $this->hasOne(ExameLaboratorialUnidade::class);
|
||||
}
|
||||
|
||||
public function exameLaboratorialUnidadeSolicitanteExame()
|
||||
{
|
||||
return $this->hasOne(UnidadeSolicitanteExame::class);
|
||||
}
|
||||
|
||||
public function agendamentosExameImagem()
|
||||
{
|
||||
return $this->hasOne(Agendamento::class);
|
||||
}
|
||||
|
||||
public function exameLaboratorialUnidadeCotas()
|
||||
{
|
||||
return $this->hasOne(Cota::class);
|
||||
}
|
||||
|
||||
public function endereco()
|
||||
{
|
||||
return $this->belongsTo(Endereco::class);
|
||||
}
|
||||
|
||||
public function centrosCusto()
|
||||
{
|
||||
return $this->hasMany(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this->hasMany(Lotacao::class);
|
||||
}
|
||||
|
||||
public function ambulatorioParametrizacaoJornadaInfraestrutura()
|
||||
{
|
||||
return $this->hasOne(AmbulatorioParametrizacaoInfraestrutura::class);
|
||||
}
|
||||
|
||||
public function getNomeAttribute($nome)
|
||||
{
|
||||
return $this->principal ? $this->unidade->nome_fantasia : $nome;
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'centrosCusto',
|
||||
'lotacoes',
|
||||
]);
|
||||
}
|
||||
}
|
||||
26
api/app/Models/Cadastro/Estabelecimento/NaturezaJuridica.php
Normal file
26
api/app/Models/Cadastro/Estabelecimento/NaturezaJuridica.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class NaturezaJuridica extends Model
|
||||
{
|
||||
protected $table = 'cadastro_natureza_juridica';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao',
|
||||
'codigo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function unidades()
|
||||
{
|
||||
return $this->hasMany(Unidade::class);
|
||||
}
|
||||
}
|
||||
40
api/app/Models/Cadastro/Estabelecimento/Sala.php
Normal file
40
api/app/Models/Cadastro/Estabelecimento/Sala.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Sala extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_sala';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
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 centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
31
api/app/Models/Cadastro/Estabelecimento/Servico.php
Normal file
31
api/app/Models/Cadastro/Estabelecimento/Servico.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Plantao\Plantao;
|
||||
|
||||
class Servico extends Model
|
||||
{
|
||||
protected $table = 'cadastro_servico';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function setores()
|
||||
{
|
||||
return $this->hasMany(Setor::class);
|
||||
}
|
||||
|
||||
public function plantoes()
|
||||
{
|
||||
return $this->hasMany(Plantao::class);
|
||||
}
|
||||
}
|
||||
53
api/app/Models/Cadastro/Estabelecimento/Setor.php
Normal file
53
api/app/Models/Cadastro/Estabelecimento/Setor.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Setor extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_setor';
|
||||
|
||||
protected $fillable = [
|
||||
'tipo_id',
|
||||
'servico_id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
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 tipo()
|
||||
{
|
||||
return $this->belongsTo(SetorTipo::class);
|
||||
}
|
||||
|
||||
public function servico()
|
||||
{
|
||||
return $this->belongsTo(Servico::class);
|
||||
}
|
||||
|
||||
public function centrosCusto()
|
||||
{
|
||||
return $this->hasMany(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'centrosCusto',
|
||||
]);
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Cadastro/Estabelecimento/SetorTipo.php
Normal file
25
api/app/Models/Cadastro/Estabelecimento/SetorTipo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class SetorTipo extends Model
|
||||
{
|
||||
protected $table = 'cadastro_setor_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function setores()
|
||||
{
|
||||
return $this->hasMany(Setor::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
155
api/app/Models/Cadastro/Estabelecimento/Unidade.php
Normal file
155
api/app/Models/Cadastro/Estabelecimento/Unidade.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Almoxarifado\SaidaRequisicao;
|
||||
use App\Models\Bpa\Procedimento;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Cadastro\SujeitoAtencao\ProntuarioUnidade;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\ExameImagem\Agendamento\Agendamento;
|
||||
use App\Models\ExameImagem\CotaPrestador;
|
||||
use App\Models\ExameImagem\Fechamento\Faturamento;
|
||||
use App\Models\ExameImagem\Jornada\Jornada;
|
||||
use App\Models\ExameImagem\Parametrizacao;
|
||||
use App\Models\ExameLaboratorial\Parametrizacao\Cota;
|
||||
use App\Models\ExameLaboratorial\Parametrizacao\Unidade as ExameLaboratorialUnidade;
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Recepcao;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Unidade extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_unidade';
|
||||
|
||||
protected $casts = [
|
||||
'pertence_sus' => 'boolean',
|
||||
'unidade_referencia' => 'boolean',
|
||||
'unidade_prestadora' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'nome_fantasia',
|
||||
'razao_social',
|
||||
'cnpj',
|
||||
'email',
|
||||
'site',
|
||||
'tipo_id',
|
||||
'esfera_administrativa_id',
|
||||
'natureza_juridica_id',
|
||||
'cnes',
|
||||
'pertence_sus',
|
||||
'unidade_referencia',
|
||||
'unidade_prestadora',
|
||||
'gestor_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 tipo()
|
||||
{
|
||||
return $this->belongsTo(UnidadeTipo::class);
|
||||
}
|
||||
|
||||
public function exameLaboratorialUnidade()
|
||||
{
|
||||
return $this->hasOne(ExameLaboratorialUnidade::class);
|
||||
}
|
||||
|
||||
public function exameLaboratorialUnidadeCotas()
|
||||
{
|
||||
return $this->hasOne(Cota::class);
|
||||
}
|
||||
|
||||
public function esferaAdministrativa()
|
||||
{
|
||||
return $this->belongsTo(EsferaAdministrativa::class);
|
||||
}
|
||||
|
||||
public function naturezaJuridica()
|
||||
{
|
||||
return $this->belongsTo(NaturezaJuridica::class);
|
||||
}
|
||||
|
||||
public function gestor()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function infraestruturas()
|
||||
{
|
||||
return $this->hasMany(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function parametrizacaoExameImagem()
|
||||
{
|
||||
return $this->hasOne(Parametrizacao::class);
|
||||
}
|
||||
|
||||
public function jornadaExameImagem()
|
||||
{
|
||||
return $this->hasMany(Jornada::class);
|
||||
}
|
||||
|
||||
public function agendamentosExameImagem()
|
||||
{
|
||||
return $this->hasMany(Agendamento::class);
|
||||
}
|
||||
|
||||
public function faturamentosExameImagem()
|
||||
{
|
||||
return $this->hasMany(Faturamento::class);
|
||||
}
|
||||
|
||||
public function cotaPrestadorExameImagem()
|
||||
{
|
||||
return $this->hasMany(CotaPrestador::class);
|
||||
}
|
||||
|
||||
public function pacientes()
|
||||
{
|
||||
return $this->hasMany(Paciente::class);
|
||||
}
|
||||
|
||||
public function prontuariosUnidade()
|
||||
{
|
||||
return $this->hasMany(ProntuarioUnidade::class);
|
||||
}
|
||||
|
||||
public function recepcoes()
|
||||
{
|
||||
return $this->hasMany(Recepcao::class, 'unidade_encaminhamento_id');
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoSaidaRequisicoes()
|
||||
{
|
||||
return $this->hasMany(SaidaRequisicao::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'infraestruturas',
|
||||
'pacientes',
|
||||
'prontuariosUnidade',
|
||||
'recepcoes',
|
||||
]);
|
||||
}
|
||||
}
|
||||
26
api/app/Models/Cadastro/Estabelecimento/UnidadeTipo.php
Normal file
26
api/app/Models/Cadastro/Estabelecimento/UnidadeTipo.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Estabelecimento;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class UnidadeTipo extends Model
|
||||
{
|
||||
protected $table = 'cadastro_unidade_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao',
|
||||
'codigo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function unidades()
|
||||
{
|
||||
return $this->hasMany(Unidade::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user