From 89951510a2f5b627ab3e97f67f31e9b7189e4bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=A2=A6=E6=A2=A6?= <3195337478@qq.com> Date: Thu, 14 Sep 2023 05:34:49 +0000 Subject: [PATCH] =?UTF-8?q?=E9=99=88=E6=A2=A6=E6=A2=A6=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈梦梦 <3195337478@qq.com> --- ...13\346\233\264\346\226\260\347\211\210.md" | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 "01 \351\231\210\346\242\246\346\242\246/20230913\346\233\264\346\226\260\347\211\210.md" diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230913\346\233\264\346\226\260\347\211\210.md" "b/01 \351\231\210\346\242\246\346\242\246/20230913\346\233\264\346\226\260\347\211\210.md" new file mode 100644 index 0000000..d1d1c0f --- /dev/null +++ "b/01 \351\231\210\346\242\246\346\242\246/20230913\346\233\264\346\226\260\347\211\210.md" @@ -0,0 +1,132 @@ +```mysql +drop table if exists docter; + +drop table if exists drug; + +drop table if exists nurse; + +drop table if exists patient; + +drop table if exists shoushushi_id; + +drop table if exists sickbed; + +drop table if exists sickperson; + +/*==============================================================*/ +/* Table: docter */ +/*==============================================================*/ +create table docter +( + docter_id int not null auto_increment, + docter_name varchar(10) not null, + docter_sex char(1) not null, + docter_degree varchar(15) not null, + docter_tel numeric(8,0) not null, + primary key (docter_id) +); + +/*==============================================================*/ +/* Table: drug */ +/*==============================================================*/ +create table drug +( + drug_id int not null auto_increment, + drug_name varchar(20) not null, + drug_medication varchar(50) not null, + drug_price int not null, + primary key (drug_id) +); + +/*==============================================================*/ +/* Table: nurse */ +/*==============================================================*/ +create table nurse +( + nurse_id int not null auto_increment, + nurse_name varchar(10) not null, + primary key (nurse_id) +); + +/*==============================================================*/ +/* Table: patient */ +/*==============================================================*/ +create table patient +( + patient_id int not null auto_increment, + patient_name varchar(10) not null, + patient_address varchar(20) not null, + patient_tel numeric(20,0) not null, + primary key (patient_id) +); + +/*==============================================================*/ +/* Table: shoushushi_id */ +/*==============================================================*/ +create table shoushushi_id +( + shoushushi_id_id int not null auto_increment, + sickbed_id int not null, + sic_sickperson_id int not null, + patient_id int not null, + docter_id int not null, + shoushushi_idname varchar(10) not null, + sickperson_id int not null, + primary key (shoushushi_id_id) +); + +/*==============================================================*/ +/* Table: sickbed */ +/*==============================================================*/ +create table sickbed +( + sickbed_id int not null, + nurse_id int not null, + primary key (sickbed_id) +); + +/*==============================================================*/ +/* Table: sickperson */ +/*==============================================================*/ +create table sickperson +( + sickperson_id int not null, + patient_id int not null, + docter_id int not null, + drug_id int not null, + shoushushi_id_id int not null, + allergy char(1) not null, + sympton varchar(50) not null, + primary key (sickperson_id, patient_id, docter_id) +); + +alter table shoushushi_id add constraint FK_inhospital foreign key (sickbed_id) + references sickbed (sickbed_id) on delete restrict on update restrict; + +alter table shoushushi_id add constraint FK_operation foreign key (sic_sickperson_id, patient_id, docter_id) + references sickperson (sickperson_id, patient_id, docter_id) on delete restrict on update restrict; + +alter table sickbed add constraint FK_nursing foreign key (nurse_id) + references nurse (nurse_id) on delete restrict on update restrict; + +alter table sickperson add constraint FK_booking foreign key (patient_id) + references patient (patient_id) on delete restrict on update restrict; + +alter table sickperson add constraint FK_operation2 foreign key (shoushushi_id_id) + references shoushushi_id (shoushushi_id_id) on delete restrict on update restrict; + +alter table sickperson add constraint FK_see foreign key (docter_id) + references docter (docter_id) on delete restrict on update restrict; + +alter table sickperson add constraint FK_takedrug foreign key (drug_id) + references drug (drug_id) on delete restrict on update restrict; + +``` + +``` + +``` + +``` +https://s2.loli.net/2023/09/14/PoB1vy2ENardRG5.png +``` -- Gitee