91 lines
2.4 KiB
PHP
91 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Imunizacao;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Imunizacao\FilaAtendimentoService;
|
|
use Illuminate\Http\Response;
|
|
|
|
class FilaAtendimentoController extends Controller
|
|
{
|
|
protected $modulo = 'imunizacao';
|
|
protected $funcionalidade = 'fila-atendimento';
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(FilaAtendimentoService::create(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function createEncaminhamento($filaId)
|
|
{
|
|
return response()->json(FilaAtendimentoService::createEncaminhamento($filaId), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(FilaAtendimentoService::store(), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(FilaAtendimentoService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(FilaAtendimentoService::update($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
return response()->json(FilaAtendimentoService::list(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function listEncaminhamento()
|
|
{
|
|
return response()->json(FilaAtendimentoService::listEncaminhamento(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function autocompletePaciente()
|
|
{
|
|
return datatables()
|
|
->of(FilaAtendimentoService::autocompletePaciente())
|
|
->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, 6, 0) like ?", ["%{$keyword}%"]);
|
|
})
|
|
->toJson();
|
|
}
|
|
|
|
public function evade($id)
|
|
{
|
|
FilaAtendimentoService::evade($id);
|
|
|
|
return response()->noContent();
|
|
}
|
|
|
|
public function forward($id)
|
|
{
|
|
FilaAtendimentoService::forward($id);
|
|
|
|
return response()->noContent();
|
|
}
|
|
|
|
public function sendBack($id)
|
|
{
|
|
FilaAtendimentoService::sendBack($id);
|
|
|
|
return response()->noContent();
|
|
}
|
|
}
|