-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.sql
More file actions
56 lines (47 loc) · 1.58 KB
/
Copy pathmodel.sql
File metadata and controls
56 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
CREATE TABLE "users" (
"id" integer PRIMARY KEY,
"first_name" varchar NOT NULL,
"name" varchar NOT NULL,
"password" varchar NOT NULL,
"id_graulande" varchar NOT NULL,
"mutuelle_id" integer
);
CREATE TABLE "hospitals" (
"id" integer PRIMARY KEY,
"name" varchar NOT NULL
);
CREATE TABLE "mutuelles" (
"id" integer PRIMARY KEY,
"name" varchar NOT NULL
);
CREATE TABLE "medical_acts" (
"id" integer PRIMARY KEY,
"user_id" integer,
"hopital_id" integer,
"mutuelle_id" integer,
"metadata_1" varchar,
"metadata_2" varchar,
"montant_total" float DEFAULT 0,
"prise_en_charge_hopital" float DEFAULT 0,
"prise_en_charge_mutuelle" float DEFAULT 0,
"prise_en_charge_patient" float DEFAULT 0,
"confirmation_paiement_patient" boolean DEFAULT false,
"confirmation_mutuelle" boolean DEFAULT false,
"confirmation_rdv" boolean DEFAULT false,
"pourcentage_prise_en_charge" integer,
"commentaire" text,
"date_creation" timestamp DEFAULT (now()),
"date_prevue" timestamp,
"date_venue" timestamp
);
CREATE TABLE "results" (
"id" integer PRIMARY KEY,
"medical_act_id" integer,
"file_name" varchar NOT NULL,
"file_data" bytea NOT NULL
);
ALTER TABLE "users" ADD FOREIGN KEY ("mutuelle_id") REFERENCES "mutuelles" ("id");
ALTER TABLE "medical_acts" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id");
ALTER TABLE "medical_acts" ADD FOREIGN KEY ("hopital_id") REFERENCES "hospitals" ("id");
ALTER TABLE "medical_acts" ADD FOREIGN KEY ("mutuelle_id") REFERENCES "mutuelles" ("id");
ALTER TABLE "results" ADD FOREIGN KEY ("medical_act_id") REFERENCES "medical_acts" ("id");