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