-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45afd2a
commit 13c58a2
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-- tabela principal que armazena todas as solicitações | ||
CREATE TABLE demo."reg_solicitacao" ( | ||
-- principais | ||
"fkreg_solicitacao" bigint PRIMARY KEY NOT NULL , | ||
"nratendimento" bigint NOT NULL, | ||
"dtsolicitacao" timestamp not null, | ||
"fkreg_tipo_solicitacao" bigint NOT NULL, | ||
"etapa" smallint not null, | ||
"risco" smallint not null, | ||
|
||
-- extra | ||
"cid" bigint, | ||
"atendente" varchar(250), | ||
"atendente_crm" integer, | ||
"justificativa" text, | ||
"dtagendamento" timestamp, | ||
"dttransporte" timestamp, | ||
-- mais campos da solicitacao ... | ||
|
||
--controle | ||
"created_at" timestamp DEFAULT NOW(), | ||
"created_by" integer | ||
"updated_at" timestamp DEFAULT NOW(), | ||
"updated_by" integer | ||
); | ||
|
||
|
||
-- tabela que armaze as movimentacoes da solicitacao | ||
CREATE TABLE demo."reg_movimentacao" ( | ||
"idreg_movimentacao" serial8 PRIMARY KEY not null, | ||
"fkreg_solicitacao" bigint not null, | ||
"etapa_origem" smallint not null, | ||
"etapa_destino" smallint not null, | ||
"acao" smallint not null, | ||
"dados" json not null, | ||
|
||
--controle | ||
"created_at" timestamp DEFAULT NOW(), | ||
"created_by" integer | ||
); | ||
|
||
|
||
-- tabela para armazenar os tipos de solicitacao (Ex. Consulta em cardiologista) | ||
CREATE TABLE demo."reg_tipo_solicitacao" ( | ||
"fkreg_tipo_solicitacao" bigint PRIMARY KEY NOT NULL, | ||
"nome" varchar(250) not null, | ||
"status" smallint not null, | ||
|
||
"created_at" timestamp DEFAULT NOW(), | ||
"created_by" integer | ||
"updated_at" timestamp DEFAULT NOW(), | ||
"updated_by" integer | ||
); |