This commit is contained in:
26
api/app/Models/Administracao/Configuracao.php
Normal file
26
api/app/Models/Administracao/Configuracao.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Configuracao extends Model
|
||||
{
|
||||
protected $table = 'administracao_configuracao';
|
||||
|
||||
protected $fillable = [
|
||||
'bpa_intrumento_registro_padrao',
|
||||
];
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/CrudAcao.php
Normal file
25
api/app/Models/Administracao/CrudAcao.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class CrudAcao extends Model
|
||||
{
|
||||
protected $table = 'administracao_crud_acao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function permissao()
|
||||
{
|
||||
return $this->hasMany(Permissao::class);
|
||||
}
|
||||
}
|
||||
26
api/app/Models/Administracao/EndpointAcao.php
Normal file
26
api/app/Models/Administracao/EndpointAcao.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EndpointAcao extends Model
|
||||
{
|
||||
protected $table = 'administracao_endpoint_acao';
|
||||
|
||||
protected $fillable = [
|
||||
'permissao_id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'permissao_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function permissao()
|
||||
{
|
||||
return $this->belongsTo(Permissao::class);
|
||||
}
|
||||
}
|
||||
53
api/app/Models/Administracao/Funcionalidade.php
Normal file
53
api/app/Models/Administracao/Funcionalidade.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Funcionalidade extends Model
|
||||
{
|
||||
protected $table = 'administracao_funcionalidade';
|
||||
|
||||
protected $fillable = [
|
||||
'modulo_id',
|
||||
'identificador',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'modulo_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'pivot',
|
||||
];
|
||||
|
||||
public function modulo()
|
||||
{
|
||||
return $this->belongsTo(Modulo::class);
|
||||
}
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this->hasMany(Permissao::class);
|
||||
}
|
||||
|
||||
public function funcionalidadesSub()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Funcionalidade::class,
|
||||
'administracao_funcionalidade_funcionalidade_sub',
|
||||
'funcionalidade_id',
|
||||
'funcionalidade_sub_id',
|
||||
)->withTimestamps();
|
||||
}
|
||||
|
||||
public function funcionalidadesPai()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Funcionalidade::class,
|
||||
'administracao_funcionalidade_funcionalidade_sub',
|
||||
'funcionalidade_sub_id',
|
||||
'funcionalidade_id',
|
||||
)->withTimestamps();
|
||||
}
|
||||
}
|
||||
44
api/app/Models/Administracao/Gestor.php
Normal file
44
api/app/Models/Administracao/Gestor.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
|
||||
class Gestor extends Model
|
||||
{
|
||||
protected $table = 'administracao_gestor';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'usuario_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function papeis()
|
||||
{
|
||||
return $this->belongsToMany(Papel::class, 'administracao_gestor_papel', 'gestor_id', 'papel_id')
|
||||
->using(GestorPapel::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this->belongsToMany(Permissao::class, 'administracao_gestor_permissao', 'gestor_id', 'permissao_id')
|
||||
->using(GestorPermissao::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Administracao/GestorPapel.php
Normal file
17
api/app/Models/Administracao/GestorPapel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class GestorPapel extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
17
api/app/Models/Administracao/GestorPermissao.php
Normal file
17
api/app/Models/Administracao/GestorPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class GestorPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
20
api/app/Models/Administracao/HistoricoAcao.php
Normal file
20
api/app/Models/Administracao/HistoricoAcao.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class HistoricoAcao extends Model
|
||||
{
|
||||
protected $table = 'administracao_historico_acao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
17
api/app/Models/Administracao/LotacaoPapel.php
Normal file
17
api/app/Models/Administracao/LotacaoPapel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPapel extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/LotacaoPapelHistorico.php
Normal file
25
api/app/Models/Administracao/LotacaoPapelHistorico.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPapelHistorico extends Pivot
|
||||
{
|
||||
protected $table = 'administracao_lotacao_papel_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'acao_id',
|
||||
'lotacao_id',
|
||||
'papel_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
17
api/app/Models/Administracao/LotacaoPermissao.php
Normal file
17
api/app/Models/Administracao/LotacaoPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/LotacaoPermissaoHistorico.php
Normal file
25
api/app/Models/Administracao/LotacaoPermissaoHistorico.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPermissaoHistorico extends Pivot
|
||||
{
|
||||
protected $table = 'administracao_lotacao_permissao_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'acao_id',
|
||||
'lotacao_id',
|
||||
'permissao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
32
api/app/Models/Administracao/Menu.php
Normal file
32
api/app/Models/Administracao/Menu.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Menu extends Model
|
||||
{
|
||||
protected $table = 'administracao_menu';
|
||||
|
||||
protected $fillable = [
|
||||
'menu_id',
|
||||
'funcionalidade_id',
|
||||
'nome',
|
||||
'icone',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function menu()
|
||||
{
|
||||
return $this->belongsTo(Menu::class, 'id', 'menu_id');
|
||||
}
|
||||
|
||||
public function funcionalidade()
|
||||
{
|
||||
return $this->belongsTo(Funcionalidade::class);
|
||||
}
|
||||
}
|
||||
32
api/app/Models/Administracao/Modulo.php
Normal file
32
api/app/Models/Administracao/Modulo.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\Feriado\Feriado;
|
||||
use App\Models\Model;
|
||||
|
||||
class Modulo extends Model
|
||||
{
|
||||
protected $table = 'administracao_modulo';
|
||||
|
||||
protected $fillable = [
|
||||
'identificador',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function funcionalidades()
|
||||
{
|
||||
return $this->hasMany(Funcionalidade::class);
|
||||
}
|
||||
|
||||
public function feriado()
|
||||
{
|
||||
return $this->hasMany(Feriado::class);
|
||||
}
|
||||
|
||||
}
|
||||
34
api/app/Models/Administracao/Notificacao.php
Normal file
34
api/app/Models/Administracao/Notificacao.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
|
||||
class Notificacao extends Model
|
||||
{
|
||||
protected $table = 'administracao_notificacao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'tipo_id',
|
||||
'titulo',
|
||||
'mensagem',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this->belongsToMany(Lotacao::class, 'administracao_notificacao_lotacao', 'notificacao_id', 'lotacao_id')
|
||||
->withPivot('visualizado')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
20
api/app/Models/Administracao/NotificacaoTipo.php
Normal file
20
api/app/Models/Administracao/NotificacaoTipo.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class NotificacaoTipo extends Model
|
||||
{
|
||||
protected $table = 'administracao_notificacao_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
79
api/app/Models/Administracao/Papel.php
Normal file
79
api/app/Models/Administracao/Papel.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Papel extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'administracao_papel';
|
||||
|
||||
protected $fillable = [
|
||||
'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',
|
||||
'pivot',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'permissoes',
|
||||
];
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Permissao::class,
|
||||
'administracao_papel_permissao',
|
||||
'papel_id',
|
||||
'permissao_id'
|
||||
)
|
||||
->using(PapelPermissao::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Lotacao::class,
|
||||
'administracao_lotacao_papel',
|
||||
'papel_id',
|
||||
'lotacao_id'
|
||||
)
|
||||
->using(LotacaoPapel::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function gestores()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Gestor::class,
|
||||
'administracao_gestor_papel',
|
||||
'papel_id',
|
||||
'gestor_id'
|
||||
)
|
||||
->using(GestorPapel::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Administracao/PapelPermissao.php
Normal file
17
api/app/Models/Administracao/PapelPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class PapelPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/PapelPermissaoHistorico.php
Normal file
25
api/app/Models/Administracao/PapelPermissaoHistorico.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class PapelPermissaoHistorico extends Pivot
|
||||
{
|
||||
protected $table = 'administracao_papel_permissao_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'acao_id',
|
||||
'papel_id',
|
||||
'permissao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
77
api/app/Models/Administracao/Permissao.php
Normal file
77
api/app/Models/Administracao/Permissao.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
|
||||
class Permissao extends Model
|
||||
{
|
||||
protected $table = 'administracao_permissao';
|
||||
|
||||
protected $fillable = [
|
||||
'funcionalidade_id',
|
||||
'crud_acao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'funcionalidade_id',
|
||||
'crud_acao_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'pivot',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'crudAcao',
|
||||
'endpointAcoes',
|
||||
];
|
||||
|
||||
public function funcionalidade()
|
||||
{
|
||||
return $this->belongsTo(Funcionalidade::class);
|
||||
}
|
||||
|
||||
public function crudAcao()
|
||||
{
|
||||
return $this->belongsTo(CrudAcao::class);
|
||||
}
|
||||
|
||||
public function endpointAcoes()
|
||||
{
|
||||
return $this->hasMany(EndpointAcao::class);
|
||||
}
|
||||
|
||||
public function papeis()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Papel::class,
|
||||
'administracao_papel_permissao',
|
||||
'permissao_id',
|
||||
'papel_id'
|
||||
)->withTimestamps();
|
||||
}
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Lotacao::class,
|
||||
'administracao_lotacao_permissao',
|
||||
'permissao_id',
|
||||
'lotacao_id'
|
||||
)->withTimestamps();
|
||||
}
|
||||
|
||||
public function gestores()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Gestor::class,
|
||||
'administracao_gestor_permissao',
|
||||
'permissao_id',
|
||||
'gestor_id'
|
||||
)
|
||||
->using(GestorPermissao::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
26
api/app/Models/Almoxarifado/BalanceteFechamento.php
Normal file
26
api/app/Models/Almoxarifado/BalanceteFechamento.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class BalanceteFechamento extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_balancete_fechamento';
|
||||
|
||||
protected $fillable = [
|
||||
'mes',
|
||||
'ano',
|
||||
'saldo_fisico',
|
||||
'saldo_financeiro',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
47
api/app/Models/Almoxarifado/Dispensacao.php
Normal file
47
api/app/Models/Almoxarifado/Dispensacao.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
|
||||
class Dispensacao extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_dispensacao';
|
||||
|
||||
protected $casts = [
|
||||
'data_dispensacao' => 'datetime:Y-m-d',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'paciente_id',
|
||||
'usuario_id',
|
||||
'data_dispensacao',
|
||||
'observacao',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function paciente()
|
||||
{
|
||||
return $this->belongsTo(Paciente::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(DispensacaoItem::class);
|
||||
}
|
||||
}
|
||||
50
api/app/Models/Almoxarifado/DispensacaoItem.php
Normal file
50
api/app/Models/Almoxarifado/DispensacaoItem.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
|
||||
class DispensacaoItem extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_dispensacao_item';
|
||||
|
||||
protected $casts = [
|
||||
'dispensado_em' => 'datetime:Y-m-d',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'dispensacao_id',
|
||||
'material_id',
|
||||
'saida_item_id',
|
||||
'quantidade',
|
||||
'dispensado_em',
|
||||
'observacao',
|
||||
'estornado',
|
||||
'supervisor_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function dispensacao()
|
||||
{
|
||||
return $this->belongsTo(Dispensacao::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function saidaItem()
|
||||
{
|
||||
return $this->belongsTo(SaidaItem::class);
|
||||
}
|
||||
}
|
||||
20
api/app/Models/Almoxarifado/DocumentoTipo.php
Normal file
20
api/app/Models/Almoxarifado/DocumentoTipo.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class DocumentoTipo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_documento_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
78
api/app/Models/Almoxarifado/Entrada.php
Normal file
78
api/app/Models/Almoxarifado/Entrada.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
|
||||
class Entrada extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada';
|
||||
|
||||
protected $casts = [
|
||||
'finalizada' => 'boolean',
|
||||
'finalizada_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'tipo_id',
|
||||
'finalizada',
|
||||
'finalizada_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'documento',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::saved(function($model) {
|
||||
$model = (object) $model->fresh()->getRawOriginal();
|
||||
|
||||
EntradaLog::create([
|
||||
'entrada_id' => $model->id,
|
||||
'centro_custo_id' => $model->centro_custo_id,
|
||||
'tipo_id' => $model->tipo_id,
|
||||
'finalizada' => $model->finalizada,
|
||||
'finalizada_em' => $model->finalizada_em,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(EntradaTipo::class);
|
||||
}
|
||||
|
||||
public function documento()
|
||||
{
|
||||
return $this->hasOne(EntradaDocumento::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(EntradaItem::class);
|
||||
}
|
||||
|
||||
public function requisicaoResposta()
|
||||
{
|
||||
return $this->hasOne(RequisicaoResposta::class);
|
||||
}
|
||||
}
|
||||
74
api/app/Models/Almoxarifado/EntradaDocumento.php
Normal file
74
api/app/Models/Almoxarifado/EntradaDocumento.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Fornecedor\Fornecedor;
|
||||
use App\Models\Cadastro\OrigemProgramatica;
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaDocumento extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada_documento';
|
||||
|
||||
protected $casts = [
|
||||
'data' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_id',
|
||||
'fornecedor_id',
|
||||
'origem_programatica_id',
|
||||
'tipo_id',
|
||||
'numero_pedido',
|
||||
'numero',
|
||||
'data',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::saved(function($model) {
|
||||
$model = (object) $model->fresh()->getRawOriginal();
|
||||
|
||||
EntradaDocumentoLog::create([
|
||||
'entrada_documento_id' => $model->id,
|
||||
'entrada_id' => $model->entrada_id,
|
||||
'tipo_id' => $model->tipo_id,
|
||||
'fornecedor_id' => $model->fornecedor_id,
|
||||
'numero_pedido' => $model->numero_pedido,
|
||||
'numero' => $model->numero,
|
||||
'data' => $model->data,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
public function entrada()
|
||||
{
|
||||
return $this->belongsTo(Entrada::class);
|
||||
}
|
||||
|
||||
public function fornecedor()
|
||||
{
|
||||
return $this->belongsTo(Fornecedor::class);
|
||||
}
|
||||
|
||||
public function origemProgramatica()
|
||||
{
|
||||
return $this->belongsTo(OrigemProgramatica::class);
|
||||
}
|
||||
|
||||
public function documentoTipo()
|
||||
{
|
||||
return $this->belongsTo(DocumentoTipo::class);
|
||||
}
|
||||
}
|
||||
33
api/app/Models/Almoxarifado/EntradaDocumentoLog.php
Normal file
33
api/app/Models/Almoxarifado/EntradaDocumentoLog.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaDocumentoLog extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada_documento_log';
|
||||
|
||||
protected $casts = [
|
||||
'data' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_documento_id',
|
||||
'entrada_id',
|
||||
'fornecedor_id',
|
||||
'tipo_id',
|
||||
'numero_pedido',
|
||||
'numero',
|
||||
'data',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
178
api/app/Models/Almoxarifado/EntradaItem.php
Normal file
178
api/app/Models/Almoxarifado/EntradaItem.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Fabricante\Fabricante;
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Integracao\Bnafar\Medicamento;
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaItem extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada_item';
|
||||
|
||||
protected $casts = [
|
||||
'validade_lote' => 'datetime:d/m/Y',
|
||||
'estornado_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_id',
|
||||
'material_id',
|
||||
'integracao_bnafar_medicamento_id',
|
||||
'quantidade',
|
||||
'lote',
|
||||
'validade_lote',
|
||||
'valor_total',
|
||||
'valor_unitario',
|
||||
'numero_empenho',
|
||||
'despesas',
|
||||
'numero_autorizacao_fornecimento',
|
||||
'fabricante_id',
|
||||
'codigo_barras',
|
||||
'estornado_em',
|
||||
'saida_item_estornado_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'entrada_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'possui_lote',
|
||||
'valor_unitario_formatted',
|
||||
'valor_total_formatted',
|
||||
'despesas_formatted',
|
||||
'estornado',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::saved(function($model) {
|
||||
$model = (object) $model->fresh()->getRawOriginal();
|
||||
|
||||
EntradaItemLog::create([
|
||||
'entrada_item_id' => $model->id,
|
||||
'entrada_id' => $model->entrada_id,
|
||||
'material_id' => $model->material_id,
|
||||
'integracao_bnafar_medicamento_id' => $model->integracao_bnafar_medicamento_id,
|
||||
'quantidade' => $model->quantidade,
|
||||
'lote' => $model->lote,
|
||||
'validade_lote' => $model->validade_lote,
|
||||
'valor_total' => $model->valor_total,
|
||||
'valor_unitario' => $model->valor_unitario,
|
||||
'numero_empenho' => $model->numero_empenho,
|
||||
'despesas' => $model->despesas,
|
||||
'numero_autorizacao_fornecimento' => $model->numero_autorizacao_fornecimento,
|
||||
'fabricante_id' => $model->fabricante_id,
|
||||
'codigo_barras' => $model->codigo_barras,
|
||||
'estornado_em' => $model->estornado_em,
|
||||
'saida_item_estornado_id' => $model->saida_item_estornado_id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
public function entrada()
|
||||
{
|
||||
return $this->belongsTo(Entrada::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function integracaoBnafarMedicamento()
|
||||
{
|
||||
return $this->belongsTo(Medicamento::class);
|
||||
}
|
||||
|
||||
public function fabricante()
|
||||
{
|
||||
return $this->belongsTo(Fabricante::class);
|
||||
}
|
||||
|
||||
public function saidaItemEstornado()
|
||||
{
|
||||
return $this->belongsTo(SaidaItem::class);
|
||||
}
|
||||
|
||||
public function saidaItens()
|
||||
{
|
||||
return $this->belongsToMany(SaidaItem::class, 'almoxarifado_saida_item_entrada_item')
|
||||
->using(SaidaItemEntradaItem::class)
|
||||
->as('pivotSaidaItemEntradaItem')
|
||||
->withPivot(['quantidade_saida', 'entrada_item_estornado_id'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function saidaItensTransferencia()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
SaidaItem::class,
|
||||
'almoxarifado_saida_item_entrada_item_transferencia',
|
||||
'entrada_item_destino_id',
|
||||
'saida_item_origem_id',
|
||||
)
|
||||
->using(SaidaItemEntradaItemTransferencia::class)
|
||||
->as('pivotSaidaItemEntradaItemTransferencia')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function reservaItens()
|
||||
{
|
||||
return $this->belongsToMany(ReservaItem::class, 'almoxarifado_reserva_item_entrada_item')
|
||||
->using(ReservaItemEntradaItem::class)
|
||||
->as('pivotReservaItemEntradaItem')
|
||||
->withPivot(['quantidade_saida'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function requisicaoRespotaItens()
|
||||
{
|
||||
return $this->belongsToMany(RequisicaoRespostaItem::class, 'almoxarifado_requisicao_resposta_item_entrada_item')
|
||||
->using(RequisicaoRespostaItemEntradaItem::class)
|
||||
->as('pivotRequisicaoRespostaItemEntradaItem')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function getPossuiLoteAttribute()
|
||||
{
|
||||
return !is_null($this->lote);
|
||||
}
|
||||
|
||||
public function getValorUnitarioFormattedAttribute()
|
||||
{
|
||||
return number_format($this->valor_unitario, 6, ',', '.');
|
||||
}
|
||||
|
||||
public function getValorTotalFormattedAttribute()
|
||||
{
|
||||
return number_format($this->valor_total, 6, ',', '.');
|
||||
}
|
||||
|
||||
public function getDespesasFormattedAttribute()
|
||||
{
|
||||
return number_format($this->despesas, 6, ',', '.');
|
||||
}
|
||||
|
||||
public function getEstornadoAttribute()
|
||||
{
|
||||
return !is_null($this->estornado_em);
|
||||
}
|
||||
|
||||
public function getHasSaidasFinalizadasAttribute()
|
||||
{
|
||||
return $this->saidaItens()
|
||||
->whereHas('saida', fn ($q) => $q->where('finalizada', true))
|
||||
->count() > 0;
|
||||
}
|
||||
}
|
||||
44
api/app/Models/Almoxarifado/EntradaItemLog.php
Normal file
44
api/app/Models/Almoxarifado/EntradaItemLog.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaItemLog extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada_item_log';
|
||||
|
||||
protected $casts = [
|
||||
'validade_lote' => 'datetime:d/m/Y',
|
||||
'estornado_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_item_id',
|
||||
'entrada_id',
|
||||
'material_id',
|
||||
'integracao_bnafar_medicamento_id',
|
||||
'quantidade',
|
||||
'lote',
|
||||
'validade_lote',
|
||||
'valor_total',
|
||||
'valor_unitario',
|
||||
'numero_empenho',
|
||||
'despesas',
|
||||
'numero_autorizacao_fornecimento',
|
||||
'fabricante_id',
|
||||
'codigo_barras',
|
||||
'estornado_em',
|
||||
'saida_item_estornado_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'entrada_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
32
api/app/Models/Almoxarifado/EntradaLog.php
Normal file
32
api/app/Models/Almoxarifado/EntradaLog.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaLog extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada_log';
|
||||
|
||||
protected $casts = [
|
||||
'finalizada' => 'boolean',
|
||||
'finalizada_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_id',
|
||||
'centro_custo_id',
|
||||
'tipo_id',
|
||||
'finalizada',
|
||||
'finalizada_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
20
api/app/Models/Almoxarifado/EntradaTipo.php
Normal file
20
api/app/Models/Almoxarifado/EntradaTipo.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaTipo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_entrada_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
50
api/app/Models/Almoxarifado/Inventario.php
Normal file
50
api/app/Models/Almoxarifado/Inventario.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Integracao\Bnafar\Medicamento;
|
||||
use App\Models\Model;
|
||||
|
||||
class Inventario extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_inventario';
|
||||
|
||||
protected $casts = [
|
||||
'finalizado' => 'boolean',
|
||||
'finalizado_em' => 'datetime:d/m/Y',
|
||||
'validade_lote' => 'datetime:d/m/Y',
|
||||
'is_novo_lote' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'finalizado',
|
||||
'finalizado_em',
|
||||
'inventario_id',
|
||||
'material_id',
|
||||
'integracao_bnafar_medicamento_id',
|
||||
'lote',
|
||||
'validade_lote',
|
||||
'contagem',
|
||||
'is_novo_lote',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function integracaoBnafarMedicamento()
|
||||
{
|
||||
return $this->belongsTo(Medicamento::class);
|
||||
}
|
||||
}
|
||||
52
api/app/Models/Almoxarifado/MotivoBaixa.php
Normal file
52
api/app/Models/Almoxarifado/MotivoBaixa.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MotivoBaixa extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'almoxarifado_motivo_baixa';
|
||||
|
||||
protected $casts = [
|
||||
'justificar' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'tipo_id',
|
||||
'descricao',
|
||||
'justificar',
|
||||
];
|
||||
|
||||
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(MotivoBaixaTipo::class);
|
||||
}
|
||||
|
||||
public function baixas()
|
||||
{
|
||||
return $this->hasMany(SaidaBaixa::class, 'motivo_id');
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'baixas',
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
api/app/Models/Almoxarifado/MotivoBaixaTipo.php
Normal file
20
api/app/Models/Almoxarifado/MotivoBaixaTipo.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class MotivoBaixaTipo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_motivo_baixa_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\Grupo\Grupo;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoControleEstoqueGrupo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_controle_estoque_grupo';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'grupo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function grupo()
|
||||
{
|
||||
return $this->belongsTo(Grupo::class);
|
||||
}
|
||||
|
||||
public function subgrupos()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoControleEstoqueSubgrupo::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Subgrupo\Subgrupo;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoControleEstoqueSubgrupo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_controle_estoque_subgrupo';
|
||||
|
||||
protected $fillable = [
|
||||
'subgrupo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function parametrizacaoControleEstoqueGrupo()
|
||||
{
|
||||
return $this->belongsTo(ParametrizacaoControleEstoqueGrupo::class);
|
||||
}
|
||||
|
||||
public function subgrupo()
|
||||
{
|
||||
return $this->belongsTo(Subgrupo::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Grupo\Grupo;
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoDispensacaoMateriais extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_dispensacao';
|
||||
|
||||
protected $fillable = [
|
||||
'grupo_id',
|
||||
'material_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function grupo()
|
||||
{
|
||||
return $this->belongsTo(Grupo::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoDispensacaoUnidade extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_dispensacao_unidade';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
}
|
||||
53
api/app/Models/Almoxarifado/ParametrizacaoEstoque.php
Normal file
53
api/app/Models/Almoxarifado/ParametrizacaoEstoque.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoEstoque extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_estoque';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'material_id',
|
||||
'estoque_minimo',
|
||||
'estoque_maximo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'has_estoque_minimo',
|
||||
'has_estoque_maximo',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function getHasEstoqueMinimo()
|
||||
{
|
||||
return !is_null($this->estoque_minimo);
|
||||
}
|
||||
|
||||
public function getHasEstoqueMaximo()
|
||||
{
|
||||
return !is_null($this->estoque_maximo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\Grupo\Grupo;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoPortalDivulgacaoGrupo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_portal_divulgacao_grupo';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'grupo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function grupo()
|
||||
{
|
||||
return $this->belongsTo(Grupo::class);
|
||||
}
|
||||
|
||||
public function subgrupos()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoPortalDivulgacaoSubgrupo::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoPortalDivulgacaoMaterialgrupo::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoPortalDivulgacaoMaterialgrupo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_portal_divulgacao_item';
|
||||
|
||||
protected $fillable = [
|
||||
'grupo_id',
|
||||
'material_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function parametrizacaoPortalDivulgacaoGrupo()
|
||||
{
|
||||
return $this->belongsTo(ParametrizacaoPortalDivulgacaoGrupo::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Subgrupo\Subgrupo;
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoPortalDivulgacaoSubgrupo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_portal_divulgacao_subgrupo';
|
||||
|
||||
protected $fillable = [
|
||||
'subgrupo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function parametrizacaoPortalDivulgacaoGrupo()
|
||||
{
|
||||
return $this->belongsTo(ParametrizacaoPortalDivulgacaoGrupo::class);
|
||||
}
|
||||
|
||||
public function subgrupo()
|
||||
{
|
||||
return $this->belongsTo(Subgrupo::class);
|
||||
}
|
||||
}
|
||||
32
api/app/Models/Almoxarifado/ParametrizacaoRequisicao.php
Normal file
32
api/app/Models/Almoxarifado/ParametrizacaoRequisicao.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ParametrizacaoRequisicao extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_parametrizacao_requisicao';
|
||||
|
||||
protected $casts = [
|
||||
'numero_requisicao_automatico' => 'boolean',
|
||||
'permite_requisitar_materiais_sem_estoque' => 'boolean',
|
||||
'motivo_obrigatorio' => 'boolean'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'numero_requisicao_automatico',
|
||||
'permite_requisitar_materiais_sem_estoque',
|
||||
'prazo_validade',
|
||||
'motivo_obrigatorio'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
46
api/app/Models/Almoxarifado/Requisicao.php
Normal file
46
api/app/Models/Almoxarifado/Requisicao.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
|
||||
class Requisicao extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao';
|
||||
|
||||
protected $fillable = [
|
||||
'status_id',
|
||||
'centro_custo_id',
|
||||
'numero',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(RequisicaoStatus::class);
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(RequisicaoItem::class);
|
||||
}
|
||||
|
||||
public function respostas()
|
||||
{
|
||||
return $this->hasMany(RequisicaoResposta::class);
|
||||
}
|
||||
}
|
||||
41
api/app/Models/Almoxarifado/RequisicaoItem.php
Normal file
41
api/app/Models/Almoxarifado/RequisicaoItem.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoItem extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_item';
|
||||
|
||||
protected $fillable = [
|
||||
'material_id',
|
||||
'quantidade',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'requisicao_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function requisicao()
|
||||
{
|
||||
return $this->belongsTo(Requisicao::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function respostaItens()
|
||||
{
|
||||
return $this->hasMany(RequisicaoRespostaItem::class);
|
||||
}
|
||||
}
|
||||
37
api/app/Models/Almoxarifado/RequisicaoPermissao.php
Normal file
37
api/app/Models/Almoxarifado/RequisicaoPermissao.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoPermissao extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_permissao';
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_requisitante_id',
|
||||
'material_id',
|
||||
'estoque_maximo',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function centroCustoRequisitante()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
}
|
||||
72
api/app/Models/Almoxarifado/RequisicaoResposta.php
Normal file
72
api/app/Models/Almoxarifado/RequisicaoResposta.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoResposta extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_resposta';
|
||||
|
||||
protected $casts = [
|
||||
'enviada_em' => 'datetime:d/m/Y H:i:s',
|
||||
'recebida_em' => 'datetime:d/m/Y H:i:s',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'status_id',
|
||||
'requisicao_id',
|
||||
'reserva_id',
|
||||
'saida_id',
|
||||
'entrada_id',
|
||||
'observacoes',
|
||||
'enviada_em',
|
||||
'enviada_lotacao_id',
|
||||
'recebida_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(RequisicaoRespostaStatus::class);
|
||||
}
|
||||
|
||||
public function requisicao()
|
||||
{
|
||||
return $this->belongsTo(Requisicao::class);
|
||||
}
|
||||
|
||||
public function reserva()
|
||||
{
|
||||
return $this->belongsTo(Reserva::class);
|
||||
}
|
||||
|
||||
public function saida()
|
||||
{
|
||||
return $this->belongsTo(Saida::class);
|
||||
}
|
||||
|
||||
public function entrada()
|
||||
{
|
||||
return $this->belongsTo(Entrada::class);
|
||||
}
|
||||
|
||||
public function enviadaLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(RequisicaoRespostaItem::class);
|
||||
}
|
||||
}
|
||||
88
api/app/Models/Almoxarifado/RequisicaoRespostaItem.php
Normal file
88
api/app/Models/Almoxarifado/RequisicaoRespostaItem.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoRespostaItem extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_resposta_item';
|
||||
|
||||
protected $fillable = [
|
||||
'requisicao_item_id',
|
||||
'reserva_item_id',
|
||||
'saida_item_id',
|
||||
'motivo_id',
|
||||
'motivo_outro',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'requisicao_resposta_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'quantidade_entrada',
|
||||
'quantidade_recebimento',
|
||||
];
|
||||
|
||||
public function requisicaoResposta()
|
||||
{
|
||||
return $this->belongsTo(RequisicaoResposta::class);
|
||||
}
|
||||
|
||||
public function requisicaoItem()
|
||||
{
|
||||
return $this->belongsTo(RequisicaoItem::class);
|
||||
}
|
||||
|
||||
public function reservaItem()
|
||||
{
|
||||
return $this->belongsTo(ReservaItem::class);
|
||||
}
|
||||
|
||||
public function saidaItem()
|
||||
{
|
||||
return $this->belongsTo(SaidaItem::class);
|
||||
}
|
||||
|
||||
public function motivo()
|
||||
{
|
||||
return $this->belongsTo(RequisicaoRespostaItemMotivo::class);
|
||||
}
|
||||
|
||||
public function entradaItens()
|
||||
{
|
||||
return $this->belongsToMany(EntradaItem::class, 'almoxarifado_requisicao_resposta_item_entrada_item')
|
||||
->using(RequisicaoRespostaItemEntradaItem::class)
|
||||
->as('pivotRequisicaoRespostaItemEntradaItem')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function recebimentos()
|
||||
{
|
||||
return $this->hasMany(RequisicaoRespostaItemRecebimento::class);
|
||||
}
|
||||
|
||||
public function getQuantidadeEntradaAttribute()
|
||||
{
|
||||
$quantidade = 0;
|
||||
|
||||
$this->entradaItens->map(function ($entradaItem) use (&$quantidade) {
|
||||
|
||||
$quantidade += (int) $entradaItem->quantidade;
|
||||
});
|
||||
|
||||
return $quantidade;
|
||||
}
|
||||
|
||||
public function getQuantidadeRecebimentoAttribute()
|
||||
{
|
||||
return $this->recebimentos->sum('quantidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class RequisicaoRespostaItemEntradaItem extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Almoxarifado/RequisicaoRespostaItemMotivo.php
Normal file
25
api/app/Models/Almoxarifado/RequisicaoRespostaItemMotivo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoRespostaItemMotivo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_resposta_item_motivo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function requisicaoRespostaItens()
|
||||
{
|
||||
return $this->hasMany(RequisicaoRespostaItem::class, 'motivo_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoRespostaItemRecebimento extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_resposta_item_recebimento';
|
||||
|
||||
protected $casts = [
|
||||
'validade_lote' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_item_origem_id',
|
||||
'quantidade',
|
||||
'lote',
|
||||
'validade_lote',
|
||||
'controlava_estoque'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'requisicao_resposta_item_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function requisicaoRespostaItem()
|
||||
{
|
||||
return $this->belongsTo(RequisicaoRespostaItem::class);
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Almoxarifado/RequisicaoRespostaStatus.php
Normal file
25
api/app/Models/Almoxarifado/RequisicaoRespostaStatus.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoRespostaStatus extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_resposta_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function requisicaoRespostas()
|
||||
{
|
||||
return $this->hasMany(RequisicaoResposta::class, 'status_id');
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Almoxarifado/RequisicaoStatus.php
Normal file
25
api/app/Models/Almoxarifado/RequisicaoStatus.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class RequisicaoStatus extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_requisicao_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function requisicoes()
|
||||
{
|
||||
return $this->hasMany(Requisicao::class, 'status_id');
|
||||
}
|
||||
}
|
||||
38
api/app/Models/Almoxarifado/Reserva.php
Normal file
38
api/app/Models/Almoxarifado/Reserva.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Reserva extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_reserva';
|
||||
|
||||
protected $fillable = [
|
||||
'motivo_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function motivo()
|
||||
{
|
||||
return $this->belongsTo(ReservaMotivo::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(ReservaItem::class);
|
||||
}
|
||||
|
||||
public function requisicaoResposta()
|
||||
{
|
||||
return $this->hasOne(RequisicaoResposta::class);
|
||||
}
|
||||
}
|
||||
70
api/app/Models/Almoxarifado/ReservaItem.php
Normal file
70
api/app/Models/Almoxarifado/ReservaItem.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
|
||||
class ReservaItem extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_reserva_item';
|
||||
|
||||
protected $casts = [
|
||||
'escolheu_entrada_item_manualmente' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'material_id',
|
||||
'escolheu_entrada_item_manualmente',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'reserva_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'quantidade',
|
||||
];
|
||||
|
||||
public function reserva()
|
||||
{
|
||||
return $this->belongsTo(Reserva::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function entradaItens()
|
||||
{
|
||||
return $this->belongsToMany(EntradaItem::class, 'almoxarifado_reserva_item_entrada_item')
|
||||
->using(ReservaItemEntradaItem::class)
|
||||
->as('pivotReservaItemEntradaItem')
|
||||
->withPivot(['quantidade_saida'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function requisicaoRespostaItem()
|
||||
{
|
||||
return $this->hasOne(RequisicaoRespostaItem::class);
|
||||
}
|
||||
|
||||
public function getQuantidadeAttribute()
|
||||
{
|
||||
$quantidade = 0;
|
||||
|
||||
$this->entradaItens->map(function ($entradaItem) use (&$quantidade) {
|
||||
|
||||
$quantidade += (int) $entradaItem->pivotReservaItemEntradaItem->quantidade_saida;
|
||||
});
|
||||
|
||||
return $quantidade;
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Almoxarifado/ReservaItemEntradaItem.php
Normal file
17
api/app/Models/Almoxarifado/ReservaItemEntradaItem.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class ReservaItemEntradaItem extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Almoxarifado/ReservaMotivo.php
Normal file
25
api/app/Models/Almoxarifado/ReservaMotivo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ReservaMotivo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_reserva_motivo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function reservas()
|
||||
{
|
||||
return $this->hasMany(Reserva::class, 'motivo_id');
|
||||
}
|
||||
}
|
||||
77
api/app/Models/Almoxarifado/Saida.php
Normal file
77
api/app/Models/Almoxarifado/Saida.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Model;
|
||||
|
||||
class Saida extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida';
|
||||
|
||||
protected $casts = [
|
||||
'finalizada' => 'boolean',
|
||||
'finalizada_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'centro_custo_id',
|
||||
'tipo_id',
|
||||
'finalizada',
|
||||
'finalizada_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'requisicao',
|
||||
'baixa',
|
||||
];
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(SaidaTipo::class);
|
||||
}
|
||||
|
||||
public function requisicao()
|
||||
{
|
||||
return $this->hasOne(SaidaRequisicao::class);
|
||||
}
|
||||
|
||||
public function transferencia()
|
||||
{
|
||||
return $this->hasOne(SaidaTransferencia::class);
|
||||
}
|
||||
|
||||
public function baixa()
|
||||
{
|
||||
return $this->hasOne(SaidaBaixa::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(SaidaItem::class);
|
||||
}
|
||||
|
||||
public function requisicaoResposta()
|
||||
{
|
||||
return $this->hasOne(RequisicaoResposta::class);
|
||||
}
|
||||
|
||||
public function itensRecusadosTransferencia()
|
||||
{
|
||||
return $this->hasMany(SaidaItemRecusadoTransferencia::class);
|
||||
}
|
||||
}
|
||||
42
api/app/Models/Almoxarifado/SaidaBaixa.php
Normal file
42
api/app/Models/Almoxarifado/SaidaBaixa.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
|
||||
class SaidaBaixa extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida_baixa';
|
||||
|
||||
protected $fillable = [
|
||||
'saida_id',
|
||||
'motivo_id',
|
||||
'justificativa',
|
||||
'usuario_solicitante_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function saida()
|
||||
{
|
||||
return $this->belongsTo(Saida::class);
|
||||
}
|
||||
|
||||
public function motivo()
|
||||
{
|
||||
return $this->belongsTo(MotivoBaixa::class);
|
||||
}
|
||||
|
||||
public function usuarioSolicitante()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
}
|
||||
98
api/app/Models/Almoxarifado/SaidaItem.php
Normal file
98
api/app/Models/Almoxarifado/SaidaItem.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Farmacia\ReceitaItemEntrega;
|
||||
use App\Models\Model;
|
||||
|
||||
class SaidaItem extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida_item';
|
||||
|
||||
protected $casts = [
|
||||
'escolheu_entrada_item_manualmente' => 'boolean',
|
||||
'estornado_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'saida_id',
|
||||
'material_id',
|
||||
'escolheu_entrada_item_manualmente',
|
||||
'estornado_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'saida_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'estornado',
|
||||
'quantidade'
|
||||
];
|
||||
|
||||
public function saida()
|
||||
{
|
||||
return $this->belongsTo(Saida::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function entradaItens()
|
||||
{
|
||||
return $this->belongsToMany(EntradaItem::class, 'almoxarifado_saida_item_entrada_item')
|
||||
->using(SaidaItemEntradaItem::class)
|
||||
->as('pivotSaidaItemEntradaItem')
|
||||
->withPivot(['quantidade_saida', 'entrada_item_estornado_id'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function entradaItensTransferencia()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
EntradaItem::class,
|
||||
'almoxarifado_saida_item_entrada_item_transferencia',
|
||||
'saida_item_origem_id',
|
||||
'entrada_item_destino_id',
|
||||
)
|
||||
->using(SaidaItemEntradaItemTransferencia::class)
|
||||
->as('pivotSaidaItemEntradaItemTransferencia')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function requisicaoRespostaItem()
|
||||
{
|
||||
return $this->hasOne(RequisicaoRespostaItem::class);
|
||||
}
|
||||
|
||||
public function farmaciaReceitaItemEntrega()
|
||||
{
|
||||
return $this->hasOne(ReceitaItemEntrega::class);
|
||||
}
|
||||
|
||||
public function getEstornadoAttribute()
|
||||
{
|
||||
return !is_null($this->estornado_em);
|
||||
}
|
||||
|
||||
public function getQuantidadeAttribute()
|
||||
{
|
||||
$quantidade = 0;
|
||||
|
||||
$this->entradaItens->map(function ($entradaItem) use (&$quantidade) {
|
||||
|
||||
$quantidade += (int) $entradaItem->pivotSaidaItemEntradaItem->quantidade_saida;
|
||||
});
|
||||
|
||||
return $quantidade;
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Almoxarifado/SaidaItemEntradaItem.php
Normal file
17
api/app/Models/Almoxarifado/SaidaItemEntradaItem.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class SaidaItemEntradaItem 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\Almoxarifado;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class SaidaItemEntradaItemTransferencia 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,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class SaidaItemRecusadoTransferencia extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida_item_recusado_transferencia';
|
||||
|
||||
protected $fillable = [
|
||||
'saida_id',
|
||||
'saida_item_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function saida()
|
||||
{
|
||||
return $this->belongsTo(Saida::class);
|
||||
}
|
||||
|
||||
public function saidaItem()
|
||||
{
|
||||
return $this->belongsTo(SaidaItem::class);
|
||||
}
|
||||
}
|
||||
48
api/app/Models/Almoxarifado/SaidaRequisicao.php
Normal file
48
api/app/Models/Almoxarifado/SaidaRequisicao.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
|
||||
class SaidaRequisicao extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida_requisicao';
|
||||
|
||||
protected $casts = [
|
||||
'data' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'saida_id',
|
||||
'centro_custo_id',
|
||||
'usuario_id',
|
||||
'numero',
|
||||
'data',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function saida()
|
||||
{
|
||||
return $this->belongsTo(Saida::class);
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Almoxarifado/SaidaTipo.php
Normal file
25
api/app/Models/Almoxarifado/SaidaTipo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class SaidaTipo extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function saidas()
|
||||
{
|
||||
return $this->hasMany(Saida::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
49
api/app/Models/Almoxarifado/SaidaTransferencia.php
Normal file
49
api/app/Models/Almoxarifado/SaidaTransferencia.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Almoxarifado;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
|
||||
class SaidaTransferencia extends Model
|
||||
{
|
||||
protected $table = 'almoxarifado_saida_transferencia';
|
||||
|
||||
protected $casts = [
|
||||
'confirmado' => 'boolean',
|
||||
'recusado' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'saida_id',
|
||||
'centro_custo_id',
|
||||
'usuario_id',
|
||||
'confirmado',
|
||||
'recusado',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function saida()
|
||||
{
|
||||
return $this->belongsTo(Saida::class);
|
||||
}
|
||||
|
||||
public function centroCusto()
|
||||
{
|
||||
return $this->belongsTo(CentroCusto::class);
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
}
|
||||
136
api/app/Models/Ambulatorio/AcompanhamentoOci.php
Normal file
136
api/app/Models/Ambulatorio/AcompanhamentoOci.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Apac\MotivoSaidaPermanencia;
|
||||
use App\Models\Apac\SolicitacaoAutorizacao;
|
||||
use App\Models\Cadastro\EtapaClinica;
|
||||
use App\Models\Cadastro\Oci;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
use App\Models\Sigtap\Cid;
|
||||
use App\Models\Sigtap\Ocupacao;
|
||||
use App\Models\Sigtap\Procedimento;
|
||||
|
||||
class AcompanhamentoOci extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_acompanhamento_oci';
|
||||
|
||||
protected $casts = [
|
||||
'iniciado_em' => 'datetime',
|
||||
'finalizado_em' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'paciente_id',
|
||||
'ocupacao_id',
|
||||
'oci_id',
|
||||
'etapa_clinica_atual_id',
|
||||
'status_id',
|
||||
'iniciado_em',
|
||||
'iniciado_lotacao_id',
|
||||
'finalizado_em',
|
||||
'finalizado_lotacao_id',
|
||||
'finalizado_motivo_encerramento_id',
|
||||
'finalizado_observacao',
|
||||
'motivo_saida_permanencia_id',
|
||||
'procedimento_oci_data',
|
||||
'procedimento_oci_procedimento_id',
|
||||
'procedimento_oci_cid_id',
|
||||
'procedimento_oci_quantidade',
|
||||
'procedimento_oci_ocupacao_id',
|
||||
'procedimento_oci_usuario_id',
|
||||
'apac_solicitacao_autorizacao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function paciente()
|
||||
{
|
||||
return $this->belongsTo(Paciente::class);
|
||||
}
|
||||
|
||||
public function ocupacao()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function oci()
|
||||
{
|
||||
return $this->belongsTo(Oci::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(AcompanhamentoOciStatus::class);
|
||||
}
|
||||
|
||||
public function etapaClinicaAtual()
|
||||
{
|
||||
return $this->belongsTo(EtapaClinica::class);
|
||||
}
|
||||
|
||||
public function iniciadoLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function finalizadoLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function motivoSaidaPermanencia()
|
||||
{
|
||||
return $this->belongsTo(MotivoSaidaPermanencia::class);
|
||||
}
|
||||
|
||||
public function finalizadoMotivoEncerramento()
|
||||
{
|
||||
return $this->belongsTo(AcompanhamentoOciMotivoEncerramento::class);
|
||||
}
|
||||
|
||||
public function procedimentoOciProcedimento()
|
||||
{
|
||||
return $this->belongsTo(Procedimento::class);
|
||||
}
|
||||
|
||||
public function procedimentoOciCid()
|
||||
{
|
||||
return $this->belongsTo(Cid::class);
|
||||
}
|
||||
|
||||
public function procedimentoOciOcupacao()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function procedimentoOciUsuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function apacSolicitacaoAutorizacao()
|
||||
{
|
||||
return $this->belongsTo(SolicitacaoAutorizacao::class);
|
||||
}
|
||||
|
||||
public function etapasClinicasConcluidas()
|
||||
{
|
||||
return $this->hasMany(AcompanhamentoOciEtapaClinicaConcluida::class);
|
||||
}
|
||||
|
||||
public function procedimentosRealizados()
|
||||
{
|
||||
return $this->hasMany(AcompanhamentoOciProcedimentoRealizado::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Cadastro\EtapaClinica;
|
||||
use App\Models\Model;
|
||||
use App\Models\Regulacao\Solicitacao;
|
||||
|
||||
class AcompanhamentoOciEtapaClinicaConcluida extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_acompanhamento_oci_etapa_clinica_concluida';
|
||||
|
||||
protected $fillable = [
|
||||
'acompanhamento_oci_id',
|
||||
'etapa_clinica_id',
|
||||
'soap_id',
|
||||
'regulacao_solicitacao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function acompanhamentoOci()
|
||||
{
|
||||
return $this->belongsTo(AcompanhamentoOci::class);
|
||||
}
|
||||
|
||||
public function etapaClinica()
|
||||
{
|
||||
return $this->belongsTo(EtapaClinica::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function regulacaoSolicitacao()
|
||||
{
|
||||
return $this->belongsTo(Solicitacao::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AcompanhamentoOciMotivoEncerramento extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_acompanhamento_oci_motivo_encerramento';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function acompanhamentosOcis()
|
||||
{
|
||||
return $this->hasMany(AcompanhamentoOci::class, 'finalizado_motivo_encerramento_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Apac\SolicitacaoAutorizacaoProcedimentoSecundario;
|
||||
use App\Models\Cadastro\Estabelecimento\Unidade;
|
||||
use App\Models\Model;
|
||||
use App\Models\Sigtap\Ocupacao;
|
||||
use App\Models\Sigtap\Procedimento;
|
||||
|
||||
class AcompanhamentoOciProcedimentoRealizado extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_acompanhamento_oci_procedimento_realizado';
|
||||
|
||||
protected $casts = [
|
||||
'data_executada' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'acompanhamento_oci_id',
|
||||
'soap_id',
|
||||
'procedimento_id',
|
||||
'data_executada',
|
||||
'unidade_executora_id',
|
||||
'ocupacao_executora_id',
|
||||
'usuario_executor_nome',
|
||||
'apac_procedimento_secundario_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function acompanhamentoOci()
|
||||
{
|
||||
return $this->belongsTo(AcompanhamentoOci::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function procedimento()
|
||||
{
|
||||
return $this->belongsTo(Procedimento::class);
|
||||
}
|
||||
|
||||
public function unidadeExecutora()
|
||||
{
|
||||
return $this->belongsTo(Unidade::class);
|
||||
}
|
||||
|
||||
public function ocupacaoExecutora()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function apacProcedimentoSecundario()
|
||||
{
|
||||
return $this->belongsTo(SolicitacaoAutorizacaoProcedimentoSecundario::class);
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Ambulatorio/AcompanhamentoOciStatus.php
Normal file
25
api/app/Models/Ambulatorio/AcompanhamentoOciStatus.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AcompanhamentoOciStatus extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_acompanhamento_oci_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function acompanhamentosOcis()
|
||||
{
|
||||
return $this->hasMany(AcompanhamentoOci::class, 'status_id');
|
||||
}
|
||||
}
|
||||
76
api/app/Models/Ambulatorio/Agendamento.php
Normal file
76
api/app/Models/Ambulatorio/Agendamento.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
||||
use App\Models\Model;
|
||||
use App\Models\Regulacao\Solicitacao as RegulacaoSolicitacao;
|
||||
use App\Models\Sms\SmsEnvio;
|
||||
|
||||
class Agendamento extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_agendamento';
|
||||
|
||||
protected $casts = [
|
||||
'horario' => 'datetime:H:i',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'agendamento_anterior_id',
|
||||
'jornada_id',
|
||||
'tipo_id',
|
||||
'horario',
|
||||
'paciente_id',
|
||||
'status_id',
|
||||
'observacao',
|
||||
'motivo_cancelamento',
|
||||
'motivo_agendamento_excedente',
|
||||
'sms_envio_id',
|
||||
'regulacao_solicitacao_id',
|
||||
'origem_agendamento',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function jornada()
|
||||
{
|
||||
return $this->belongsTo(Jornada::class);
|
||||
}
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(AgendamentoTipo::class);
|
||||
}
|
||||
|
||||
public function paciente()
|
||||
{
|
||||
return $this->belongsTo(Paciente::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(AgendamentoStatus::class);
|
||||
}
|
||||
|
||||
public function smsEnvio()
|
||||
{
|
||||
return $this->belongsTo(SmsEnvio::class);
|
||||
}
|
||||
|
||||
public function regulacaoSolicitacao()
|
||||
{
|
||||
return $this->belongsTo(RegulacaoSolicitacao::class);
|
||||
}
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->hasOne(Atendimento::class);
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Ambulatorio/AgendamentoStatus.php
Normal file
25
api/app/Models/Ambulatorio/AgendamentoStatus.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AgendamentoStatus extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_agendamento_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function agendamentos()
|
||||
{
|
||||
return $this->hasMany(Agendamento::class, 'status_id');
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Ambulatorio/AgendamentoTipo.php
Normal file
25
api/app/Models/Ambulatorio/AgendamentoTipo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AgendamentoTipo extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_agendamento_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function agendamentos()
|
||||
{
|
||||
return $this->hasMany(Agendamento::class, 'tipo_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AmbulatorioEncaminhamentoCaraterInternacao extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'ambulatorio_encaminhamento_carater_internacao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AmbulatorioEncaminhamentoCausaExterna extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ambulatorio_encaminhamento_causa_externa';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AmbulatorioEncaminhamentoClinica extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ambulatorio_encaminhamento_clinica';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AmbulatorioEncaminhamentoVinculoPrevidencia extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'ambulatorio_encaminhamento_vinculo_previdencia';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Ambulatorio/ArcadaDentaria.php
Normal file
25
api/app/Models/Ambulatorio/ArcadaDentaria.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class ArcadaDentaria extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_arcada_dentaria';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function dentes()
|
||||
{
|
||||
return $this->hasMany(Dente::class, 'arcada_id');
|
||||
}
|
||||
}
|
||||
190
api/app/Models/Ambulatorio/Atendimento.php
Normal file
190
api/app/Models/Ambulatorio/Atendimento.php
Normal file
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Enums\Ambulatorio\DemandaTipo;
|
||||
use App\Models\AtencaoBasica\AtendimentoIndividual\TipoAtendimento;
|
||||
use App\Models\Cadastro\Especialidade;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
use App\Models\PainelSenha\Fila;
|
||||
use App\Models\Sigtap\Ocupacao;
|
||||
|
||||
class Atendimento extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento';
|
||||
|
||||
protected $casts = [
|
||||
'finalizado_em' => 'datetime:d/m/Y H:i:s',
|
||||
'pos_consulta' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_tipo_id',
|
||||
'fila_id',
|
||||
'paciente_id',
|
||||
'agendamento_id',
|
||||
'demanda_espontanea_id',
|
||||
'responsavel_atual_usuario_id',
|
||||
'responsavel_atual_ocupacao_id',
|
||||
'responsavel_atual_especialidade_id',
|
||||
'responsavel_encaminhamento_atual_lotacao_id',
|
||||
'finalizado_em',
|
||||
'finalizado_lotacao_id',
|
||||
'pos_consulta',
|
||||
'tempo_atendimento'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function fila()
|
||||
{
|
||||
return $this->belongsTo(Fila::class);
|
||||
}
|
||||
|
||||
public function agendamento()
|
||||
{
|
||||
return $this->belongsTo(Agendamento::class);
|
||||
}
|
||||
|
||||
public function demandaEspontanea()
|
||||
{
|
||||
return $this->belongsTo(DemandaEspontanea::class);
|
||||
}
|
||||
|
||||
public function responsavelAtualUsuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function responsavelAtualOcupacao()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function responsavelAtualEspecialidade()
|
||||
{
|
||||
return $this->belongsTo(Especialidade::class);
|
||||
}
|
||||
|
||||
public function responsavelEncaminhamentoAtualLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function finalizadoLotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
|
||||
public function servicos()
|
||||
{
|
||||
return $this->belongsToMany(Servico::class, 'ambulatorio_atendimento_servico')
|
||||
->using(AtendimentoServico::class)
|
||||
->as('atendimentoServico')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function preAtendimento()
|
||||
{
|
||||
return $this->hasOne(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function raas()
|
||||
{
|
||||
return $this->hasOne(AtendimentoRaas::class);
|
||||
}
|
||||
|
||||
public function soaps()
|
||||
{
|
||||
return $this->hasMany(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function posConsultas()
|
||||
{
|
||||
return $this->hasMany(AtendimentoPosConsulta::class);
|
||||
}
|
||||
|
||||
public function antropometrias()
|
||||
{
|
||||
return $this->hasMany(AtendimentoAntropometria::class);
|
||||
}
|
||||
|
||||
public function sinaisVitais()
|
||||
{
|
||||
return $this->hasMany(AtendimentoSinalVital::class);
|
||||
}
|
||||
|
||||
public function glicemiasCapilares()
|
||||
{
|
||||
return $this->hasMany(AtendimentoGlicemiaCapilar::class);
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(AtendimentoProcedimento::class);
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(AtendimentoDeclaracaoComparecimento::class);
|
||||
}
|
||||
|
||||
public function getFinalizadoAttribute()
|
||||
{
|
||||
return !is_null($this->finalizado_em);
|
||||
}
|
||||
|
||||
public function getDemandaTipoAttribute()
|
||||
{
|
||||
return is_null($this->agendamento_id) ? DemandaTipo::ESPONTANEA : DemandaTipo::AGENDADA;
|
||||
}
|
||||
|
||||
public function getIsDemandaEspontaneaAttribute()
|
||||
{
|
||||
return $this->demanda_tipo === DemandaTipo::ESPONTANEA;
|
||||
}
|
||||
|
||||
public function getPacienteAttribute()
|
||||
{
|
||||
return ($this->agendamento ?? $this->demandaEspontanea)->paciente;
|
||||
}
|
||||
|
||||
public function getOcupacaoAttribute()
|
||||
{
|
||||
return $this->responsavelAtualOcupacao ?? ($this->agendamento->jornada->lotacao ?? $this->demandaEspontanea)->ocupacao;
|
||||
}
|
||||
|
||||
public function getEspecialidadeAttribute()
|
||||
{
|
||||
return $this->responsavelAtualEspecialidade ?? ($this->agendamento->jornada ?? $this->demandaEspontanea)->especialidade;
|
||||
}
|
||||
|
||||
public function getUsuarioAttribute()
|
||||
{
|
||||
return $this->responsavelAtualUsuario ?? ($this->agendamento->jornada->lotacao ?? $this->demandaEspontanea)->usuario;
|
||||
}
|
||||
|
||||
public function getJornadaAttribute()
|
||||
{
|
||||
return $this->demandaEspontanea->jornada;
|
||||
}
|
||||
|
||||
public function getInfraestruturaAttribute()
|
||||
{
|
||||
return ($this->agendamento->jornada->lotacao ?? $this->demandaEspontanea->createdLotacao)->infraestrutura;
|
||||
}
|
||||
|
||||
public function atendimentoTipo()
|
||||
{
|
||||
return $this->belongsTo(TipoAtendimento::class);
|
||||
}
|
||||
}
|
||||
67
api/app/Models/Ambulatorio/AtendimentoAntropometria.php
Normal file
67
api/app/Models/Ambulatorio/AtendimentoAntropometria.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoAntropometria extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_antropometria';
|
||||
|
||||
protected $casts = [
|
||||
'medido_em' => 'datetime:d/m/Y',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'pre_atendimento_id',
|
||||
'pos_consulta_id',
|
||||
'soap_id',
|
||||
'medido_em',
|
||||
'peso',
|
||||
'altura',
|
||||
'perimetro_cefalico',
|
||||
'circunferencia_abdominal',
|
||||
'perimetro_panturrilha',
|
||||
'comprimento_pe_direito',
|
||||
'largura_pe_direito',
|
||||
'circunferencia_pe_direito',
|
||||
'comprimento_pe_esquerdo',
|
||||
'largura_pe_esquerdo',
|
||||
'circunferencia_pe_esquerdo',
|
||||
];
|
||||
|
||||
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 preAtendimento()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function posConsulta()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPosConsulta::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function soapObjetivoAntropometria()
|
||||
{
|
||||
return $this->hasOne(AtendimentoSoapObjetivoAntropometria::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Geral\Turno;
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoDeclaracaoComparecimento extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_declaracao_comparecimento';
|
||||
|
||||
protected $casts = [
|
||||
'entrada' => 'datetime:H:i',
|
||||
'saida' => 'datetime:H:i',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'pre_atendimento_id',
|
||||
'soap_id',
|
||||
'nome_acompanhante',
|
||||
'motivo_comparecimento',
|
||||
'turno_id',
|
||||
'entrada',
|
||||
'saida',
|
||||
];
|
||||
|
||||
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 preAtendimento()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function turno()
|
||||
{
|
||||
return $this->belongsTo(Turno::class);
|
||||
}
|
||||
}
|
||||
54
api/app/Models/Ambulatorio/AtendimentoGlicemiaCapilar.php
Normal file
54
api/app/Models/Ambulatorio/AtendimentoGlicemiaCapilar.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoGlicemiaCapilar extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_glicemia_capilar';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'pre_atendimento_id',
|
||||
'pos_consulta_id',
|
||||
'soap_id',
|
||||
'valor',
|
||||
'momento_coleta_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function preAtendimento()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function posConsulta()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPosConsulta::class);
|
||||
}
|
||||
|
||||
public function momentoColeta()
|
||||
{
|
||||
return $this->belongsTo(GlicemiaCapilarMomentoColeta::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function soapObjetivoGlicemiaCapilar()
|
||||
{
|
||||
return $this->hasOne(AtendimentoSoapObjetivoGlicemiaCapilar::class);
|
||||
}
|
||||
}
|
||||
46
api/app/Models/Ambulatorio/AtendimentoImpressaoLog.php
Normal file
46
api/app/Models/Ambulatorio/AtendimentoImpressaoLog.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoImpressaoLog extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_impressao_log';
|
||||
|
||||
protected $casts = [
|
||||
'impresso_em' => 'datetime:d/m/Y H:i:s',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'impressao_tipo_id',
|
||||
'lotacao_id',
|
||||
'impresso_em',
|
||||
];
|
||||
|
||||
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 impressaoTipo()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoImpressaoTipo::class);
|
||||
}
|
||||
|
||||
public function lotacao()
|
||||
{
|
||||
return $this->belongsTo(Lotacao::class);
|
||||
}
|
||||
}
|
||||
25
api/app/Models/Ambulatorio/AtendimentoImpressaoTipo.php
Normal file
25
api/app/Models/Ambulatorio/AtendimentoImpressaoTipo.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoImpressaoTipo extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_impressao_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function atendimentosImpressoesLogs()
|
||||
{
|
||||
return $this->hasMany(AtendimentoImpressaoLog::class, 'impressao_tipo_id');
|
||||
}
|
||||
}
|
||||
41
api/app/Models/Ambulatorio/AtendimentoMedicamento.php
Normal file
41
api/app/Models/Ambulatorio/AtendimentoMedicamento.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Almoxarifado\SaidaItem;
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoMedicamento extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_medicamento';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'pre_atendimento_id',
|
||||
'saida_item_id',
|
||||
];
|
||||
|
||||
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 preAtendimento()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoSaidaItem()
|
||||
{
|
||||
return $this->belongsTo(SaidaItem::class, 'saida_item_id');
|
||||
}
|
||||
}
|
||||
131
api/app/Models/Ambulatorio/AtendimentoPosConsulta.php
Normal file
131
api/app/Models/Ambulatorio/AtendimentoPosConsulta.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\AtencaoBasica\MarcadorConsumoAlimentar\LocalAtendimento;
|
||||
use App\Models\AtencaoBasica\Parametrizacao\Equipe;
|
||||
use App\Models\AtencaoBasica\Procedimento\ViaAdministracao;
|
||||
use App\Models\Geral\Turno;
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoPosConsulta extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_pos_consulta';
|
||||
|
||||
protected $casts = [
|
||||
'orientacao_individual_em_saude' => 'boolean',
|
||||
'paciente_liberado' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'observacoes',
|
||||
'equipe_id',
|
||||
'atencao_basica_local_atendimento_id',
|
||||
'turno_id',
|
||||
'orientacao_individual_em_saude',
|
||||
'paciente_liberado',
|
||||
];
|
||||
|
||||
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 equipe()
|
||||
{
|
||||
return $this->belongsTo(Equipe::class);
|
||||
}
|
||||
|
||||
public function atencaoBasicaLocalAtendimento()
|
||||
{
|
||||
return $this->belongsTo(LocalAtendimento::class);
|
||||
}
|
||||
|
||||
public function turno()
|
||||
{
|
||||
return $this->belongsTo(Turno::class);
|
||||
}
|
||||
|
||||
public function testesRapidos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
TesteRapido::class,
|
||||
'ambulatorio_atendimento_pos_consulta_teste_rapido',
|
||||
'pos_consulta_id',
|
||||
'teste_rapido_id'
|
||||
)
|
||||
->using(AtendimentoPosConsultaTesteRapido::class)
|
||||
->as('posConsultaTesteRapido')
|
||||
->withPivot(['resultado'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function administracoesMedicamentos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ViaAdministracao::class,
|
||||
'ambulatorio_atendimento_pos_consulta_admin_medicamento',
|
||||
'pos_consulta_id',
|
||||
'via_administracao_id'
|
||||
)
|
||||
->using(AtendimentoPosConsultaAdministracaoMedicamento::class)
|
||||
->as('posConsultaAdministracaoMedicamento')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function outrosProcedimentos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
OutroProcedimento::class,
|
||||
'ambulatorio_atendimento_pos_consulta_outro_procedimento',
|
||||
'pos_consulta_id',
|
||||
'outro_procedimento_id'
|
||||
)
|
||||
->using(AtendimentoPosConsultaOutroProcedimento::class)
|
||||
->as('posConsultaOutroProcedimento')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function coletasMateriais()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ColetaMaterial::class,
|
||||
'ambulatorio_atendimento_pos_consulta_coleta_material',
|
||||
'pos_consulta_id',
|
||||
'coleta_material_id'
|
||||
)
|
||||
->using(AtendimentoPosConsultaColetaMaterial::class)
|
||||
->as('posConsultaColetaMaterial')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(AtendimentoProcedimento::class, 'pos_consulta_id');
|
||||
}
|
||||
|
||||
public function antropometria()
|
||||
{
|
||||
return $this->hasOne(AtendimentoAntropometria::class, 'pos_consulta_id');
|
||||
}
|
||||
|
||||
public function sinalVital()
|
||||
{
|
||||
return $this->hasOne(AtendimentoSinalVital::class, 'pos_consulta_id');
|
||||
}
|
||||
|
||||
public function glicemiaCapilar()
|
||||
{
|
||||
return $this->hasOne(AtendimentoGlicemiaCapilar::class, 'pos_consulta_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPosConsultaAdministracaoMedicamento 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\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPosConsultaColetaMaterial 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\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPosConsultaOutroProcedimento 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\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPosConsultaTesteRapido extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPreAtendimentoAdministracaoMedicamento 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\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPreAtendimentoColetaMaterial 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\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPreAtendimentoOutroProcedimento 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\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoPreAtendimentoTesteRapido extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
133
api/app/Models/Ambulatorio/AtendimentoProcedimento.php
Normal file
133
api/app/Models/Ambulatorio/AtendimentoProcedimento.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Almoxarifado\SaidaItem;
|
||||
use App\Models\Apac\SolicitacaoAutorizacao;
|
||||
use App\Models\Bpa\Procedimento as BpaProcedimento;
|
||||
use App\Models\Cadastro\Especialidade;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
use App\Models\Raas\AtendimentoProcedimento as RaasAtendimentoProcedimento;
|
||||
use App\Models\Sigtap\Cid;
|
||||
use App\Models\Sigtap\Ocupacao;
|
||||
use App\Models\Sigtap\Procedimento;
|
||||
|
||||
class AtendimentoProcedimento extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_procedimento';
|
||||
|
||||
protected $casts = [
|
||||
'automatico' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'pre_atendimento_id',
|
||||
'soap_id',
|
||||
'pos_consulta_id',
|
||||
'bpa_procedimento_id',
|
||||
'raas_atendimento_procedimento_id',
|
||||
'apac_solicitacao_autorizacao_id',
|
||||
'apac_procedimento_secundario_id',
|
||||
'ocupacao_id',
|
||||
'especialidade_id',
|
||||
'usuario_id',
|
||||
'procedimento_id',
|
||||
'cid_id',
|
||||
'saida_item_id',
|
||||
'quantidade',
|
||||
'automatico',
|
||||
'local_curativo',
|
||||
'acompanhamento_oci_id',
|
||||
];
|
||||
|
||||
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 preAtendimento()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function posConsulta()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPosConsulta::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function raasAtendimentoProcedimento()
|
||||
{
|
||||
return $this->belongsTo(RaasAtendimentoProcedimento::class);
|
||||
}
|
||||
|
||||
public function apacSolicitacaoAutorizacao()
|
||||
{
|
||||
return $this->belongsTo(SolicitacaoAutorizacao::class);
|
||||
}
|
||||
|
||||
public function bpaProcedimento()
|
||||
{
|
||||
return $this->belongsTo(BpaProcedimento::class);
|
||||
}
|
||||
|
||||
public function ocupacao()
|
||||
{
|
||||
return $this->belongsTo(Ocupacao::class);
|
||||
}
|
||||
|
||||
public function especialidade()
|
||||
{
|
||||
return $this->belongsTo(Especialidade::class);
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function procedimento()
|
||||
{
|
||||
return $this->belongsTo(Procedimento::class);
|
||||
}
|
||||
|
||||
public function cid()
|
||||
{
|
||||
return $this->belongsTo(Cid::class);
|
||||
}
|
||||
|
||||
public function soapProcedimentoClinico()
|
||||
{
|
||||
return $this->hasOne(AtendimentoSoapProcedimentoClinico::class);
|
||||
}
|
||||
|
||||
public function soapProcedimentoAdministrativo()
|
||||
{
|
||||
return $this->hasOne(AtendimentoSoapProcedimentoAdministrativo::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoSaidaItem()
|
||||
{
|
||||
return $this->belongsTo(SaidaItem::class, 'saida_item_id');
|
||||
}
|
||||
|
||||
public function materiais()
|
||||
{
|
||||
return $this->hasMany(AtendimentoSoapFeridaMaterial::class, 'atendimento_procedimento_id');
|
||||
}
|
||||
}
|
||||
71
api/app/Models/Ambulatorio/AtendimentoRaas.php
Normal file
71
api/app/Models/Ambulatorio/AtendimentoRaas.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\Raas\CaraterAtendimento;
|
||||
use App\Models\Raas\DestinoPaciente;
|
||||
use App\Models\Raas\LocalRealizacaoExame;
|
||||
use App\Models\Raas\MotivoSaidaPermanencia;
|
||||
use App\Models\Raas\OrigemPaciente;
|
||||
use App\Models\Sigtap\Classificacao;
|
||||
|
||||
class AtendimentoRaas extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_raas';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'origem_paciente_id',
|
||||
'destino_paciente_id',
|
||||
'motivo_saida_permanencia_id',
|
||||
'carater_atendimento_id',
|
||||
'numero_autorizacao',
|
||||
'classificacao_id',
|
||||
'local_realizacao_exame_id',
|
||||
];
|
||||
|
||||
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 origemPaciente()
|
||||
{
|
||||
return $this->belongsTo(OrigemPaciente::class);
|
||||
}
|
||||
|
||||
public function destinoPaciente()
|
||||
{
|
||||
return $this->belongsTo(DestinoPaciente::class);
|
||||
}
|
||||
|
||||
public function motivoSaidaPermanencia()
|
||||
{
|
||||
return $this->belongsTo(MotivoSaidaPermanencia::class);
|
||||
}
|
||||
|
||||
public function caraterAtendimento()
|
||||
{
|
||||
return $this->belongsTo(CaraterAtendimento::class);
|
||||
}
|
||||
|
||||
public function classificacao()
|
||||
{
|
||||
return $this->belongsTo(Classificacao::class);
|
||||
}
|
||||
|
||||
public function localRealizacaoExame()
|
||||
{
|
||||
return $this->belongsTo(LocalRealizacaoExame::class);
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Ambulatorio/AtendimentoServico.php
Normal file
17
api/app/Models/Ambulatorio/AtendimentoServico.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class AtendimentoServico extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
56
api/app/Models/Ambulatorio/AtendimentoSinalVital.php
Normal file
56
api/app/Models/Ambulatorio/AtendimentoSinalVital.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ambulatorio;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class AtendimentoSinalVital extends Model
|
||||
{
|
||||
protected $table = 'ambulatorio_atendimento_sinal_vital';
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'pre_atendimento_id',
|
||||
'pos_consulta_id',
|
||||
'soap_id',
|
||||
'pressao_arterial',
|
||||
'frequencia_respiratoria',
|
||||
'frequencia_cardiaca',
|
||||
'temperatura',
|
||||
'saturacao_o2',
|
||||
];
|
||||
|
||||
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 preAtendimento()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPreAtendimento::class);
|
||||
}
|
||||
|
||||
public function posConsulta()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoPosConsulta::class);
|
||||
}
|
||||
|
||||
public function soap()
|
||||
{
|
||||
return $this->belongsTo(AtendimentoSoap::class);
|
||||
}
|
||||
|
||||
public function soapObjetivoSinalVital()
|
||||
{
|
||||
return $this->hasOne(AtendimentoSoapObjetivoSinalVital::class);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user