41 lines
1.5 KiB
PHP
41 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Services\AtencaoBasica\CadastroIndividual;
|
|
|
|
use App\Models\Cadastro\SujeitoAtencao\Paciente;
|
|
use App\Models\Intranet\Cliente;
|
|
use App\Services\Service;
|
|
use App\Utils\MaskUtil;
|
|
use Carbon\Carbon;
|
|
|
|
class TermoRecusaCadastroService extends Service
|
|
{
|
|
public static function index($id)
|
|
{
|
|
$currentLotacao = self::getCurrentLotacao();
|
|
$cliente = Cliente::where('link', app('config')->get('database.default'))->firstOrFail();
|
|
$paciente = Paciente::findOrFail($id);
|
|
|
|
return [
|
|
'form' => [
|
|
'data_atual' => Carbon::now()->format('d/m/Y'),
|
|
'unidade' => $currentLotacao->infraestrutura->unidade->nome_fantasia,
|
|
'unidade_id' => $currentLotacao->infraestrutura->unidade->id,
|
|
'infraestrutura_id' => $currentLotacao->infraestrutura->id,
|
|
'infraestrutura' => $currentLotacao->infraestrutura->nome,
|
|
'sistema' => [
|
|
'ramo_atividade' => [
|
|
'nome' => $cliente->sistema->ramoAtividade->nome ?? null,
|
|
],
|
|
'nome' => $cliente->sistema->nome ?? null,
|
|
'versao' => $cliente->sistema->versao ?? null,
|
|
],
|
|
],
|
|
'nome' => $paciente->cidadao->nome ?? null,
|
|
'nome_social' => $paciente->cidadao->nome_social ?? null,
|
|
'cpf' => $paciente->cidadao->cpf ? MaskUtil::getCpfMasked($paciente->cidadao->cpf) : 'NÃO INFORMADO',
|
|
|
|
];
|
|
}
|
|
}
|