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,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('descricao', 50)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_tipo');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUnidadeTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_unidade_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('descricao', 50)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_unidade_tipo');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_unidade', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->boolean('unidade_coleta');
$table->boolean('laboratorio');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_unidade');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUnidadeSolicitanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_unidade_solicitante', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('unidade_solicitante_id')->constrained('cadastro_unidade');
$table->foreignId('unidade_tipo_id')->constrained('exame_laboratorial_parametrizacao_unidade_tipo');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_unidade_solicitante');
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('unidade_tipo_id')->constrained('exame_laboratorial_parametrizacao_unidade_tipo');
$table->foreignId('cota_tipo_id')->constrained('exame_laboratorial_parametrizacao_cota_tipo');
$table->date('inicio');
$table->date('fim');
$table->smallInteger('cota_quantidade')->nullable();
$table->decimal('cota_valor', 8, 2)->nullable();
$table->tinyInteger('unidade_solicitante_id')->nullable()->constrained('cadastro_unidade');
$table->text('observacao', 250)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaAnualTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->id();
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
$table->smallInteger('ano')->nullable();
$table->smallInteger('cota')->nullable();
$table->text('observacao', 250)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_anual');
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaExamePeriodoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_exame_periodo', function (Blueprint $table) {
$table->id();
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('cota_tipo_id')->constrained('exame_laboratorial_parametrizacao_cota_tipo');
$table->text('observacao', 250)->nullable();
$table->date('inicio');
$table->date('fim');
$table->integer('cota_quantidade')->nullable();
$table->decimal('cota_valor', 8, 2)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_exame_periodo');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFieldsIntoExameLaboratorialParametrizacaoCotaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura')->after('unidade_id');
$table->foreignId('unidade_solicitante_infraestrutura_id')->nullable()->constrained('cadastro_infraestrutura')->after('unidade_solicitante_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->dropForeign(['infraestrutura_id']);
$table->dropForeign(['unidade_solicitante_infraestrutura_id']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddInfraestruturaIdToExameLaboratorialParametrizacaoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_unidade', function (Blueprint $table) {
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura')->after('unidade_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_unidade', function (Blueprint $table) {
$table->dropForeign(['infraestrutura_id']);
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFieldsToExameLaboratorialParametrizacaoUnidadeSolicitanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_unidade_solicitante', function (Blueprint $table) {
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura')->after('unidade_id');
$table->foreignId('unidade_solicitante_infraestrutura_id')->nullable()->constrained('cadastro_infraestrutura')->after('unidade_solicitante_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_unidade_solicitante', function (Blueprint $table) {
$table->dropForeign(['infraestrutura_id']);
$table->dropForeign(['unidade_solicitante_infraestrutura_id']);
});
}
}

View File

@@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterFieldsToExameLaboratorialParametrizacaoCotaAnualTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->dropColumn([
'ano',
]);
$table->foreignId('infraestrutura_id')->after('observacao')->constrained('cadastro_infraestrutura');
$table->foreignId('unidade_id')->after('infraestrutura_id')->constrained('cadastro_unidade');
$table->foreignId('cota_tipo_id')->after('unidade_id')->constrained('exame_laboratorial_parametrizacao_cota_tipo');
$table->date('inicio')->after('cota_tipo_id');
$table->date('fim')->after('inicio');
$table->mediumInteger('cota_quantidade')->after('fim')->nullable();
$table->decimal('cota_valor', 8, 2)->after('cota_quantidade')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->dropColumn([
'infraestrutura_id',
'unidade_id',
'cota_tipo_id',
'inicio',
'fim',
'cota_quantidade',
'cota_valor',
]);
$table->smallInteger('ano')->nullable();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoMesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_mes', function (Blueprint $table) {
$table->id();
$table->string('descricao');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_mes');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaExameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->id();
$table->foreignId('cota_id')->constrained('exame_laboratorial_parametrizacao_cota')->onDelete('cascade');
$table->smallInteger('cota_quantidade')->nullable();
$table->decimal('cota_valor', 8, 2)->nullable();
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_exame');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaUnidadeSolicitanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->id();
$table->foreignId('cota_id')->constrained('exame_laboratorial_parametrizacao_cota')->onDelete('cascade');
$table->foreignId('unidade_solicitante_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_solicitante_id')->constrained('cadastro_infraestrutura');
$table->smallInteger('cota_quantidade')->nullable();
$table->decimal('cota_valor', 8, 2)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_unidade_solicitante');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCotaAnualIdToExameLaboratorialParametrizacaoCotaExame extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->foreignId('cota_anual_id')
->after('exame_id')->nullable()
->constrained('exame_laboratorial_parametrizacao_cota_exame_periodo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->dropForeign(['cota_anual_id']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCotaIdUnidadeSolicitanteToExameLaboratorialParametrizacaoCotaUnidadeSolicitante extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->foreignId('cota_id_unidade_solicitante')->after('cota_valor')->constrained('exame_laboratorial_parametrizacao_cota');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->dropForeign(['cota_id_unidade_solicitante']);
});
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaExameUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_exame_unidade', function (Blueprint $table) {
$table->id();
$table->foreignId('cota_exame_id')
->constrained('exame_laboratorial_parametrizacao_cota_exame')
->onDelete('cascade');
$table->foreignId('cota_id')->constrained('exame_laboratorial_parametrizacao_cota');
$table->foreignId('unidade_solicitante_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_solicitante_id')->constrained('cadastro_infraestrutura');
$table->smallInteger('cota_quantidade')->nullable();
$table->decimal('cota_valor', 8, 2)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_exame_unidade');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaToExameLaboratorialParametrizacaoCotaAnualTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->integer('cota')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->smallInteger('cota')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoMensagemProtocoloTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_mensagem_protocolo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('mensagem', 500);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_mensagem_protocolo');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropCotaToExameLaboratorialParametrizacaoCotaAnualTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->dropColumn([
'cota',
]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->integer('cota')->nullable();
});
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaAnualIdToCotaExamePeriodoIdExameLaboratorialParametrizacaoCotaExameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'cota_anual_id');
$table->foreignId('cota_exame_periodo_id')
->after('exame_id')
->nullable()
->constrained('exame_laboratorial_parametrizacao_cota_exame_periodo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->dropForeign(['cota_exame_periodo_id']);
$table->foreignId('cota_anual_id')
->after('exame_id')
->nullable()
->constrained('exame_laboratorial_parametrizacao_cota_exame_periodo');
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropExameLaboratorialParametrizacaoCotaAnualTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::drop('exame_laboratorial_parametrizacao_cota_anual');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('exame_laboratorial_parametrizacao_cota_anual', function (Blueprint $table) {
$table->id();
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
$table->smallInteger('ano')->nullable();
$table->smallInteger('cota')->nullable();
$table->text('observacao', 250)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoMotivoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_motivo', function (Blueprint $table) {
$table->id();
$table->string('descricao', 100);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_motivo');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoOcupacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_ocupacao', function (Blueprint $table) {
$table->id();
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_ocupacao');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropFieldsToExameLaboratorialParametrizacaoMesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_mes', function (Blueprint $table) {
$table->dropColumn('deleted_at');
MigrationUtil::dropColumnWithForeign($table, 'deleted_lotacao_id');
MigrationUtil::dropColumnWithForeign($table, 'deleted_centro_custo_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_mes', function (Blueprint $table) {
$table->softDeletes();
});
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoSupervisorTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_supervisor', function (Blueprint $table) {
$table->id();
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_supervisor');
}
}

View File

@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaTransferenciaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_transferencia', function (Blueprint $table) {
$table->id();
$table->foreignId('cota_id')->nullable()->constrained('exame_laboratorial_parametrizacao_cota');
$table->foreignId('laboratorio_unidade_id')->nullable()->constrained('cadastro_unidade');
$table->foreignId('laboratorio_infraestrutura_id')->nullable()->constrained('cadastro_infraestrutura');
$table->foreignId('origem_unidade_id')->constrained('cadastro_unidade');
$table->foreignId('origem_infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->date('origem_inicio');
$table->date('origem_fim');
$table->integer('origem_cota_quantidade')->nullable();
$table->decimal('origem_cota_valor', 8, 2)->nullable();
$table->foreignId('destino_unidade_id')->constrained('cadastro_unidade');
$table->foreignId('destino_infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->date('destino_inicio');
$table->date('destino_fim');
$table->integer('destino_cota_quantidade')->nullable();
$table->decimal('destino_cota_valor', 8, 2)->nullable();
$table->foreignId('unidade_tipo_id')->constrained('exame_laboratorial_parametrizacao_unidade_tipo');
$table->foreignId('cota_tipo_id')->constrained('exame_laboratorial_parametrizacao_cota_tipo');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_transferencia');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoCotaTransferenciaExamesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
$table->id();
$table->foreignId('cota_transferencia_id')->constrained('exame_laboratorial_parametrizacao_cota_transferencia');
$table->integer('cota_quantidade')->nullable();
$table->decimal('cota_valor', 8, 2)->nullable();
$table->foreignId('cota_exame_id')->constrained('exame_laboratorial_parametrizacao_cota_exame');
$table->integer('cota_quantidade_transferido')->nullable();
$table->decimal('cota_valor_transferido', 8, 2)->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_cota_transferencia_exames');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropExameLaboratorialParametrizacaoOcupacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::drop('exame_laboratorial_parametrizacao_ocupacao');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('exame_laboratorial_parametrizacao_ocupacao', function (Blueprint $table) {
$table->id();
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropCotaExameIdToExameLaboratorialParametrizacaoCotaTransferenciaExamesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'cota_exame_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
$table->foreignId('cota_exame_id')->constrained('exame_laboratorial_parametrizacao_cota_exame');
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaExameIdToExameLaboratorialParametrizacaoCotaTransferenciaExamesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
$table->foreignId('cota_exame_id')
->after('id')
->nullable()
->constrained('exame_laboratorial_parametrizacao_cota_exame_periodo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'cota_exame_id');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaQuantidadeToExameLaboratorialParametrizacaoCotaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->integer('cota_quantidade')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->smallInteger('cota_quantidade')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaQuantidadeToExameLaboratorialParametrizacaoCotaUnidadeSolicitanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->integer('cota_quantidade')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->smallInteger('cota_quantidade')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaQuantidadeToExameLaboratorialParametrizacaoCotaExameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->integer('cota_quantidade')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->smallInteger('cota_quantidade')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCotaQuantidadeToExameLaboratorialParametrizacaoCotaExameUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame_unidade', function (Blueprint $table) {
$table->integer('cota_quantidade')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame_unidade', function (Blueprint $table) {
$table->smallInteger('cota_quantidade')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUnidadeFaturamentoAutomaticoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_unidade_faturamento_automatico', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->foreignId('usuario_id')->nullable()->constrained('cadastro_usuario');
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->foreignId('unidade_id_principal')->nullable()->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id_principal')->nullable()->constrained('cadastro_infraestrutura');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_unidade_faturamento_automatico');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddRelacionamentoIdToExameLaboratorialParametrizacaoUnidadeFaturamentoAutomaticoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico', function (Blueprint $table) {
$table->foreignId('relacionado_id')
->after('infraestrutura_id_principal')
->nullable()
->constrained('exame_laboratorial_parametrizacao_unidade_faturamento_automatico');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'relacionado_id');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoProfissionalAssinaturaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_profissional_assinatura', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->foreignId('usuario_id')->nullable()->constrained('cadastro_usuario');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_profissional_assinatura');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoImpressaoAgendamentoTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_impressao_agendamento_tipo', function (Blueprint $table) {
$table->id();
$table->string('descricao');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_impressao_agendamento_tipo');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoImpressaoAgendamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_impressao_agendamento', function (Blueprint $table) {
$table->id();
$table->foreignId('tipo_id')->constrained('exame_laboratorial_parametrizacao_impressao_agendamento_tipo');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_impressao_agendamento');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaTransferenciaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia', function (Blueprint $table) {
$table->decimal('origem_cota_valor', 12, 2)->nullable()->change();
$table->decimal('destino_cota_valor', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia', function (Blueprint $table) {
$table->decimal('origem_cota_valor', 8, 2)->nullable()->change();
$table->decimal('destino_cota_valor', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->decimal('cota_valor', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota', function (Blueprint $table) {
$table->decimal('cota_valor', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaExamePeriodoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame_periodo', function (Blueprint $table) {
$table->decimal('cota_valor', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame_periodo', function (Blueprint $table) {
$table->decimal('cota_valor', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaExameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->decimal('cota_valor', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame', function (Blueprint $table) {
$table->decimal('cota_valor', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaUnidadeSolicitanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->decimal('cota_valor', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_unidade_solicitante', function (Blueprint $table) {
$table->decimal('cota_valor', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaExameUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame_unidade', function (Blueprint $table) {
$table->decimal('cota_valor', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_exame_unidade', function (Blueprint $table) {
$table->decimal('cota_valor', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDecimalToExameLaboratorialParametrizacaoCotaTransferenciaExamesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
$table->decimal('cota_valor', 12, 2)->nullable()->change();
$table->decimal('cota_valor_transferido', 12, 2)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_cota_transferencia_exames', function (Blueprint $table) {
$table->decimal('cota_valor', 8, 2)->nullable()->change();
$table->decimal('cota_valor_transferido', 8, 2)->nullable()->change();
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUnidadeSolicitanteExameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_unidade_solicitante_exame', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->boolean('urgencia');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_unidade_solicitante_exame');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUnidadeSolicitanteExameItemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_unidade_solicitante_exame_item', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_solicitante_exame_id')->constrained('exame_laboratorial_parametrizacao_unidade_solicitante_exame');
$table->foreignId('exame_id')->nullable()->constrained('parametrizacao_exame');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_unidade_solicitante_exame_item');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUniFatuAutoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_uni_fatu_auto_unidade', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_faturamento_automatico_id')->constrained('exame_laboratorial_parametrizacao_unidade_faturamento_automatico');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_uni_fatu_auto_unidade');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoUniFatuAutoUsuarioTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_uni_fatu_auto_usuario', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_faturamento_automatico_id')->constrained('exame_laboratorial_parametrizacao_unidade_faturamento_automatico');
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_uni_fatu_auto_usuario');
}
}

View File

@@ -0,0 +1,90 @@
<?php
use Carbon\Carbon;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class UpdateFieldsToExameLaboratorialParametrizacaoUniFatuAutoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$unidadeId = null;
$infraestruturaId = null;
$ids = [];
$unidades = DB::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico')
->whereNull('relacionado_id')
->orderBy('infraestrutura_id')
->get();
foreach ($unidades as $unidade) {
if ($infraestruturaId != $unidade->infraestrutura_id) {
$infraestruturaId = $unidade->infraestrutura_id;
$unidadeId = $unidade->id;
$ids[] = $unidade->id;
}
DB::table('exame_laboratorial_parametrizacao_uni_fatu_auto_usuario')->insertGetId([
'unidade_faturamento_automatico_id' => $unidadeId,
'usuario_id' => $unidade->usuario_id,
'ocupacao_id' => $unidade->ocupacao_id,
]);
$relacionadas = DB::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico')
->where('relacionado_id', $unidade->id)
->get();
foreach ($relacionadas as $relacionada) {
DB::table('exame_laboratorial_parametrizacao_uni_fatu_auto_unidade')->insertGetId([
'unidade_faturamento_automatico_id' => $unidadeId,
'infraestrutura_id' => $relacionada->infraestrutura_id,
]);
}
}
DB::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico')
->whereNotNull('relacionado_id')
->delete();
DB::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico')
->whereNotIn('id', $ids)
->delete();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$feriados = DB::table('cadastro_feriado')
->whereNull('created_at')
->get();
foreach ($feriados as $feriado) {
DB::table('cadastro_feriado_modulo')
->where('feriado_id', $feriado->id)
->delete();
}
DB::table('cadastro_feriado')
->whereNull('created_at')
->delete();
DB::table('cadastro_feriado')
->update([
'data' => null
]);
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropFieldsToExameLaboratorialParametrizacaoUnidadeFaturamentoAutomaticoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'usuario_id');
MigrationUtil::dropColumnWithForeign($table, 'ocupacao_id');
MigrationUtil::dropColumnWithForeign($table, 'unidade_id_principal');
MigrationUtil::dropColumnWithForeign($table, 'infraestrutura_id_principal');
MigrationUtil::dropColumnWithForeign($table, 'relacionado_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_unidade_faturamento_automatico', function (Blueprint $table) {
$table->foreignId('usuario_id')->nullable()->constrained('cadastro_usuario');
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->foreignId('unidade_id_principal')->nullable()->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id_principal')->nullable()->constrained('cadastro_infraestrutura');
$table->foreignId('relacionado_id')
->after('infraestrutura_id_principal')
->nullable()
->constrained('exame_laboratorial_parametrizacao_unidade_faturamento_automatico');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoLaboratorioFaturaAutomaticoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_laboratorio_fatura_automatico', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_laboratorio_fatura_automatico');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoLabFatuAutoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_lab_fatu_auto_unidade', function (Blueprint $table) {
$table->id();
$table->foreignId('laboratorio_fatura_automatico_id')->constrained('exame_laboratorial_parametrizacao_laboratorio_fatura_automatico');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_lab_fatu_auto_unidade');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoLabFatuAutoUsuarioTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_lab_fatu_auto_usuario', function (Blueprint $table) {
$table->id();
$table->foreignId('laboratorio_fatura_automatico_id')->constrained('exame_laboratorial_parametrizacao_laboratorio_fatura_automatico');
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_lab_fatu_auto_usuario');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoReagendarExameTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_reagendar_exame', function (Blueprint $table) {
$table->id();
$table->boolean('exibir')->default(true);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_reagendar_exame');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoExameProntoAtendimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_exame_pronto_atendimento', function (Blueprint $table) {
$table->id();
$table->boolean('exibir')->default(true);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_exame_pronto_atendimento');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoExameAmbulatorioAtendimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_exame_ambulatorio_atendimento', function (Blueprint $table) {
$table->id();
$table->boolean('exibir')->default(true);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_exame_ambulatorio_atendimento');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropExameLaboratorialParametrizacaoExameProntoAtendimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_exame_pronto_atendimento');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::create('exame_laboratorial_parametrizacao_exame_pronto_atendimento', function (Blueprint $table) {
$table->id();
$table->boolean('exibir')->default(true);
MigrationUtil::addCommonFields($table);
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLaboratorioPadraoInfraestruturaIdToExameLaboratorialParametrizacaoUnidadeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('exame_laboratorial_parametrizacao_unidade', function (Blueprint $table) {
$table->foreignId('laboratorio_padrao_infraestrutura_id')
->after('laboratorio')
->nullable()
->constrained('cadastro_infraestrutura');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('exame_laboratorial_parametrizacao_unidade', function (Blueprint $table) {
MigrationUtil::dropColumnWithForeign($table, 'laboratorio_padrao_infraestrutura_id');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoWebServiceTipoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_web_service_tipo', function (Blueprint $table) {
MigrationUtil::idWithoutIncrements($table);
$table->string('nome', 50)->unique();
MigrationUtil::addCommonFields($table, ['staticData' => true]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_web_service_tipo');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoWebServiceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_web_service', function (Blueprint $table) {
$table->id();
$table->foreignId('tipo_id')->nullable()->constrained('exame_laboratorial_parametrizacao_web_service_tipo');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_web_service');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoIntegracaoAplicativoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_integracao_aplicativo', function (Blueprint $table) {
$table->id();
$table->boolean('habilita_agendamento_conectasus_cidadao')
->nullable()
->default(false);
$table->boolean('habilita_visualizacao_laudo_conectasus_cidadao')
->nullable()
->default(false);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_integracao_aplicativo');
}
}

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoAppConectasusCidadaoLaboratorioTable extends Migration
{
public function up()
{
Schema::create('exame_laboratorial_param_app_conectasus_cidadao_laboratorio', function (Blueprint $table) {
$table->id();
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->unsignedTinyInteger('percentual_financeiro')->default(0);
$table->unsignedTinyInteger('percentual_quantitativo')->default(0);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
public function down()
{
Schema::dropIfExists('exame_laboratorial_param_app_conectasus_cidadao_laboratorio');
}
}

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterPercentualOnExameLaboratorialParametrizacaoAppCidadaoLaboratorioTable extends Migration
{
public function up()
{
Schema::table('exame_laboratorial_param_app_conectasus_cidadao_laboratorio', function (Blueprint $table) {
$table->unique('infraestrutura_id');
});
}
public function down()
{
Schema::table('exame_laboratorial_param_app_conectasus_cidadao_laboratorio', function (Blueprint $table) {
$table->dropUnique(['infraestrutura_id']);
});
}
}

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoAppConectasusCidadaoExameTable extends Migration
{
public function up()
{
Schema::create('exame_laboratorial_parametrizacao_app_conectasus_cidadao_exame', function (Blueprint $table) {
$table->id();
$table->foreignId('cota_exame_periodo_id')->constrained('exame_laboratorial_parametrizacao_cota_exame_periodo');
$table->unsignedTinyInteger('percentual_financeiro')->default(0);
$table->unsignedTinyInteger('percentual_quantitativo')->default(0);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
public function down()
{
Schema::dropIfExists('exame_laboratorial_parametrizacao_app_conectasus_cidadao_exame');
}
}

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateExameLaboratorialParametrizacaoAppConectasusCidadaoUnidadeSolicitanteTable extends Migration
{
public function up()
{
Schema::create('exame_laboratorial_param_app_conectasus_cidadao_unidade_sol', function (Blueprint $table) {
$table->id();
$table->foreignId('unidade_id')->constrained('cadastro_unidade');
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
$table->unsignedTinyInteger('percentual_financeiro')->default(0);
$table->unsignedTinyInteger('percentual_quantitativo')->default(0);
$table->unique(['unidade_id', 'infraestrutura_id']);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
public function down()
{
Schema::dropIfExists('exame_laboratorial_param_app_conectasus_cidadao_unidade_sol');
}
}