Skip to content

Commit

Permalink
regulation wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloarocha committed Nov 14, 2024
1 parent 45afd2a commit 13c58a2
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions noharm-regulation.sql
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
);

0 comments on commit 13c58a2

Please sign in to comment.