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 CreateIntegracaoBnafarParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_bnafar_parametrizacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('usuario', 100);
|
||||
$table->string('senha', 100);
|
||||
$table->boolean('ativo', 100)->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_bnafar_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoBnafarMedicamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_bnafar_medicamento', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('codigo', 20)->unique();
|
||||
$table->string('codigo_catmat', 100)->nullable();
|
||||
$table->string('codigo_registro_sanitario', 20)->nullable();
|
||||
$table->string('codigo_barras_primario', 20)->nullable();
|
||||
$table->string('codigo_barras_secundario', 20)->nullable();
|
||||
$table->text('descricao', 300)->nullable();
|
||||
$table->string('cnpj_nome_fabricante', 200)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_bnafar_medicamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIntegracaoBnafarMedicamentoIdToIntegracaoBnafarPosicaoEstoqueItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function (Blueprint $table) {
|
||||
$table->foreignId('integracao_bnafar_medicamento_id')->nullable()->after('fabricante_id')->constrained('integracao_bnafar_medicamento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('integracao_bnafar_medicamento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIntegracaoBnafarMedicamentoIdToIntegracaoBnafarSaidaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_saida_item', function (Blueprint $table) {
|
||||
$table->foreignId('integracao_bnafar_medicamento_id')->nullable()->after('fabricante_id')->constrained('integracao_bnafar_medicamento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_saida_item', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('integracao_bnafar_medicamento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddValorUnitarioToIntegracaoBnafarPosicaoEstoqueItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function (Blueprint $table) {
|
||||
$table->decimal('valor_unitario', 19, 2)->after('quantidade')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function (Blueprint $table) {
|
||||
$table->dropColumn('valor_unitario');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddValorUnitarioToIntegracaoBnafarSaidaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_saida_item', function (Blueprint $table) {
|
||||
$table->decimal('valor_unitario', 19, 2)->after('quantidade')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_saida_item', function (Blueprint $table) {
|
||||
$table->dropColumn('valor_unitario');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoBnafarRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_bnafar_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_bnafar_resposta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoBnafarProtocoloRespostaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_bnafar_protocolo_resposta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('protocolo_id')->constrained('integracao_bnafar_protocolo')->onDelete('cascade');
|
||||
$table->json('resposta');
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_bnafar_protocolo_resposta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Integracao\Bnafar\ProtocoloResposta;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateIntegracaoBnafarProtocoloTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
DB::table('integracao_bnafar_protocolo')
|
||||
->select([
|
||||
'id',
|
||||
'erro'
|
||||
])
|
||||
->whereNotNull('erro')
|
||||
->get()
|
||||
->each(function($protocolo) {
|
||||
$erros = json_decode($protocolo->erro, true) ?? null;
|
||||
|
||||
if (!is_null($erros)) {
|
||||
if (isset($erros['exceptions'])) {
|
||||
foreach ($erros['exceptions'] as $exception) {
|
||||
ProtocoloResposta::create([
|
||||
'protocolo_id' => $protocolo->id,
|
||||
'resposta' => json_encode($exception),
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
foreach ($erros as $erro) {
|
||||
if (isset($erro['inconsistencias'])) {
|
||||
foreach ($erro['inconsistencias'] as $inconsistencia) {
|
||||
ProtocoloResposta::create([
|
||||
'protocolo_id' => $protocolo->id,
|
||||
'resposta' => json_encode($inconsistencia),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropErroOnIntegracaoBnafarProtocoloTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_protocolo', function(Blueprint $table) {
|
||||
$table->dropColumn('erro');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_protocolo', function(Blueprint $table) {
|
||||
$table->json('erro')->nullable()->after('data_protocolo');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCascadeOnIntegracaoBnafarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_entrada_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['entrada_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_entrada', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['saida_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['dispensacao_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['posicao_estoque_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_protocolo_resposta', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_entrada_item', function(Blueprint $table) {
|
||||
$table->foreign('entrada_id')->references('id')->on('integracao_bnafar_entrada')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_entrada', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida_item', function(Blueprint $table) {
|
||||
$table->foreign('saida_id')->references('id')->on('integracao_bnafar_saida')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao_item', function(Blueprint $table) {
|
||||
$table->foreign('dispensacao_id')->references('id')->on('integracao_bnafar_dispensacao')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function(Blueprint $table) {
|
||||
$table->foreign('posicao_estoque_id')->references('id')->on('integracao_bnafar_posicao_estoque')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo')->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_protocolo_resposta', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_entrada_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['entrada_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_entrada', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['saida_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['dispensacao_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function(Blueprint $table) {
|
||||
$table->dropForeign(['posicao_estoque_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_protocolo_resposta', function(Blueprint $table) {
|
||||
$table->dropForeign(['protocolo_id']);
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_entrada_item', function(Blueprint $table) {
|
||||
$table->foreign('entrada_id')->references('id')->on('integracao_bnafar_entrada');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_entrada', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida_item', function(Blueprint $table) {
|
||||
$table->foreign('saida_id')->references('id')->on('integracao_bnafar_saida');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_saida', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao_item', function(Blueprint $table) {
|
||||
$table->foreign('dispensacao_id')->references('id')->on('integracao_bnafar_dispensacao');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_dispensacao', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function(Blueprint $table) {
|
||||
$table->foreign('posicao_estoque_id')->references('id')->on('integracao_bnafar_posicao_estoque');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_posicao_estoque', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo');
|
||||
});
|
||||
|
||||
Schema::table('integracao_bnafar_protocolo_resposta', function(Blueprint $table) {
|
||||
$table->foreign('protocolo_id')->references('id')->on('integracao_bnafar_protocolo');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMensagemToIntegracaoBnafarPosicaoEstoqueItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function (Blueprint $table) {
|
||||
$table->text('mensagem')->after('valor_unitario')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_posicao_estoque_item', function (Blueprint $table) {
|
||||
$table->dropColumn('mensagem');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMensagemToIntegracaoBnafarSaidaItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_bnafar_saida_item', function (Blueprint $table) {
|
||||
$table->text('mensagem')->after('valor_unitario')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_bnafar_saida_item', function (Blueprint $table) {
|
||||
$table->dropColumn('mensagem');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use App\Enums\Integracao\Bnafar\BnafarProcessamentoStatus;
|
||||
|
||||
class RemoveSaidaEEstoqueTravados extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::table('integracao_bnafar_protocolo')
|
||||
->whereIn('processamento_status_id',[BnafarProcessamentoStatus::SERVIDOR_INICIOU_PROCESSAMENTO_PROTOCOLO, BnafarProcessamentoStatus::PROTOCOLO_NA_FILA_AGUARDANDO_INICIO_DO_PROCESSAMENTO])
|
||||
->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CreateIntegracaoCnsParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_cns_parametrizacao', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('senha', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_cns_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeTipoAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_tipo_atendimento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 50);
|
||||
$table->char('codigo')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_tipo_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeUnidadeEncaminhadoraTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_unidade_encaminhadora', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 50);
|
||||
$table->char('codigo')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_unidade_encaminhadora');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeUnidadeAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_unidade_atendimento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 50);
|
||||
$table->char('codigo')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_unidade_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeTipoAltaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_tipo_alta', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 100);
|
||||
$table->char('codigo')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_tipo_alta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudePacienteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_paciente', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('nome');
|
||||
$table->date('data_nascimento')->nullable();
|
||||
$table->string('sexo', 1)->nullable();
|
||||
$table->string('cns', 15)->nullable();
|
||||
$table->string('cep', 8)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_paciente');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->date('data')->nullable();
|
||||
$table->time('hora')->nullable();
|
||||
$table->date('data_alta')->nullable();
|
||||
$table->time('hora_alta')->nullable();
|
||||
$table->date('data_atendimento')->nullable();
|
||||
$table->time('horario_atendimento')->nullable();
|
||||
|
||||
$table->string('cod_tipo_encaminhamento', 10)->nullable();
|
||||
$table->string('cod_grupo_atendimento', 10)->nullable();
|
||||
|
||||
$table->foreignId('paciente_id')->constrained('integracao_erpsaude_paciente');
|
||||
$table->foreignId('tipo_atendimento_id')->nullable()->constrained('integracao_erpsaude_tipo_atendimento');
|
||||
$table->foreignId('unidade_encaminhadora_id')->nullable()->constrained('integracao_erpsaude_unidade_encaminhadora');
|
||||
$table->foreignId('unidade_atendimento_id')->nullable()->constrained('integracao_erpsaude_unidade_atendimento');
|
||||
$table->foreignId('tipo_alta_id')->nullable()->constrained('integracao_erpsaude_tipo_alta');
|
||||
|
||||
$table->string('unidade_atendimento')->nullable();
|
||||
$table->string('cnes_un_atendimento', 20)->nullable();
|
||||
|
||||
$table->char('suspeita_maus_tratos', 1)->nullable();
|
||||
$table->text('hipotese_diagnostica')->nullable();
|
||||
$table->string('cid10', 10)->nullable();
|
||||
$table->text('descricao_procedimento')->nullable();
|
||||
$table->text('descricao_exame_clinico')->nullable();
|
||||
$table->text('conduta_medica')->nullable();
|
||||
|
||||
$table->string('codigo_conta_prof', 50)->nullable();
|
||||
$table->string('profissional')->nullable();
|
||||
$table->string('conselho', 50)->nullable();
|
||||
$table->char('uf_conselho', 2)->nullable();
|
||||
|
||||
$table->string('convenio')->nullable();
|
||||
$table->string('registro_ans', 50)->nullable();
|
||||
$table->string('cod_convenio', 50)->nullable();
|
||||
|
||||
$table->string('nome_setor')->nullable();
|
||||
$table->string('codigo_setor', 50)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeReavaliacoesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_reavaliacoes', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->constrained('integracao_erpsaude_atendimento');
|
||||
$table->date('data');
|
||||
$table->time('hora');
|
||||
$table->text('reavaliacao')->nullable();
|
||||
$table->string('profissional')->nullable();
|
||||
$table->string('numero_conselho')->nullable();
|
||||
$table->string('uf_conselho', 2)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_reavaliacoes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeExamesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_exames', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->constrained('integracao_erpsaude_atendimento');
|
||||
$table->string('exame');
|
||||
$table->string('tipo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_exames');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoErpsaudeMedicamentosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('integracao_erpsaude_medicamentos', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->constrained('integracao_erpsaude_atendimento');
|
||||
$table->string('medicamento');
|
||||
$table->decimal('quantidade', 8, 2);
|
||||
$table->string('unidade_medida');
|
||||
$table->string('tipo');
|
||||
$table->integer('medicamento_id');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('integracao_erpsaude_medicamentos');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCpfToIntegracaoErpsaudePacienteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('integracao_erpsaude_paciente', function (Blueprint $table) {
|
||||
|
||||
$table->string('cpf', 11)->nullable()->after('cns');;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
if (app('config')->get('database.default') !== 'santarita') {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('integracao_erpsaude_paciente', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['cpf']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->boolean('ativo');
|
||||
$table->string('url_instalacao', 255)->nullable();
|
||||
$table->string('usuario', 100)->nullable();
|
||||
$table->string('senha', 100)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusOrigemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_origem', 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('integracao_esus_origem');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('origem_id')->constrained('integracao_esus_origem');
|
||||
$table->date('data_atendimento');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
|
||||
$table->foreignId('equipe_id')->constrained('atencao_basica_parametrizacao_equipe');
|
||||
$table->foreignId('atendimento_domiciliar_id')->nullable()->constrained('atencao_basica_atendimento_domiciliar');
|
||||
$table->foreignId('atividade_coletiva_id')->nullable()->constrained('atencao_basica_atividade_coletiva');
|
||||
$table->foreignId('avaliacao_id')->nullable()->constrained('atencao_basica_avaliacao');
|
||||
$table->foreignId('procedimento_id')->nullable()->constrained('atencao_basica_procedimento');
|
||||
$table->foreignId('ficha_vacinacao_id')->nullable()->constrained('atencao_basica_ficha_vacinacao');
|
||||
$table->foreignId('ficha_complementar_id')->nullable()->constrained('atencao_basica_ficha_complementar');
|
||||
$table->foreignId('cadastro_domiciliar_id')->nullable()->constrained('atencao_basica_cadastro_domiciliar');
|
||||
$table->foreignId('cadastro_individual_id')->nullable()->constrained('atencao_basica_cadastro_individual');
|
||||
$table->foreignId('consumo_alimentar_id')->nullable()->constrained('atencao_basica_consumo_alimentar');
|
||||
$table->json('inconsistencia');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaAtendimentoIndividualTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_atendimento_individual', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('atendimento_individual_id')->constrained('atencao_basica_atendimento_individual');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'atendimento_individual_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_atendimento_individual');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaAtendimentoOdontologicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_atendimento_odontologico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('atendimento_odontologico_id')->constrained('atencao_basica_atendimento_odontologico');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'atendimento_odontologico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_atendimento_odontologico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaVisitaDomiciliarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_visita_domiciliar', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('visita_domiciliar_id')->constrained('atencao_basica_visita_domiciliar');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'visita_domiciliar_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_visita_domiciliar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaAtendimentoDomiciliarAtendTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_atendimento_domiciliar_atend', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('atendimento_domiciliar_atendimento_id')->constrained('atencao_basica_atendimento_domiciliar_atendimento');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'atendimento_domiciliar_atendimento_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_atendimento_domiciliar_atend');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaProcedimentoAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_procedimento_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('procedimento_atendimento_id')->constrained('atencao_basica_procedimento_atendimento');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'procedimento_atendimento_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_procedimento_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaAtividadeColetivaParticipanteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_atividade_coletiva_participante', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('atividade_coletiva_participante_id')->constrained('atencao_basica_atividade_coletiva_participante');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'atividade_coletiva_participante_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_atividade_coletiva_participante');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaFichaVacinacaoPacienteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_ficha_vacinacao_paciente', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('ficha_vacinacao_paciente_id')->constrained('atencao_basica_vacinacao_paciente');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'ficha_vacinacao_paciente_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_ficha_vacinacao_paciente');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoEsusInconsistenciaCadastroDomiciliarPacienteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_esus_inconsistencia_cadastro_domiciliar_paciente', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('inconsistencia_id')->constrained('integracao_esus_inconsistencia')->onDelete('cascade');
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->integer('posicao');
|
||||
|
||||
$table->primary(['inconsistencia_id', 'paciente_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_esus_inconsistencia_cadastro_domiciliar_paciente');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterIntegracaoEsusInconsistenciaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('integracao_esus_inconsistencia', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('usuario_id')->nullable()->change();
|
||||
$table->foreignId('ocupacao_id')->nullable()->change();
|
||||
$table->foreignId('equipe_id')->nullable()->change();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('integracao_esus_inconsistencia', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('usuario_id')->nullable(false)->change();
|
||||
$table->foreignId('ocupacao_id')->nullable(false)->change();
|
||||
$table->foreignId('equipe_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiraParametrizacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_rira_parametrizacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('senha', 100)->nullable();
|
||||
$table->string('identificador_solicitante', 100)->nullable();
|
||||
$table->char('cns_solicitante', 15);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_rira_parametrizacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiraDocumentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_rira_documento', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('regulacao_solicitacao_item_id')->constrained('regulacao_solicitacao_item');
|
||||
$table->string('identificador', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_rira_documento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateIntegracaoRiraDocumentoEnvioTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('integracao_rira_documento_envio', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('documento_id')->constrained('integracao_rira_documento')->onDelete('cascade');
|
||||
$table->string('url_rnds', 200)->nullable();
|
||||
$table->string('identificador_rnds', 100)->nullable();
|
||||
$table->foreignId('regulacao_status_enviado_id')->constrained('regulacao_status');
|
||||
$table->string('identificador_solicitante', 100);
|
||||
$table->char('cns_solicitante', 15);
|
||||
$table->timestamp('data_hora_envio');
|
||||
$table->json('request')->nullable();
|
||||
$table->json('response')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('integracao_rira_documento_envio');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user