36 lines
875 B
PHP
36 lines
875 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Mobile\ConectaSusAb\Sigtap;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Sigtap\Procedimento;
|
|
use App\Models\Sigtap\Competencia;
|
|
use Illuminate\Http\Response;
|
|
|
|
class ProcedimentoController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
|
|
$listaCamposProcedimentos = [
|
|
'id',
|
|
'competencia_id',
|
|
'codigo',
|
|
'nome',
|
|
'complexidade',
|
|
'sexo',
|
|
'idade_minima',
|
|
'idade_maxima'
|
|
];
|
|
|
|
$ultimaCompetencia = Competencia::orderBy('valor', 'desc')->first(['id']);
|
|
|
|
$procedimentos = Procedimento::where('competencia_id', $ultimaCompetencia->id)
|
|
->select($listaCamposProcedimentos)
|
|
->get()
|
|
->toArray();
|
|
|
|
return response()->json($procedimentos, Response::HTTP_OK);
|
|
}
|
|
}
|