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 CreateAtencaoBasicaCadastroMotivoVisitaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('atencao_basica_cadastro_motivo_visita', function (Blueprint $table) {
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 100);
|
||||
$table->smallInteger('codigo_esus')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('atencao_basica_cadastro_motivo_visita');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAtencaoBasicaCadastroMomentoColetaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('atencao_basica_cadastro_momento_coleta', function (Blueprint $table) {
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 50);
|
||||
$table->smallInteger('codigo_esus')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('atencao_basica_cadastro_momento_coleta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAtencaoBasicaCadastroDesfechoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('atencao_basica_cadastro_desfecho', function (Blueprint $table) {
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('descricao', 50);
|
||||
$table->smallInteger('codigo_esus')->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('atencao_basica_cadastro_desfecho');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAtencaoBasicaVisitaDomiciliarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('atencao_basica_visita_domiciliar', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('paciente_id')->nullable()->constrained('cadastro_paciente');
|
||||
$table->foreignId('usuario_id')->nullable()->constrained('cadastro_usuario');
|
||||
$table->foreignId('equipe_id')->nullable()->constrained('atencao_basica_parametrizacao_equipe');
|
||||
$table->foreignId('usuario_ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
|
||||
$table->date('data_usuario_responsavel')->nullable();
|
||||
$table->foreignId('turno_id')->nullable()->constrained('geral_turno');
|
||||
$table->foreignId('imovel_tipo_id')->nullable()->constrained('atencao_basica_cadastro_imovel_tipo');
|
||||
$table->string('latitude', 10)->nullable();
|
||||
$table->string('longitude', 10)->nullable();
|
||||
$table->boolean('visita_compartilhada')->default(false)->nullable();
|
||||
$table->decimal('peso', 8, 2)->nullable();
|
||||
$table->decimal('altura', 5, 2)->nullable();
|
||||
$table->decimal('temperatura', 3, 1)->nullable();
|
||||
$table->string('afericao_pa')->nullable();
|
||||
$table->integer('glicemia')->nullable();
|
||||
$table->foreignId('momento_coleta_id')->nullable()->constrained('atencao_basica_cadastro_momento_coleta');
|
||||
$table->foreignId('desfecho_id')->nullable()->constrained('atencao_basica_cadastro_desfecho');
|
||||
$table->text('complemento', 1000)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('atencao_basica_visita_domiciliar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAtencaoBasicaVisitaDomiciliarMotivoVisitaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('atencao_basica_visita_domiciliar_motivo_visita', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('visita_domiciliar_id')->constrained('atencao_basica_visita_domiciliar');
|
||||
$table->foreignId('motivo_visita_id')->constrained('atencao_basica_cadastro_motivo_visita');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('atencao_basica_visita_domiciliar_motivo_visita');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFieldsExportacaoToAtencaoBasicaVisitaDomiciliarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('atencao_basica_visita_domiciliar', function (Blueprint $table) {
|
||||
|
||||
$table
|
||||
->foreignId('exportacao_id')
|
||||
->nullable()
|
||||
->after('id')
|
||||
->constrained('atencao_basica_exportacao');
|
||||
|
||||
$table
|
||||
->string('uuid_ficha', 44)
|
||||
->nullable()
|
||||
->after('exportacao_id')
|
||||
->unique();
|
||||
|
||||
$table
|
||||
->foreignId('usuario_exportacao_id')
|
||||
->nullable()
|
||||
->after('uuid_ficha')
|
||||
->constrained('cadastro_usuario');
|
||||
|
||||
$table
|
||||
->dateTime('data_hora_exportacao')
|
||||
->nullable()
|
||||
->after('usuario_exportacao_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('atencao_basica_visita_domiciliar', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign(['exportacao_id']);
|
||||
$table->dropColumn(['exportacao_id']);
|
||||
|
||||
$table->dropForeign(['usuario_exportacao_id']);
|
||||
$table->dropColumn(['usuario_exportacao_id']);
|
||||
|
||||
$table->dropColumn('uuid_ficha');
|
||||
$table->dropColumn('data_hora_exportacao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterUuidFichaToAtencaoBasicaVisitaDomiciliarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('atencao_basica_visita_domiciliar', function (Blueprint $table) {
|
||||
|
||||
$table->dropUnique(['uuid_ficha']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('atencao_basica_visita_domiciliar', function (Blueprint $table) {
|
||||
|
||||
$table
|
||||
->string('uuid_ficha', 44)
|
||||
->nullable()
|
||||
->unique()
|
||||
->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user