init commit
All checks were successful
build-api-image / build (push) Successful in 51s

This commit is contained in:
Antonio Lopes dos Santos
2026-08-04 16:52:02 -03:00
commit afec302c3e
11594 changed files with 1636728 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
$table->foreignId('motivo_id')->constrained('transporte_paciente_motivo_viagem_procedimento');
$table->date('data');
$table->time('horario');
$table->foreignId('municipio_id')->nullable()->constrained('intranet.cadastro_municipio');
$table->foreignId('destino_id')->nullable()->constrained('transporte_paciente_destino');
$table->text('consulta_observacao', 500)->nullable();
$table->tinyInteger('acompanhante')->nullable();
$table->foreignId('ponto_id')->nullable()->constrained('transporte_paciente_ponto');
$table->date('data_saida');
$table->time('horario_saida')->nullable();
$table->foreignId('tipo_passageiro_id')->nullable()->constrained('transporte_paciente_veiculo_tipo_passageiro');
$table->foreignId('veiculo_id')->nullable()->constrained('transporte_paciente_veiculo');
$table->foreignId('jornada_id')->nullable()->constrained('transporte_paciente_jornada');
$table->foreignId('supervisor_id')->nullable()->constrained('cadastro_usuario');
$table->text('observacao', 500)->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_agendar_transporte');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPreAgendaIdToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('pre_agendamento_id')->nullable()->references('id')->on('transporte_paciente_pre_agendamento_transporte');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropForeign('transporte_paciente_agendamento_transporte_pre_agendar_id_foreign');
$table->dropColumn('pre_agendamento_id');
});
}
}

View File

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

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddStatusIdToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('status_id')
->nullable()
->after('supervisor_id')
->constrained('transporte_paciente_status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropForeign(['status_id']);
$table->dropColumn('status_id');
});
}
}

View File

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

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteAcompanhanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->id();
$table->string('nome');
$table->string('cns')->nullable();
$table->string('telefone')->nullable();
$table->foreignId('relacao_id')->nullable()->references('id')->on('transporte_paciente_acompanhante_relacao');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_acompanhante');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAcompanhantesIdsToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('acompanhante_1_id')->nullable()->references('id')->on('transporte_paciente_acompanhante');
$table->foreignId('acompanhante_2_id')->nullable()->references('id')->on('transporte_paciente_acompanhante');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropConstrainedForeignId('acompanhante_1_id');
$table->dropConstrainedForeignId('acompanhante_2_id');
});
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddViagemIdToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('viagem_id')
->nullable()
->after('status_id')
->constrained('transporte_paciente_viagem');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropForeign(['viagem_id']);
$table->dropColumn('viagem_id');
});
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProcedimentoToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('procedimento_id')->nullable()->after('observacao')->constrained('sigtap.procedimento');
$table->foreignId('lotacao_id')->nullable()->after('procedimento_id')->constrained('cadastro_lotacao');
$table->foreignId('ocupacao_id')->after('lotacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->unsignedSmallInteger('quantidade')->after('ocupacao_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropForeign(['procedimento_id']);
$table->dropColumn('procedimento_id');
$table->dropForeign(['lotacao_id']);
$table->dropColumn('lotacao_id');
$table->dropForeign(['ocupacao_id']);
$table->dropColumn(['ocupacao_id']);
$table->dropColumn('quantidade');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUsuarioIdBpaLaboratorialToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('usuario_id')->nullable()->after('quantidade')->constrained('cadastro_usuario');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropForeign(['usuario_id']);
$table->dropColumn('usuario_id');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUsuarioIdToTransportePacienteAcompanhanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->foreignId('usuario_id')->nullable()->after('id')->constrained('cadastro_paciente');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->dropForeign(['usuario_id']);
$table->dropColumn('usuario_id');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterQuantidadeDefaultOnTransportePacienteAgendar extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->unsignedSmallInteger('quantidade')->default(1)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->unsignedSmallInteger('quantidade')->change();
});
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropFieldsToTransportePacienteAcompanhanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->dropColumn('nome');
$table->dropColumn('cns');
$table->dropColumn('telefone');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->string('nome');
$table->string('cns')->nullable();
$table->string('telefone')->nullable();
});
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVeiculoEditedToTransportePacienteAgendarTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->foreignId('veiculo_edited_by')->nullable()->constrained('cadastro_usuario');
$table->timestamp('veiculo_edited_at')->nullable();
$table->integer('funcionalidade_origem')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_agendar_transporte', function (Blueprint $table) {
$table->dropConstrainedForeignId('veiculo_edited_by');
$table->dropColumn('veiculo_edited_at');
$table->dropColumn('funcionalidade_origem');
});
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCommonFieldsToTransportePacienteAcompanhanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->foreignId('created_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('updated_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('created_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
$table->foreignId('updated_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->dropForeign(['created_lotacao_id']);
$table->dropColumn(['created_lotacao_id']);
$table->dropForeign(['created_centro_custo_id']);
$table->dropColumn(['created_centro_custo_id']);
$table->dropForeign(['updated_lotacao_id']);
$table->dropColumn(['updated_lotacao_id']);
$table->dropForeign(['updated_centro_custo_id']);
$table->dropColumn(['updated_centro_custo_id']);
});
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCommonFieldsToTransportePacienteAcompanhanteRelacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_acompanhante_relacao', function (Blueprint $table) {
$table->foreignId('created_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('updated_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('created_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
$table->foreignId('updated_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_acompanhante_relacao', function (Blueprint $table) {
$table->dropForeign(['created_lotacao_id']);
$table->dropColumn(['created_lotacao_id']);
$table->dropForeign(['created_centro_custo_id']);
$table->dropColumn(['created_centro_custo_id']);
$table->dropForeign(['updated_lotacao_id']);
$table->dropColumn(['updated_lotacao_id']);
$table->dropForeign(['updated_centro_custo_id']);
$table->dropColumn(['updated_centro_custo_id']);
});
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteAgendarTransporteHistoricoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_agendar_transporte_historico', function (Blueprint $table) {
$table->id();
$table->foreignId('transporte_paciente_agendar_transporte_id')->constrained('transporte_paciente_agendar_transporte');
$table->date('data_saida');
$table->time('horario_saida')->nullable();
$table->foreignId('destino_id')->nullable()->constrained('transporte_paciente_destino');
$table->foreignId('veiculo_id')->nullable()->constrained('transporte_paciente_veiculo');
$table->tinyInteger('acompanhante')->nullable();
$table->foreignId('motivo_id')->constrained('transporte_paciente_motivo_viagem_procedimento');
$table->foreignId('status_id')->constrained('transporte_paciente_status');
$table->foreignId('lotacao_anterior_id')->constrained('cadastro_lotacao');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_agendar_transporte_historico');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTelefoneToTransportePacienteAcompanhanteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->string('telefone', 11)->after('nome')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_acompanhante', function (Blueprint $table) {
$table->dropColumn('telefone');
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteCondutor extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_condutor', function (Blueprint $table) {
$table->id();
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->string('numero_cnh', 11);
$table->foreignId('categoria_cnh_id')->constrained('cadastro_carteira_habilitacao_categoria');
$table->boolean('bloqueado');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_condutor');
}
}

View File

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

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddMatriculaToTransportePacienteCondutor extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_condutor', function (Blueprint $table) {
$table->string('matricula', 11)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_condutor', function (Blueprint $table) {
$table->dropColumn('matricula');
});
}
}

View File

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

View File

@@ -0,0 +1,77 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteDestino extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_destino', function (Blueprint $table) {
$table->id();
$table->string('descricao_destino', 100);
$table->string('numero_telefone_fax', 11)->nullable();
$table->string('numero_cnpj', 14)->nullable();
$table->string('numero_cpf', 11)->nullable();
$table->string('nome_logradouro', 50)->nullable();
$table->string('numero_logradouro', 5)->nullable();
$table->string('nome_complemento', 40)->nullable();
$table->string('nome_bairro', 30)->nullable();
$table->integer('numero_cep')->nullable();
$table->string('numero_telefone_comercial', 11)->nullable();
$table->string('observacao', 200)->nullable();
$table->boolean('bloqueado')->nullable();
$table->boolean('tipo_prestador')->nullable();
$table->integer('distancia')->nullable();
$table
->foreignId('destino_tipo_id')
->nullable()
->constrained('transporte_paciente_destino_tipo');
$table
->foreignId('cadastro_logradouro_tipo_id')
->nullable()
->constrained('cadastro_logradouro_tipo');
$table
->foreignId('documento_tipo_id')
->nullable()
->constrained('geral_documento_tipo');
$table
->foreignId('usuario_id')
->nullable()
->constrained('cadastro_usuario');
$table
->foreignId('estado_id')
->nullable()
->constrained('intranet.cadastro_estado');
$table
->foreignId('municipio_id')
->nullable()
->constrained('intranet.cadastro_municipio');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_destino');
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteFaturamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_faturamento', function (Blueprint $table) {
$table->id();
$table->foreignId('agendamento_id')->constrained('transporte_paciente_agendar_transporte');
$table->foreignId('bpa_procedimento_id')->nullable()->constrained('bpa_procedimento');
$table->foreignId('procedimento_id')->nullable()->constrained('sigtap.procedimento');
$table->foreignId('lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->unsignedSmallInteger('quantidade');
$table->foreignId('cid_principal_id')->nullable()->constrained('sigtap.cid');
$table->foreignId('cid_secundario_id')->nullable()->constrained('sigtap.cid');
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
$table->foreignId('motivo_id')->constrained('transporte_paciente_motivo_viagem_procedimento');
$table->foreignId('destino_id')->constrained('transporte_paciente_destino');
$table->unsignedSmallInteger('distancia')->nullable();
$table->foreignId('usuario_id')->nullable()->constrained('cadastro_usuario');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_faturamento');
}
}

View File

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

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteJornada extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_jornada', function (Blueprint $table) {
$table->id();
/**
* Informações da jornada
*/
$table->dateTime('data_inicial');
$table->dateTime('data_final');
/**
* FK's
*/
$table->foreignId('veiculo_id')->constrained('transporte_paciente_veiculo');
$table->foreignId('geral_dia_semana_id')->constrained('geral_dia_semana');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_jornada');
}
}

View File

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

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteMotivoViagemProcedimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_motivo_viagem_procedimento', function (Blueprint $table) {
$table->id();
$table->string('descricao', 100);
$table->foreignId('grupo_id')->constrained('transporte_paciente_grupo');
$table->foreignId('modulo_id')->nullable()->constrained('transporte_paciente_motivo_modulo');
$table->string('codigo_procedimento', 10);
$table->boolean('regulada')->nullable();
$table->boolean('bloqueado')->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_motivo_viagem_procedimento');
}
}

View File

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

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteParametrizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->id();
$table->integer('faltas')->nullable();
$table->integer('periodo')->nullable();
$table->boolean('lista_viagem_agendada')->nullable();
$table->boolean('horario_saida')->nullable();
$table->boolean('faturamento')->nullable();
$table->boolean('auxilio_alimentacao')->nullable();
$table->boolean('agendar_transporte_jornada')->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_parametrizacao');
}
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddColumnsToTransportePacienteParametrizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->boolean('campos_obrigatorios')->nullable();
$table->boolean('comprovante_acompanhante')->nullable();
$table->boolean('dados_acompanhante')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->dropColumn('campos_obrigatorios');
$table->dropColumn('comprovante_acompanhante');
$table->dropColumn('dados_acompanhante');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterCamposObrigatoriosOnTransportePacienteParametrizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->renameColumn('campos_obrigatorios', 'veiculo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_parametrizacao', function(Blueprint $table) {
$table->renameColumn('veiculo', 'campos_obrigatorios');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCampoLivreToTransportePacienteParametrizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->boolean('campo_livre')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->dropColumn('campo_livre');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddExibirObservacaoPacienteToTransportePacienteParametrizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->boolean('exibir_observacao_paciente')->default(true);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->dropColumn('exibir_observacao_paciente');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddExibirObservacaoTransporteToTransportePacienteParametrizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->boolean('exibir_observacao_transporte')->default(true);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_parametrizacao', function (Blueprint $table) {
$table->dropColumn('exibir_observacao_transporte');
});
}
}

View File

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

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacientePontoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_ponto', function (Blueprint $table) {
$table->id();
$table->string('descricao', 100);
$table->foreignId('logradouro_id')->constrained('cadastro_logradouro');
$table->unsignedInteger('numero')->nullable();
$table->boolean('bloqueado')->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_ponto');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterDescricaoNullableInTransportePacientePontoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_ponto', function (Blueprint $table) {
$table->string('descricao', 100)->nullable()->change();
$table->foreignId('logradouro_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_ponto', function (Blueprint $table) {
$table->string('descricao', 100)->change();
$table->foreignId('logradouro_id')->change();
});
}
}

View File

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

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacientePreAgendamentoTransporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_pre_agendamento_transporte', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->references('id')->on('cadastro_paciente');
$table->foreignId('motivo_id')->references('id')->on('transporte_paciente_motivo_viagem_procedimento');
$table->time('horario');
$table->date('data');
$table->foreignId('municipio_id')->references('id')->on('intranet.cadastro_municipio');
$table->foreignId('destino_id')->references('id')->on('transporte_paciente_destino');
$table->smallInteger('acompanhante');
$table->foreignId('ponto_id')->references('id')->on('transporte_paciente_ponto');
$table->string('observacao', 200)->nullable();
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_pre_agendamento_transporte');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddColumnsToPreAgendarTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_pre_agendamento_transporte', function (Blueprint $table) {
$table->date('data_saida')->nullable();
$table->time('horario_saida')->nullable();
$table->foreignId('veiculo_id')->nullable()->references('id')->on('transporte_paciente_veiculo');
$table->foreignId('jornada_id')->nullable()->references('id')->on('transporte_paciente_jornada');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_pre_agendamento_transporte', function (Blueprint $table) {
$table->dropColumn(['data_saida','horario_saida']);
$table->dropConstrainedForeignId('veiculo_id');
$table->dropConstrainedForeignId('jornada_id');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddColumnTipoPassageiroOnTranportePacientePreagendarTranporteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_pre_agendamento_transporte', function (Blueprint $table) {
$table->foreignId('tipo_passageiro_id')->nullable()->references('id')->on('transporte_paciente_veiculo_tipo_passageiro');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_pre_agendamento_transporte', function (Blueprint $table) {
$table->dropConstrainedForeignId('tipo_passageiro_id');
});
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,61 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransportePacienteVeiculo extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_veiculo', function (Blueprint $table) {
$table->id();
/**
* Identificação do veículo
*/
$table->string('numero_placa', 7);
$table->boolean('padrao_placa_mercosul');
$table->string('descricao_modelo', 56);
$table->integer('numero_capacidade')->default(0);
$table->integer('ano_fabricacao');
$table->string('numero_patrimonio', 10)->nullable();
$table->string('prefixo', 3)->nullable();
$table->string('kilometro_inicial', 11)->default(0);
$table->string('numero_renavam', 11);
$table->integer('numero_eixos')->default(0);
$table->string('numero_chassi', 17);
$table->date('data_aquisicao');
$table->string('numero_cnpj_proprietario', 14);
$table->string('nome_proprietario', 72);
$table->boolean('bloqueado');
$table->boolean('tipo_ambulancia');
/**
* FK's
*/
$table->foreignId('marca_id')->constrained('transporte_paciente_veiculo_marca');
$table->foreignId('tipo_id')->constrained('transporte_paciente_veiculo_tipo');
$table->foreignId('tipo_passageiro_id')->constrained('transporte_paciente_veiculo_tipo_passageiro');
$table->foreignId('cor_id')->constrained('transporte_paciente_veiculo_cor');
$table->foreignId('combustivel_id')->constrained('transporte_paciente_veiculo_combustivel');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_veiculo');
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterTransportePacienteVeiculoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_veiculo', function (Blueprint $table) {
$table->string('kilometro_inicial', 11)->default(0)->change();
$table->string('numero_renavam', 11)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateViagemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transporte_paciente_viagem', function (Blueprint $table) {
$table->id();
$table->foreignId('condutor_id')->nullable()->references('id')->on('transporte_paciente_condutor');
$table->foreignId('veiculo_id')->nullable()->references('id')->on('transporte_paciente_veiculo');
$table->date('data')->nullable();
$table->time('horario_saida_temp')->nullable();
$table->time('horario_saida_real')->nullable();
$table->time('horario_chegada_destino')->nullable();
$table->time('horario_saida_destino')->nullable();
$table->date('data_chegada')->nullable();
$table->time('horario_chegada')->nullable();
$table->string('km_saida', 6)->nullable();
$table->string('km_chegada', 6)->nullable();
$table->decimal('diaria')->nullable();
$table->decimal('refeicao')->nullable();
$table->decimal('pernoite')->nullable();
$table->decimal('pedagio')->nullable();
$table->decimal('combustivel')->nullable();
$table->decimal('outras_despesas')->nullable();
$table->string('descricao_outras_despesas', 200)->nullable();
$table->decimal('total_despesa')->nullable();
$table->foreignId('situacao_id')->default(1);
$table->foreignId('jornada_id')->nullable()->references('id')->on('transporte_paciente_jornada');
$table->foreignId('destino_id')->nullable()->references('id')->on('transporte_paciente_destino');
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transporte_paciente_viagem');
}
}

View File

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

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RenameTransportePacienteViagemColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_viagem', function(Blueprint $table) {
$table->renameColumn('situacao_id', 'status_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_viagem', function(Blueprint $table) {
$table->renameColumn('status_id', 'situacao_id');
});
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCommonFieldsToTransportePacienteViagemStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_viagem_status', function (Blueprint $table) {
$table->foreignId('created_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('updated_lotacao_id')->nullable()->constrained('cadastro_lotacao');
$table->foreignId('created_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
$table->foreignId('updated_centro_custo_id')->nullable()->constrained('cadastro_centro_custo');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_viagem_status', function (Blueprint $table) {
$table->dropForeign(['created_lotacao_id']);
$table->dropColumn(['created_lotacao_id']);
$table->dropForeign(['created_centro_custo_id']);
$table->dropColumn(['created_centro_custo_id']);
$table->dropForeign(['updated_lotacao_id']);
$table->dropColumn(['updated_lotacao_id']);
$table->dropForeign(['updated_centro_custo_id']);
$table->dropColumn(['updated_centro_custo_id']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProtocoloIntoTransportePacienteViagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transporte_paciente_viagem', function (Blueprint $table) {
$table->unsignedInteger('protocolo')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transporte_paciente_viagem', function (Blueprint $table) {
$table->dropColumn('protocolo');
});
}
}

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class AlterTransportePacienteViagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("UPDATE transporte_paciente_viagem SET protocolo = id WHERE status_id != 3;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("UPDATE transporte_paciente_viagem SET protocolo = NULL;");
}
}