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,61 @@
<?php
namespace App\Http\Controllers\Mobile\ConectaCidadao\PerfilCidadao;
use App\Http\Controllers\Controller;
use App\Models\Cadastro\SujeitoAtencao\Paciente;
use App\Services\Mobile\ConectaCidadao\PerfilCidadao\PerfilCidadaoService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Exception;
class PerfilCidadaoController extends Controller
{
private PerfilCidadaoService $perfilCidadaoService;
public function __construct(PerfilCidadaoService $perfilCidadaoService)
{
$this->perfilCidadaoService = $perfilCidadaoService;
}
public function index(Request $request)
{
try {
$pacienteId = $request->input('paciente_id');
if (!$pacienteId) {
return response()->json(
[
'message' => 'O parâmetro paciente_id é obrigatório.'
],
Response::HTTP_BAD_REQUEST
);
}
$paciente = Paciente::find($pacienteId);
if (!$paciente) {
return response()->json(
[
'message' => 'Paciente não encontrado.'
],
Response::HTTP_NOT_FOUND
);
}
$dadosCidadao = $this->perfilCidadaoService->getDadosCidadao($paciente);
} catch (Exception $exception) {
return response()->json(
[
'message' => $exception->getMessage(),
],
Response::HTTP_INTERNAL_SERVER_ERROR
);
}
return response()->json($dadosCidadao, Response::HTTP_OK);
}
}