This commit is contained in:
@@ -0,0 +1,379 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Enums\Intranet\Sistema;
|
||||
use App\Enums\Log\AcessoSistemaStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Autenticacao\RecuperacaoSenhaRequest;
|
||||
use App\Http\Requests\Autenticacao\TrocaSenhaRequest;
|
||||
use App\Mail\UsuarioLogin;
|
||||
use App\Models\Administracao\Menu;
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Cadastro\SujeitoAtencao\UsuarioHistoricoAcesso;
|
||||
use App\Models\Geral\Configuracao;
|
||||
use App\Models\Intranet\Cliente;
|
||||
use App\Models\Log\AcessoSistema;
|
||||
use App\Services\Administracao\NotificacaoService;
|
||||
use App\Services\Intranet\Cadastro\NotaVersaoService;
|
||||
use App\Utils\Email;
|
||||
use App\Utils\Senha;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AutenticacaoController extends Controller
|
||||
{
|
||||
public function login()
|
||||
{
|
||||
$cliente = Cliente::where('sistema_id', Sistema::CONECTASUS)
|
||||
->where('link', request()->header('customer'))
|
||||
->first();
|
||||
|
||||
if (!is_null($cliente) && $cliente->ativo === false) {
|
||||
return response()->json(['message' => 'O cliente está com o status inativo.'], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
$credentials = request(['usuario', 'senha']);
|
||||
|
||||
$usuario = Usuario::where('usuario', $credentials['usuario'])
|
||||
->first();
|
||||
|
||||
if (is_null($usuario)) {
|
||||
|
||||
return response()->json(['message' => 'Usuário e/ou senha incorreto(s).'], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
if ($usuario->bloqueado) {
|
||||
AcessoSistema::create([
|
||||
'usuario_id' => $usuario->id,
|
||||
'status_id' => AcessoSistemaStatus::USUARIO_BLOQUEADO,
|
||||
]);
|
||||
|
||||
return response()->json(['message' => 'Usuário bloqueado e sem acesso ao sistema.'], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
if (!Hash::check($credentials['senha'], $usuario->senha)) {
|
||||
$configuracao = Configuracao::first();
|
||||
|
||||
$usuarioHistoricoAcesso = UsuarioHistoricoAcesso::where('usuario_id', $usuario->id)
|
||||
->where('ativo', true)
|
||||
->orderBy('created_at', 'desc')
|
||||
->take($configuracao->maximo_tentativa_login - 1)
|
||||
->get();
|
||||
|
||||
if ($usuarioHistoricoAcesso->count() === ($configuracao->maximo_tentativa_login - 1)
|
||||
&& $usuarioHistoricoAcesso->contains('sucesso', true) === false) {
|
||||
$usuario->update(['bloqueado' => true]);
|
||||
}
|
||||
|
||||
UsuarioHistoricoAcesso::create(
|
||||
[
|
||||
'usuario_id' => $usuario->id,
|
||||
'sucesso' => false
|
||||
]
|
||||
);
|
||||
|
||||
AcessoSistema::create([
|
||||
'usuario_id' => $usuario->id,
|
||||
'status_id' => AcessoSistemaStatus::USUARIO_E_OU_SENHA_INCORRETOS,
|
||||
]);
|
||||
|
||||
return response()->json(['message' => 'Usuário e/ou senha incorreto(s).'], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
UsuarioHistoricoAcesso::create(
|
||||
[
|
||||
'usuario_id' => $usuario->id,
|
||||
'sucesso' => true,
|
||||
'ativo' => false,
|
||||
]
|
||||
);
|
||||
|
||||
UsuarioHistoricoAcesso::where('usuario_id', $usuario->id)->update(['ativo' => false]);
|
||||
|
||||
AcessoSistema::create([
|
||||
'usuario_id' => $usuario->id,
|
||||
'status_id' => AcessoSistemaStatus::ACESSO_REALIZADO_COM_SUCESSO,
|
||||
]);
|
||||
|
||||
$token = auth()->login($usuario);
|
||||
|
||||
$usuario = auth()->user()->load([
|
||||
'lotacoes' => fn ($q) => $q->where('ativo', true),
|
||||
'lotacoes.infraestrutura.unidade',
|
||||
'lotacoes.ocupacao',
|
||||
]);
|
||||
|
||||
$lotacoes = $usuario->lotacoes->sortBy('infraestrutura.unidade.nome_fantasia')->values()
|
||||
->map(function($lotacao) {
|
||||
$centrosCusto = $lotacao->centrosCusto->sortBy('setor.nome')->values()->toArray();
|
||||
|
||||
if (empty($centrosCusto)) {
|
||||
$centrosCusto = $lotacao->infraestrutura->centrosCusto->sortBy('setor.nome')->values()->toArray();
|
||||
}
|
||||
|
||||
$lotacao = $lotacao->toArray();
|
||||
|
||||
$lotacao['infraestrutura']['centrosCusto'] = $centrosCusto;
|
||||
|
||||
return $lotacao;
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$usuario = $usuario->toArray();
|
||||
|
||||
$usuario['lotacoes'] = $lotacoes;
|
||||
|
||||
$response = [
|
||||
'expiration' => time() + 60 * auth()->factory()->getTTL(),
|
||||
'token' => $token,
|
||||
'usuario' => $usuario,
|
||||
];
|
||||
|
||||
return response()->json($response, Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
auth()->logout();
|
||||
|
||||
return response()->json(['message' => 'Successfully logged out']);
|
||||
}
|
||||
|
||||
public function refresh()
|
||||
{
|
||||
$usuario = auth()->user();
|
||||
|
||||
if ($usuario->troca_senha) {
|
||||
return response()->json(['error' => 'Você deve alterar sua senha antes de prosseguir.'], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
$lotacao = Lotacao::with(['usuario', 'ocupacao', 'papeis.permissoes.funcionalidade.modulo', 'permissoes.funcionalidade.modulo'])
|
||||
->where('id', request()->lotacao_id)
|
||||
->where('ativo', true)
|
||||
->firstOrFail();
|
||||
|
||||
$centroCusto = CentroCusto::with(['setor', 'salas'])->findOrFail(request()->centro_custo_id);
|
||||
$cliente = Cliente::with(['municipio.estado'])->where('link', app('config')->get('database.default'))->firstOrFail();
|
||||
|
||||
$token = auth()->claims([
|
||||
'lotacao_id' => $lotacao->id,
|
||||
'centro_custo_id' => $centroCusto->id,
|
||||
'unidade_id' => $centroCusto->infraestrutura->unidade_id,
|
||||
'infraestrutura_id' => $centroCusto->infraestrutura_id,
|
||||
]);
|
||||
|
||||
$permissoes = collect();
|
||||
|
||||
foreach ($lotacao->papeis as $papel) {
|
||||
foreach ($papel->permissoes as $permissao) {
|
||||
$permissoes->push($permissao);
|
||||
}
|
||||
}
|
||||
|
||||
$permissoes = $permissoes->merge($lotacao->permissoes);
|
||||
|
||||
$menu = Menu::whereHas('menu.funcionalidade.permissoes.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orWhereHas('menu.funcionalidade.permissoes.papeis.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orWhereHas('menu', function($query) use ($lotacao) {
|
||||
$query->whereNull('funcionalidade_id')
|
||||
->where(function($query) use ($lotacao) {
|
||||
$query->whereHas('menu.funcionalidade.permissoes.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orWhereHas('menu.funcionalidade.permissoes.papeis.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orWhereHas('menu', function($query) use ($lotacao) {
|
||||
$query->whereNull('funcionalidade_id')
|
||||
->where(function($query) use ($lotacao) {
|
||||
$query->whereHas('menu.funcionalidade.permissoes.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orWhereHas('menu.funcionalidade.permissoes.papeis.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
->orWhereHas('funcionalidade.permissoes.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orWhereHas('funcionalidade.permissoes.papeis.lotacoes', function($query) use ($lotacao) {
|
||||
$query->where('lotacao_id', $lotacao->id);
|
||||
})
|
||||
->orderBy('nome')
|
||||
->get();
|
||||
|
||||
$menuIds = $menu->pluck('menu_id')->filter()->unique();
|
||||
|
||||
while ($menuIds->isNotEmpty()) {
|
||||
$menusPais = Menu::whereIn('id', $menuIds)->get();
|
||||
$menu = $menu->merge($menusPais);
|
||||
$menuIds = $menusPais->pluck('menu_id')->filter()->unique()->diff($menu->pluck('id'));
|
||||
}
|
||||
|
||||
|
||||
$usuario = auth()->user()->load([
|
||||
'lotacoes' => fn ($q) => $q->where('ativo', true),
|
||||
'lotacoes.infraestrutura.unidade',
|
||||
'lotacoes.ocupacao',
|
||||
]);
|
||||
|
||||
$lotacoes = $usuario->lotacoes->sortBy('infraestrutura.unidade.nome_fantasia')
|
||||
->values()
|
||||
->map(function($lotacao) {
|
||||
$centrosCusto = $lotacao->centrosCusto->sortBy('setor.nome')->values()->toArray();
|
||||
|
||||
if (empty($centrosCusto)) {
|
||||
$centrosCusto = $lotacao->infraestrutura->centrosCusto->sortBy('setor.nome')->values()->toArray();
|
||||
}
|
||||
|
||||
$lotacao = $lotacao->toArray();
|
||||
|
||||
$lotacao['infraestrutura']['centrosCusto'] = $centrosCusto;
|
||||
|
||||
return $lotacao;
|
||||
})
|
||||
->toArray();
|
||||
|
||||
$usuario = $usuario->toArray();
|
||||
|
||||
$usuario['lotacoes'] = $lotacoes;
|
||||
|
||||
return response()->json([
|
||||
'expiration' => time() + 60 * auth()->factory()->getTTL(),
|
||||
'lotacao' => $lotacao->load('infraestrutura.unidade')->unsetRelation('papeis')->unsetRelation('permissoes'),
|
||||
'centro_custo' => $centroCusto,
|
||||
'menu' => $this->buildTreeMenu($menu),
|
||||
'token' => $token->refresh(),
|
||||
'usuario' => $usuario,
|
||||
'cliente' => [
|
||||
'municipio' => [
|
||||
'estado' => [
|
||||
'id' => $cliente->municipio->estado->id,
|
||||
'uf' => $cliente->municipio->estado->uf,
|
||||
'nome' => $cliente->municipio->estado->nome,
|
||||
],
|
||||
'id' => $cliente->municipio->id,
|
||||
'nome' => $cliente->municipio->nome,
|
||||
],
|
||||
'nome' => $cliente->nome,
|
||||
'ativo_app_conectasus_cidadao' => $cliente->ativo_app_conectasus_cidadao,
|
||||
],
|
||||
'permissoes' => $permissoes,
|
||||
'quantidade_notificacoes_nao_lidas' => $this->getQuantidadeNotificacoesNaoLidas(),
|
||||
'quantidade_notas_versao_novas' => $this->getQuantidadeNotasVersaoNovas(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function recuperarSenha(RecuperacaoSenhaRequest $request)
|
||||
{
|
||||
$usuario = Usuario::where('email', $request->email)
|
||||
->whereHas('cidadao', function($query) use ($request) {
|
||||
$query->where('cpf', $request->cpf);
|
||||
})
|
||||
->first();
|
||||
|
||||
if (is_null($usuario)) {
|
||||
|
||||
return response()->json([
|
||||
'message' => 'A informação inserida não está correta, tente novamente.'
|
||||
], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
if ($usuario) {
|
||||
$senha = Senha::gerar();
|
||||
|
||||
$params = [
|
||||
'senha' => $senha,
|
||||
'troca_senha' => true,
|
||||
];
|
||||
|
||||
$usuario->update($params);
|
||||
|
||||
$object = new \stdClass();
|
||||
$object->user = $usuario->usuario;
|
||||
$object->password = $senha;
|
||||
$object->cliente = $request->header('customer');
|
||||
|
||||
Email::enviar(strtolower($usuario->email), new UsuarioLogin($object));
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Usuário e senha enviados para o e-mail ' . $usuario->email
|
||||
], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function trocarSenha(TrocaSenhaRequest $request, $id)
|
||||
{
|
||||
$usuario = Usuario::findOrFail($id);
|
||||
|
||||
$params = [
|
||||
'senha' => $request->nova_senha,
|
||||
'troca_senha' => false,
|
||||
];
|
||||
|
||||
$usuario->update($params);
|
||||
|
||||
return response()->json($usuario->fresh(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
private function buildTreeMenu($elements, $identifier = null)
|
||||
{
|
||||
$items = collect();
|
||||
|
||||
foreach ($elements as $element) {
|
||||
if ($element->menu_id === $identifier) {
|
||||
$children = $this->buildTreeMenu($elements, $element->id);
|
||||
|
||||
if ($children) {
|
||||
$element['items'] = $children;
|
||||
}
|
||||
|
||||
$item = [
|
||||
'id' => $element->id,
|
||||
'nome' => $element->nome,
|
||||
];
|
||||
|
||||
if ($element->menu_id) {
|
||||
$item['menu_id'] = $element->menu_id;
|
||||
}
|
||||
|
||||
if ($element->funcionalidade_id) {
|
||||
$item['link'] = '/' . $element->funcionalidade->modulo->identificador . '/' . $element->funcionalidade->identificador;
|
||||
}
|
||||
|
||||
if ($element->icone) {
|
||||
$item['icone'] = $element->icone;
|
||||
}
|
||||
|
||||
$item['items'] = $children;
|
||||
|
||||
$items->push($item);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private function getQuantidadeNotificacoesNaoLidas()
|
||||
{
|
||||
return sizeOf(NotificacaoService::index()->where('visualizado', false));
|
||||
}
|
||||
|
||||
private function getQuantidadeNotasVersaoNovas()
|
||||
{
|
||||
return NotaVersaoService::index()
|
||||
->where('created_at', '>=', Carbon::now()->subDays(7))
|
||||
->count();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\ConfiguracaoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ConfiguracaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'configuracao';
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ConfiguracaoService::edit(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ConfiguracaoService::update($request), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
61
api/app/Http/Controllers/Administracao/GestorController.php
Normal file
61
api/app/Http/Controllers/Administracao/GestorController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\GestorService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class GestorController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'gestor';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GestorService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GestorService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GestorService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GestorService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GestorService::update($request, $id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GestorService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()->of(GestorService::datatable())->skipTotalRecords()->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\NotificacaoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class NotificacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'notificacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(NotificacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(NotificacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(NotificacaoService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(NotificacaoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(NotificacaoService::update($request, $id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(NotificacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(NotificacaoService::datatable())
|
||||
->filterColumn('administracao_notificacao.updated_at', function ($query, $keyword) {
|
||||
$query->whereRaw("DATE_FORMAT(administracao_notificacao.updated_at, '%d/%m/%Y %H:%i') like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(NotificacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
201
api/app/Http/Controllers/Administracao/PapelController.php
Normal file
201
api/app/Http/Controllers/Administracao/PapelController.php
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Enums\Administracao\HistoricoAcao;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Administracao\PapelRequest;
|
||||
use App\Models\Administracao\Modulo;
|
||||
use App\Models\Administracao\Papel;
|
||||
use App\Models\Administracao\PapelPermissaoHistorico;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PapelController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'papel';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
$currentLotacao = self::getCurrentLotacao();
|
||||
|
||||
$papeis = DB::table('administracao_papel AS papel')
|
||||
->select(
|
||||
'papel.id',
|
||||
'papel.nome'
|
||||
)
|
||||
->whereNull('papel.deleted_at')
|
||||
->when( $currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereExists(fn ($q) => $q->select(DB::raw(1))
|
||||
->from('administracao_gestor_papel')
|
||||
->join('administracao_gestor', 'administracao_gestor.id', 'administracao_gestor_papel.gestor_id')
|
||||
->where('administracao_gestor.usuario_id', $currentLotacao->usuario_id)
|
||||
->whereColumn('administracao_gestor_papel.papel_id', 'papel.id')
|
||||
));
|
||||
|
||||
return datatables()->of($papeis)->skipTotalRecords()->make(true);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$papeis = $this->get(Papel::class)->orderBy('nome')->get();
|
||||
|
||||
return response()->json($papeis, Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return [
|
||||
'form' => $this->getFormData(),
|
||||
'model' => [
|
||||
'nome' => null,
|
||||
'permissoes' => []
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function store(PapelRequest $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$papel = new Papel;
|
||||
$params = $request->all();
|
||||
|
||||
DB::transaction(function () use ($papel, $params) {
|
||||
|
||||
$papel->fill($params);
|
||||
$papel->save();
|
||||
|
||||
$permissoes = $papel->permissoes()->sync($params['permissoes']);
|
||||
|
||||
foreach ($permissoes['attached'] as $permissao) {
|
||||
PapelPermissaoHistorico::create([
|
||||
'acao_id' => HistoricoAcao::CADASTRO,
|
||||
'papel_id' => $papel->id,
|
||||
'permissao_id' => $permissao,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($permissoes['detached'] as $permissao) {
|
||||
PapelPermissaoHistorico::create([
|
||||
'acao_id' => HistoricoAcao::EXCLUSAO,
|
||||
'papel_id' => $papel->id,
|
||||
'permissao_id' => $permissao,
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
return response()->json($papel->fresh(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json($this->get(Papel::class, $id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$papel = Papel::findOrFail($id);
|
||||
|
||||
return [
|
||||
'form' => $this->getFormData(),
|
||||
'model' => [
|
||||
'nome' => $papel->nome,
|
||||
'permissoes' => $papel->permissoes->pluck('id'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
$currentLotacao = self::getCurrentLotacao();
|
||||
|
||||
return [
|
||||
'modulos' => Modulo::whereHas('funcionalidades')
|
||||
->when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('funcionalidades.permissoes.gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->orderBy('nome')
|
||||
->get()
|
||||
->map(fn ($modulo) => [
|
||||
'id' => $modulo->id,
|
||||
'nome' => $modulo->nome,
|
||||
'funcionalidades' => $modulo->funcionalidades()
|
||||
->when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('permissoes.gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->orderBy('nome')
|
||||
->get()
|
||||
->map(fn ($funcionalidade) => [
|
||||
'id' => $funcionalidade->id,
|
||||
'nome' => $funcionalidade->nome,
|
||||
'permissoes' => $funcionalidade->permissoes()
|
||||
->when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->get()
|
||||
->map(fn ($permissao) => [
|
||||
'id' => $permissao->id,
|
||||
'nome' => $permissao->crudAcao->nome,
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
public function update(PapelRequest $request, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$papel = Papel::findOrFail($id);
|
||||
$params = $request->all();
|
||||
|
||||
DB::transaction(function () use ($papel, $params) {
|
||||
|
||||
$papel->update($params);
|
||||
$permissoes = $papel->permissoes()->sync($params['permissoes']);
|
||||
|
||||
foreach ($permissoes['attached'] as $permissao) {
|
||||
PapelPermissaoHistorico::create([
|
||||
'acao_id' => HistoricoAcao::CADASTRO,
|
||||
'papel_id' => $papel->id,
|
||||
'permissao_id' => $permissao,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($permissoes['detached'] as $permissao) {
|
||||
PapelPermissaoHistorico::create([
|
||||
'acao_id' => HistoricoAcao::EXCLUSAO,
|
||||
'papel_id' => $papel->id,
|
||||
'permissao_id' => $permissao,
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
return response()->json($papel->fresh(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
Papel::findOrFail($id)->delete();
|
||||
|
||||
return response()->json(null, Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
158
api/app/Http/Controllers/Administracao/PermissaoController.php
Normal file
158
api/app/Http/Controllers/Administracao/PermissaoController.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Enums\Administracao\HistoricoAcao;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Administracao\PermissaoRequest;
|
||||
use App\Models\Administracao\LotacaoPapelHistorico;
|
||||
use App\Models\Administracao\LotacaoPermissaoHistorico;
|
||||
use App\Models\Administracao\Modulo;
|
||||
use App\Models\Administracao\Papel;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PermissaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'permissao';
|
||||
|
||||
public static function datatable()
|
||||
{
|
||||
$lotacoes = DB::table('cadastro_lotacao AS lotacao')
|
||||
->join('cadastro_infraestrutura AS infraestrutura', 'infraestrutura.id', 'lotacao.infraestrutura_id')
|
||||
->join('cadastro_unidade AS unidade', 'unidade.id', 'infraestrutura.unidade_id')
|
||||
->join('cadastro_usuario AS usuario', 'usuario.id', 'lotacao.usuario_id')
|
||||
->join('cadastro_cidadao AS cidadao', 'cidadao.id', 'usuario.cidadao_id')
|
||||
->join('sigtap.ocupacao AS ocupacao', 'ocupacao.id', 'lotacao.ocupacao_id')
|
||||
->select([
|
||||
'lotacao.id',
|
||||
'unidade.nome_fantasia AS unidade_nome_fantasia',
|
||||
DB::raw('COALESCE(infraestrutura.nome, unidade.nome_fantasia) AS infraestrutura_nome'),
|
||||
'cidadao.nome AS usuario_nome',
|
||||
'ocupacao.nome AS ocupacao_nome',
|
||||
])
|
||||
->whereNull('lotacao.deleted_at')
|
||||
->whereNull('usuario.deleted_at')
|
||||
->where('lotacao.ativo', true);
|
||||
|
||||
return datatables()->of($lotacoes)->skipTotalRecords()->toJson();
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$lotacao = Lotacao::findOrFail($id);
|
||||
|
||||
$currentLotacao = self::getCurrentLotacao();
|
||||
|
||||
return [
|
||||
'form' => [
|
||||
'unidade_nome_fantasia' => $lotacao->infraestrutura->unidade->nome_fantasia,
|
||||
'infraestrutura_nome' => $lotacao->infraestrutura->nome,
|
||||
'usuario_nome' => $lotacao->usuario->cidadao->nome,
|
||||
'ocupacao_nome' => $lotacao->ocupacao->nome,
|
||||
'papeis' => Papel::when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->orderBy('nome')
|
||||
->get()
|
||||
->map(fn ($papel) => [
|
||||
'id' => $papel->id,
|
||||
'nome' => $papel->nome,
|
||||
]),
|
||||
'modulos' => Modulo::whereHas('funcionalidades')
|
||||
->when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('funcionalidades.permissoes.gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->orderBy('nome')
|
||||
->get()
|
||||
->map(fn ($modulo) => [
|
||||
'id' => $modulo->id,
|
||||
'nome' => $modulo->nome,
|
||||
'funcionalidades' => $modulo->funcionalidades()
|
||||
->when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('permissoes.gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->orderBy('nome')
|
||||
->get()
|
||||
->map(fn ($funcionalidade) => [
|
||||
'id' => $funcionalidade->id,
|
||||
'nome' => $funcionalidade->nome,
|
||||
'permissoes' => $funcionalidade->permissoes()
|
||||
->when($currentLotacao->usuario->is_administrador !== true, fn ($q) => $q
|
||||
->whereHas('gestores', fn ($q) => $q
|
||||
->where('usuario_id', $currentLotacao->usuario_id)
|
||||
)
|
||||
)
|
||||
->get()
|
||||
->map(fn ($permissao) => [
|
||||
'id' => $permissao->id,
|
||||
'nome' => $permissao->crudAcao->nome,
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
'model' => [
|
||||
'papeis' => $lotacao->papeis->pluck('id'),
|
||||
'permissoes' => $lotacao->permissoes->pluck('id'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function update(PermissaoRequest $request, $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$lotacao = Lotacao::findOrFail($id);
|
||||
$params = $request->all();
|
||||
|
||||
DB::transaction(function () use ($lotacao, $params) {
|
||||
|
||||
$papeis = $lotacao->papeis()->sync($params['papeis']);
|
||||
$permissoes = $lotacao->permissoes()->sync($params['permissoes']);
|
||||
|
||||
foreach ($papeis['attached'] as $papel) {
|
||||
LotacaoPapelHistorico::create([
|
||||
'acao_id' => HistoricoAcao::CADASTRO,
|
||||
'lotacao_id' => $lotacao->id,
|
||||
'papel_id' => $papel,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($papeis['detached'] as $papel) {
|
||||
LotacaoPapelHistorico::create([
|
||||
'acao_id' => HistoricoAcao::EXCLUSAO,
|
||||
'lotacao_id' => $lotacao->id,
|
||||
'papel_id' => $papel,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($permissoes['attached'] as $permissao) {
|
||||
LotacaoPermissaoHistorico::create([
|
||||
'acao_id' => HistoricoAcao::CADASTRO,
|
||||
'lotacao_id' => $lotacao->id,
|
||||
'permissao_id' => $permissao,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($permissoes['detached'] as $permissao) {
|
||||
LotacaoPermissaoHistorico::create([
|
||||
'acao_id' => HistoricoAcao::EXCLUSAO,
|
||||
'lotacao_id' => $lotacao->id,
|
||||
'permissao_id' => $permissao,
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
return response()->json($lotacao->fresh(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioAcessoFuncionalidadeService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioAcessoFuncionalidadeController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-acesso-funcionalidade';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioAcessoFuncionalidadeService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioAcessoFuncionalidadeService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioAcessoFuncionalidadeService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioAcessoSistemaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioAcessoSistemaController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-acesso-sistema';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioAcessoSistemaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioAcessoSistemaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioAcessoSistemaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioHistoricoPapelLotacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioHistoricoPapelLotacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-historico-papel-lotacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioHistoricoPapelLotacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioHistoricoPapelLotacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioHistoricoPapelLotacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteUsuario()
|
||||
{
|
||||
return datatables()->of(RelatorioHistoricoPapelLotacaoService::autocompleteUsuario())->toJson();
|
||||
}
|
||||
|
||||
public function autocompleteUsuarioResponsavel()
|
||||
{
|
||||
return datatables()->of(RelatorioHistoricoPapelLotacaoService::autocompleteUsuarioResponsavel())->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioHistoricoPermissaoLotacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioHistoricoPermissaoLotacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-historico-permissao-lotacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioHistoricoPermissaoLotacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioHistoricoPermissaoLotacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioHistoricoPermissaoLotacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteUsuario()
|
||||
{
|
||||
return datatables()->of(RelatorioHistoricoPermissaoLotacaoService::autocompleteUsuario())->toJson();
|
||||
}
|
||||
|
||||
public function autocompleteUsuarioResponsavel()
|
||||
{
|
||||
return datatables()->of(RelatorioHistoricoPermissaoLotacaoService::autocompleteUsuarioResponsavel())->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioHistoricoPermissaoPapelService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioHistoricoPermissaoPapelController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-historico-permissao-papel';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioHistoricoPermissaoPapelService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioHistoricoPermissaoPapelService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioHistoricoPermissaoPapelService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteUsuario()
|
||||
{
|
||||
return datatables()->of(RelatorioHistoricoPermissaoPapelService::autocompleteUsuario())->toJson();
|
||||
}
|
||||
|
||||
public function autocompleteUsuarioResponsavel()
|
||||
{
|
||||
return datatables()->of(RelatorioHistoricoPermissaoPapelService::autocompleteUsuarioResponsavel())->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioPapelLotacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioPapelLotacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-papel-lotacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioPapelLotacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioPapelLotacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioPapelLotacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioPermissaoLotacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioPermissaoLotacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-permissao-lotacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioPermissaoLotacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioPermissaoLotacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioPermissaoLotacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Administracao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Administracao\RelatorioPermissaoPapelService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioPermissaoPapelController extends Controller
|
||||
{
|
||||
protected $modulo = 'administracao';
|
||||
protected $funcionalidade = 'relatorio-permissao-papel';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioPermissaoPapelService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioPermissaoPapelService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioPermissaoPapelService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
44
api/app/Http/Controllers/Almoxarifado/BaixaController.php
Normal file
44
api/app/Http/Controllers/Almoxarifado/BaixaController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\BaixaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class BaixaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'baixa';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return BaixaService::datatable();
|
||||
}
|
||||
|
||||
public function history()
|
||||
{
|
||||
return BaixaService::history();
|
||||
}
|
||||
|
||||
public function create($materialId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(BaixaService::create($materialId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(BaixaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function reverse($saidaItemId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(BaixaService::reverse($saidaItemId), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\BalanceteService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class BalanceteController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'balancete';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(BalanceteService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(BalanceteService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function checkDate($data)
|
||||
{
|
||||
return response()->json(BalanceteService::checkDate($data), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(BalanceteService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Services\Almoxarifado\DispensacaoService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class DispensacaoMateriaisController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'dispensacao-materiais';
|
||||
|
||||
public function create($pacienteId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
return response()->json(DispensacaoService::create($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
return response()->json(DispensacaoService::store(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function print($id)
|
||||
{
|
||||
return response()->json(DispensacaoService::print($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getHistorico($id)
|
||||
{
|
||||
return response()->json(DispensacaoService::getHistorico($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
58
api/app/Http/Controllers/Almoxarifado/EntradaController.php
Normal file
58
api/app/Http/Controllers/Almoxarifado/EntradaController.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\EntradaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class EntradaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'entrada';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return EntradaService::datatable();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(EntradaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\EntradaInicialService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class EntradaInicialController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'entrada-inicial';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return EntradaInicialService::datatable();
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaInicialService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(EntradaInicialService::list(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\InventarioService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class InventarioController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'inventario';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(InventarioService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(InventarioService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(InventarioService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function getIntegracaoBnafarMedicamentos()
|
||||
{
|
||||
return response()->json(InventarioService::getIntegracaoBnafarMedicamentos(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\MotivoBaixaService;
|
||||
use DB;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class MotivoBaixaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'motivo-baixa';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(MotivoBaixaService::datatable())
|
||||
->filterColumn('almoxarifado_motivo_baixa.justificar', function ($query, $keyword) {
|
||||
$query->whereRaw('DECODE_ORACLE(almoxarifado_motivo_baixa.justificar, 1, "Sim", "Não") LIKE ?', ["%{$keyword}%"]);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MotivoBaixaService::create(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MotivoBaixaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MotivoBaixaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MotivoBaixaService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MotivoBaixaService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\ParametrizacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ParametrizacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'parametrizacao';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return ParametrizacaoService::datatable();
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(ParametrizacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ParametrizacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ParametrizacaoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\ConsumoFinanceiroService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ConsumoFinanceiroController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-consumo-financeiro';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ConsumoFinanceiroService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ConsumoFinanceiroService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\ConsumoMedioMensalService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ConsumoMedioMensalController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-consumo-medio-mensal';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ConsumoMedioMensalService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ConsumoMedioMensalService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteMaterial()
|
||||
{
|
||||
return datatables()->of(ConsumoMedioMensalService::autocompleteMaterial())->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\EntradaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class EntradaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-entrada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EntradaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\EstornoEntradaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class EstornoEntradaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-estorno-entrada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EstornoEntradaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EstornoEntradaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\EstornoSaidaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class EstornoSaidaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-estorno-saida';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EstornoSaidaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(EstornoSaidaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\MovimentacaoGeralService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class MovimentacaoGeralController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-movimentacao-geral';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MovimentacaoGeralService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(MovimentacaoGeralService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(MovimentacaoGeralService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocomplete()
|
||||
{
|
||||
return datatables()->of(MovimentacaoGeralService::autocomplete())->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\PosicaoEstoqueService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class PosicaoEstoqueController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-posicao-estoque';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(PosicaoEstoqueService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(PosicaoEstoqueService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteMaterial()
|
||||
{
|
||||
return datatables()->of(PosicaoEstoqueService::autocompleteMaterial())->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\RequisicaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RequisicaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-requisicao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteMaterial()
|
||||
{
|
||||
return datatables()->of(RequisicaoService::autocompleteMaterial())->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\SaidaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class SaidaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-saida';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteMaterial()
|
||||
{
|
||||
return datatables()->of(SaidaService::autocompleteMaterial())->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado\Relatorios;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\Relatorios\ValidadeMaterialService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ValidadeMaterialController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'relatorio-validade-material';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ValidadeMaterialService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ValidadeMaterialService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\RequisicaoAberturaFechamentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RequisicaoAberturaFechamentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'requisicao-abertura-fechamento';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return RequisicaoAberturaFechamentoService::datatable();
|
||||
}
|
||||
|
||||
public function getEstoque($materialId, $centroCustoAlmoxarifadoId)
|
||||
{
|
||||
return response()->json(
|
||||
RequisicaoAberturaFechamentoService::getEstoque($materialId, $centroCustoAlmoxarifadoId),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function getMateriaisPermitidos($centroCustoAlmoxarifadoId)
|
||||
{
|
||||
return response()->json(
|
||||
RequisicaoAberturaFechamentoService::getMateriaisPermitidos($centroCustoAlmoxarifadoId),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoAberturaFechamentoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoAberturaFechamentoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoAberturaFechamentoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoAberturaFechamentoService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoAberturaFechamentoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\RequisicaoPendentePermissaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RequisicaoPendentePermissaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'requisicao-pendente-permissao';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return RequisicaoPendentePermissaoService::datatable();
|
||||
}
|
||||
|
||||
public function datatablePermissao()
|
||||
{
|
||||
return RequisicaoPendentePermissaoService::datatablePermissao();
|
||||
}
|
||||
|
||||
public function getMateriais($centroCustoRequisitanteId)
|
||||
{
|
||||
return response()->json(
|
||||
RequisicaoPendentePermissaoService::getMateriais($centroCustoRequisitanteId),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function datatableHistorico()
|
||||
{
|
||||
return RequisicaoPendentePermissaoService::datatableHistorico();
|
||||
}
|
||||
|
||||
public function storePermissoes()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoPendentePermissaoService::storePermissoes(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function createImportacao($centroCustoDestinoId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(
|
||||
RequisicaoPendentePermissaoService::createImportacao($centroCustoDestinoId),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function storeImportacao()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoPendentePermissaoService::storeImportacao(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoPendentePermissaoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RequisicaoPendentePermissaoService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
53
api/app/Http/Controllers/Almoxarifado/SaidaController.php
Normal file
53
api/app/Http/Controllers/Almoxarifado/SaidaController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\SaidaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class SaidaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'saida';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return SaidaService::datatable();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SaidaService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Almoxarifado;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Almoxarifado\TransferenciaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class TransferenciaController extends Controller
|
||||
{
|
||||
protected $modulo = 'almoxarifado';
|
||||
protected $funcionalidade = 'transferencia';
|
||||
|
||||
public function datatableEnviadas()
|
||||
{
|
||||
return TransferenciaService::datatableEnviadas();
|
||||
}
|
||||
|
||||
public function datatableRecebidas()
|
||||
{
|
||||
return TransferenciaService::datatableRecebidas();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(TransferenciaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(TransferenciaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(TransferenciaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(TransferenciaService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(TransferenciaService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function getTransferenciaRecebida($id)
|
||||
{
|
||||
return response()->json(TransferenciaService::getTransferenciaRecebida($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function accept($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
TransferenciaService::accept($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function reject($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
TransferenciaService::reject($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
}
|
||||
223
api/app/Http/Controllers/Ambulatorio/AgendamentoController.php
Normal file
223
api/app/Http/Controllers/Ambulatorio/AgendamentoController.php
Normal file
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Exceptions\Ambulatorio\AgendamentoConflitanteException;
|
||||
use App\Exceptions\Ambulatorio\AgendamentoNaoPermitidoJornadaGrupoException;
|
||||
use App\Exceptions\Ambulatorio\NaoPodeAlterarStatusAgendamentoException;
|
||||
use App\Exceptions\Ambulatorio\NaoPodeExcluirAgendamentoException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\AgendamentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AgendamentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'agendamento';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(AgendamentoService::datatable())
|
||||
->filterColumn('cidadao.data_nascimento', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.data_nascimento,9,2),
|
||||
SUBSTR(cidadao.data_nascimento,6,2),
|
||||
SUBSTR(cidadao.data_nascimento,1,4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cidadao.cpf', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('cidadao.cns', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cns like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cns, 1, 3),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 4, 4),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 8, 4),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 12, 4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('municipio_uf', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("CONCAT(municipio.nome, ' / ', estado.uf) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('validade_fim', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("IF(paciente.validade_fim IS NULL,
|
||||
'INDETERMINADO',
|
||||
DATE_FORMAT(paciente.validade_fim, '%d/%m/%Y')
|
||||
) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AgendamentoService::index((object) request()->all()), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create($pacienteId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AgendamentoService::create($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function createAgendamentoDemandaEspontanea($pacienteId)
|
||||
{
|
||||
return response()->json(AgendamentoService::createAgendamentoDemandaEspontanea($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AgendamentoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(AgendamentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getSugestao($pacienteId, $infraestruturaId, $ocupacaoId, $especialidadeId, $usuarioId)
|
||||
{
|
||||
return response()->json(
|
||||
AgendamentoService::getSugestao(
|
||||
$pacienteId,
|
||||
$infraestruturaId,
|
||||
$ocupacaoId,
|
||||
$especialidadeId,
|
||||
$usuarioId
|
||||
),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function unidadePaciente($pacienteId, $infraestruturaId)
|
||||
{
|
||||
return response()->json(
|
||||
AgendamentoService::unidadePaciente(
|
||||
$pacienteId,
|
||||
$infraestruturaId
|
||||
),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(AgendamentoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (AgendamentoConflitanteException
|
||||
| AgendamentoNaoPermitidoJornadaGrupoException $e
|
||||
) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(AgendamentoService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
catch (AgendamentoConflitanteException
|
||||
| AgendamentoNaoPermitidoJornadaGrupoException $e
|
||||
) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function cancel($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(AgendamentoService::cancel($id, request()->all()), Response::HTTP_OK);
|
||||
}
|
||||
catch (NaoPodeAlterarStatusAgendamentoException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
AgendamentoService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
catch (NaoPodeExcluirAgendamentoException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function absent($id)
|
||||
{
|
||||
AgendamentoService::absent($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function undoAbsent($id)
|
||||
{
|
||||
AgendamentoService::undoAbsent($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function getAgendamentosDemandasEspontaneas()
|
||||
{
|
||||
return response()->json(AgendamentoService::getAgendamentosDemandasEspontaneas((object) request()->all()), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Exceptions\Ambulatorio\AgendamentoConflitanteException;
|
||||
use App\Exceptions\Ambulatorio\AgendamentoNaoPermitidoJornadaGrupoException;
|
||||
use App\Exceptions\Ambulatorio\NaoPodeExcluirAgendamentoException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\AgendamentoRetroativoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AgendamentoRetroativoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'agendamento-retroativo';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(AgendamentoRetroativoService::datatable())
|
||||
->filterColumn('cidadao.data_nascimento', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.data_nascimento,9,2),
|
||||
SUBSTR(cidadao.data_nascimento,6,2),
|
||||
SUBSTR(cidadao.data_nascimento,1,4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cidadao.cpf', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('cidadao.cns', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cns like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cns, 1, 3),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 4, 4),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 8, 4),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 12, 4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('municipio_uf', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("CONCAT(municipio.nome, ' / ', estado.uf) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('validade_fim', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("IF(paciente.validade_fim IS NULL,
|
||||
'INDETERMINADO',
|
||||
DATE_FORMAT(paciente.validade_fim, '%d/%m/%Y')
|
||||
) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function unidadePaciente($pacienteId, $infraestruturaId)
|
||||
{
|
||||
return response()->json(
|
||||
AgendamentoRetroativoService::unidadePaciente(
|
||||
$pacienteId,
|
||||
$infraestruturaId
|
||||
),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AgendamentoRetroativoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create($pacienteId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AgendamentoRetroativoService::create($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(AgendamentoRetroativoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(AgendamentoRetroativoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (AgendamentoConflitanteException
|
||||
| AgendamentoNaoPermitidoJornadaGrupoException $e
|
||||
) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
AgendamentoRetroativoService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
catch (NaoPodeExcluirAgendamentoException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Services\Ambulatorio\AlteracaoConsultasFinalizadasService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AlteracaoConsultasFinalizadasController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'atendimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(AlteracaoConsultasFinalizadasService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(AlteracaoConsultasFinalizadasService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEspecialidades()
|
||||
{
|
||||
return response()->json(AlteracaoConsultasFinalizadasService::getEspecialidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUsuarios()
|
||||
{
|
||||
return response()->json(AlteracaoConsultasFinalizadasService::getUsuarios(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(AlteracaoConsultasFinalizadasService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AlteracaoConsultasFinalizadasService::store(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\AssinaturaEletronicaService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AssinaturaEletronicaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'assinatura-eletronica';
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AssinaturaEletronicaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function datatable(Request $request)
|
||||
{
|
||||
return response()->json(AssinaturaEletronicaService::datatable($request), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
151
api/app/Http/Controllers/Ambulatorio/AtendimentoController.php
Normal file
151
api/app/Http/Controllers/Ambulatorio/AtendimentoController.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Exceptions\Ambulatorio\NaoPodeCriarFichaAtencaoBasicaException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Ambulatorio\AtendimentoSoap;
|
||||
use App\Services\Ambulatorio\AtendimentoService;
|
||||
use App\Utils\Crypt;
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class AtendimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'atendimento';
|
||||
|
||||
public function getHistoricoPreAtendimento($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::getHistoricoPreAtendimento($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getHistoricoAtendimentoSoap($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::getHistoricoAtendimentoSoap($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getHistoricoAtendimentoHospital($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::getHistoricoAtendimentoHospital($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getHistoricoPosConsulta($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::getHistoricoPosConsulta($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getHistoricoProntoAtendimentoAtendimento($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::getHistoricoProntoAtendimentoAtendimento($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function uploadImagem()
|
||||
{
|
||||
return response()->json(AtendimentoService::uploadImagem(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
|
||||
return response()->json(AtendimentoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function destroyFeridaProcedimento($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::destroyFeridaProcedimento($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function storeFeridaProcedimento()
|
||||
{
|
||||
return response()->json(AtendimentoService::storeFeridaProcedimento(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function validarProcedimentosCbo()
|
||||
{
|
||||
return response()->json(AtendimentoService::validarProcedimentosCbo(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUrlHistoricoConectaSUSV1($prontuario)
|
||||
{
|
||||
if(app('config')->get('database.default') == 'pederneiras'){
|
||||
|
||||
return response()->json(['url' => env('CONECTASUS_V1_URL_PEDERNEIRAS') . '/' . app('config')->get('database.default') . '/especialidade/lista_pacientes_historico_externo.php?DATA=' . Crypt::XORCrypt("NR_PRONTUARIO=$prontuario")] , Response::HTTP_OK);
|
||||
|
||||
}else{
|
||||
|
||||
return response()->json(['url' => env('CONECTASUS_V1_URL') . '/' . app('config')->get('database.default') . '/especialidade/lista_pacientes_historico_externo.php?DATA=' . Crypt::XORCrypt("NR_PRONTUARIO=$prontuario")] , Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(AtendimentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create($filaId = null, $agendamentoId = null)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoService::create($filaId, $agendamentoId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(AtendimentoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (NaoPodeCriarFichaAtencaoBasicaException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function exameDentroPrazoValidade()
|
||||
{
|
||||
return response()->json(AtendimentoService::exameDentroPrazoValidade(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function encaminhamentoPendente()
|
||||
{
|
||||
return response()->json(AtendimentoService::encaminhamentoPendente(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function prescricaoMedicamento()
|
||||
{
|
||||
return response()->json(AtendimentoService::prescricaoMedicamento(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function storeAtendimentoAssinado($id)
|
||||
{
|
||||
$path = 'assinatura-eletronica' . DIRECTORY_SEPARATOR . app('config')->get('database.default') . DIRECTORY_SEPARATOR . 'ambulatorio' . DIRECTORY_SEPARATOR . 'atendimento';
|
||||
|
||||
$atendimento = AtendimentoSoap::findOrFail($id);
|
||||
|
||||
if (!is_null($atendimento)) {
|
||||
|
||||
foreach (request()->atendimento_assinado as $arquivoBase64) {
|
||||
|
||||
$arquivo = "{$arquivoBase64['fileName']}.PDF";
|
||||
$pdf = base64_decode($arquivoBase64['data']);
|
||||
|
||||
if (!Storage::disk('local')->put($path . DIRECTORY_SEPARATOR . $arquivo, $pdf)) {
|
||||
throw new Exception("Erro ao salvar o arquivo {$arquivo}.");
|
||||
}
|
||||
}
|
||||
|
||||
$atendimento->update(['is_atendimento_soap_assinado' => true]);
|
||||
}
|
||||
|
||||
return response($atendimento->fresh(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOci($id)
|
||||
{
|
||||
return response()->json(AtendimentoService::getOci($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Exceptions\Ambulatorio\NaoPodeCriarFichaAtencaoBasicaException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\AtendimentoEnfermagemService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AtendimentoEnfermagemController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'atendimento-enfermagem';
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(AtendimentoEnfermagemService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoEnfermagemService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(AtendimentoEnfermagemService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (NaoPodeCriarFichaAtencaoBasicaException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function validarProcedimentosCbo()
|
||||
{
|
||||
return response()->json(AtendimentoEnfermagemService::validarProcedimentosCbo(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function uploadImagem()
|
||||
{
|
||||
return response()->json(AtendimentoEnfermagemService::uploadImagem(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
|
||||
return response()->json(AtendimentoEnfermagemService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function storeFeridaProcedimento()
|
||||
{
|
||||
return response()->json(AtendimentoEnfermagemService::storeFeridaProcedimento(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function destroyFeridaProcedimento($id)
|
||||
{
|
||||
return response()->json(AtendimentoEnfermagemService::destroyFeridaProcedimento($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
15
api/app/Http/Controllers/Ambulatorio/ChamadaController.php
Normal file
15
api/app/Http/Controllers/Ambulatorio/ChamadaController.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\ChamadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ChamadaController extends Controller
|
||||
{
|
||||
public function store()
|
||||
{
|
||||
return response()->json(ChamadaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\FechamentoConsultaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FechamentoConsultaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'fechamento-consulta';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
return response()->json(FechamentoConsultaService::index((object) request()->all()), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FechamentoConsultaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(FechamentoConsultaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(FechamentoConsultaService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(FechamentoConsultaService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEspecialidadesWithJornada()
|
||||
{
|
||||
return response()->json(FechamentoConsultaService::getEspecialidadesWithJornada(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUsuariosWithJornada()
|
||||
{
|
||||
return response()->json(FechamentoConsultaService::getUsuariosWithJornada(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FechamentoConsultaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
59
api/app/Http/Controllers/Ambulatorio/FilaController.php
Normal file
59
api/app/Http/Controllers/Ambulatorio/FilaController.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\FilaService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FilaController extends Controller
|
||||
{
|
||||
public function list()
|
||||
{
|
||||
return response()->json(FilaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(FilaService::index((object) request()->all()), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function sendBack($id)
|
||||
{
|
||||
FilaService::sendBack($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function evade($id)
|
||||
{
|
||||
FilaService::evade($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function undoEvade($id)
|
||||
{
|
||||
FilaService::undoEvade($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
FilaService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
|
||||
public function getAgendamentosRetroativos()
|
||||
{
|
||||
return response()->json(FilaService::getAgendamentosRetroativos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function forward(Request $request, $id)
|
||||
{
|
||||
return response()->json(FilaService::forward($id, $request->centro_custo_encaminhamento_id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\FormularioRaasService;
|
||||
use App\Utils\MaskUtil;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FormularioRaasController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'formulario-raas';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(FormularioRaasService::datatable())
|
||||
->filterColumn('data', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), 9, 2),
|
||||
SUBSTR(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), 6, 2),
|
||||
SUBSTR(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), 1, 4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->editColumn('paciente_cns', fn ($a) => MaskUtil::getCnsMasked($a->paciente_cns))
|
||||
->editColumn('paciente_cpf', fn ($a) => MaskUtil::getCpfMasked($a->paciente_cpf))
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormularioRaasService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormularioRaasService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\GerenciamentoDiarioService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class GerenciamentoDiarioController extends Controller
|
||||
{
|
||||
public function list()
|
||||
{
|
||||
return response()->json(GerenciamentoDiarioService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(GerenciamentoDiarioService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
return response()->json(GerenciamentoDiarioService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\GerenciamentoMedicoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class GerenciamentoMedicoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'gerenciamento-medico';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return GerenciamentoMedicoService::datatable();
|
||||
}
|
||||
|
||||
public function edit($usuarioId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GerenciamentoMedicoService::edit($usuarioId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(GerenciamentoMedicoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function reschedule()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GerenciamentoMedicoService::reschedule(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function cancel()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(GerenciamentoMedicoService::cancel(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\HistoricoAtendimentoService;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class HistoricoAtendimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'historico-atendimento';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(HistoricoAtendimentoService::datatable())
|
||||
->filterColumn('cidadao.data_nascimento', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.data_nascimento,9,2),
|
||||
SUBSTR(cidadao.data_nascimento,6,2),
|
||||
SUBSTR(cidadao.data_nascimento,1,4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cidadao.cpf', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('cidadao.cns', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cns like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cns, 1, 3),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 4, 4),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 8, 4),
|
||||
' ',
|
||||
SUBSTR(cidadao.cns, 12, 4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('municipio_uf', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("CONCAT(municipio.nome, ' / ', estado.uf) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('validade_fim', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("IF(paciente.validade_fim IS NULL,
|
||||
'INDETERMINADO',
|
||||
DATE_FORMAT(paciente.validade_fim, '%d/%m/%Y')
|
||||
) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(HistoricoAtendimentoService::show($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
15
api/app/Http/Controllers/Ambulatorio/ImpressaoController.php
Normal file
15
api/app/Http/Controllers/Ambulatorio/ImpressaoController.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\ImpressaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ImpressaoController extends Controller
|
||||
{
|
||||
public function list()
|
||||
{
|
||||
return response()->json(ImpressaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Exceptions\Ambulatorio\ConflitoJornadaBloqueioException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\JornadaBloqueioService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class JornadaBloqueioController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'jornada-bloqueio';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return JornadaBloqueioService::datatable();
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(JornadaBloqueioService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaBloqueioService::create(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaBloqueioService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(JornadaBloqueioService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (ConflitoJornadaBloqueioException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(JornadaBloqueioService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
catch (ConflitoJornadaBloqueioException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
JornadaBloqueioService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
}
|
||||
113
api/app/Http/Controllers/Ambulatorio/JornadaController.php
Normal file
113
api/app/Http/Controllers/Ambulatorio/JornadaController.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Exceptions\Ambulatorio\FimExcedeuDataJornadaException;
|
||||
use App\Exceptions\Ambulatorio\JornadaConflitanteException;
|
||||
use App\Exceptions\Ambulatorio\PossuiAgendamentoException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Rules\Cns;
|
||||
use App\Services\Ambulatorio\JornadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class JornadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'jornada';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return JornadaService::datatable();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(JornadaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(JornadaService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (FimExcedeuDataJornadaException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(JornadaService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
catch (JornadaConflitanteException | PossuiAgendamentoException | FimExcedeuDataJornadaException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAll()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(JornadaService::updateAll(), Response::HTTP_OK);
|
||||
}
|
||||
catch (FimExcedeuDataJornadaException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
JornadaService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
catch (PossuiAgendamentoException $e) {
|
||||
|
||||
return response()->json(['message' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroyAll()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaService::destroyAll(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\JornadaSituacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class JornadaSituacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'jornada-situacao';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()->of(JornadaSituacaoService::datatable())->skipTotalRecords()->toJson();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaSituacaoService::create(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaSituacaoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaSituacaoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaSituacaoService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(JornadaSituacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\ListagemConsultaAgendadaRealizadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ListagemConsultaAgendadaRealizadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'listagem-consulta-agendada-realizada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ListagemConsultaAgendadaRealizadaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(ListagemConsultaAgendadaRealizadaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ListagemConsultaAgendadaRealizadaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\ParametrizacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ParametrizacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'parametrizacao';
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ParametrizacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(ParametrizacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ParametrizacaoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
62
api/app/Http/Controllers/Ambulatorio/RecepcaoController.php
Normal file
62
api/app/Http/Controllers/Ambulatorio/RecepcaoController.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RecepcaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RecepcaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'recepcao';
|
||||
|
||||
public function autocompletePaciente()
|
||||
{
|
||||
return RecepcaoService::autocompletePaciente();
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RecepcaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create($filaId = null)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RecepcaoService::create($filaId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function unidadePaciente($pacienteId)
|
||||
{
|
||||
return response()->json(
|
||||
RecepcaoService::unidadePaciente(
|
||||
$pacienteId
|
||||
),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
public function edit($atendimentoId)
|
||||
{
|
||||
return response()->json(RecepcaoService::edit($atendimentoId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RecepcaoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function update($atendimentoId)
|
||||
{
|
||||
return response()->json(RecepcaoService::update($atendimentoId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($atendimentoId)
|
||||
{
|
||||
return response()->json(RecepcaoService::destroy($atendimentoId), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioConsultaFinalizadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioConsultaFinalizadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-consulta-finalizada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioConsultaFinalizadaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioConsultaFinalizadaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioConsultaFinalizadaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioConsultaSolicitadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioConsultaSolicitadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-consulta-solicitada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioConsultaSolicitadaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioConsultaSolicitadaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioConsultaSolicitadaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioEstatisticoConsultaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioEstatisticoConsultaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-estatistico-consulta';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioEstatisticoConsultaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioEstatisticoConsultaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioEstatisticoConsultaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioEstatisticoPacienteService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioEstatisticoPacienteController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-estatistico-paciente';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioEstatisticoPacienteService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioEstatisticoPacienteService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioEstatisticoPacienteService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioEstatisticoStatusService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioEstatisticoStatusController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-estatistico-status';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioEstatisticoStatusService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioEstatisticoStatusService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioEstatisticoStatusService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioIdentificacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioIdentificacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-identificacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioIdentificacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioIdentificacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioIdentificacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocomplete()
|
||||
{
|
||||
return datatables()->of(RelatorioIdentificacaoService::autocomplete())->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioJornadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioJornadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-jornada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioJornadaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioJornadaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioPacienteAtendimentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioPacienteAtendimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-paciente-atendimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioPacienteAtendimentoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioPacienteAtendimentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioProcedimentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioProcedimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-procedimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioProcedimentoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioProcedimentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioProcedimentoLancadoPeriodoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioProcedimentoLancadoPeriodoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-procedimento-lancado-periodo';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioProcedimentoLancadoPeriodoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioProcedimentoLancadoPeriodoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioProducaoAmbulatorialService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioProducaoAmbulatorialController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-producao-ambulatorial';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioProducaoAmbulatorialService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioProducaoAmbulatorialService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioQuantitativoAtendimentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioQuantitativoAtendimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-quantitativo-atendimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoAtendimentoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoAtendimentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioQuantitativoCidService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioQuantitativoCidController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-quantitativo-cid';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoCidService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioQuantitativoCidService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoCidService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocomplete()
|
||||
{
|
||||
return datatables()->of(RelatorioQuantitativoCidService::autocomplete())->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioQuantitativoConsultaSolicitadaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioQuantitativoConsultaSolicitadaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-quantitativo-consulta-solicitada';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoConsultaSolicitadaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioQuantitativoConsultaSolicitadaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoConsultaSolicitadaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioQuantitativoProcedimentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioQuantitativoProcedimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-quantitativo-procedimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoProcedimentoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoProcedimentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioQuantitativoProducaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioQuantitativoProducaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-quantitativo-producao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoProducaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioQuantitativoProducaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\RelatorioRastreioFeridaService;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\MaskUtil;
|
||||
|
||||
class RelatorioRastreioFeridaController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'relatorio-rastreio-ferida';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioRastreioFeridaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioRastreioFeridaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioRastreioFeridaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocomplete()
|
||||
{
|
||||
return datatables()
|
||||
->of(RelatorioRastreioFeridaService::autocomplete())
|
||||
->filterColumn('cadastro_cidadao.data_nascimento', function ($query, $keyword) {
|
||||
$query->whereRaw("DATE_FORMAT(cadastro_cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cadastro_paciente.prontuario', function ($query, $keyword) {
|
||||
$query->whereRaw("LPAD(cadastro_paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cadastro_cidadao.cpf', function ($query, $keyword) {
|
||||
$query
|
||||
->whereRaw("cadastro_cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cadastro_cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cadastro_cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cadastro_cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cadastro_cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->editColumn('cns', fn ($paciente) => MaskUtil::getCnsMasked($paciente->cns))
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
55
api/app/Http/Controllers/Ambulatorio/ServicoController.php
Normal file
55
api/app/Http/Controllers/Ambulatorio/ServicoController.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\ServicoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ServicoController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'servico';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()->of(ServicoService::datatable())->skipTotalRecords()->toJson();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ServicoService::create(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ServicoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ServicoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ServicoService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
ServicoService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\SupervisorService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class SupervisorController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'supervisor';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return SupervisorService::datatable();
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(SupervisorService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function isSupervisor($usuarioId, $infraestruturaId = null, $lotacaoInfraestruturaId = null)
|
||||
{
|
||||
return response()->json(SupervisorService::isSupervisor($usuarioId, $infraestruturaId, $lotacaoInfraestruturaId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SupervisorService::create(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SupervisorService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SupervisorService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(SupervisorService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
SupervisorService::destroy($id);
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
}
|
||||
57
api/app/Http/Controllers/Apac/ExportacaoController.php
Normal file
57
api/app/Http/Controllers/Apac/ExportacaoController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Apac;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Apac\ExportacaoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ExportacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'apac';
|
||||
protected $funcionalidade = 'exportacao';
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::update($id), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()->of(ExportacaoService::datatable())->skipTotalRecords()->make(true);
|
||||
}
|
||||
|
||||
public function download($id)
|
||||
{
|
||||
$response = ExportacaoService::download($id);
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'text/plain;charset=UTF-8',
|
||||
];
|
||||
|
||||
return response()->download($response['arquivo'], $response['nome'], $headers);
|
||||
}
|
||||
}
|
||||
92
api/app/Http/Controllers/Apac/ProcedimentoController.php
Normal file
92
api/app/Http/Controllers/Apac/ProcedimentoController.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Apac;
|
||||
|
||||
use App\Exceptions\Apac\ProcedimentoSecundarioSemOcupacaoException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Apac\ProcedimentoService;
|
||||
use App\Utils\MaskUtil;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProcedimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'apac';
|
||||
protected $funcionalidade = 'procedimento';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(ProcedimentoService::datatable())
|
||||
->filterColumn('solicitacao_autorizacao.data_processamento', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(solicitacao_autorizacao.data_processamento, '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(solicitacao_autorizacao.data_processamento, 9, 2),
|
||||
SUBSTR(solicitacao_autorizacao.data_processamento, 6, 2),
|
||||
SUBSTR(solicitacao_autorizacao.data_processamento, 1, 4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('procedimento_principal.codigo', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("procedimento_principal.codigo like ?", ['%' . str_replace(['.', '-'], '', $keyword) . '%']);
|
||||
})
|
||||
->editColumn('procedimento_principal_codigo', fn ($sa) => MaskUtil::getProcedimentoMasked($sa->procedimento_principal_codigo))
|
||||
->skipTotalRecords()
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
try {
|
||||
|
||||
return response()->json(ProcedimentoService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
catch (ProcedimentoSecundarioSemOcupacaoException $e) {
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Existem procedimentos secundários sem CBO preenchido. '
|
||||
. 'Favor preencher na funcionalidade Regulação > Monitoramento de protocolos.'
|
||||
], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::update($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroyAutomaticos($unidadeExecutanteId, $competenciaId)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::destroyAutomaticos($unidadeExecutanteId, $competenciaId), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Apac;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Apac\RelatorioInconsistenciaService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioInconsistenciaController extends Controller
|
||||
{
|
||||
protected $modulo = 'apac';
|
||||
protected $funcionalidade = 'relatorio-inconsistencia';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioInconsistenciaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioInconsistenciaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioInconsistenciaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteUsuarioExecutante()
|
||||
{
|
||||
return datatables()->of(RelatorioInconsistenciaService::autocompleteUsuarioExecutante())->toJson();
|
||||
}
|
||||
|
||||
public function autocompleteProcedimento()
|
||||
{
|
||||
return datatables()->of(RelatorioInconsistenciaService::autocompleteProcedimento())->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\AtendimentoDomiciliar;
|
||||
|
||||
use App\Services\AtencaoBasica\AtendimentoDomiciliar\AtendimentoDomiciliarService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AtendimentoDomiciliarController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'atendimento-domiciliar';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoDomiciliarService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::edit(), response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoDomiciliarService::update($request), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoDomiciliarService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function getArea()
|
||||
{
|
||||
return response()->json(AtendimentoDomiciliarService::getArea(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\AtendimentoIndividual;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\AtendimentoIndividual\AtendimentoIndividualService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AtendimentoIndividualController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'atendimento-individual';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAtendimentos()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::getAtendimentos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoesAuxiliar()
|
||||
{
|
||||
return response()->json(AtendimentoIndividualService::getOcupacoesAuxiliar(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
//$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoIndividualService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoIndividualService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoIndividualService::show($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoIndividualService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\AtendimentoOdontologico;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\AtendimentoOdontologico\AtendimentoOdontologicoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AtendimentoOdontologicoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'atendimento-odontologico';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoesAuxiliar()
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::getOcupacoesAuxiliar(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoOdontologicoService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function create($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoOdontologicoService::create($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoOdontologicoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoOdontologicoService::update($id, $request), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAtendimentos($id)
|
||||
{
|
||||
return response()->json(AtendimentoOdontologicoService::getAtendimentos($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtendimentoOdontologicoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\AtividadeColetiva;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\AtividadeColetiva\AtividadeColetivaService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AtividadeColetivaController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'atividade-coletiva';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(AtividadeColetivaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return AtividadeColetivaService::datatable();
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(AtividadeColetivaService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(AtividadeColetivaService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(AtividadeColetivaService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(AtividadeColetivaService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtividadeColetivaService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtividadeColetivaService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AtividadeColetivaService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\Avaliacao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\Avaliacao\AvaliacaoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class AvaliacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'avaliacao';
|
||||
|
||||
public function create($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AvaliacaoService::create($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AvaliacaoService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
return response()->json(AvaliacaoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AvaliacaoService::update($id, $request), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(AvaliacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(AvaliacaoService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(AvaliacaoService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(AvaliacaoService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(AvaliacaoService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAvaliacoes($id)
|
||||
{
|
||||
return response()->json(AvaliacaoService::getAvaliacoes($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\CadastroDomiciliar;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\CadastroDomiciliar\CadastroDomiciliarService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class CadastroDomiciliarController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'cadastro-domiciliar';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return CadastroDomiciliarService::datatable();
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getCadastro()
|
||||
{
|
||||
return response()->json(CadastroDomiciliarService::getCadastro(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(CadastroDomiciliarService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(CadastroDomiciliarService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(CadastroDomiciliarService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\CadastroIndividual;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\CadastroIndividual\CadastroIndividualService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class CadastroIndividualController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'cadastro-individual';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(CadastroIndividualService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(CadastroIndividualService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(CadastroIndividualService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(CadastroIndividualService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(CadastroIndividualService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getSupervisores()
|
||||
{
|
||||
return response()->json(CadastroIndividualService::getSupervisores(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(CadastroIndividualService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(CadastroIndividualService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompleteComunidades()
|
||||
{
|
||||
return datatables()->of(CadastroIndividualService::autocompleteComunidades())->make(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\Exportacao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\Exportacao\ExportacaoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ExportacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'exportacao';
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
return response()->json(ExportacaoService::index($request), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(ExportacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
return response()->json(ExportacaoService::store($request), Response::HTTP_ACCEPTED);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ExportacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function download($id)
|
||||
{
|
||||
$response = ExportacaoService::download($id);
|
||||
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
];
|
||||
|
||||
return response()->download($response['arquivo'], $response['nome'], $headers);
|
||||
}
|
||||
|
||||
public function getFichas()
|
||||
{
|
||||
return response()->json(ExportacaoService::getFichas(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\FichaComplementar;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\FichaComplementar\FichaComplementarService;
|
||||
use Exception;
|
||||
use Illuminate\Http\{JsonResponse, Request, Response};
|
||||
|
||||
class FichaComplementarController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
|
||||
protected $funcionalidade = 'ficha-complementar';
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function historico(Request $request)
|
||||
{
|
||||
$pacienteId = filter_var($request->id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$pacienteId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(FichaComplementarService::historico($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$pacienteId = filter_var($request->id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$pacienteId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(FichaComplementarService::create($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FichaComplementarService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function edit(int $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$fichaComplementarId = filter_var($id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$fichaComplementarId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(FichaComplementarService::edit($fichaComplementarId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$fichaComplementarId = filter_var($id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$fichaComplementarId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(
|
||||
FichaComplementarService::update($fichaComplementarId, $request),
|
||||
Response::HTTP_NO_CONTENT
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(int $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$fichaComplementarId = filter_var($id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$fichaComplementarId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(FichaComplementarService::destroy($fichaComplementarId), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(FichaComplementarService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(FichaComplementarService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(FichaComplementarService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(FichaComplementarService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\FichaVacinacao;
|
||||
|
||||
use App\Services\AtencaoBasica\FichaVacinacao\FichaVacinacaoService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FichaVacinacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'ficha-vacinacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getProfissionais()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getProfissionais(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getPaciente()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getPaciente(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getLotes()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getLotes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getFabricantes()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getFabricantes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FichaVacinacaoService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FichaVacinacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function destroyAll($id)
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::destroyAll($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function destroyOne($id)
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::destroyOne($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function getVacinas()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getVacinas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FichaVacinacaoService::update($id, $request), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEstrategias()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getEstrategias(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getDoses()
|
||||
{
|
||||
return response()->json(FichaVacinacaoService::getDoses(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\MapaAtendimentoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class MapaAtendimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'mapa-atendimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(MapaAtendimentoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(MapaAtendimentoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(MapaAtendimentoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\MarcadorConsumoAlimentar;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\MarcadorConsumoAlimentar\MarcadorConsumoAlimentarService;
|
||||
use Exception;
|
||||
use Illuminate\Http\{JsonResponse, Request, Response};
|
||||
|
||||
class MarcadorConsumoAlimentarController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
|
||||
protected $funcionalidade = 'marcador-consumo-alimentar';
|
||||
|
||||
/**
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public function autocomplete(): JsonResponse
|
||||
{
|
||||
return datatables()->of(MarcadorConsumoAlimentarService::autocomplete())->toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o histórico de atendimento de um paciente.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function atendimento(Request $request): JsonResponse
|
||||
{
|
||||
$pacienteId = filter_var($request->id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$pacienteId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(MarcadorConsumoAlimentarService::historico($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request): JsonResponse
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$pacienteId = filter_var($request->id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$pacienteId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(MarcadorConsumoAlimentarService::create($pacienteId), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
private function getParams(Request $request): array
|
||||
{
|
||||
return [
|
||||
'data_atendimento' => $request->data_atendimento,
|
||||
'local_atendimento' => $request->local_atendimento,
|
||||
'paciente' => $request->paciente,
|
||||
'usuario' => $request->usuario,
|
||||
'cbo_codigo' => (int) $request->cbo,
|
||||
'unidade' => $request->unidade,
|
||||
'equipe' => $request->equipe,
|
||||
'pergunta' => [
|
||||
'resposta_multipla' => array_filter(
|
||||
$request->questionario['pergunta_multipla'],
|
||||
fn ($valor) => $valor !== null
|
||||
),
|
||||
'resposta_unica' => array_filter(
|
||||
$request->questionario['pergunta_unica'],
|
||||
fn ($valor) => $valor !== null
|
||||
)
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(
|
||||
MarcadorConsumoAlimentarService::store($this->getParams($request)),
|
||||
Response::HTTP_CREATED
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function edit(int $id): JsonResponse
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$marcadorId = filter_var($id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$marcadorId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(MarcadorConsumoAlimentarService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(int $id, Request $request): JsonResponse
|
||||
{
|
||||
$marcadorConsumoAlimentarId = filter_var($id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$marcadorConsumoAlimentarId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(
|
||||
MarcadorConsumoAlimentarService::update($marcadorConsumoAlimentarId, $this->getParams($request)),
|
||||
Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy($id): JsonResponse
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
$marcadorId = filter_var($id, FILTER_VALIDATE_INT);
|
||||
|
||||
if (!$marcadorId) {
|
||||
return response()->json([], Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response()->json(MarcadorConsumoAlimentarService::destroy($marcadorId), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(MarcadorConsumoAlimentarService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(MarcadorConsumoAlimentarService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(MarcadorConsumoAlimentarService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(MarcadorConsumoAlimentarService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\Parametrizacao;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\Parametrizacao\ParametrizacaoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ParametrizacaoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'parametrizacao';
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ParametrizacaoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
ParametrizacaoService::store($request);
|
||||
|
||||
return response()->json(null, Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(ParametrizacaoService::datatable())
|
||||
->make(true);
|
||||
}
|
||||
|
||||
public function autocomplete()
|
||||
{
|
||||
|
||||
return datatables()->of(ParametrizacaoService::autocomplete())->make(true);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(ParametrizacaoService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\Procedimento;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\Procedimento\ProcedimentoService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ProcedimentoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'procedimento';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(ProcedimentoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(ProcedimentoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAtendimentos()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getAtendimentos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getProcedimentos()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getProcedimentos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getProcedimentosUsuario()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getProcedimentosUsuario(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function loadUnidades()
|
||||
{
|
||||
return response()->json(ProcedimentoService::loadUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getCadastroIndividual()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getCadastroIndividual(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function loadLocaisAtendimento()
|
||||
{
|
||||
return response()->json(ProcedimentoService::loadLocaisAtendimento(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function loadProfissionais()
|
||||
{
|
||||
return response()->json(ProcedimentoService::loadProfissionais(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getInfraestruturas()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getInfraestruturas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAtendimentoResponsavel()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getAtendimentoResponsavel(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAtendimentoPaciente()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getAtendimentoPaciente(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getCadastroDomiciliar()
|
||||
{
|
||||
return response()->json(ProcedimentoService::getCadastroDomiciliar(request()->all()), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::store($request), Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::edit($id), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::show(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(ProcedimentoService::destroy($id), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioAcessoCuidadoProgramadoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioAcessoCuidadoProgramadoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-acesso-cuidado-programado';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioAcessoCuidadoProgramadoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioAcessoCuidadoProgramadoService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioAcessoCuidadoProgramadoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioAtendimentoDomiciliarService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioAtendimentoDomiciliarController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-atendimento-domiciliar';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioAtendimentoDomiciliarService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioAtendimentoDomiciliarService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioAtendimentoDomiciliarService::list(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica\RelatorioAtendimentoOdontologico;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioAtendimentoOdontologico\RelatorioAtendimentoOdontologicoService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioAtendimentoOdontologicoController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-atendimento-odontologico';
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(RelatorioAtendimentoOdontologicoService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioAtendimentoOdontologicoService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(RelatorioAtendimentoOdontologicoService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(RelatorioAtendimentoOdontologicoService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioAtividadeColetivaService;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\MaskUtil;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RelatorioAtividadeColetivaController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-atividade-coletiva';
|
||||
|
||||
public function autocompletePaciente()
|
||||
{
|
||||
return datatables()
|
||||
->of(RelatorioAtividadeColetivaService::autocompletePaciente())
|
||||
->filterColumn('cidadao.data_nascimento', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cidadao.cpf', function ($query, $keyword) {
|
||||
|
||||
$query
|
||||
->whereRaw("cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->editColumn('cns', fn ($paciente) => MaskUtil::getCnsMasked($paciente->cns))
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getPses()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getPses(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getTurnos()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getTurnos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getLocaisAtendimentos()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getLocaisAtendimentos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getProfissionais()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getProfissionais(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getOcupacoes()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getOcupacoes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getEquipes()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getEquipes(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAtividades()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getAtividades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getPublicosAlvo()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getPublicosAlvo(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getTemasSaude()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getTemasSaude(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getPraticasSaude()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getPraticasSaude(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getProcedimentos()
|
||||
{
|
||||
return response()->json(RelatorioAtividadeColetivaService::getProcedimentos(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioCadastroConsistente\RelatorioCadastroConsistenteService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioCadastroConsistenteController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-cadastro-consistente';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
return response()->json([], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getUnidades()
|
||||
{
|
||||
return response()->json(RelatorioCadastroConsistenteService::getUnidades(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getAreas()
|
||||
{
|
||||
return response()->json(RelatorioCadastroConsistenteService::getAreas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getMicroAreas()
|
||||
{
|
||||
return response()->json(RelatorioCadastroConsistenteService::getMicroAreas(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioCadastroConsistenteService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function getPacientes()
|
||||
{
|
||||
return response()->json(RelatorioCadastroConsistenteService::getPacientes(), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioCuidadoDesenvolvimentoInfantilService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioCuidadoDesenvolvimentoInfantil extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-cuidado-desenvolvimento-infantil';
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioCuidadoDesenvolvimentoInfantilService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
return response()->json(RelatorioCuidadoDesenvolvimentoInfantilService::index($request), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list(Request $request)
|
||||
{
|
||||
|
||||
return response()->json(RelatorioCuidadoDesenvolvimentoInfantilService::list($request), Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioCuidadoGestacaoPuerperioService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioCuidadoGestacaoPuerperioController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-cuidado-gestacao-puerperio';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioCuidadoGestacaoPuerperioService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioCuidadoGestacaoPuerperioService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioCuidadoGestacaoPuerperioService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompletePaciente()
|
||||
{
|
||||
return datatables()
|
||||
->of(RelatorioCuidadoGestacaoPuerperioService::autocompletePaciente())
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cidadao.cpf', function ($query, $keyword) {
|
||||
$query->whereRaw("cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AtencaoBasica;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\AtencaoBasica\RelatorioCuidadoMulherPrevencaoCancerService;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class RelatorioCuidadoMulherPrevencaoCancerController extends Controller
|
||||
{
|
||||
protected $modulo = 'atencao-basica';
|
||||
protected $funcionalidade = 'relatorio-cuidado-mulher-prevencao-cancer';
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(RelatorioCuidadoMulherPrevencaoCancerService::index(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return response()->json(RelatorioCuidadoMulherPrevencaoCancerService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
return response()->json(RelatorioCuidadoMulherPrevencaoCancerService::list(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function autocompletePaciente()
|
||||
{
|
||||
return datatables()
|
||||
->of(RelatorioCuidadoMulherPrevencaoCancerService::autocompletePaciente())
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->filterColumn('cidadao.cpf', function ($query, $keyword) {
|
||||
$query->whereRaw("cidadao.cpf like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(cidadao.cpf, 1, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 4, 3),
|
||||
'.',
|
||||
SUBSTR(cidadao.cpf, 7, 3),
|
||||
'-',
|
||||
SUBSTR(cidadao.cpf, 10, 2)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->toJson();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user