init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View 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);
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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();
}
}

View 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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View 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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View 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();
}
}

View File

@@ -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();
}
}