This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoJornadaInfraestruturaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_jornada_infraestrutura', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->unique()->constrained('cadastro_infraestrutura');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_jornada_infraestrutura');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioJornadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('lotacao_id')->constrained('cadastro_lotacao');
|
||||
$table->date('data');
|
||||
$table->time('inicio');
|
||||
$table->time('fim');
|
||||
$table->unsignedInteger('quantidade_consulta');
|
||||
$table->unsignedInteger('tempo_consulta');
|
||||
$table->unsignedInteger('quantidade_retorno');
|
||||
$table->unsignedInteger('tempo_retorno');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioJornadaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTipoIdToAmbulatorioJornadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('tipo_id')->after('id')->constrained('ambulatorio_jornada_tipo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'tipo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioJornadaSituacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada_situacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('nome', 100)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada_situacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSituacaoIdToAmbulatorioJornadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('situacao_id')
|
||||
->nullable()
|
||||
->after('tempo_retorno')
|
||||
->constrained('ambulatorio_jornada_situacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'situacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class SetQuantidadeTempoToNullableOnAmbulatorioJornada extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('quantidade_consulta')->nullable()->change();
|
||||
$table->unsignedInteger('tempo_consulta')->nullable()->change();
|
||||
$table->unsignedInteger('quantidade_retorno')->nullable()->change();
|
||||
$table->unsignedInteger('tempo_retorno')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('quantidade_consulta')->nullable(false)->change();
|
||||
$table->unsignedInteger('tempo_consulta')->nullable(false)->change();
|
||||
$table->unsignedInteger('quantidade_retorno')->nullable(false)->change();
|
||||
$table->unsignedInteger('tempo_retorno')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioJornadaVagaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada_vaga_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada_vaga_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioJornadaVagaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada_vaga', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('jornada_id')->constrained('ambulatorio_jornada');
|
||||
$table->foreignId('tipo_id')->constrained('ambulatorio_jornada_vaga_tipo');
|
||||
$table->time('horario');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada_vaga');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAgendamentoStatusTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_agendamento_status', 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('ambulatorio_agendamento_status');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('jornada_vaga_id')->constrained('ambulatorio_jornada_vaga');
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('status_id')->constrained('ambulatorio_agendamento_status');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_agendamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAmbulatorioParametrizacaoJornadaInfraestruturaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_jornada_infraestrutura');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_jornada_infraestrutura', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->unique()->constrained('cadastro_infraestrutura');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->unique()->constrained('cadastro_infraestrutura');
|
||||
$table->boolean('envia_sms')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaSmsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura_sms', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parametrizacao_infraestrutura_id')
|
||||
->constrained('ambulatorio_parametrizacao_infraestrutura')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unsignedSmallInteger('dia_antecedencia');
|
||||
$table->date('envio_de')->nullable();
|
||||
$table->date('envio_ate')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura_sms');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaSmsEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura_sms_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('parametrizacao_infraestrutura_sms_id')
|
||||
->constrained('ambulatorio_parametrizacao_infraestrutura_sms')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
|
||||
$table->primary(['parametrizacao_infraestrutura_sms_id', 'especialidade_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura_sms_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddEspecialidadeIdOnAmbulatorioJornadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('especialidade_id')->after('lotacao_id')->constrained('cadastro_especialidade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'especialidade_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropJornadaVagaIdOnAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'jornada_vaga_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('jornada_vaga_id')->constrained('ambulatorio_jornada_vaga');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAmbulatorioJornadaVagaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada_vaga');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada_vaga', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('jornada_id')->constrained('ambulatorio_jornada');
|
||||
$table->foreignId('tipo_id')->constrained('ambulatorio_jornada_vaga_tipo');
|
||||
$table->time('horario');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAmbulatorioJornadaVagaTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_jornada_vaga_tipo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('ambulatorio_jornada_vaga_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAgendamentoTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_agendamento_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50)->unique();
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_agendamento_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddJornadaTipoHorarioToAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('jornada_id')->after('id')->constrained('ambulatorio_jornada');
|
||||
$table->foreignId('tipo_id')->after('jornada_id')->constrained('ambulatorio_agendamento_tipo');
|
||||
$table->time('horario')->after('tipo_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'jornada_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'tipo_id');
|
||||
|
||||
$table->dropColumn('horario');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAgendamentoAnteriorIdToAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('agendamento_anterior_id')
|
||||
->nullable()
|
||||
->after('id')
|
||||
->constrained('ambulatorio_agendamento');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'agendamento_anterior_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->boolean('avisa_paciente_desatualizado');
|
||||
$table->unsignedSmallInteger('avisa_paciente_desatualizado_dias')->nullable();
|
||||
$table->boolean('avisa_cns_provisorio');
|
||||
$table->boolean('avisa_paciente_outra_unidade');
|
||||
$table->boolean('avisa_falta');
|
||||
$table->unsignedSmallInteger('avisa_falta_quantidade')->nullable();
|
||||
$table->unsignedSmallInteger('avisa_falta_dias')->nullable();
|
||||
$table->boolean('bloqueia_paciente_temporario');
|
||||
$table->boolean('permite_somente_infraestrutura_logada');
|
||||
$table->boolean('obriga_motivo_agendamento_excedente');
|
||||
$table->unsignedSmallInteger('quantidade_dias_retorno')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_agendamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoBloqueioJornadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_bloqueio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->date('inicio');
|
||||
$table->date('fim');
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_bloqueio_jornada');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioSupervisorTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_supervisor', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
|
||||
$table->unique(['infraestrutura_id', 'usuario_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_supervisor');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSupervisorIdMotivoAgendamentoExcedenteToAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('usuario_supervisor_id')
|
||||
->nullable()
|
||||
->after('status_id')
|
||||
->constrained('cadastro_usuario');
|
||||
|
||||
$table->string('motivo_agendamento_excedente', 500)->nullable()->after('usuario_supervisor_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'usuario_supervisor_id');
|
||||
|
||||
$table->dropColumn('motivo_agendamento_excedente');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddMotivoCancelamentoToAmbulatorioAgendamento extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->string('motivo_cancelamento', 500)->nullable()->after('status_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('motivo_cancelamento');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropUsuarioSupervisorIdOnAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'usuario_supervisor_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('usuario_supervisor_id')
|
||||
->nullable()
|
||||
->constrained('cadastro_usuario');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddObservacaoToAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->string('observacao', 500)->nullable()->after('status_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('observacao');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAvisaPacienteDesatualizadoOnAmbulatorioParametrizacaoAgendamento extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['avisa_paciente_desatualizado', 'avisa_paciente_desatualizado_dias']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('avisa_paciente_desatualizado');
|
||||
$table->unsignedSmallInteger('avisa_paciente_desatualizado_dias')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSmsEnvioIdToAmbulatorioAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('sms_envio_id')->nullable()->after('motivo_agendamento_excedente')->constrained('sms_envio');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_agendamento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'sms_envio_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioServicoTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_servico_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_servico_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioServicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_servico', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->string('nome', 100);
|
||||
$table->foreignId('tipo_id')->nullable()->constrained('ambulatorio_servico_tipo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_servico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaServicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura_servico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('parametrizacao_infraestrutura_id')
|
||||
->constrained('ambulatorio_parametrizacao_infraestrutura')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('servico_id')->constrained('ambulatorio_servico');
|
||||
|
||||
$table->primary(['parametrizacao_infraestrutura_id', 'servico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura_servico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioDemandaEspontaneaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_demanda_espontanea', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
|
||||
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
|
||||
$table->foreignId('especialidade_id')->nullable()->constrained('cadastro_especialidade');
|
||||
$table->foreignId('usuario_id')->nullable()->constrained('cadastro_usuario');
|
||||
$table->date('data');
|
||||
$table->boolean('realizado')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_demanda_espontanea');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioChegadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_chegada', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('agendamento_id')->nullable()->unique()->constrained('ambulatorio_agendamento');
|
||||
$table->foreignId('demanda_espontanea_id')->nullable()->unique()->constrained('ambulatorio_demanda_espontanea');
|
||||
$table->time('horario');
|
||||
$table->foreignId('fila_id')->constrained('painel_senha_fila');
|
||||
$table->boolean('aguardou')->default(true);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_chegada');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioChegadaServicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_chegada_servico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('chegada_id')->constrained('ambulatorio_chegada')->onDelete('cascade');
|
||||
$table->foreignId('servico_id')->constrained('ambulatorio_servico');
|
||||
|
||||
$table->primary(['chegada_id', 'servico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_chegada_servico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('chegada_id')->constrained('ambulatorio_chegada');
|
||||
$table->boolean('finalizado')->default(false);
|
||||
$table->timestamp('finalizado_em')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioClassificacaoRiscoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_classificacao_risco', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
$table->string('cor', 9);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_classificacao_risco');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoPreAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_pre_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->constrained('ambulatorio_atendimento');
|
||||
$table->foreignId('ciap_id')->nullable()->constrained('geral_ciap');
|
||||
$table->string('motivo_atendimento')->nullable();
|
||||
$table->foreignId('classificacao_risco_id')->constrained('ambulatorio_classificacao_risco');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_pre_atendimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->constrained('ambulatorio_atendimento');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoAntropometriaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_antropometria', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->nullable()->constrained('ambulatorio_atendimento');
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->decimal('peso', 6, 3)->nullable();
|
||||
$table->decimal('altura', 4, 1)->nullable();
|
||||
$table->decimal('perimetro_cefalico', 4, 1)->nullable();
|
||||
$table->decimal('circunferencia_abdominal', 4, 1)->nullable();
|
||||
$table->decimal('perimetro_panturrilha', 3, 1)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_antropometria');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSinalVitalTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_sinal_vital', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->nullable()->constrained('ambulatorio_atendimento');
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->string('pressao_arterial', 7)->nullable();
|
||||
$table->unsignedSmallInteger('frequencia_respiratoria')->nullable();
|
||||
$table->unsignedSmallInteger('frequencia_cardiaca')->nullable();
|
||||
$table->decimal('temperatura', 3, 1)->nullable();
|
||||
$table->unsignedSmallInteger('saturacao_o2')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_sinal_vital');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioGlicemiaCapilarMomentoColetaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_glicemia_capilar_momento_coleta', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_glicemia_capilar_momento_coleta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoGlicemiaCapilarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_glicemia_capilar', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->nullable()->constrained('ambulatorio_atendimento');
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unsignedSmallInteger('valor');
|
||||
$table->foreignId('momento_coleta_id')->constrained('ambulatorio_glicemia_capilar_momento_coleta');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_glicemia_capilar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoProcedimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_procedimento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->nullable()->constrained('ambulatorio_atendimento');
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('procedimento_id')->constrained('sigtap.procedimento');
|
||||
$table->boolean('automatico')->default(false);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_procedimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RenameAmbulatorioParametrizacaoBloqueioJornadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("RENAME TABLE ambulatorio_parametrizacao_bloqueio_jornada to ambulatorio_jornada_bloqueio;");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::statement("RENAME TABLE ambulatorio_jornada_bloqueio to ambulatorio_parametrizacao_bloqueio_jornada;");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaEspecialidadeTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura_especialidade', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parametrizacao_infraestrutura_id')
|
||||
->constrained('ambulatorio_parametrizacao_infraestrutura')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('especialidade_id')->constrained('cadastro_especialidade');
|
||||
|
||||
$table->unsignedSmallInteger('avisa_falta_quantidade')->nullable();
|
||||
$table->unsignedSmallInteger('avisa_falta_dias')->nullable();
|
||||
$table->unsignedSmallInteger('quantidade_dias_retorno')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura_especialidade');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAvisoFaltaRetornoOnAmbulatorioParametrizacaoAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['avisa_falta', 'avisa_falta_quantidade', 'avisa_falta_dias', 'quantidade_dias_retorno']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('avisa_falta')->nullable();
|
||||
$table->unsignedSmallInteger('avisa_falta_quantidade')->nullable();
|
||||
$table->unsignedSmallInteger('avisa_falta_dias')->nullable();
|
||||
$table->unsignedSmallInteger('quantidade_dias_retorno')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPermiteAgendamentoSomenteSupervisorToAmbulatorioJornada extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('permite_agendamento_somente_supervisor')->default(false)->nullable()->after('situacao_id');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE ambulatorio_jornada SET permite_agendamento_somente_supervisor = 0");
|
||||
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('permite_agendamento_somente_supervisor')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_jornada', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('permite_agendamento_somente_supervisor');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaOcupacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura_ocupacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parametrizacao_infraestrutura_id')
|
||||
->constrained('ambulatorio_parametrizacao_infraestrutura')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura_ocupacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioParametrizacaoInfraestruturaAgendadoraTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_parametrizacao_infraestrutura_agendadora', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parametrizacao_infraestrutura_id')
|
||||
->constrained('ambulatorio_parametrizacao_infraestrutura')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('infraestrutura_id')->constrained('cadastro_infraestrutura');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_parametrizacao_infraestrutura_agendadora');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropPermiteSomenteInfraestruturaLogadaOnAmbulatorioParametrizacaoAgendamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('permite_somente_infraestrutura_logada');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_parametrizacao_agendamento', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('permite_somente_infraestrutura_logada')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ReorganizeMainFieldsOnAmbulatorioAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'chegada_id');
|
||||
|
||||
$table->dropColumn('finalizado');
|
||||
|
||||
$table->foreignId('fila_id')
|
||||
->unique()
|
||||
->after('id')
|
||||
->constrained('painel_senha_fila');
|
||||
|
||||
$table->foreignId('agendamento_id')
|
||||
->nullable()
|
||||
->unique()
|
||||
->after('fila_id')
|
||||
->constrained('ambulatorio_agendamento');
|
||||
|
||||
$table->foreignId('demanda_espontanea_id')
|
||||
->nullable()
|
||||
->unique()
|
||||
->after('agendamento_id')
|
||||
->constrained('ambulatorio_demanda_espontanea');
|
||||
|
||||
$table->foreignId('finalizado_lotacao_id')
|
||||
->nullable()
|
||||
->after('finalizado_em')
|
||||
->constrained('cadastro_lotacao');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('chegada_id')->nullable()->after('id')->constrained('ambulatorio_chegada');
|
||||
$table->boolean('finalizado')->nullable()->default(false)->after('chegada_id');
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'fila_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'agendamento_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'demanda_espontanea_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'finalizado_lotacao_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAmbulatorioChegadaServicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_chegada_servico');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('ambulatorio_chegada_servico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('chegada_id')->constrained('ambulatorio_chegada')->onDelete('cascade');
|
||||
$table->foreignId('servico_id')->constrained('ambulatorio_servico');
|
||||
|
||||
$table->primary(['chegada_id', 'servico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAmbulatorioChegadaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_chegada');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('ambulatorio_chegada', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('agendamento_id')->nullable()->unique()->constrained('ambulatorio_agendamento');
|
||||
$table->foreignId('demanda_espontanea_id')->nullable()->unique()->constrained('ambulatorio_demanda_espontanea');
|
||||
$table->time('horario');
|
||||
$table->foreignId('fila_id')->constrained('painel_senha_fila');
|
||||
$table->boolean('aguardou')->default(true);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoServicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_servico', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('atendimento_id')->constrained('ambulatorio_atendimento')->onDelete('cascade');
|
||||
$table->foreignId('servico_id')->constrained('ambulatorio_servico');
|
||||
|
||||
$table->primary(['atendimento_id', 'servico_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_servico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropRealizadoOnAmbulatorioDemandaEspontaneaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_demanda_espontanea', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('realizado');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_demanda_espontanea', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('realizado')->nullable()->default(false)->after('data');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoDeclaracaoComparecimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_declaracao_comparecimento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('atendimento_id')->constrained('ambulatorio_atendimento');
|
||||
$table->string('nome_acompanhante', 150)->nullable();
|
||||
$table->foreignId('turno_id')->nullable()->constrained('geral_turno');
|
||||
$table->time('entrada')->nullable();
|
||||
$table->time('saida')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_declaracao_comparecimento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPacienteLiberadoToAmbulatorioAtendimentoPreAtendimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_pre_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('paciente_liberado')->nullable()->after('classificacao_risco_id');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE ambulatorio_atendimento_pre_atendimento SET paciente_liberado = 0;");
|
||||
|
||||
Schema::table('ambulatorio_atendimento_pre_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('paciente_liberado')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_pre_atendimento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('paciente_liberado');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddPreAtendimentoIdToAmbulatorioAtendimentoDeclaracaoComparecimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_declaracao_comparecimento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('pre_atendimento_id')
|
||||
->nullable()
|
||||
->after('atendimento_id')
|
||||
->constrained('ambulatorio_atendimento_pre_atendimento')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_declaracao_comparecimento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'pre_atendimento_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioProblemaCondicaoSituacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_problema_condicao_situacao', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_problema_condicao_situacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtestadoModeloTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atestado_modelo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atestado_modelo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioCasoSuspeitoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_caso_suspeito', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 100);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_caso_suspeito');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddInitialFieldsToAmbulatorioAtendimentoSoapTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->text('subjetivo_descricao')->nullable();
|
||||
$table->text('objetivo_descricao')->nullable();
|
||||
$table->date('dum')->nullable();
|
||||
$table->boolean('vacinacao_em_dia')->nullable();
|
||||
$table->text('avaliacao_descricao')->nullable();
|
||||
$table->text('plano_descricao')->nullable();
|
||||
|
||||
$table->foreignId('atendimento_tipo_id')
|
||||
->nullable()
|
||||
->before('created_at')
|
||||
->constrained('ambulatorio_atendimento_tipo');
|
||||
|
||||
$table->foreignId('atendimento_compartilhado_usuario_id')
|
||||
->nullable()
|
||||
->before('created_at')
|
||||
->constrained('cadastro_usuario');
|
||||
|
||||
$table->boolean('paciente_liberado')->nullable()->before('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'subjetivo_descricao',
|
||||
'objetivo_descricao',
|
||||
'dum',
|
||||
'vacinacao_em_dia',
|
||||
'avaliacao_descricao',
|
||||
'plano_descricao',
|
||||
'paciente_liberado',
|
||||
]);
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'atendimento_tipo_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'atendimento_compartilhado_usuario_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapMotivoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_motivo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('ciap_id')->constrained('geral_ciap');
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_motivo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToAmbulatorioAtendimentoAntropometriaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_antropometria', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')
|
||||
->nullable()
|
||||
->after('pre_atendimento_id')
|
||||
->constrained('ambulatorio_atendimento_soap')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_antropometria', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToAmbulatorioAtendimentoSinalVitalTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_sinal_vital', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')
|
||||
->nullable()
|
||||
->after('pre_atendimento_id')
|
||||
->constrained('ambulatorio_atendimento_soap')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_sinal_vital', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToAmbulatorioAtendimentoGlicemiaCapilarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_glicemia_capilar', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')
|
||||
->nullable()
|
||||
->after('pre_atendimento_id')
|
||||
->constrained('ambulatorio_atendimento_soap')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_glicemia_capilar', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapProblemaCondicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_problema_condicao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('ciap_id')->nullable()->constrained('geral_ciap');
|
||||
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
|
||||
$table->foreignId('situacao_id')->nullable()->constrained('ambulatorio_problema_condicao_situacao');
|
||||
$table->date('inicio')->nullable();
|
||||
$table->date('fim')->nullable();
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
$table->foreignId('problema_condicao_anterior_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_atendimento_soap_problema_condicao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_problema_condicao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapIntervencaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_intervencao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('ciap_id')->constrained('geral_ciap');
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_intervencao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapProcedimentoClinicoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_procedimento_clinico', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('atendimento_procedimento_id')->constrained('ambulatorio_atendimento_procedimento')->onDelete('cascade');
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_procedimento_clinico');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapProcedimentoAdministrativoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_procedimento_administrativo', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('atendimento_procedimento_id')->constrained('ambulatorio_atendimento_procedimento')->onDelete('cascade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_procedimento_administrativo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapCasoSuspeitoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_caso_suspeito', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('caso_suspeito_id')->constrained('ambulatorio_caso_suspeito');
|
||||
|
||||
$table->primary(['soap_id', 'caso_suspeito_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_caso_suspeito');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToAmbulatorioAtendimentoDeclaracaoComparecimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_declaracao_comparecimento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')
|
||||
->nullable()
|
||||
->after('pre_atendimento_id')
|
||||
->constrained('ambulatorio_atendimento_soap')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_declaracao_comparecimento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSoapIdToAmbulatorioAtendimentoProcedimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_procedimento', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')
|
||||
->nullable()
|
||||
->after('pre_atendimento_id')
|
||||
->constrained('ambulatorio_atendimento_soap')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_procedimento', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'soap_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapAtestadoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_atestado', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('modelo_id')->constrained('ambulatorio_atestado_modelo');
|
||||
$table->text('descricao')->nullable();
|
||||
$table->foreignId('documento_tipo_id')->nullable()->constrained('geral_documento_tipo');
|
||||
$table->string('cpf', 11)->nullable();
|
||||
$table->string('cns', 15)->nullable();
|
||||
$table->date('data')->nullable();
|
||||
$table->time('horario')->nullable();
|
||||
$table->unsignedSmallInteger('dias')->nullable();
|
||||
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_atestado');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapOrientacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_orientacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->text('descricao');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_orientacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapPrescricaoMedicamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_prescricao_medicamento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_prescricao_medicamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapPrescricaoMedicamentoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_prescricao_medicamento_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('prescricao_medicamento_id')
|
||||
->constrained('ambulatorio_atendimento_soap_prescricao_medicamento')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->text('descricao')->nullable();
|
||||
$table->foreignId('material_id')->nullable()->constrained('cadastro_material');
|
||||
$table->string('dose', 50)->nullable();
|
||||
$table->unsignedTinyInteger('frequencia_vezes')->nullable();
|
||||
$table->foreignId('turno_id')->nullable()->constrained('geral_turno');
|
||||
$table->unsignedTinyInteger('intervalo')->nullable();
|
||||
$table->foreignId('intervalo_medida_tempo_id')->nullable()->constrained('geral_medida_tempo');
|
||||
$table->date('inicio')->nullable();
|
||||
$table->unsignedSmallInteger('duracao')->nullable();
|
||||
$table->foreignId('duracao_medida_tempo_id')->nullable()->constrained('geral_medida_tempo');
|
||||
$table->string('recomendacoes', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_prescricao_medicamento_item');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapAntecedenteTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_antecedente', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->text('descricao')->nullable();
|
||||
$table->unsignedTinyInteger('gestas_previas')->nullable();
|
||||
$table->unsignedTinyInteger('abortos')->nullable();
|
||||
$table->boolean('desfecho_gestacao_aconteceu_menos_um_ano')->nullable();
|
||||
$table->unsignedTinyInteger('partos_realizados')->nullable();
|
||||
$table->unsignedTinyInteger('partos_vaginais')->nullable();
|
||||
$table->unsignedTinyInteger('partos_cesareas')->nullable();
|
||||
$table->unsignedTinyInteger('partos_domiciliares')->nullable();
|
||||
$table->unsignedTinyInteger('nascidos_vivos')->nullable();
|
||||
$table->unsignedTinyInteger('nascidos_mortos')->nullable();
|
||||
$table->unsignedTinyInteger('recem_nascidos_com_menos2500_gramas')->nullable();
|
||||
$table->unsignedTinyInteger('recem_nascidos_com_mais4500_gramas')->nullable();
|
||||
$table->unsignedTinyInteger('nascidos_vivos_vivem')->nullable();
|
||||
$table->unsignedTinyInteger('nascidos_vivos_mortos_primeira_semana')->nullable();
|
||||
$table->unsignedTinyInteger('nascidos_vivos_mortos_depois_primeira_semana')->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_antecedente');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapAntecedenteProblemaCondicaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_antecedente_problema_condicao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('antecedente_id')->constrained('ambulatorio_atendimento_soap_antecedente')->onDelete('cascade');
|
||||
$table->foreignId('ciap_id')->nullable()->constrained('geral_ciap');
|
||||
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
|
||||
$table->foreignId('situacao_id')->constrained('ambulatorio_problema_condicao_situacao');
|
||||
$table->date('inicio')->nullable();
|
||||
$table->date('fim')->nullable();
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_antecedente_problema_condicao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapAntecedenteCirurgiaInternacaoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_antecedente_cirurgia_internacao', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('antecedente_id')->constrained('ambulatorio_atendimento_soap_antecedente')->onDelete('cascade');
|
||||
$table->string('descricao', 100);
|
||||
$table->date('realizada_em')->nullable();
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_antecedente_cirurgia_internacao');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapAntecedenteProblemaFamiliarTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_antecedente_problema_familiar', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('antecedente_id')->constrained('ambulatorio_atendimento_soap_antecedente')->onDelete('cascade');
|
||||
$table->foreignId('ciap_id')->constrained('geral_ciap');
|
||||
$table->string('observacao', 500)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_antecedente_problema_familiar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAndAddInitialFieldsOnAmbulatorioAtendimentoSoapTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'subjetivo_descricao',
|
||||
'objetivo_descricao',
|
||||
'dum',
|
||||
'vacinacao_em_dia',
|
||||
'avaliacao_descricao',
|
||||
'plano_descricao',
|
||||
'paciente_liberado',
|
||||
]);
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'atendimento_tipo_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'atendimento_compartilhado_usuario_id');
|
||||
});
|
||||
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->text('subjetivo_descricao')->nullable()->after('atendimento_id');
|
||||
$table->text('objetivo_descricao')->nullable()->after('subjetivo_descricao');
|
||||
$table->date('dum')->nullable()->after('objetivo_descricao');
|
||||
$table->boolean('vacinacao_em_dia')->nullable()->after('dum');
|
||||
$table->text('avaliacao_descricao')->nullable()->after('vacinacao_em_dia');
|
||||
$table->text('plano_descricao')->nullable()->after('avaliacao_descricao');
|
||||
|
||||
$table->foreignId('atendimento_tipo_id')
|
||||
->nullable()
|
||||
->after('plano_descricao')
|
||||
->constrained('ambulatorio_atendimento_tipo');
|
||||
|
||||
$table->foreignId('atendimento_compartilhado_usuario_id')
|
||||
->nullable()
|
||||
->after('atendimento_tipo_id')
|
||||
->constrained('cadastro_usuario');
|
||||
|
||||
$table->boolean('paciente_liberado')->nullable()->after('atendimento_compartilhado_usuario_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'subjetivo_descricao',
|
||||
'objetivo_descricao',
|
||||
'dum',
|
||||
'vacinacao_em_dia',
|
||||
'avaliacao_descricao',
|
||||
'plano_descricao',
|
||||
'paciente_liberado',
|
||||
]);
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'atendimento_tipo_id');
|
||||
MigrationUtil::dropColumnWithForeign($table, 'atendimento_compartilhado_usuario_id');
|
||||
});
|
||||
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->text('subjetivo_descricao')->nullable();
|
||||
$table->text('objetivo_descricao')->nullable();
|
||||
$table->date('dum')->nullable();
|
||||
$table->boolean('vacinacao_em_dia')->nullable();
|
||||
$table->text('avaliacao_descricao')->nullable();
|
||||
$table->text('plano_descricao')->nullable();
|
||||
|
||||
$table->foreignId('atendimento_tipo_id')
|
||||
->nullable()
|
||||
->before('created_at')
|
||||
->constrained('ambulatorio_atendimento_tipo');
|
||||
|
||||
$table->foreignId('atendimento_compartilhado_usuario_id')
|
||||
->nullable()
|
||||
->before('created_at')
|
||||
->constrained('cadastro_usuario');
|
||||
|
||||
$table->boolean('paciente_liberado')->nullable()->before('created_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRacionalidadeSaudeIdToAmbulatorioAtendimentoSoapTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('racionalidade_saude_id')
|
||||
->nullable()
|
||||
->after('atendimento_compartilhado_usuario_id')
|
||||
->constrained('atencao_basica_cadastro_racionalidade_saude');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::dropColumnWithForeign($table, 'racionalidade_saude_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapCondutaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_conduta', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('conduta_id')->constrained('atencao_basica_cadastro_conduta');
|
||||
|
||||
$table->primary(['soap_id', 'conduta_id']);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_conduta');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapEncaminhamentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_encaminhamento', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('tipo_id')->constrained('atencao_basica_cadastro_encaminhamento');
|
||||
|
||||
$table->foreignId('servico_especializado_especialidade_id')
|
||||
->nullable()
|
||||
->constrained('cadastro_especialidade');
|
||||
|
||||
$table->string('servico_especializado_complemento', 100)->nullable();
|
||||
|
||||
$table->foreignId('servico_especializado_cid_id')
|
||||
->nullable()
|
||||
->constrained('sigtap.cid');
|
||||
|
||||
$table->foreignId('servico_especializado_classificacao_risco_id')
|
||||
->nullable()
|
||||
->constrained('ambulatorio_classificacao_risco');
|
||||
|
||||
$table->text('servico_especializado_motivo')->nullable();
|
||||
$table->string('servico_especializado_observacao', 500)->nullable();
|
||||
|
||||
$table->foreignId('intersetorial_infraestrutura_id')
|
||||
->nullable()
|
||||
->constrained('cadastro_infraestrutura');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_encaminhamento');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapAlergiaTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_alergia', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('alergia_id')->constrained('cadastro_alergia');
|
||||
$table->foreignId('criticidade_id')->constrained('cadastro_alergia_criticidade');
|
||||
$table->string('reacoes_observacoes', 100)->nullable();
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_alergia');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioSoapResultadoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_soap_resultado_exame', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->date('solicitado_em')->nullable();
|
||||
$table->date('realizado_em');
|
||||
$table->date('resultado_em')->nullable();
|
||||
$table->text('resultado');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_soap_resultado_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddQuantidadeToAmbulatorioAtendimentoProcedimentoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_procedimento', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('quantidade')->nullable()->after('procedimento_id');
|
||||
});
|
||||
|
||||
DB::statement("UPDATE ambulatorio_atendimento_procedimento SET quantidade = 1;");
|
||||
|
||||
Schema::table('ambulatorio_atendimento_procedimento', function (Blueprint $table) {
|
||||
|
||||
$table->unsignedInteger('quantidade')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_procedimento', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn('quantidade');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DropAmbulatorioSoapResultadoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_soap_resultado_exame');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('ambulatorio_soap_resultado_exame', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->date('solicitado_em')->nullable();
|
||||
$table->date('realizado_em');
|
||||
$table->date('resultado_em')->nullable();
|
||||
$table->text('resultado');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapResultadoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_resultado_exame', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
$table->date('solicitado_em')->nullable();
|
||||
$table->date('realizado_em');
|
||||
$table->date('resultado_em')->nullable();
|
||||
$table->text('resultado');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_resultado_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoEspecificoTipoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_especifico_tipo', function (Blueprint $table) {
|
||||
|
||||
MigrationUtil::idWithoutIncrements($table);
|
||||
|
||||
$table->string('nome', 50);
|
||||
|
||||
MigrationUtil::addCommonFields($table, ['staticData' => true]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_especifico_tipo');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAtendimentoEspecificoTipoIdToAmbulatorioAtendimentoSoapTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->foreignId('atendimento_especifico_tipo_id')
|
||||
->nullable()
|
||||
->after('plano_descricao')
|
||||
->constrained('ambulatorio_atendimento_especifico_tipo');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap', function (Blueprint $table) {
|
||||
|
||||
$table->dropConstrainedForeignId('atendimento_especifico_tipo_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIsDoseUnicaIsUsoContinuoOnAmbulatorioAtendimentoSoapPrescricaoMedicamentoItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap_prescricao_medicamento_item', function (Blueprint $table) {
|
||||
|
||||
$table->boolean('is_dose_unica')->after('dose');
|
||||
$table->boolean('is_uso_continuo')->after('is_dose_unica');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ambulatorio_atendimento_soap_prescricao_medicamento_item', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn(['is_dose_unica', 'is_uso_continuo']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapCompartilhamentoCuidadoTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_compartilhamento_cuidado', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('especialidade_id')->nullable()->constrained('cadastro_especialidade');
|
||||
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
|
||||
$table->foreignId('ciap_id')->nullable()->constrained('geral_ciap');
|
||||
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
|
||||
$table->foreignId('classificacao_risco_id')->constrained('ambulatorio_classificacao_risco');
|
||||
$table->string('discussao_caso_clinico', 500);
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_compartilhamento_cuidado');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapSolicitacaoExameTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_solicitacao_exame', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
$table->foreignId('soap_id')->constrained('ambulatorio_atendimento_soap')->onDelete('cascade');
|
||||
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
|
||||
$table->string('justificativa', 500)->nullable();
|
||||
$table->string('observacao', 500)->nullable();
|
||||
$table->boolean('alto_custo');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_solicitacao_exame');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAmbulatorioAtendimentoSoapSolicitacaoExameItemTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ambulatorio_atendimento_soap_solicitacao_exame_item', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('solicitacao_exame_id')
|
||||
->constrained('ambulatorio_atendimento_soap_solicitacao_exame_item')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('exame_id')->constrained('parametrizacao_exame');
|
||||
|
||||
MigrationUtil::addCommonFields($table);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ambulatorio_atendimento_soap_solicitacao_exame_item');
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user