This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiaParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('senha', 100)->nullable();
|
||||
$table->string('identificador_solicitante', 100)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_ria_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('registro_aplicacao_id')->constrained('imunizacao_registro_aplicacao')->onDelete('cascade');
|
||||
$table->string('identificador_solicitante', 100);
|
||||
$table->char('cns_solicitante', 15);
|
||||
$table->string('identificador_documento', 100);
|
||||
$table->string('identificador_composicao', 100);
|
||||
$table->string('identificador_imunizacao', 100);
|
||||
$table->timestamp('data_hora_envio');
|
||||
$table->json('response')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_ria_documento_imunologico_rotina');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCnsToIntegracaoRiaParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->char('cns', 15)->after('identificador_solicitante');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->dropColumn('cns');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenameCnsOnIntegracaoRiaParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->renameColumn('cns', 'cns_solicitante');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->renameColumn('cns_solicitante', 'cns');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddProducaoToIntegracaoRiaParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->boolean('producao')->after('cns_solicitante')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->dropColumn('producao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropProducaoOnIntegracaoRiaParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->dropColumn('producao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_parametrizacao', function (Blueprint $table) {
|
||||
$table->boolean('producao')->after('cns_solicitante')->default(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIdentificadorRndsToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->string('identificador_rnds', 200)->nullable()->after('registro_aplicacao_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->dropColumn('identificador_rnds');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiaRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_ria_resposta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('codigo', 100);
|
||||
$table->text('mensagem');
|
||||
$table->text('descricao');
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_ria_resposta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIdentificadorCondicaoToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->string('identificador_condicao', 100)->nullable()->after('identificador_imunizacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->dropColumn('identificador_condicao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiaDocumentoImunologicoRotinaRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_ria_documento_imunologico_rotina_resposta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('documento_imunologico_rotina_id')->constrained('integracao_ria_documento_imunologico_rotina')->onDelete('cascade');
|
||||
$table->text('resposta');
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_ria_documento_imunologico_rotina_resposta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
DB::table('integracao_ria_documento_imunologico_rotina')
|
||||
->select([
|
||||
'id',
|
||||
'response'
|
||||
])
|
||||
->whereNotNull('response')
|
||||
->get()
|
||||
->each(function($documentoImunologicoRotina) {
|
||||
$response = json_decode($documentoImunologicoRotina->response);
|
||||
|
||||
foreach ($response->issue as $issue) {
|
||||
DB::table('integracao_ria_documento_imunologico_rotina_resposta')->insert([
|
||||
'documento_imunologico_rotina_id' => $documentoImunologicoRotina->id,
|
||||
'resposta' => $issue->diagnostics,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropResponseOnIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function(Blueprint $table) {
|
||||
$table->dropColumn('response');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function(Blueprint $table) {
|
||||
$table->json('response')->nullable()->after('data_hora_envio');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRegistroAtualizacaoIdToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->foreignId('registro_aplicacao_id')->nullable()->change();
|
||||
$table->foreignId('registro_atualizacao_id')->after('registro_aplicacao_id')->nullable()->constrained('imunizacao_registro_atualizacao')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->dropColumn(['registro_atualizacao_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddUsuarioAtualizouToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->boolean('usuario_atualizou')->default(false)->after('alterar');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->dropColumn('usuario_atualizou');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTentouSubstituirToIntegracaoRiaDocumentoImunologicoRotinaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->boolean('tentou_substituir')->default(false)->after('usuario_atualizou');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_ria_documento_imunologico_rotina', function (Blueprint $table) {
|
||||
$table->dropColumn('tentou_substituir');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user