This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user