init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<?php
use App\Models\ExameImagem\Parametrizacao\TipoCotaPrestador as Model;
use Illuminate\Database\Seeder;
class ParametrizacaoCotaPrestadorTipo_20240506092037 extends Seeder
{
public function run()
{
$tipos = [
['id' => 1, 'descricao' => 'VALOR'],
['id' => 2, 'descricao' => 'QUANTIDADE'],
];
SeederUtil::saveList(Model::class, $tipos, 'id');
}
}

View File

@@ -0,0 +1,27 @@
<?php
use App\Models\ExameImagem\Parametrizacao\MesCotaPrestador as Model;
use Illuminate\Database\Seeder;
class ParametrizacaoCotaPrestadorMes_20240506092139 extends Seeder
{
public function run()
{
$meses = [
['id' => 1, 'descricao' => 'JANEIRO'],
['id' => 2, 'descricao' => 'FEVEREIRO'],
['id' => 3, 'descricao' => 'MARÇO'],
['id' => 4, 'descricao' => 'ABRIL'],
['id' => 5, 'descricao' => 'MAIO'],
['id' => 6, 'descricao' => 'JUNHO'],
['id' => 7, 'descricao' => 'JULHO'],
['id' => 8, 'descricao' => 'AGOSTO'],
['id' => 9, 'descricao' => 'SETEMBRO'],
['id' => 10, 'descricao' => 'OUTUBRO'],
['id' => 11, 'descricao' => 'NOVEMBRO'],
['id' => 12, 'descricao' => 'DEZEMBRO'],
];
SeederUtil::saveList(Model::class, $meses, 'id');
}
}

View File

@@ -0,0 +1,19 @@
<?php
use App\Models\ExameImagem\Parametrizacao\MensagemProtocolo as Model;
use Illuminate\Database\Seeder;
class ParametrizacaoMensagemProtocolo_20240506092239 extends Seeder
{
public function run()
{
$msg = [
[
'id' => 1,
'mensagem' => 'Chegar com 20 minutos de antecedência e levar o cartão SUS.',
],
];
SeederUtil::saveList(Model::class, $msg, 'id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
use App\Models\ExameImagem\Parametrizacao\ControleJornada\TipoControleJornada as Model;
use Illuminate\Database\Seeder;
class ParametrizacaoControleJornadaTipo_20240506092337 extends Seeder
{
public function run()
{
$tipos = [
['id' => 1, 'descricao' => 'ATENDIMENTO'],
['id' => 2, 'descricao' => 'EXAME'],
];
SeederUtil::saveList(Model::class, $tipos, 'id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
use App\Models\ExameImagem\Jornada\TipoJornada as Model;
use Illuminate\Database\Seeder;
class JornadaTipo_20240506092424 extends Seeder
{
public function run()
{
$tipos = [
['id' => 1, 'nome' => 'FIXA'],
['id' => 2, 'nome' => 'DINÂMICA'],
];
SeederUtil::saveList(Model::class, $tipos, 'id');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use App\Models\ExameImagem\Jornada\StatusJornada as Model;
use Illuminate\Database\Seeder;
class JornadaStatus_20240506092531 extends Seeder
{
public function run()
{
$status = [
['id' => 1, 'nome' => 'ATIVO'],
['id' => 2, 'nome' => 'ALTERAÇÃO DE AGENDA'],
['id' => 3, 'nome' => 'ATESTADO'],
['id' => 4, 'nome' => 'ATIVIDADE ENCERRADA'],
['id' => 5, 'nome' => 'ATIVIDADE DO ESPEC. ENCERRADA'],
['id' => 6, 'nome' => 'BANCO DE HORAS'],
['id' => 7, 'nome' => 'CONGRESSO'],
['id' => 8, 'nome' => 'CURSO/ESPECIALIZAÇÃO'],
['id' => 9, 'nome' => 'EMERGÊNCIA'],
['id' => 10, 'nome' => 'FALTA'],
['id' => 11, 'nome' => 'FÉRIAS'],
['id' => 12, 'nome' => 'FERIADO/PONTO FACULTATIVO'],
['id' => 13, 'nome' => 'FOLGA ABONADA'],
['id' => 14, 'nome' => 'FOLGA BANCO'],
['id' => 15, 'nome' => 'GALA'],
['id' => 16, 'nome' => 'LICENÇA-GESTANTE'],
['id' => 17, 'nome' => 'NOJO'],
['id' => 18, 'nome' => 'OUTROS'],
['id' => 19, 'nome' => 'PLANTÃO'],
['id' => 20, 'nome' => 'REPOSIÇÃO DE COTA'],
['id' => 21, 'nome' => 'RESERVADO'],
['id' => 22, 'nome' => 'TRIAGEM'],
];
SeederUtil::saveList(Model::class, $status, 'id');
}
}

View File

@@ -0,0 +1,22 @@
<?php
use App\Models\ExameImagem\Jornada\SemanaJornada as Model;
use Illuminate\Database\Seeder;
class JornadaSemana_20240506092632 extends Seeder
{
public function run()
{
$semana = [
['id' => 1, 'nome' => 'DOMINGO'],
['id' => 2, 'nome' => 'SEGUNDA'],
['id' => 3, 'nome' => 'TERÇA'],
['id' => 4, 'nome' => 'QUARTA'],
['id' => 5, 'nome' => 'QUINTA'],
['id' => 6, 'nome' => 'SEXTA'],
['id' => 7, 'nome' => 'SÁBADO'],
];
SeederUtil::saveList(Model::class, $semana, 'id');
}
}

View File

@@ -0,0 +1,20 @@
<?php
use App\Models\ExameImagem\Fechamento\StatusFechamento as Model;
use Illuminate\Database\Seeder;
class FechamentoStatus_20240506092928 extends Seeder
{
public function run()
{
$status = [
['id' => 1, 'nome' => 'REALIZADO'],
['id' => 2, 'nome' => 'FALTOU'],
['id' => 3, 'nome' => 'RESULTADO LANÇADO'],
['id' => 4, 'nome' => 'AGENDADO'],
['id' => 5, 'nome' => 'FALTA MÉDICA'],
];
SeederUtil::saveList(Model::class, $status, 'id');
}
}

View File

@@ -0,0 +1,17 @@
<?php
use App\Models\ExameImagem\Fechamento\StatusFechamento as Model;
use Illuminate\Database\Seeder;
class FechamentoStatus_20250227122436 extends Seeder
{
public function run()
{
$status = [
['id' => 6, 'nome' => 'REAGENDADO'],
['id' => 7, 'nome' => 'CANCELADO'],
];
SeederUtil::saveList(Model::class, $status, 'id');
}
}

View File

@@ -0,0 +1,87 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RemoverJornadasDuplicadas_20260701142342 extends Seeder
{
public function run()
{
DB::transaction(function () {
$duplicados = DB::table('exame_imagem_jornada')
->select(
DB::raw('MIN(id) as id_manter'),
DB::raw('COUNT(*) as quantidade'),
'data',
'hora_inicial',
'hora_fim',
'usuario_id',
'infraestrutura_id',
'semana_id'
)
->groupBy(
'data',
'hora_inicial',
'hora_fim',
'usuario_id',
'infraestrutura_id',
'semana_id'
)
->havingRaw('COUNT(*) > 1')
->get();
if ($duplicados->isEmpty()) {
$this->command->info('Nenhuma jornada duplicada encontrada.');
return;
}
$foreignKeys = DB::select("
SELECT
TABLE_NAME,
COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_SCHEMA = DATABASE()
AND REFERENCED_TABLE_NAME = 'exame_imagem_jornada'
");
foreach ($duplicados as $duplicado) {
$idsExcluir = DB::table('exame_imagem_jornada')
->where('data', $duplicado->data)
->where('hora_inicial', $duplicado->hora_inicial)
->where('hora_fim', $duplicado->hora_fim)
->where('usuario_id', $duplicado->usuario_id)
->where('id', '<>', $duplicado->id_manter)
->pluck('id');
if ($idsExcluir->isEmpty()) {
continue;
}
foreach ($foreignKeys as $fk) {
DB::table($fk->TABLE_NAME)
->whereIn($fk->COLUMN_NAME, $idsExcluir)
->update([
$fk->COLUMN_NAME => $duplicado->id_manter
]);
}
DB::table('exame_imagem_jornada')
->whereIn('id', $idsExcluir)
->delete();
$this->command->info(
'Jornadas ' . $idsExcluir->implode(', ') . " -> {$duplicado->id_manter}"
);
}
});
$this->command->info('Concluído!');
}
}

View File

@@ -0,0 +1,86 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RemoverAgendamentosDuplicados_20260701150728 extends Seeder
{
public function run()
{
DB::transaction(function () {
$duplicados = DB::table('exame_imagem_agendamento')
->select(
DB::raw('MIN(id) as id_manter'),
DB::raw('COUNT(*) as quantidade'),
'paciente_id',
'medico_id',
'unidade_id',
'infraestrutura_id',
'jornada_id'
)
->groupBy(
'paciente_id',
'medico_id',
'unidade_id',
'infraestrutura_id',
'jornada_id'
)
->havingRaw('COUNT(*) > 1')
->get();
if ($duplicados->isEmpty()) {
$this->command->info('Nenhum agendamento duplicado encontrado.');
return;
}
$foreignKeys = DB::select("
SELECT
TABLE_NAME,
COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_SCHEMA = DATABASE()
AND REFERENCED_TABLE_NAME = 'exame_imagem_agendamento'
");
foreach ($duplicados as $duplicado) {
$idsExcluir = DB::table('exame_imagem_agendamento')
->where('paciente_id', $duplicado->paciente_id)
->where('medico_id', $duplicado->medico_id)
->where('unidade_id', $duplicado->unidade_id)
->where('infraestrutura_id', $duplicado->infraestrutura_id)
->where('jornada_id', $duplicado->jornada_id)
->where('id', '<>', $duplicado->id_manter)
->pluck('id');
if ($idsExcluir->isEmpty()) {
continue;
}
foreach ($foreignKeys as $fk) {
DB::table($fk->TABLE_NAME)
->whereIn($fk->COLUMN_NAME, $idsExcluir)
->update([
$fk->COLUMN_NAME => $duplicado->id_manter
]);
}
DB::table('exame_imagem_agendamento')
->whereIn('id', $idsExcluir)
->delete();
$this->command->info(
'Agendamentos ' . $idsExcluir->implode(', ') . " -> {$duplicado->id_manter}"
);
}
});
$this->command->info('Concluído!');
}
}

View File

@@ -0,0 +1,80 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RemoverAgendamentoExameDuplicado_20260702162055 extends Seeder
{
public function run()
{
DB::transaction(function () {
$duplicados = DB::table('exame_imagem_agendamento_exame')
->select(
DB::raw('MIN(id) as id_manter'),
DB::raw('COUNT(*) as quantidade'),
'agendamento_id',
'exame_id',
'paciente_id'
)
->groupBy(
'agendamento_id',
'exame_id',
'paciente_id'
)
->havingRaw('COUNT(*) > 1')
->get();
if ($duplicados->isEmpty()) {
$this->command->info('Nenhum exame duplicado encontrado.');
return;
}
$foreignKeys = DB::select("
SELECT
TABLE_NAME,
COLUMN_NAME
FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_SCHEMA = DATABASE()
AND REFERENCED_TABLE_NAME = 'exame_imagem_agendamento_exame'
");
foreach ($duplicados as $duplicado) {
$idsExcluir = DB::table('exame_imagem_agendamento_exame')
->where('agendamento_id', $duplicado->agendamento_id)
->where('exame_id', $duplicado->exame_id)
->where('paciente_id', $duplicado->paciente_id)
->where('id', '<>', $duplicado->id_manter)
->pluck('id');
if ($idsExcluir->isEmpty()) {
continue;
}
foreach ($foreignKeys as $fk) {
DB::table($fk->TABLE_NAME)
->whereIn($fk->COLUMN_NAME, $idsExcluir)
->update([
$fk->COLUMN_NAME => $duplicado->id_manter
]);
}
DB::table('exame_imagem_agendamento_exame')
->whereIn('id', $idsExcluir)
->delete();
$this->command->info(
'Agendamentos ' . $idsExcluir->implode(', ') . " -> {$duplicado->id_manter}"
);
}
});
$this->command->info('Concluído!');
}
}