This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_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('regulacao_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoStatusTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_status_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('regulacao_status_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_status', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('tipo_id')->constrained('regulacao_status_tipo');
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_status');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoStatusStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_status_status', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('status_de_id')->constrained('regulacao_status')->onDelete('cascade');
|
||||
$table->foreignId('status_para_id')->constrained('regulacao_status');
|
||||
|
||||
$table->primary(['status_de_id', 'status_para_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_status_status');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoOpcaoRetiradaProtocoloAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_opcao_retirada_protocolo_agendamento', 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('regulacao_parametrizacao_opcao_retirada_protocolo_agendamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->boolean('numero_solicitacao_automatico');
|
||||
$table->boolean('solicitacao_automatica_ambulatorio');
|
||||
$table->boolean('permite_agendar_fora_ordem_posicao');
|
||||
|
||||
$table->foreignId('opcao_retirada_protocolo_agendamento_id')
|
||||
->constrained('regulacao_parametrizacao_opcao_retirada_protocolo_agendamento');
|
||||
|
||||
$table->string('mensagem_protocolo_solicitacao', 500)->nullable();
|
||||
$table->string('mensagem_comprovante_agendamento', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoSupervisorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_supervisor', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_supervisor');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoReguladorTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_regulador_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('regulacao_parametrizacao_regulador_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoReguladorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_regulador', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('tipo_id')->constrained('regulacao_parametrizacao_regulador_tipo');
|
||||
$table->boolean('solicitante_controla_protocolo_fechamento');
|
||||
$table->boolean('ativo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_regulador');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoReguladorExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_regulador_exame', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_regulador')->onDelete('cascade');
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['regulador_id', 'exame_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_regulador_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoReguladorProcedimentoCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_regulador_procedimento_cirurgico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_regulador')->onDelete('cascade');
|
||||
$table->foreignId('procedimento_cirurgico_id')->constrained('parametrizacao_procedimento_cirurgico');
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['regulador_id', 'procedimento_cirurgico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_regulador_procedimento_cirurgico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoReguladorEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_regulador_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_regulador')->onDelete('cascade');
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['regulador_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_regulador_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoSolicitanteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_solicitante', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
$table->boolean('is_ppi');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_solicitante');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoSolicitanteReguladorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_solicitante_regulador', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('solicitante_id')->constrained('regulacao_parametrizacao_solicitante')->onDelete('cascade');
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_regulador');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_solicitante_regulador');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoSolicitanteReguladorExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_solicitante_regulador_exame', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('solicitante_regulador_id')
|
||||
->constrained('regulacao_parametrizacao_solicitante_regulador')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
|
||||
$table->primary(['solicitante_regulador_id', 'exame_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_solicitante_regulador_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoSolicitanteReguladorProcedCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_solicitante_regulador_proced_cirurgico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('solicitante_regulador_id')
|
||||
->constrained('regulacao_parametrizacao_solicitante_regulador')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('procedimento_cirurgico_id')->constrained('parametrizacao_procedimento_cirurgico');
|
||||
|
||||
$table->primary(['solicitante_regulador_id', 'procedimento_cirurgico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_solicitante_regulador_proced_cirurgico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoSolicitanteReguladorEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_solicitante_regulador_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('solicitante_regulador_id')
|
||||
->constrained('regulacao_parametrizacao_solicitante_regulador')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
|
||||
$table->primary(['solicitante_regulador_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_solicitante_regulador_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorInternoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_interno', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->nullable()->constrained('cadastro_infraestrutura');
|
||||
$table->boolean('ativo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_interno');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorInternoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_interno_exame', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_interno_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_interno')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['prestador_interno_id', 'exame_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_interno_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorInternoProcedCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_interno_proced_cirurgico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_interno_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_interno')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('procedimento_cirurgico_id')->constrained('parametrizacao_procedimento_cirurgico');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['prestador_interno_id', 'procedimento_cirurgico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_interno_proced_cirurgico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorInternoEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_interno_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_interno_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_interno')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['prestador_interno_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_interno_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorExternoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_externo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('destino_id')->nullable()->constrained('transporte_paciente_destino');
|
||||
$table->boolean('ativo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_externo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorExternoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_externo_exame', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_externo_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_externo')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['prestador_externo_id', 'exame_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_externo_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorExternoProcedCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_externo_proced_cirurgico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_externo_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_externo')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('procedimento_cirurgico_id')->constrained('parametrizacao_procedimento_cirurgico');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['prestador_externo_id', 'procedimento_cirurgico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_externo_proced_cirurgico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoPrestadorExternoEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_prestador_externo_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_externo_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_externo')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
$table->string('observacoes', 1000)->nullable();
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['prestador_externo_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_prestador_externo_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAtivoToRegulacaoStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_status', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('ativo')->nullable()->after('nome');
|
||||
});
|
||||
|
||||
DB::statement('UPDATE regulacao_status SET ativo = 1');
|
||||
|
||||
Schema::table('regulacao_status', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('ativo')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_status', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['ativo']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoPrioridadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_prioridade', 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('regulacao_solicitacao_prioridade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('numero', 16);
|
||||
$table->date('data');
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('status_id')->constrained('regulacao_status');
|
||||
$table->foreignId('infraestrutura_solicitante_id')->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('usuario_solicitante_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_regulador');
|
||||
$table->foreignId('cid_id')->constrained('sigtap.cid');
|
||||
$table->foreignId('ciap_id')->nullable()->constrained('geral_ciap');
|
||||
$table->string('hipotese_diagnostica_justificativa', 500)->nullable();
|
||||
$table->foreignId('prioridade_id')->constrained('regulacao_solicitacao_prioridade');
|
||||
$table->string('observacao', 500)->nullable();
|
||||
$table->date('data_desejada')->nullable();
|
||||
$table->decimal('peso', 6, 3)->nullable();
|
||||
$table->decimal('altura', 4, 1)->nullable();
|
||||
$table->timestamp('confirmado_em')->nullable();
|
||||
$table->foreignId('confirmado_lotacao_id')->nullable()->constrained('cadastro_lotacao');
|
||||
$table->timestamp('cancelado_em')->nullable();
|
||||
$table->foreignId('cancelado_lotacao_id')->nullable()->constrained('cadastro_lotacao');
|
||||
$table->string('justificativa_cancelamento', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('solicitacao_id')->constrained('regulacao_solicitacao')->onDelete('cascade');
|
||||
$table->foreignId('exame_id')->nullable()->constrained('parametrizacao_exame');
|
||||
|
||||
$table->foreignId('procedimento_cirurgico_id')
|
||||
->nullable()
|
||||
->constrained('parametrizacao_procedimento_cirurgico');
|
||||
|
||||
$table->foreignId('especialidade_id')->nullable()->constrained('cadastro_especialidade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('solicitacao_id')->constrained('regulacao_solicitacao')->onDelete('cascade');
|
||||
$table->string('numero', 16);
|
||||
$table->date('data');
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('status_id')->constrained('regulacao_status');
|
||||
$table->foreignId('infraestrutura_solicitante_id')->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('usuario_solicitante_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_regulador');
|
||||
$table->foreignId('cid_id')->constrained('sigtap.cid');
|
||||
$table->foreignId('ciap_id')->nullable()->constrained('geral_ciap');
|
||||
$table->string('hipotese_diagnostica_justificativa', 500)->nullable();
|
||||
$table->foreignId('prioridade_id')->constrained('regulacao_solicitacao_prioridade');
|
||||
$table->string('observacao', 500)->nullable();
|
||||
$table->date('data_desejada')->nullable();
|
||||
$table->decimal('peso', 6, 3)->nullable();
|
||||
$table->decimal('altura', 4, 1)->nullable();
|
||||
$table->timestamp('confirmado_em')->nullable();
|
||||
$table->foreignId('confirmado_lotacao_id')->nullable()->constrained('cadastro_lotacao');
|
||||
$table->timestamp('cancelado_em')->nullable();
|
||||
$table->foreignId('cancelado_lotacao_id')->nullable()->constrained('cadastro_lotacao');
|
||||
$table->string('justificativa_cancelamento', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_historico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoItemHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_item_historico', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('solicitacao_historico_id')
|
||||
->constrained('regulacao_solicitacao_historico')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('exame_id')->nullable()->constrained('parametrizacao_exame');
|
||||
|
||||
$table->foreignId('procedimento_cirurgico_id')
|
||||
->nullable()
|
||||
->constrained('parametrizacao_procedimento_cirurgico');
|
||||
|
||||
$table->foreignId('especialidade_id')->nullable()->constrained('cadastro_especialidade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_item_historico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPosicaoRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('posicao')->nullable()->after('numero')->unique();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['posicao']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPosicaoRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('posicao')->nullable()->after('numero');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['posicao']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPrestadorIdToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_interno_id')
|
||||
->nullable()
|
||||
->after('regulador_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_interno');
|
||||
|
||||
$table->foreignId('prestador_externo_id')
|
||||
->nullable()
|
||||
->after('prestador_interno_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_externo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('prestador_interno_id');
|
||||
$table->dropConstrainedForeignId('prestador_externo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPrestadorIdToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('prestador_interno_id')
|
||||
->nullable()
|
||||
->after('regulador_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_interno');
|
||||
|
||||
$table->foreignId('prestador_externo_id')
|
||||
->nullable()
|
||||
->after('prestador_interno_id')
|
||||
->constrained('regulacao_parametrizacao_prestador_externo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('prestador_interno_id');
|
||||
$table->dropConstrainedForeignId('prestador_externo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoTentativaContatoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_tentativa_contato', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('solicitacao_id')->constrained('regulacao_solicitacao')->onDelete('cascade');
|
||||
$table->date('data');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->string('detalhes', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_tentativa_contato');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoTentativaContatoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_tentativa_contato_historico', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('solicitacao_historico_id')
|
||||
->constrained('regulacao_solicitacao_historico')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->date('data');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->string('detalhes', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_tentativa_contato_historico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFilaFieldsToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->string('justificativa_reagendamento', 500)->nullable()->after('justificativa_cancelamento');
|
||||
$table->string('justificativa_remarcacao', 500)->nullable()->after('justificativa_reagendamento');
|
||||
|
||||
$table->foreignId('opcao_retirada_protocolo_agendamento_id')
|
||||
->nullable()
|
||||
->after('justificativa_remarcacao')
|
||||
->constrained('regulacao_parametrizacao_opcao_retirada_protocolo_agendamento');
|
||||
|
||||
$table->string('nome_pessoa_retirada_protocolo_agendamento', 150)
|
||||
->nullable()
|
||||
->after('opcao_retirada_protocolo_agendamento_id');
|
||||
|
||||
$table->date('data_agendada')->nullable()->after('nome_pessoa_retirada_protocolo_agendamento');
|
||||
$table->time('hora_agendada')->nullable()->after('data_agendada');
|
||||
$table->date('data_realizacao')->nullable()->after('hora_agendada');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'justificativa_reagendamento',
|
||||
'justificativa_remarcacao',
|
||||
'nome_pessoa_retirada_protocolo_agendamento',
|
||||
'data_agendada',
|
||||
'hora_agendada',
|
||||
'data_realizacao',
|
||||
]);
|
||||
|
||||
$table->dropConstrainedForeignId('opcao_retirada_protocolo_agendamento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFilaFieldsToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->string('justificativa_reagendamento', 500)->nullable()->after('justificativa_cancelamento');
|
||||
$table->string('justificativa_remarcacao', 500)->nullable()->after('justificativa_reagendamento');
|
||||
|
||||
$table->foreignId('opcao_retirada_protocolo_agendamento_id')
|
||||
->nullable()
|
||||
->after('justificativa_remarcacao')
|
||||
->constrained('regulacao_parametrizacao_opcao_retirada_protocolo_agendamento');
|
||||
|
||||
$table->string('nome_pessoa_retirada_protocolo_agendamento', 150)
|
||||
->nullable()
|
||||
->after('opcao_retirada_protocolo_agendamento_id');
|
||||
|
||||
$table->date('data_agendada')->nullable()->after('nome_pessoa_retirada_protocolo_agendamento');
|
||||
$table->time('hora_agendada')->nullable()->after('data_agendada');
|
||||
$table->date('data_realizacao')->nullable()->after('hora_agendada');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'justificativa_reagendamento',
|
||||
'justificativa_remarcacao',
|
||||
'nome_pessoa_retirada_protocolo_agendamento',
|
||||
'data_agendada',
|
||||
'hora_agendada',
|
||||
'data_realizacao',
|
||||
]);
|
||||
|
||||
$table->dropConstrainedForeignId('opcao_retirada_protocolo_agendamento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropDataRealizacaoOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('data_realizacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->date('data_realizacao')->nullable()->after('hora_agendada');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropDataRealizacaoOnRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('data_realizacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->date('data_realizacao')->nullable()->after('hora_agendada');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIsHistoricoMudancaPosicaoToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('is_historico_mudanca_posicao')->nullable()->after('id');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE regulacao_solicitacao_historico SET is_historico_mudanca_posicao = 0");
|
||||
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('is_historico_mudanca_posicao')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('is_historico_mudanca_posicao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToRegulacaoSolicitacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('soap_id')->nullable();
|
||||
$table->foreign('soap_id', 'ambulatorio_atendimento_soap_id')
|
||||
->references('id')
|
||||
->on('ambulatorio_atendimento_soap');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
$table->dropForeign(['soap_id']);
|
||||
$table->dropColumn('soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToRegulacaoSolicitacaoHistorico extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('soap_id')->nullable();
|
||||
$table->foreign('soap_id', 'ambulatorio_atendimento_soap_id_historico')
|
||||
->references('id')
|
||||
->on('ambulatorio_atendimento_soap');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
$table->dropForeign(['soap_id']);
|
||||
$table->dropColumn('soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPosicaoReguladorOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('posicao_regulador')->nullable()->after('posicao');
|
||||
$table->unique(['regulador_id', 'posicao_regulador']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign(['regulador_id']);
|
||||
$table->dropUnique(['regulador_id', 'posicao_regulador']);
|
||||
$table->foreign('regulador_id')->references('id')->on('regulacao_parametrizacao_regulador');
|
||||
$table->dropColumn('posicao_regulador');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPosicaoReguladorOnRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('posicao_regulador')->nullable()->after('posicao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('posicao_regulador');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenamePosicaoToPosicaoMunicipalOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropUnique(['posicao']);
|
||||
$table->renameColumn('posicao', 'posicao_municipal');
|
||||
$table->unique(['posicao_municipal']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropUnique(['posicao_municipal']);
|
||||
$table->renameColumn('posicao_municipal', 'posicao');
|
||||
$table->unique(['posicao']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenamePosicaoToPosicaoMunicipalOnRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->renameColumn('posicao', 'posicao_municipal');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->renameColumn('posicao_municipal', 'posicao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFields2411220900ToRegulacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('exibe_protocolo_cross')->nullable()->after('mensagem_comprovante_agendamento');
|
||||
$table->boolean('obriga_protocolo_cross')->nullable()->after('exibe_protocolo_cross');
|
||||
|
||||
$table->foreignId('usuario_registro_estado_id')
|
||||
->nullable()
|
||||
->after('obriga_protocolo_cross')
|
||||
->constrained('intranet.cadastro_estado');
|
||||
|
||||
$table->boolean('obriga_data_desejada')->nullable()->after('usuario_registro_estado_id');
|
||||
});
|
||||
|
||||
DB::statement("
|
||||
UPDATE regulacao_parametrizacao
|
||||
SET exibe_protocolo_cross = 0,
|
||||
obriga_protocolo_cross = 0,
|
||||
obriga_data_desejada = 0;
|
||||
");
|
||||
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('exibe_protocolo_cross')->nullable(false)->change();
|
||||
$table->boolean('obriga_protocolo_cross')->nullable(false)->change();
|
||||
$table->boolean('obriga_data_desejada')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'exibe_protocolo_cross',
|
||||
'obriga_protocolo_cross',
|
||||
'obriga_data_desejada',
|
||||
]);
|
||||
|
||||
$table->dropConstrainedForeignId('usuario_registro_estado_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddControlaProtocoloFechamentoOnRegulacaoParametrizacaoPrestadorInternoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_prestador_interno', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('controla_protocolo_fechamento')->nullable()->after('infraestrutura_id');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE regulacao_parametrizacao_prestador_interno SET controla_protocolo_fechamento = 0;");
|
||||
|
||||
Schema::table('regulacao_parametrizacao_prestador_interno', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('controla_protocolo_fechamento')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_prestador_interno', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['controla_protocolo_fechamento']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAtenteOutroMunicipioToRegulacaoParametrizacaoSolicitanteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_solicitante', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('atende_outro_municipio')->nullable()->after('is_ppi');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE regulacao_parametrizacao_solicitante SET atende_outro_municipio = 0;");
|
||||
|
||||
Schema::table('regulacao_parametrizacao_solicitante', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('atende_outro_municipio')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_solicitante', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['atende_outro_municipio']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDataDesejadaGrupoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_data_desejada_grupo_exame', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('parametrizacao_id')->constrained('regulacao_parametrizacao')->onDelete('cascade');
|
||||
$table->foreignId('grupo_id')->constrained('cadastro_grupo');
|
||||
|
||||
$table->primary(['parametrizacao_id', 'grupo_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_data_desejada_grupo_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDataDesejadaProcedimentoCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_data_desejada_procedimento_cirurgico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('parametrizacao_id')->constrained('regulacao_parametrizacao')->onDelete('cascade');
|
||||
$table->foreignId('procedimento_cirurgico_id')->constrained('parametrizacao_procedimento_cirurgico');
|
||||
|
||||
$table->primary(['parametrizacao_id', 'procedimento_cirurgico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_data_desejada_procedimento_cirurgico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDataDesejadaEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_data_desejada_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('parametrizacao_id')->constrained('regulacao_parametrizacao')->onDelete('cascade');
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
|
||||
$table->primary(['parametrizacao_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_data_desejada_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDataDesejadaInfraestruturaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_data_desejada_infraestrutura', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('parametrizacao_id')->constrained('regulacao_parametrizacao')->onDelete('cascade');
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
|
||||
$table->primary(['parametrizacao_id', 'infraestrutura_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_data_desejada_infraestrutura');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropPosicaoReguladorUniqueOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign(['regulador_id']);
|
||||
$table->dropUnique(['regulador_id', 'posicao_regulador']);
|
||||
$table->foreign('regulador_id')->references('id')->on('regulacao_parametrizacao_regulador');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->unique(['regulador_id', 'posicao_regulador']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropPosicaoMunicipalUniqueOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropUnique(['posicao_municipal']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->unique(['posicao_municipal']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSolicitacaoRetroativaOnRegulacaoParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('solicitacao_retroativa')->default(false)->nullable()->after('permite_agendar_fora_ordem_posicao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('solicitacao_retroativa');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterCidIdInRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedBigInteger('cid_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedBigInteger('cid_id')->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterCidIdInRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedBigInteger('cid_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedBigInteger('cid_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddInfoUsuarioSolicitanteOnRegulacaoSolicitacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('unidade_usuario_id')->nullable()->constrained('cadastro_unidade');
|
||||
$table->foreignId('infraestrutura_usuario_id')->nullable()->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('ocupacao_usuario_id')->nullable()->constrained('sigtap.ocupacao');
|
||||
$table->foreignId('lotaca_usuario_id')->nullable()->constrained('cadastro_lotacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
$table->dropForeign(['unidade_usuario_id']);
|
||||
$table->dropForeign(['infraestrutura_usuario_id']);
|
||||
$table->dropForeign(['ocupacao_usuario_id']);
|
||||
$table->dropForeign(['lotaca_usuario_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMotivoAlteracaoPrioridadeToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->string('motivo_alteracao_prioridade', 200)->nullable()->after('hora_agendada');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['motivo_alteracao_prioridade']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMotivoAlteracaoPrioridadeToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->string('motivo_alteracao_prioridade', 200)->nullable()->after('hora_agendada');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['motivo_alteracao_prioridade']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddJustificativas2411220950ToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->string('justificativa_devolucao', 500)->nullable()->after('justificativa_remarcacao');
|
||||
$table->string('justificativa_reenvio', 500)->nullable()->after('justificativa_devolucao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'justificativa_devolucao',
|
||||
'justificativa_reenvio',
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddJustificativas2411220950ToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->string('justificativa_devolucao', 500)->nullable()->after('justificativa_remarcacao');
|
||||
$table->string('justificativa_reenvio', 500)->nullable()->after('justificativa_devolucao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'justificativa_devolucao',
|
||||
'justificativa_reenvio',
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoMovimentacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_movimentacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('solicitacao_id')->constrained('regulacao_solicitacao')->onDelete('cascade');
|
||||
$table->foreignId('status_id')->constrained('regulacao_status');
|
||||
$table->timestamp('movimentado_em');
|
||||
$table->foreignId('lotacao_id')->constrained('cadastro_lotacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_movimentacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Regulacao\Solicitacao;
|
||||
use App\Models\Regulacao\SolicitacaoMovimentacao;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class InsertMovimentacoesRegulacaoSolicitacaoMovimentacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
|
||||
Solicitacao::get(['id'])->each(function ($solicitacao) {
|
||||
|
||||
self::getHistoricoMovimentacoesSolicitacao($solicitacao->id)->each(function ($movimentacao) use ($solicitacao) {
|
||||
|
||||
SolicitacaoMovimentacao::create([
|
||||
'solicitacao_id' => $solicitacao->id,
|
||||
'status_id' => $movimentacao->status_id,
|
||||
'movimentado_em' => $movimentacao->created_at,
|
||||
'lotacao_id' => $movimentacao->created_lotacao_id,
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static function getHistoricoMovimentacoesSolicitacao($solicitacaoId)
|
||||
{
|
||||
$movimentacoes = collect();
|
||||
|
||||
$statusAnteriorId = null;
|
||||
|
||||
DB::table('regulacao_solicitacao_historico as solicitacao_historico')
|
||||
->where('solicitacao_historico.solicitacao_id', $solicitacaoId)
|
||||
->where('solicitacao_historico.is_historico_mudanca_posicao', false)
|
||||
->selectRaw("
|
||||
solicitacao_historico.status_id,
|
||||
solicitacao_historico.created_at,
|
||||
solicitacao_historico.created_lotacao_id
|
||||
")
|
||||
->orderBy('solicitacao_historico.created_at')
|
||||
->get()
|
||||
->each(function ($movimentacao) use (&$statusAnteriorId, $movimentacoes) {
|
||||
|
||||
if ($movimentacao->status_id !== $statusAnteriorId) {
|
||||
|
||||
$movimentacoes->push($movimentacao);
|
||||
}
|
||||
|
||||
$statusAnteriorId = $movimentacao->status_id;
|
||||
});
|
||||
|
||||
return $movimentacoes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\Regulacao\StatusTipo;
|
||||
use App\Models\Regulacao\Solicitacao;
|
||||
use App\Services\Regulacao\SolicitacaoService;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateRegraPosicaoOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
DB::transaction(function () {
|
||||
|
||||
$ids = Solicitacao::whereHas('status', fn ($q) => $q
|
||||
->whereNotIn('tipo_id', [
|
||||
StatusTipo::FALTA,
|
||||
StatusTipo::REALIZADO,
|
||||
StatusTipo::CANCELADO,
|
||||
])
|
||||
)
|
||||
->orderBy('id')
|
||||
->pluck('id');
|
||||
|
||||
Solicitacao::whereIn('id', $ids)->update([
|
||||
'posicao_municipal' => null,
|
||||
'posicao_regulador' => null,
|
||||
]);
|
||||
|
||||
$ids->each(function ($id) {
|
||||
|
||||
$solicitacao = Solicitacao::findOrFail($id);
|
||||
|
||||
$posicoes = SolicitacaoService::getProximasPosicoes(
|
||||
$solicitacao->prioridade_id,
|
||||
$solicitacao->regulador_id,
|
||||
$solicitacao->itens()->first()
|
||||
);
|
||||
|
||||
$solicitacao->update([
|
||||
'posicao_municipal' => $posicoes->posicao_municipal,
|
||||
'posicao_regulador' => $posicoes->posicao_regulador,
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddExamesNaoReguladosInRegulacaoParametrizacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->boolean('exames_nao_regulados')->default(false)->after('opcao_retirada_protocolo_agendamento_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->dropColumn('exames_nao_regulados');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSempreAlterarUnidadeSolicitanteInRegulacaoParametrizacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->boolean('sempre_alterar_unidade_solicitante')->default(false)->after('exames_nao_regulados');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao', function (Blueprint $table) {
|
||||
$table->dropColumn('sempre_alterar_unidade_solicitante');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoSolicitacaoUploadTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_solicitacao_upload', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('solicitacao_id')->constrained('regulacao_solicitacao')->onDelete('cascade');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario')->onDelete('cascade');
|
||||
$table->string('arquivo', 255);
|
||||
$table->string('nome_arquivo_real', 255);
|
||||
$table->string('extensao_arquivo', 10);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_solicitacao_upload');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddExigeDocumentoAnexoToRegulacaoParametrizacaoReguladorExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_regulador_exame', function (Blueprint $table) {
|
||||
$table->boolean('exige_documento_anexo')->after('ativo')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_regulador_exame', function (Blueprint $table) {
|
||||
$table->dropColumn('exige_documento_anexo');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddExigeDocumentoAnexoToRegulacaoParametrizacaoReguladorEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_regulador_especialidade', function (Blueprint $table) {
|
||||
$table->boolean('exige_documento_anexo')->after('ativo')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_regulador_especialidade', function (Blueprint $table) {
|
||||
$table->dropColumn('exige_documento_anexo');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddExigeDocumentoAnexoToRegulacaoParametrizacaoReguladorProcedimentoCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_regulador_procedimento_cirurgico', function (Blueprint $table) {
|
||||
$table->boolean('exige_documento_anexo')->after('ativo')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_parametrizacao_regulador_procedimento_cirurgico', function (Blueprint $table) {
|
||||
$table->dropColumn('exige_documento_anexo');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DeleteHistoricoMudancaPosicaoOnRegulacaoSolicitacaoHistorico extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$batchSize = 100000;
|
||||
|
||||
$deletedSum = 0;
|
||||
|
||||
do {
|
||||
|
||||
$deleted = DB::table('regulacao_solicitacao_historico')
|
||||
->where('is_historico_mudanca_posicao', true)
|
||||
->limit($batchSize)
|
||||
->delete();
|
||||
|
||||
$deletedSum += $deleted;
|
||||
|
||||
dump("Deleted: {$deletedSum}");
|
||||
}
|
||||
while ($deleted > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropIsHistoricoMudancaPosicaoOnRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('is_historico_mudanca_posicao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('is_historico_mudanca_posicao')->default(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldHipoteseDiagnosticaJustificativaOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->text('hipotese_diagnostica_justificativa')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->string('hipotese_diagnostica_justificativa', 500)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldHipoteseDiagnosticaJustificativaOnRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->text('hipotese_diagnostica_justificativa')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->string('hipotese_diagnostica_justificativa', 500)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoReguladorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_regulador', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('regulacao_parametrizacao_regulador_id')
|
||||
->constrained('regulacao_parametrizacao_regulador')
|
||||
->onDelete('cascade');
|
||||
$table->boolean('ativo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_regulador');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoReguladorEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_regulador_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_divulgacao_regulador')->onDelete('cascade');
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['regulador_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_regulador_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAcompanhamentoOciIdToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('acompanhamento_oci_id')
|
||||
->nullable()
|
||||
->after('motivo_alteracao_prioridade')
|
||||
->constrained('ambulatorio_acompanhamento_oci');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('acompanhamento_oci_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAcompanhamentoOciIdToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('acompanhamento_oci_id')
|
||||
->nullable()
|
||||
->after('motivo_alteracao_prioridade')
|
||||
->constrained('ambulatorio_acompanhamento_oci');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('acompanhamento_oci_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateRegulacaoSolicitacaoObservacaoField extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function(Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 1500)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function(Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 500)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateRegulacaoSolicitacaoHistoricoObservacaoField extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function(Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 1500)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function(Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 500)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoReguladorExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_regulador_exame', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_divulgacao_regulador')->onDelete('cascade');
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['regulador_id', 'exame_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_regulador_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoReguladorProcedimentoCirurgicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_regulador_cirurgico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('regulador_id')->constrained('regulacao_parametrizacao_divulgacao_regulador')->onDelete('cascade');
|
||||
$table->foreignId('procedimento_cirurgico_id')->constrained('parametrizacao_procedimento_cirurgico');
|
||||
$table->boolean('ativo');
|
||||
|
||||
$table->primary(['regulador_id', 'procedimento_cirurgico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_regulador_cirurgico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldObservacaoOnRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->text('observacao')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 1500)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterFieldObservacaoOnRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->text('observacao')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 1500)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapSolicitacaoItemIdToRegulacaoSolicitacaoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_item', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_solicitacao_item_id')
|
||||
->nullable()
|
||||
->after('especialidade_id')
|
||||
->constrained('ambulatorio_atendimento_soap_solicitacao_exame_item');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_item', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('soap_solicitacao_item_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPrestadorExternoExecutorFieldsToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('ocupacao_executora_id')
|
||||
->nullable()
|
||||
->after('acompanhamento_oci_id')
|
||||
->constrained('sigtap.ocupacao');
|
||||
|
||||
$table->string('usuario_executor_nome', 100)->nullable()->after('ocupacao_executora_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('ocupacao_executora_id');
|
||||
$table->dropColumn('usuario_executor_nome');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPrestadorExternoExecutorFieldsToRegulacaoSolicitacaoHistoricoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('ocupacao_executora_id')
|
||||
->nullable()
|
||||
->after('acompanhamento_oci_id')
|
||||
->constrained('sigtap.ocupacao');
|
||||
|
||||
$table->string('usuario_executor_nome', 100)->nullable()->after('ocupacao_executora_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_historico', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('ocupacao_executora_id');
|
||||
$table->dropColumn('usuario_executor_nome');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFazParteOciToRegulacaoSolicitacaoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_item', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('faz_parte_oci')->default(false)->after('soap_solicitacao_item_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao_item', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('faz_parte_oci');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class CreateTransferirDirectoryInRegulacao extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
$cliente = app('config')->get('database.default');
|
||||
|
||||
$destino = storage_path("app/regulacao/uploads/" . $cliente);
|
||||
|
||||
if (!File::exists($destino)) {
|
||||
File::makeDirectory($destino, 0775, true);
|
||||
}
|
||||
|
||||
|
||||
DB::table('regulacao_solicitacao_upload')
|
||||
->select(['id', 'arquivo'])
|
||||
->whereNotNull('arquivo')
|
||||
->orderBy('id')
|
||||
->chunk(1000, function ($registros) use ($destino) {
|
||||
|
||||
foreach ($registros as $registro) {
|
||||
|
||||
$origem = storage_path('app/regulacao/uploads/' . $registro->arquivo);
|
||||
|
||||
if (File::exists($origem)) {
|
||||
$novoDestino = $destino . '/' . basename($registro->arquivo);
|
||||
File::move($origem, $novoDestino);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoAbaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_aba', function (Blueprint $table) {
|
||||
\MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
\MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_aba');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoColunaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_coluna', function (Blueprint $table) {
|
||||
\MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
\MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_coluna');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoAbaColunaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_aba_coluna', function (Blueprint $table) {
|
||||
$table->foreignId('aba_id')->constrained('regulacao_parametrizacao_divulgacao_aba');
|
||||
$table->foreignId('coluna_id')->constrained('regulacao_parametrizacao_divulgacao_coluna');
|
||||
$table->boolean('visivel');
|
||||
|
||||
$table->primary(['aba_id', 'coluna_id']);
|
||||
|
||||
\MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_aba_coluna');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoAbaStatusTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_aba_status_tipo', function (Blueprint $table) {
|
||||
$table->foreignId('aba_id')->constrained('regulacao_parametrizacao_divulgacao_aba');
|
||||
$table->foreignId('status_tipo_id')->constrained('regulacao_status_tipo');
|
||||
$table->boolean('visivel');
|
||||
|
||||
$table->primary(['aba_id', 'status_tipo_id']);
|
||||
|
||||
\MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_aba_status_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoModoTempoMedioTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao_modo_tempo_medio', function (Blueprint $table) {
|
||||
\MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
\MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao_modo_tempo_medio');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateRegulacaoParametrizacaoDivulgacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('regulacao_parametrizacao_divulgacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('modo_tempo_medio_id')->nullable()->constrained('regulacao_parametrizacao_divulgacao_modo_tempo_medio');
|
||||
|
||||
\MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('regulacao_parametrizacao_divulgacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPosicaoPortalToRegulacaoSolicitacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
$table->unsignedInteger('posicao_portal')->nullable()->after('posicao_regulador');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('regulacao_solicitacao', function (Blueprint $table) {
|
||||
$table->dropColumn('posicao_portal');
|
||||
});
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user