120 lines
3.8 KiB
PHP
120 lines
3.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\AtencaoBasica;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\AtencaoBasica\RelatorioAtividadeColetivaService;
|
|
use Illuminate\Http\Response;
|
|
use App\Utils\MaskUtil;
|
|
use Illuminate\Http\Request;
|
|
|
|
class RelatorioAtividadeColetivaController extends Controller
|
|
{
|
|
protected $modulo = 'atencao-basica';
|
|
protected $funcionalidade = 'relatorio-atividade-coletiva';
|
|
|
|
public function autocompletePaciente()
|
|
{
|
|
return datatables()
|
|
->of(RelatorioAtividadeColetivaService::autocompletePaciente())
|
|
->filterColumn('cidadao.data_nascimento', function ($query, $keyword) {
|
|
|
|
$query->whereRaw("DATE_FORMAT(cidadao.data_nascimento, '%d/%m/%Y') like ?", ["%{$keyword}%"]);
|
|
})
|
|
->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}%"]
|
|
);
|
|
})
|
|
->editColumn('cns', fn ($paciente) => MaskUtil::getCnsMasked($paciente->cns))
|
|
->toJson();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::index(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::list(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getPses()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getPses(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getTurnos()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getTurnos(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getUnidades()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getUnidades(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getLocaisAtendimentos()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getLocaisAtendimentos(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getProfissionais()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getProfissionais(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getOcupacoes()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getOcupacoes(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getEquipes()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getEquipes(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getAtividades()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getAtividades(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getPublicosAlvo()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getPublicosAlvo(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getTemasSaude()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getTemasSaude(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getPraticasSaude()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getPraticasSaude(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function getProcedimentos()
|
|
{
|
|
return response()->json(RelatorioAtividadeColetivaService::getProcedimentos(), Response::HTTP_OK);
|
|
}
|
|
|
|
|
|
}
|