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