This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Ambulatorio;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Ambulatorio\FormularioRaasService;
|
||||
use App\Utils\MaskUtil;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FormularioRaasController extends Controller
|
||||
{
|
||||
protected $modulo = 'ambulatorio';
|
||||
protected $funcionalidade = 'formulario-raas';
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
return datatables()
|
||||
->of(FormularioRaasService::datatable())
|
||||
->filterColumn('data', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("DATE_FORMAT(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), '%d/%m/%Y') like ?", ["%{$keyword}%"])
|
||||
->orWhereRaw(
|
||||
"CONCAT(
|
||||
SUBSTR(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), 9, 2),
|
||||
SUBSTR(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), 6, 2),
|
||||
SUBSTR(COALESCE(jornada.data, CAST(demanda_espontanea.created_at AS DATE)), 1, 4)
|
||||
) like ?",
|
||||
["%{$keyword}%"]
|
||||
);
|
||||
})
|
||||
->filterColumn('paciente.prontuario', function ($query, $keyword) {
|
||||
|
||||
$query->whereRaw("LPAD(paciente.prontuario, 7, 0) like ?", ["%{$keyword}%"]);
|
||||
})
|
||||
->editColumn('paciente_cns', fn ($a) => MaskUtil::getCnsMasked($a->paciente_cns))
|
||||
->editColumn('paciente_cpf', fn ($a) => MaskUtil::getCpfMasked($a->paciente_cpf))
|
||||
->skipTotalRecords()
|
||||
->toJson();
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormularioRaasService::create(), Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$this->auth(__FUNCTION__);
|
||||
|
||||
return response()->json(FormularioRaasService::store(), Response::HTTP_CREATED);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user