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

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

View File

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

View File

@@ -0,0 +1,214 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class CreateProntoAtendimentoAtendimentoViewTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("
CREATE VIEW pronto_atendimento_atendimento_view AS
SELECT pronto_atendimento_faa.id AS 'FAA',
DATE_FORMAT(pronto_atendimento_faa.created_at, '%d/%m/%Y %H:%i') AS data_atendimento,
cadastro_paciente.prontuario,
cadastro_cidadao.nome,
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 2
LIMIT 1
), 'NÃO') AS 'Diabético',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 4
LIMIT 1
), 'NÃO') AS 'Hipertenso',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 1
LIMIT 1
), 'NÃO') AS 'Câncer',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 3
LIMIT 1
), 'NÃO') AS 'Etilismo',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 11
LIMIT 1
), 'NÃO') AS 'Gestante',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 5
LIMIT 1
), 'NÃO') AS 'Obesidade',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 10
LIMIT 1
), 'NÃO') AS 'Outro',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 6
LIMIT 1
), 'NÃO') AS 'Perfil sanguíneo alterado',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 7
LIMIT 1
), 'NÃO') AS 'Radioterapia',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 8
LIMIT 1
), 'NÃO') AS 'Tabagismo',
COALESCE(
(
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 9
LIMIT 1
),
'NÃO'
) AS 'Uso de medicamentos antineoplásicos ou imunossupressores',
cadastro_unidade.nome_fantasia AS 'Unidade',
CASE WHEN cadastro_infraestrutura.principal THEN cadastro_unidade.nome_fantasia ELSE cadastro_infraestrutura.nome END AS 'Local de atendimento',
cadastro_unidade_paciente.nome_fantasia AS 'Unidade de origem do paciente',
cadastro_paciente_classificacao.descricao AS 'Classificação do paciente',
DECODE_ORACLE(pronto_atendimento_faa.finalizado, 0, 'Aberto', 1, 'Finalizado', '') AS 'Status do atendimento',
pronto_atendimento_faa_desfecho.nome AS 'Desfecho do atendimento',
COALESCE(
(
SELECT ocupacao.nome
FROM sigtap.ocupacao
INNER JOIN cadastro_lotacao
ON cadastro_lotacao.ocupacao_id = ocupacao.id
INNER JOIN pronto_atendimento_atendimento_medico
ON pronto_atendimento_atendimento_medico.created_lotacao_id = cadastro_lotacao.id
WHERE pronto_atendimento_atendimento_medico.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_medico.created_at
LIMIT 1
),
(
SELECT ocupacao.nome
FROM sigtap.ocupacao
JOIN cadastro_lotacao
ON cadastro_lotacao.ocupacao_id = ocupacao.id
WHERE cadastro_lotacao.id = pronto_atendimento_faa.lotacao_id
)
) AS 'CBO',
(
SELECT GROUP_CONCAT(cid.nome SEPARATOR ',')
FROM sigtap.cid
INNER JOIN (
SELECT pronto_atendimento_atendimento_cid.cid_id,
pronto_atendimento_atendimento_cid.atendimento_id
FROM pronto_atendimento_atendimento_cid
UNION
SELECT pronto_atendimento_atendimento_procedimento.cid_principal_id as cid_id,
pronto_atendimento_atendimento_procedimento.atendimento_id
FROM pronto_atendimento_atendimento_procedimento
WHERE pronto_atendimento_atendimento_procedimento.is_parametrizado = 1
) x
WHERE x.cid_id = cid.id
AND x.atendimento_id = pronto_atendimento_atendimento.id
) AS 'CIDs do atendimento',
procedimento.nome AS 'Procedimento',
(
SELECT pronto_atendimento_classificacao_risco.nome
FROM pronto_atendimento_atendimento_classificacao_risco
INNER JOIN pronto_atendimento_classificacao_risco
ON pronto_atendimento_classificacao_risco.id = pronto_atendimento_atendimento_classificacao_risco.classificacao_risco_id
WHERE pronto_atendimento_atendimento_classificacao_risco.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_classificacao_risco.created_at DESC
LIMIT 1
) AS 'Classificação de risco'
FROM pronto_atendimento_faa
INNER JOIN pronto_atendimento_atendimento
ON pronto_atendimento_atendimento.faa_id = pronto_atendimento_faa.id
INNER JOIN cadastro_paciente
ON cadastro_paciente.id = pronto_atendimento_faa.paciente_id
INNER JOIN cadastro_cidadao
ON cadastro_cidadao.id = cadastro_paciente.cidadao_id
INNER JOIN cadastro_centro_custo
ON cadastro_centro_custo.id = pronto_atendimento_faa.created_centro_custo_id
INNER JOIN cadastro_infraestrutura
ON cadastro_infraestrutura.id = cadastro_centro_custo.infraestrutura_id
INNER JOIN cadastro_unidade
ON cadastro_unidade.id = cadastro_infraestrutura.unidade_id
INNER JOIN cadastro_paciente_classificacao
ON cadastro_paciente_classificacao.id = cadastro_paciente.classificacao_id
LEFT JOIN pronto_atendimento_atendimento_gestacao
ON pronto_atendimento_atendimento_gestacao.atendimento_id = pronto_atendimento_atendimento.id
LEFT JOIN cadastro_unidade AS cadastro_unidade_paciente
ON cadastro_unidade_paciente.id = cadastro_paciente.unidade_id
LEFT JOIN pronto_atendimento_faa_desfecho
ON pronto_atendimento_faa_desfecho.id = pronto_atendimento_faa.desfecho_id
LEFT JOIN pronto_atendimento_atendimento_procedimento
ON pronto_atendimento_atendimento_procedimento.atendimento_id = pronto_atendimento_atendimento.id
LEFT JOIN sigtap.procedimento
ON procedimento.id = pronto_atendimento_atendimento_procedimento.procedimento_id
");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("DROP VIEW pronto_atendimento_atendimento_view");
}
}

View File

@@ -0,0 +1,245 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class AlterProntoAtendimentoAtendimentoViewTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("
CREATE OR REPLACE VIEW pronto_atendimento_atendimento_view AS
SELECT pronto_atendimento_faa.id AS 'FAA',
DATE_FORMAT(pronto_atendimento_faa.created_at, '%d/%m/%Y %H:%i') AS data_atendimento,
cadastro_paciente.prontuario,
cadastro_cidadao.nome,
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 2
LIMIT 1
), 'NÃO') AS 'Diabético',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 4
LIMIT 1
), 'NÃO') AS 'Hipertenso',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 1
LIMIT 1
), 'NÃO') AS 'Câncer',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 3
LIMIT 1
), 'NÃO') AS 'Etilismo',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 11
LIMIT 1
), 'NÃO') AS 'Gestante',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 5
LIMIT 1
), 'NÃO') AS 'Obesidade',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 10
LIMIT 1
), 'NÃO') AS 'Outro',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 6
LIMIT 1
), 'NÃO') AS 'Perfil sanguíneo alterado',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 7
LIMIT 1
), 'NÃO') AS 'Radioterapia',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 8
LIMIT 1
), 'NÃO') AS 'Tabagismo',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 9
LIMIT 1
), 'NÃO') AS 'Uso de medicamentos antineoplásicos ou imunossupressores',
cadastro_unidade.nome_fantasia AS 'Unidade',
CASE WHEN cadastro_infraestrutura.principal THEN cadastro_unidade.nome_fantasia ELSE cadastro_infraestrutura.nome END AS 'Local de atendimento',
cadastro_unidade_paciente.nome_fantasia AS 'Unidade de origem do paciente',
cadastro_paciente_classificacao.descricao AS 'Classificação do paciente',
DECODE_ORACLE(pronto_atendimento_faa.finalizado, 0, 'Aberto', 1, 'Finalizado', '') AS 'Status do atendimento',
pronto_atendimento_faa_desfecho.nome AS 'Desfecho do atendimento',
COALESCE(
(
SELECT ocupacao.nome
FROM sigtap.ocupacao
INNER JOIN cadastro_lotacao
ON cadastro_lotacao.ocupacao_id = ocupacao.id
INNER JOIN pronto_atendimento_atendimento_medico
ON pronto_atendimento_atendimento_medico.created_lotacao_id = cadastro_lotacao.id
WHERE pronto_atendimento_atendimento_medico.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_medico.created_at
LIMIT 1
),
(
SELECT ocupacao.nome
FROM sigtap.ocupacao
JOIN cadastro_lotacao
ON cadastro_lotacao.ocupacao_id = ocupacao.id
WHERE cadastro_lotacao.id = pronto_atendimento_faa.lotacao_id
)
) AS 'CBO',
(
SELECT GROUP_CONCAT(cid.nome SEPARATOR ',')
FROM sigtap.cid
INNER JOIN (
SELECT pronto_atendimento_atendimento_cid.cid_id,
pronto_atendimento_atendimento_cid.atendimento_id
FROM pronto_atendimento_atendimento_cid
UNION
SELECT pronto_atendimento_atendimento_procedimento.cid_principal_id as cid_id,
pronto_atendimento_atendimento_procedimento.atendimento_id
FROM pronto_atendimento_atendimento_procedimento
WHERE pronto_atendimento_atendimento_procedimento.is_parametrizado = 1
) x
WHERE x.cid_id = cid.id
AND x.atendimento_id = pronto_atendimento_atendimento.id
) AS 'CIDs do atendimento',
procedimento.nome AS 'Procedimento',
(
SELECT pronto_atendimento_classificacao_risco.nome
FROM pronto_atendimento_atendimento_classificacao_risco
INNER JOIN pronto_atendimento_classificacao_risco
ON pronto_atendimento_classificacao_risco.id = pronto_atendimento_atendimento_classificacao_risco.classificacao_risco_id
WHERE pronto_atendimento_atendimento_classificacao_risco.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_classificacao_risco.created_at DESC
LIMIT 1
) AS 'Classificação de risco',
COALESCE(
(
SELECT cadastro_cidadao.nome
FROM pronto_atendimento_atendimento_medico
INNER JOIN cadastro_lotacao
ON cadastro_lotacao.id = pronto_atendimento_atendimento_medico.created_lotacao_id
INNER JOIN cadastro_usuario
ON cadastro_usuario.id = cadastro_lotacao.usuario_id
INNER JOIN cadastro_cidadao
ON cadastro_usuario.id = cadastro_usuario.cidadao_id
ORDER BY pronto_atendimento_atendimento_medico.created_at
LIMIT 1
),
(
SELECT cadastro_cidadao.nome
FROM pronto_atendimento_faa
INNER JOIN cadastro_lotacao
ON cadastro_lotacao.id = pronto_atendimento_faa.lotacao_id
INNER JOIN cadastro_usuario
ON cadastro_usuario.id = cadastro_lotacao.usuario_id
INNER JOIN cadastro_cidadao
ON cadastro_usuario.id = cadastro_usuario.cidadao_id
)
) AS 'Profissional',
cadastro_sexo.descricao AS 'Sexo',
TIMESTAMPDIFF(YEAR, cadastro_cidadao.data_nascimento, NOW()) AS 'Idade',
DAYNAME(pronto_atendimento_faa.created_at) AS 'Dia da semana',
CASE WHEN procedimento.codigo LIKE '02%' THEN
'EXAM'
ELSE
'PROC'
END AS 'Tipo de procedimento'
FROM pronto_atendimento_faa
INNER JOIN pronto_atendimento_atendimento
ON pronto_atendimento_atendimento.faa_id = pronto_atendimento_faa.id
INNER JOIN cadastro_paciente
ON cadastro_paciente.id = pronto_atendimento_faa.paciente_id
INNER JOIN cadastro_cidadao
ON cadastro_cidadao.id = cadastro_paciente.cidadao_id
INNER JOIN cadastro_sexo
ON cadastro_sexo.id = cadastro_cidadao.sexo_id
INNER JOIN cadastro_centro_custo
ON cadastro_centro_custo.id = pronto_atendimento_faa.created_centro_custo_id
INNER JOIN cadastro_infraestrutura
ON cadastro_infraestrutura.id = cadastro_centro_custo.infraestrutura_id
INNER JOIN cadastro_unidade
ON cadastro_unidade.id = cadastro_infraestrutura.unidade_id
LEFT JOIN cadastro_paciente_classificacao
ON cadastro_paciente_classificacao.id = cadastro_paciente.classificacao_id
LEFT JOIN pronto_atendimento_atendimento_gestacao
ON pronto_atendimento_atendimento_gestacao.atendimento_id = pronto_atendimento_atendimento.id
LEFT JOIN cadastro_unidade AS cadastro_unidade_paciente
ON cadastro_unidade_paciente.id = cadastro_paciente.unidade_id
LEFT JOIN pronto_atendimento_faa_desfecho
ON pronto_atendimento_faa_desfecho.id = pronto_atendimento_faa.desfecho_id
LEFT JOIN pronto_atendimento_atendimento_procedimento
ON pronto_atendimento_atendimento_procedimento.atendimento_id = pronto_atendimento_atendimento.id
LEFT JOIN sigtap.procedimento
ON procedimento.id = pronto_atendimento_atendimento_procedimento.procedimento_id
");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("DROP VIEW pronto_atendimento_atendimento_view");
}
}

View File

@@ -0,0 +1,256 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class AlterUmProntoAtendimentoAtendimentoViewTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("
CREATE OR REPLACE VIEW pronto_atendimento_atendimento_view AS
SELECT pronto_atendimento_faa.id AS 'FAA',
DATE_FORMAT(pronto_atendimento_faa.created_at, '%d/%m/%Y %H:%i') AS data_atendimento,
cadastro_paciente.prontuario,
cadastro_cidadao.nome,
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 2
LIMIT 1
), 'NÃO') AS 'Diabético',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 4
LIMIT 1
), 'NÃO') AS 'Hipertenso',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 1
LIMIT 1
), 'NÃO') AS 'Câncer',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 3
LIMIT 1
), 'NÃO') AS 'Etilismo',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 11
LIMIT 1
), 'NÃO') AS 'Gestante',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 5
LIMIT 1
), 'NÃO') AS 'Obesidade',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 10
LIMIT 1
), 'NÃO') AS 'Outro',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 6
LIMIT 1
), 'NÃO') AS 'Perfil sanguíneo alterado',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 7
LIMIT 1
), 'NÃO') AS 'Radioterapia',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 8
LIMIT 1
), 'NÃO') AS 'Tabagismo',
COALESCE((
SELECT 'SIM'
FROM cadastro_cidadao_fator_risco
INNER JOIN cadastro_fator_risco
ON cadastro_fator_risco.id = cadastro_cidadao_fator_risco.fator_risco_id
WHERE cadastro_cidadao_fator_risco.cidadao_id = pronto_atendimento_faa.paciente_id
AND cadastro_fator_risco.id = 9
LIMIT 1
), 'NÃO') AS 'Uso de medicamentos antineoplásicos ou imunossupressores',
cadastro_unidade.nome_fantasia AS 'Unidade',
CASE WHEN cadastro_infraestrutura.principal THEN cadastro_unidade.nome_fantasia ELSE cadastro_infraestrutura.nome END AS 'Local de atendimento',
cadastro_unidade_paciente.nome_fantasia AS 'Unidade de origem do paciente',
cadastro_paciente_classificacao.descricao AS 'Classificação do paciente',
DECODE_ORACLE(pronto_atendimento_faa.finalizado, 0, 'Aberto', 1, 'Finalizado', '') AS 'Status do atendimento',
pronto_atendimento_faa_desfecho.nome AS 'Desfecho do atendimento',
COALESCE(
(
SELECT ocupacao.nome
FROM sigtap.ocupacao
INNER JOIN cadastro_lotacao
ON cadastro_lotacao.ocupacao_id = ocupacao.id
INNER JOIN pronto_atendimento_atendimento_medico
ON pronto_atendimento_atendimento_medico.created_lotacao_id = cadastro_lotacao.id
WHERE pronto_atendimento_atendimento_medico.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_medico.created_at
LIMIT 1
),
(
SELECT ocupacao.nome
FROM sigtap.ocupacao
JOIN cadastro_lotacao
ON cadastro_lotacao.ocupacao_id = ocupacao.id
WHERE cadastro_lotacao.id = pronto_atendimento_faa.lotacao_id
)
) AS 'CBO',
(
SELECT GROUP_CONCAT(cid.nome SEPARATOR ',')
FROM sigtap.cid
INNER JOIN (
SELECT pronto_atendimento_atendimento_cid.cid_id,
pronto_atendimento_atendimento_cid.atendimento_id
FROM pronto_atendimento_atendimento_cid
UNION
SELECT pronto_atendimento_atendimento_procedimento.cid_principal_id as cid_id,
pronto_atendimento_atendimento_procedimento.atendimento_id
FROM pronto_atendimento_atendimento_procedimento
WHERE pronto_atendimento_atendimento_procedimento.is_parametrizado = 1
) x
WHERE x.cid_id = cid.id
AND x.atendimento_id = pronto_atendimento_atendimento.id
) AS 'CIDs do atendimento',
procedimento.nome AS 'Procedimento',
(
SELECT pronto_atendimento_classificacao_risco.nome
FROM pronto_atendimento_atendimento_classificacao_risco
INNER JOIN pronto_atendimento_classificacao_risco
ON pronto_atendimento_classificacao_risco.id = pronto_atendimento_atendimento_classificacao_risco.classificacao_risco_id
WHERE pronto_atendimento_atendimento_classificacao_risco.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_classificacao_risco.created_at DESC
LIMIT 1
) AS 'Classificação de risco',
COALESCE(
(
SELECT cadastro_cidadao.nome
FROM pronto_atendimento_atendimento_medico
INNER JOIN cadastro_lotacao
ON cadastro_lotacao.id = pronto_atendimento_atendimento_medico.created_lotacao_id
INNER JOIN cadastro_usuario
ON cadastro_usuario.id = cadastro_lotacao.usuario_id
INNER JOIN cadastro_cidadao
ON cadastro_cidadao.id = cadastro_usuario.cidadao_id
WHERE pronto_atendimento_atendimento_medico.atendimento_id = pronto_atendimento_atendimento.id
ORDER BY pronto_atendimento_atendimento_medico.created_at
LIMIT 1
),
(
SELECT cadastro_cidadao.nome
FROM cadastro_lotacao
INNER JOIN cadastro_usuario
ON cadastro_usuario.id = cadastro_lotacao.usuario_id
INNER JOIN cadastro_cidadao
ON cadastro_cidadao.id = cadastro_usuario.cidadao_id
WHERE cadastro_lotacao.id = pronto_atendimento_faa.lotacao_id
)
) AS 'Profissional',
cadastro_sexo.descricao AS 'Sexo',
TIMESTAMPDIFF(YEAR, cadastro_cidadao.data_nascimento, NOW()) AS 'Idade',
DAYNAME(pronto_atendimento_faa.created_at) AS 'Dia da semana',
CASE WHEN procedimento.codigo LIKE '02%' THEN
'EXAM'
ELSE
'PROC'
END AS 'Tipo de procedimento',
(
SELECT cadastro_bairro.nome
FROM cadastro_domicilio
INNER JOIN cadastro_endereco
ON cadastro_endereco.id = cadastro_domicilio.endereco_id
INNER JOIN cadastro_logradouro
ON cadastro_logradouro.id = cadastro_endereco.logradouro_id
INNER JOIN cadastro_bairro
ON cadastro_bairro.id = cadastro_logradouro.bairro_id
WHERE cadastro_domicilio.id = cadastro_cidadao.domicilio_id
) AS 'Bairro'
FROM pronto_atendimento_faa
INNER JOIN pronto_atendimento_atendimento
ON pronto_atendimento_atendimento.faa_id = pronto_atendimento_faa.id
INNER JOIN cadastro_paciente
ON cadastro_paciente.id = pronto_atendimento_faa.paciente_id
INNER JOIN cadastro_cidadao
ON cadastro_cidadao.id = cadastro_paciente.cidadao_id
INNER JOIN cadastro_sexo
ON cadastro_sexo.id = cadastro_cidadao.sexo_id
INNER JOIN cadastro_centro_custo
ON cadastro_centro_custo.id = pronto_atendimento_faa.created_centro_custo_id
INNER JOIN cadastro_infraestrutura
ON cadastro_infraestrutura.id = cadastro_centro_custo.infraestrutura_id
INNER JOIN cadastro_unidade
ON cadastro_unidade.id = cadastro_infraestrutura.unidade_id
LEFT JOIN cadastro_paciente_classificacao
ON cadastro_paciente_classificacao.id = cadastro_paciente.classificacao_id
LEFT JOIN pronto_atendimento_atendimento_gestacao
ON pronto_atendimento_atendimento_gestacao.atendimento_id = pronto_atendimento_atendimento.id
LEFT JOIN cadastro_unidade AS cadastro_unidade_paciente
ON cadastro_unidade_paciente.id = cadastro_paciente.unidade_id
LEFT JOIN pronto_atendimento_faa_desfecho
ON pronto_atendimento_faa_desfecho.id = pronto_atendimento_faa.desfecho_id
LEFT JOIN pronto_atendimento_atendimento_procedimento
ON pronto_atendimento_atendimento_procedimento.atendimento_id = pronto_atendimento_atendimento.id
LEFT JOIN sigtap.procedimento
ON procedimento.id = pronto_atendimento_atendimento_procedimento.procedimento_id
");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement("DROP VIEW pronto_atendimento_atendimento_view");
}
}

View File

@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class CreateTransferirDirectoryInProntoAtendimento extends Migration
{
public function up()
{
$cliente = app('config')->get('database.default');
DB::table('pronto_atendimento_pedido_exame_laudo')
->select(['id', 'pedido_exame_id', 'hash'])
->orderBy('pedido_exame_id')
->chunk(1000, function ($laudos) use ($cliente) {
foreach ($laudos as $laudo) {
$pedidoId = $laudo->pedido_exame_id;
$hash = $laudo->hash;
$pastaAntiga = storage_path("pronto-atendimento/laudos/{$pedidoId}");
$arquivoAntigo = $pastaAntiga . '/' . $hash;
if (!File::exists($arquivoAntigo)) {
continue;
}
$pastaNova = storage_path("pronto-atendimento/laudos/{$cliente}/{$pedidoId}");
if (!File::exists($pastaNova)) {
File::makeDirectory($pastaNova, 0775, true);
}
$arquivoNovo = $pastaNova . '/' . $hash;
File::move($arquivoAntigo, $arquivoNovo);
if (File::exists($pastaAntiga) && count(File::files($pastaAntiga)) === 0) {
File::deleteDirectory($pastaAntiga);
}
}
});
}
public function down()
{
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AddNumeroToProntoAtendimentoFaaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_faa', function (Blueprint $table) {
$table->integer('numero')->nullable()->after('id');
});
DB::table('pronto_atendimento_faa')->update(['numero' => DB::raw('id')]);
DB::statement("ALTER TABLE pronto_atendimento_faa MODIFY numero INT NOT NULL");
Schema::table('pronto_atendimento_faa', function (Blueprint $table) {
$table->unique('numero');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_faa', function (Blueprint $table) {
$table->dropColumn('numero');
});
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAihClinicaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_aih_clinica', 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('pronto_atendimento_aih_clinica');
}
}

View File

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

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAihCausaExternaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_aih_causa_externa', 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('pronto_atendimento_aih_causa_externa');
}
}

View File

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

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAihInternacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_aih_internacao', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
$table->foreignId('unidade_solicitante_id')->constrained('cadastro_unidade');
$table->foreignId('unidade_internacao_id')->constrained('cadastro_unidade');
$table->foreignId('cid_principal_id')->constrained('sigtap.cid');
$table->foreignId('cid_secundario_id')->nullable()->constrained('sigtap.cid');
$table->foreignId('cid_causas_associadas_id')->nullable()->constrained('sigtap.cid');
$table->foreignId('faa_id')->nullable()->constrained('pronto_atendimento_faa');
$table->string('principais_sinais_sintomas_clinicos', 1000);
$table->string('condicoes_que_justificam_internacao', 1000);
$table->string('principais_resultados_de_provas_diagnosticas', 1000);
$table->boolean('finalizada');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_aih_internacao');
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAihInternacaoProcedimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_aih_internacao_procedimento', function (Blueprint $table) {
$table->id();
$table->foreignId('internacao_id')->constrained('pronto_atendimento_aih_internacao');
$table->foreignId('procedimento_solicitado_id')->constrained('sigtap.procedimento');
$table->date('data_solicitacao');
$table->foreignId('clinica_id')->constrained('pronto_atendimento_aih_clinica');
$table->foreignId('carater_internacao_id')->constrained('pronto_atendimento_aih_carater_internacao');
$table->foreignId('profissional_solicitante_assistente_id')->constrained('cadastro_usuario');
$table->foreignId('documento_tipo_id')->constrained('geral_documento_tipo');
$table->string('documento_numero', 15);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_aih_internacao_procedimento');
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAihInternacaoCausaExternaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_aih_internacao_causa_externa', function (Blueprint $table) {
$table->id();
$table->foreignId('internacao_id')->constrained('pronto_atendimento_aih_internacao');
$table->foreignId('causa_externa_id')->nullable()->constrained('pronto_atendimento_aih_causa_externa');
$table->string('cnpj_seguradora', 14)->nullable();
$table->string('numero_bilhete', 10)->nullable();
$table->string('serie', 6)->nullable();
$table->string('cnpj_empresa', 14)->nullable();
$table->string('cnae_empresa', 10)->nullable();
$table->string('cbor', 3)->nullable();
$table->foreignId('vinculo_previdencia_id')->nullable()->constrained('pronto_atendimento_aih_vinculo_previdencia');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_aih_internacao_causa_externa');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAihInternacaoAutorizacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_aih_internacao_autorizacao', function (Blueprint $table) {
$table->id();
$table->foreignId('internacao_id')->constrained('pronto_atendimento_aih_internacao');
$table->foreignId('profissional_autorizador_id')->constrained('cadastro_usuario');
$table->foreignId('documento_tipo_id')->nullable()->constrained('geral_documento_tipo');
$table->string('documento_numero', 15)->nullable();
$table->date('data_autorizacao')->nullable();
$table->string('codigo_orgao_emissor', 6)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_aih_internacao_autorizacao');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAssistenciaSocialTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_assistencia_social', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->date('data_anotacao');
$table->string('anotacao', 1500);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_assistencia_social');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAssistenciaSocialHistoricoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_assistencia_social_historico', function (Blueprint $table) {
$table->id();
$table->foreignId('assistencia_id')->constrained('pronto_atendimento_assistencia_social');
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->string('anotacao', 1500);
MigrationUtil::addCommonFields($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_assistencia_social_historico');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoFaaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_faa', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_id')->constrained('cadastro_paciente');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_faa');
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoRaatTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_raat', function (Blueprint $table) {
$table->id();
$table->foreignId('faa_id')->constrained('pronto_atendimento_faa');
$table->string('empresa_nome', 150);
$table->string('empresa_ramo_atividade', 150)->nullable();
$table->string('empresa_endereco', 150)->nullable();
$table->string('empresa_telefone', 11)->nullable();
$table->date('acidente_data');
$table->time('acidente_hora')->nullable();
$table->foreignId('acidente_tipo_id')->nullable()->constrained('pronto_atendimento_raat_tipo_acidente');
$table->string('acidente_local', 150)->nullable();
$table->string('acidente_descricao', 250);
$table->foreignId('regime_trabalho_id')->nullable()->constrained('pronto_atendimento_raat_regime_trabalho');
$table->string('regime_trabalho_outro', 50)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_raat');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento', function (Blueprint $table) {
$table->id();
$table->foreignId('faa_id')->constrained('pronto_atendimento_faa');
$table->foreignId('fila_id')->constrained('painel_senha_fila');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medico', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->boolean('simples');
$table->string('evolucao', 500)->nullable();
$table->string('queixa_principal_duracao', 300)->nullable();
$table->string('historia', 300)->nullable();
$table->string('exame_fisico', 300)->nullable();
$table->string('diagnostico', 300)->nullable();
$table->string('conduta', 300)->nullable();
$table->string('atendimento_geral', 500)->nullable();
$table->string('orientacoes', 150)->nullable();
$table->boolean('solicitou_reavaliacao')->nullable();
$table->string('observacoes_enfermagem', 500)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medico');
}
}

View File

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

View File

@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoRecepcaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_recepcao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
// Não deveria ser nullable, mas se não for, o Laravel está adicionando automanticamente
// "current_timestamp() ON UPDATE current_timestamp()" como default.
$table->timestamp('atendido_em')->nullable();
$table->boolean('urgente')->nullable();
$table->string('urgente_motivo', 100)->nullable();
$table->foreignId('origem_entrada_id')->nullable()->constrained('pronto_atendimento_origem_entrada');
$table->string('medico_samu', 150)->nullable();
$table->string('motivo_atendimento', 3000)->nullable();
$table->string('acompanhante', 150)->nullable();
$table->foreignId('unidade_encaminhamento_id')->nullable()->constrained('cadastro_unidade');
$table->string('medico_solicitante_encaminhamento', 150)->nullable();
$table->foreignId('unidade_externa_encaminhamento_id')->nullable()->constrained('cadastro_unidade_externa');
$table->foreignId('servico_id')->constrained('cadastro_servico');
$table->foreignId('ocupacao_id')->nullable()->constrained('sigtap.ocupacao');
$table->string('observacao', 500)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_recepcao');
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoRaatParecerMedicoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_raat_parecer_medico', function (Blueprint $table) {
$table->id();
$table->foreignId('raat_id')->constrained('pronto_atendimento_raat')->onDelete('cascade');
$table->foreignId('atendimento_medico_id')->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('agente_id')->constrained('pronto_atendimento_raat_agente');
$table->string('parte_corpo_atingida_outras', 150)->nullable();
$table->string('causa_acidente_outras', 150)->nullable();
$table->string('diagnostico_outros', 150)->nullable();
$table->string('observacao', 150)->nullable();
$table->foreignId('classificacao_inicial_id')->constrained('pronto_atendimento_raat_classificacao_inicial');
$table->boolean('afastado')->default(false);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_raat_parecer_medico');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoRaatParecerMedicoParteCorpoAtingidaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_raat_parecer_medico_parte_corpo_atingida', function (Blueprint $table) {
$table
->foreignId('parecer_medico_id')
->constrained('pronto_atendimento_raat_parecer_medico')
->onDelete('cascade');
$table->foreignId('parte_corpo_atingida_id');
$table->foreign('parte_corpo_atingida_id', 'pro_ate_raa_par_med_par_cor_ati_par_cor_ati_id_foreign')
->references('id')
->on('pronto_atendimento_raat_parte_corpo_atingida');
MigrationUtil::addCommonFields($table, ['foreignNames' => [
'created_centro_custo_id' => 'pro_ate_raa_par_med_par_cor_ati_cre_cen_cus_id_foreign',
'updated_centro_custo_id' => 'pro_ate_raa_par_med_par_cor_ati_upd_cen_cus_id_foreign',
]]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_raat_parecer_medico_parte_corpo_atingida');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoRaatParecerMedicoCausaAcidenteTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_raat_parecer_medico_causa_acidente', function (Blueprint $table) {
$table
->foreignId('parecer_medico_id')
->constrained('pronto_atendimento_raat_parecer_medico')
->onDelete('cascade');
$table->foreignId('causa_acidente_id');
$table->foreign('causa_acidente_id', 'pro_ate_raa_par_med_cau_aci_cau_aci_id_foreign')
->references('id')
->on('pronto_atendimento_raat_causa_acidente');
MigrationUtil::addCommonFields($table, ['foreignNames' => [
'created_centro_custo_id' => 'pro_ate_raa_par_med_cau_aci_cre_cen_cus_id_foreign',
'updated_centro_custo_id' => 'pro_ate_raa_par_med_cau_aci_upd_cen_cus_id_foreign',
]]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_raat_parecer_medico_causa_acidente');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoRaatParecerMedicoDiagnosticoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_raat_parecer_medico_diagnostico', function (Blueprint $table) {
$table
->foreignId('parecer_medico_id')
->constrained('pronto_atendimento_raat_parecer_medico')
->onDelete('cascade');
$table->foreignId('diagnostico_id');
$table->foreign('diagnostico_id', 'pro_ate_raa_par_med_dia_dia_id_foreign')
->references('id')
->on('pronto_atendimento_raat_diagnostico');
MigrationUtil::addCommonFields($table, ['foreignNames' => [
'created_centro_custo_id' => 'pro_ate_raa_par_med_dia_cre_cen_cus_id_foreign',
'updated_centro_custo_id' => 'pro_ate_raa_par_med_dia_upd_cen_cus_id_foreign',
]]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_raat_parecer_medico_diagnostico');
}
}

View File

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

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicoAtestadoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medico_atestado', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->constrained('pronto_atendimento_atendimento_medico');
$table->boolean('imprime_cid');
$table->unsignedSmallInteger('dias')->nullable();
$table->foreignId('documento_tipo_id')->constrained('geral_documento_tipo');
$table->string('documento_numero', 16);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medico_atestado');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicoEncaminhamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medico_encaminhamento', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->constrained('pronto_atendimento_atendimento_medico');
$table->boolean('urgente');
$table->foreignId('ocupacao_id')->constrained('sigtap.ocupacao');
$table->string('motivo', 300);
$table->string('observacoes', 300)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medico_encaminhamento');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicoReceitaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medico_receita', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->constrained('pronto_atendimento_atendimento_medico');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medico_receita');
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicoReceitaMedicamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medico_receita_medicamento', function (Blueprint $table) {
$table->id();
$table
->foreignId('receita_id')
->constrained('pronto_atendimento_atendimento_medico_receita')
->onDelete('cascade');
$table->foreignId('medicamento_id')->constrained('cadastro_medicamento');
$table->string('via_administracao_outras', 100)->nullable();
$table->unsignedSmallInteger('quantidade');
$table->unsignedTinyInteger('intervalo_tempo')->nullable();
$table->foreignId('intervalo_medida_tempo_id')->nullable()->constrained('geral_medida_tempo');
$table->foreignId('turno_id')->nullable()->constrained('geral_turno');
$table->unsignedTinyInteger('durante_tempo')->nullable();
$table->foreignId('durante_medida_tempo_id')->nullable()->constrained('geral_medida_tempo');
$table->string('recomendacoes', 250)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medico_receita_medicamento');
}
}

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicoDeclaracaoComparecimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medico_declaracao_comparecimento', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('tipo_id')->constrained('pronto_atendimento_declaracao_comparecimento_tipo');
$table->string('nome', 255)->nullable();
$table->foreignId('documento_tipo_id')->constrained('geral_documento_tipo');
$table->string('documento_numero', 16);
// Não deveria ser nullable, mas se não for, o Laravel está adicionando automanticamente
// "current_timestamp() ON UPDATE current_timestamp()" como default.
$table->timestamp('de')->nullable();
// Não deveria ser nullable, mas se não for, o Laravel está adicionando automanticamente
// "'0000-00-00 00:00:00'" como default.
$table->timestamp('ate')->nullable();
$table->string('motivo', 50);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medico_declaracao_comparecimento');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoCidTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_cid', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('cid_id')->constrained('sigtap.cid');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_cid');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoProcedimentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_procedimento', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('procedimento_id')->constrained('sigtap.procedimento');
$table->foreignId('cid_principal_id')->nullable()->constrained('sigtap.cid');
$table->foreignId('cid_secundario_id')->nullable()->constrained('sigtap.cid');
$table->unsignedSmallInteger('quantidade');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_procedimento');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoClassificacaoRiscoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_classificacao_risco', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('classificacao_risco_id')->constrained('pronto_atendimento_classificacao_risco');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_classificacao_risco');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoGestacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_gestacao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->boolean('gestante')->default(false);
$table->date('dum')->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_gestacao');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoMedicamentoUsoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_medicamento_uso', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('atendimento_enfermagem_id')->nullable()->constrained('pronto_atendimento_atendimento_enfermagem');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_medicamento_uso');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoSinalVitalTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_sinal_vital', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->decimal('pa', 6, 3)->nullable();
$table->foreignId('pa_unidade_medida_id')->nullable()->constrained('cadastro_unidade_medida');
$table->unsignedSmallInteger('glicemia')->nullable();
$table->decimal('temperatura', 3, 1)->nullable();
$table->unsignedSmallInteger('pulso')->nullable();
$table->unsignedTinyInteger('respiracao')->nullable();
$table->unsignedTinyInteger('saturacao')->nullable();
$table->unsignedTinyInteger('intensidade_dor')->nullable();
$table->unsignedSmallInteger('cintura')->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_sinal_vital');
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoAvaliacaoAntropometricaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_avaliacao_antropometrica', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->decimal('massa', 8, 2)->nullable();
$table->foreignId('massa_unidade_medida_id')->nullable()->constrained('cadastro_unidade_medida');
$table->foreignId('altura_tipo_medida_id')->nullable()->constrained('geral_tipo_medida_altura');
$table->decimal('altura', 5, 2)->nullable();
$table->foreignId('altura_unidade_medida_id')->nullable()->constrained('cadastro_unidade_medida');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_avaliacao_antropometrica');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoObservacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_observacao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_observacao');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoTriagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_triagem', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->text('historico_individual_familiar', 3000)->nullable();
$table->text('outras_avaliacoes_condicoes', 3000)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_triagem');
}
}

View File

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

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateServicoEnfermagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_servico_enfermagem', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('procedimento_id')->nullable()->constrained('sigtap.procedimento');
$table->string('observacoes', 100)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_servico_enfermagem');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoPrescricaoInternaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_prescricao_interna', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->nullable()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('via_administracao_id')->constrained('cadastro_via_administracao');
$table->unsignedSmallInteger('frequencia_quantidade_vezes')->nullable();
$table->unsignedTinyInteger('frequencia_tempo')->nullable();
$table->foreignId('frequencia_medida_tempo_id')->nullable()->constrained('geral_medida_tempo');
$table->string('observacoes', 250)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_prescricao_interna');
}
}

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoPrescricaoInternaMedicamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_prescricao_interna_medicamento', function (Blueprint $table) {
$table->id();
$table->foreignId('prescricao_interna_id')
->constrained('pronto_atendimento_atendimento_prescricao_interna')
->onDelete('cascade');
$table->foreignId('medicamento_id')->constrained('cadastro_medicamento');
$table->unsignedTinyInteger('quantidade');
$table->string('administracao', 50)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
$table->unique(['prescricao_interna_id', 'medicamento_id', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_prescricao_interna_medicamento');
}
}

View File

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

View File

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

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEncaminhamentoHospitalarTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_encaminhamento_hospitalar', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_medico_id')->unique()->constrained('pronto_atendimento_atendimento_medico');
$table->foreignId('usuario_id')->constrained('cadastro_usuario');
$table->foreignId('unidade_id')->nullable()->constrained('cadastro_unidade');
$table->string('unidade_nome', 100)->nullable();
$table->string('quarto', 3)->nullable();
$table->string('leito', 3)->nullable();
$table->foreignId('cid_id')->nullable()->constrained('sigtap.cid');
$table->string('medico_hospitalar', 150)->nullable();
$table->string('observacoes', 3000)->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_encaminhamento_hospitalar');
}
}

View File

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

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->text('planejamento')->nullable();
$table->text('avaliacao')->nullable();
$table->text('diagnostico')->nullable();
$table->text('implementacao')->nullable();
$table->text('historico')->nullable();
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemAnotacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem_anotacao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_enfermagem_id')->constrained('pronto_atendimento_atendimento_enfermagem');
$table->datetime('anotado_em');
$table->text('descricao');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem_anotacao');
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoPrescricaoInternaAplicacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_prescricao_interna_aplicacao', function (Blueprint $table) {
$table->id();
$table->foreignId('prescricao_interna_medicamento_id')->constrained('pronto_atendimento_atendimento_prescricao_interna_medicamento');
$table->foreignId('status_id')->constrained('cadastro_exame_status');
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_prescricao_interna_aplicacao');
}
}

View File

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

View File

@@ -0,0 +1,38 @@
<?php
use App\Enums\Parametrizacao\Exame\Status;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddStatusIdIntoProntoAtendimentoAtendimentoServicoEnfermagem extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_atendimento_servico_enfermagem', function (Blueprint $table) {
$table->foreignId('status_id')
->after('observacoes')->default(Status::SOLICITADO)
->constrained('cadastro_exame_status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_atendimento_servico_enfermagem', function (Blueprint $table) {
$table->dropForeign(['status_id']);
$table->dropColumn(['status_id']);
});
}
}

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoHistoriaEnfermagemTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_historia_enfermagem', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_triagem_id')->nullable()->constrained('pronto_atendimento_atendimento_triagem');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_historia_enfermagem');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemHistoricoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem_historico', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_enfermagem_id')->nullable()->constrained('pronto_atendimento_atendimento_enfermagem');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem_historico');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemDiagnosticoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem_diagnostico', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_enfermagem_id')->nullable()->constrained('pronto_atendimento_atendimento_enfermagem');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem_diagnostico');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemPlanejamentoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem_planejamento', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_enfermagem_id')->nullable()->constrained('pronto_atendimento_atendimento_enfermagem');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem_planejamento');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemImplementacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem_implementacao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_enfermagem_id')->nullable()->constrained('pronto_atendimento_atendimento_enfermagem');
$table->string('descricao', 3000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem_implementacao');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoAtendimentoEnfermagemAvaliacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_atendimento_enfermagem_avaliacao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->foreignId('atendimento_enfermagem_id')->nullable()->constrained('pronto_atendimento_atendimento_enfermagem');
$table->string('descricao', 6000);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_atendimento_enfermagem_avaliacao');
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropFieldsFromProntoAtendimentoAtendimentoEnfermagem extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_atendimento_enfermagem', function (Blueprint $table) {
$table->dropColumn([
'planejamento',
'avaliacao',
'diagnostico',
'implementacao',
'historico',
]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_atendimento_enfermagem', function (Blueprint $table) {
$table->text('planejamento')->nullable();
$table->text('avaliacao')->nullable();
$table->text('diagnostico')->nullable();
$table->text('implementacao')->nullable();
$table->text('historico')->nullable();
});
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoPacienteObservacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_paciente_observacao', function (Blueprint $table) {
$table->id();
$table->foreignId('atendimento_id')->constrained('pronto_atendimento_atendimento');
$table->string('quarto', 5)->nullable();
$table->string('leito', 5)->nullable();
$table->boolean('aguardando_vaga_hospitalar')->default(false);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_paciente_observacao');
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoPacienteTraumaStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_paciente_trauma_status', 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('pronto_atendimento_paciente_trauma_status');
}
}

View File

@@ -0,0 +1,152 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFieldsIntoProntoAtendimentoPacienteObservacaoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_paciente_observacao', function (Blueprint $table) {
$table->string('observacao', 3000)->nullable()->after('aguardando_vaga_hospitalar');
$table->string('avaliacao_mmss_mmii', 3000)->nullable()->after('aguardando_vaga_hospitalar');
$table->string('avaliacao_abdome', 3000)->nullable()->after('aguardando_vaga_hospitalar');
$table->string('avaliacao_torax', 3000)->nullable()->after('aguardando_vaga_hospitalar');
$table->string('avaliacao_cabeca_pescoco', 3000)->nullable()->after('aguardando_vaga_hospitalar');
$table->foreignId('exposicao_hipotermia_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->string('exposicao_hipotermia_observacao', 100)
->nullable()
->after('exposicao_hipotermia_trauma_status_id');
$table->foreignId('plegia_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->foreignId('paresias_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->foreignId('pupilas_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->foreignId('sangramento_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->string('sangramento_local', 100)
->nullable()
->after('sangramento_trauma_status_id');
$table->foreignId('perfuracao_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->string('perfuracao_lentificada', 100)
->nullable()
->after('perfuracao_trauma_status_id');
$table->foreignId('pele_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->string('pele_alteracao', 100)
->nullable()
->after('pele_trauma_status_id');
$table->foreignId('pulso_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->foreignId('oxigenacao_respiracao_ventilacao_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->foreignId('vias_aerias_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->string('vias_aerias_obstrucao_por', 100)
->nullable()
->after('vias_aerias_trauma_status_id');
$table->foreignId('hemorragia_externa_grave_trauma_status_id')
->nullable()
->after('aguardando_vaga_hospitalar')
->constrained('pronto_atendimento_paciente_trauma_status');
$table->string('hemorragia_externa_grave_local', 100)
->nullable()
->after('hemorragia_externa_grave_trauma_status_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_paciente_observacao', function (Blueprint $table) {
$table->dropForeign(['hemorragia_externa_grave_trauma_status_id']);
$table->dropForeign(['vias_aerias_trauma_status_id']);
$table->dropForeign(['oxigenacao_respiracao_ventilacao_trauma_status_id']);
$table->dropForeign(['pulso_trauma_status_id']);
$table->dropForeign(['pele_trauma_status_id']);
$table->dropForeign(['perfuracao_trauma_status_id']);
$table->dropForeign(['sangramento_trauma_status_id']);
$table->dropForeign(['pupilas_trauma_status_id']);
$table->dropForeign(['paresias_trauma_status_id']);
$table->dropForeign(['plegia_trauma_status_id']);
$table->dropForeign(['exposicao_hipotermia_trauma_status_id']);
$table->dropColumn([
'hemorragia_externa_grave_trauma_status_id',
'hemorragia_externa_grave_local',
'vias_aerias_trauma_status_id',
'vias_aerias_obstrucao_por',
'oxigenacao_respiracao_ventilacao_trauma_status_id',
'pulso_trauma_status_id',
'pele_trauma_status_id',
'pele_alteracao',
'perfuracao_trauma_status_id',
'perfuracao_lentificada',
'sangramento_trauma_status_id',
'sangramento_local',
'pupilas_trauma_status_id',
'paresias_trauma_status_id',
'plegia_trauma_status_id',
'exposicao_hipotermia_trauma_status_id',
'exposicao_hipotermia_observacao',
'avaliacao_cabeca_pescoco',
'avaliacao_torax',
'avaliacao_abdome',
'avaliacao_mmss_mmii',
'observacao',
]);
});
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddPacienteObservacaoIdIntoProntoAtendimentoAtendimentoEnfermagemAnotacao extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_atendimento_enfermagem_anotacao', function (Blueprint $table) {
$table->foreignId('atendimento_enfermagem_id')
->nullable()
->change();
$table->foreignId('paciente_observacao_id')
->nullable()
->after('atendimento_enfermagem_id')
->constrained('pronto_atendimento_paciente_observacao');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_atendimento_enfermagem_anotacao', function (Blueprint $table) {
$table->foreignId('atendimento_enfermagem_id')
->nullable(false)
->change();
$table->dropForeign(['paciente_observacao_id']);
$table->dropColumn(['paciente_observacao_id']);
});
}
}

View File

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

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProntoAtendimentoPacienteObservacaoEscalaComaGlasgowTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pronto_atendimento_paciente_observacao_escala_coma_glasgow', function (Blueprint $table) {
$table->id();
$table->foreignId('paciente_observacao_id')->constrained('pronto_atendimento_paciente_observacao');
$table->foreignId('abertura_ocular_id')->constrained('geral_glasgow_abertura_ocular');
$table->foreignId('resposta_verbal_id')->constrained('geral_glasgow_resposta_verbal');
$table->foreignId('resposta_motora_id')->constrained('geral_glasgow_resposta_motora');
$table->foreignId('reatividade_pupilar_id')->constrained('geral_glasgow_reatividade_pupilar');
$table->string('observacao', 2500);
MigrationUtil::addCommonFieldsWithSoftDeletes($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pronto_atendimento_paciente_observacao_escala_coma_glasgow');
}
}

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddMotivoEvasaoIntoProntoAtendimentoAtendimentoMedico extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_atendimento_medico', function (Blueprint $table) {
$table->text('motivo_evasao')
->after('desfecho_id')
->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_atendimento_medico', function (Blueprint $table) {
$table->dropColumn('motivo_evasao');
});
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFieldDataHoraProximaReavaliacaoIntoProntoAtendimentoAtendimentoMedico extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_atendimento_medico', function (Blueprint $table) {
$table->timestamp('data_hora_proxima_reavaliacao')
->after('observacoes_enfermagem')
->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_atendimento_medico', function (Blueprint $table) {
$table->dropColumn('data_hora_proxima_reavaliacao');
});
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsParametrizadoIntoProntoAtendimentoAtendimentoProcedimento extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pronto_atendimento_atendimento_procedimento', function (Blueprint $table) {
$table->boolean('is_parametrizado')
->after('quantidade')
->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pronto_atendimento_atendimento_procedimento', function (Blueprint $table) {
$table->dropColumn('is_parametrizado');
});
}
}

View File

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

Some files were not shown because too many files have changed in this diff Show More