This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class FeridaNotFoundException extends Exception
|
||||
{
|
||||
private string $identificador;
|
||||
private ?int $indice;
|
||||
public function __construct(string $identificador, ?int $indice = null)
|
||||
{
|
||||
$this->identificador = $identificador;
|
||||
$this->indice = $indice;
|
||||
parent::__construct();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$msg = "Ferida com identificador externo '{$this->identificador}' não encontrada.";
|
||||
if ($this->indice !== null) {
|
||||
$msg = "Ferida [{$this->indice}]: {$msg}";
|
||||
}
|
||||
return response()->json([
|
||||
'message' => $msg
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LocalAnatomicoAusenteException extends Exception
|
||||
{
|
||||
private ?int $indice;
|
||||
public function __construct(?int $indice = null)
|
||||
{
|
||||
$this->indice = $indice;
|
||||
parent::__construct();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$msg = 'É necessário informar ao menos o local anatômico ou o local anatômico região.';
|
||||
if ($this->indice !== null) {
|
||||
$msg = "Ferida [{$this->indice}]: {$msg}";
|
||||
}
|
||||
return response()->json([
|
||||
'message' => $msg
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LocalAnatomicoInconsistenteException extends Exception
|
||||
{
|
||||
private string $pai;
|
||||
private string $filho;
|
||||
private ?int $indice;
|
||||
public function __construct(string $pai = '', string $filho = '', ?int $indice = null)
|
||||
{
|
||||
$this->pai = $pai;
|
||||
$this->filho = $filho;
|
||||
$this->indice = $indice;
|
||||
parent::__construct();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$msg = ($this->pai && $this->filho)
|
||||
? "Local anatômico '{$this->pai}' não corresponde ao local anatômico região '{$this->filho}'."
|
||||
: 'Local anatômico informado não corresponde ao local anatômico região.';
|
||||
if ($this->indice !== null) {
|
||||
$msg = "Ferida [{$this->indice}]: {$msg}";
|
||||
}
|
||||
return response()->json([
|
||||
'message' => $msg
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LocalAnatomicoNotFoundException extends Exception
|
||||
{
|
||||
private string $valor;
|
||||
private ?int $indice;
|
||||
public function __construct(string $valor, ?int $indice = null)
|
||||
{
|
||||
$this->valor = $valor;
|
||||
$this->indice = $indice;
|
||||
parent::__construct();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$msg = "Local anatômico '{$this->valor}' não encontrado.";
|
||||
if ($this->indice !== null) {
|
||||
$msg = "Ferida [{$this->indice}]: {$msg}";
|
||||
}
|
||||
return response()->json([
|
||||
'message' => $msg
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LocalAnatomicoRegiaoInativoException extends Exception
|
||||
{
|
||||
private string $valor;
|
||||
private ?int $indice;
|
||||
public function __construct(string $valor = '', ?int $indice = null)
|
||||
{
|
||||
$this->valor = $valor;
|
||||
$this->indice = $indice;
|
||||
parent::__construct();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$msg = $this->valor
|
||||
? "Local anatômico região '{$this->valor}' está inativo."
|
||||
: 'Local anatômico região informado está inativo.';
|
||||
if ($this->indice !== null) {
|
||||
$msg = "Ferida [{$this->indice}]: {$msg}";
|
||||
}
|
||||
return response()->json([
|
||||
'message' => $msg
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class LocalAnatomicoRegiaoNotFoundException extends Exception
|
||||
{
|
||||
private string $valor;
|
||||
private ?int $indice;
|
||||
public function __construct(string $valor = '', ?int $indice = null)
|
||||
{
|
||||
$this->valor = $valor;
|
||||
$this->indice = $indice;
|
||||
parent::__construct();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
$msg = $this->valor
|
||||
? "Local anatômico região '{$this->valor}' não encontrado ou inexistente."
|
||||
: 'Local anatômico região não encontrado ou inexistente.';
|
||||
if ($this->indice !== null) {
|
||||
$msg = "Ferida [{$this->indice}]: {$msg}";
|
||||
}
|
||||
return response()->json([
|
||||
'message' => $msg
|
||||
], Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions\WebService\Ambulatorio\ConectaSus;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class PacienteNotFoundException extends Exception
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return response()->json([
|
||||
'message' => 'Paciente não encontrado.'
|
||||
], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user