From a762cc1e2831e12fbd6bb8c01ca7335afe999f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?22=20=E8=82=96=E9=92=9F=E5=87=AF=E9=9F=A9?= <3175644391@qq.com> Date: Thu, 14 Sep 2023 03:59:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E9=99=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230914.md" | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 "22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" new file mode 100644 index 0000000..c7d39f1 --- /dev/null +++ "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" @@ -0,0 +1,222 @@ +## 笔记 + +如果一个主体的属性有多个值,那这个属性就可以拆成一个新的主体 + +## 作业 + +![img](https://s2.loli.net/2023/09/14/oTW4nt8yMiLVQN2.png) + +![img](https://s2.loli.net/2023/09/14/TLfw4g3YmxZQ7Fb.png) + +~~~mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/14 3:40:22 */ +/*==============================================================*/ +create database yiyuan charset utf8; +use yiyuan; + +/*==============================================================*/ +/* Table: binli --- 病例 */ +/*==============================================================*/ +create table binli +( + patient_id int not null, + case_content varchar(255) not null, + case_time datetime not null, + doctor_id int not null, + primary key (patient_id, doctor_id) +); + +/*==============================================================*/ +/* Table: charge ---收费处 */ +/*==============================================================*/ +create table charge +( + charge_id int not null auto_increment, + hospital_id int not null, + charge_name char(5) not null, + charge_money decimal(8,2) not null, + primary key (charge_id) +); + +/*==============================================================*/ +/* Table: doctor ---医生 */ +/*==============================================================*/ +create table doctor +( + doctor_id int not null auto_increment, + doctor_name char(5) not null, + doctor_age int not null, + doctor_gender char(1) not null, + doctor_post char(20) not null, + education char(20) not null, + doctor_tel char(11) not null, + primary key (doctor_id) +); + +/*==============================================================*/ +/* Table: drug ---药品 */ +/*==============================================================*/ +create table drug +( + drug_id int not null auto_increment, + pharmacy_id int not null, + drug_name char(10) not null, + drug_date datetime not null, + drug_warranty datetime not null, + primary key (drug_id) +); + +/*==============================================================*/ +/* Table: give_off ---出库 */ +/*==============================================================*/ +create table give_off +( + drug_id int not null, + patient_id int not null, + give_off_time date not null, + primary key (drug_id, patient_id) +); + +/*==============================================================*/ +/* Table: hospital ---医院 */ +/*==============================================================*/ +create table hospital +( + hospital_id int not null auto_increment, + hospital_name char(10) not null, + hospital_introduce varchar(255) not null, + hospital_address varchar(100) not null, + hospital_time varchar(30) not null, + hospital_tel char(11) not null, + primary key (hospital_id) +); + +/*==============================================================*/ +/* Table: inpatient_ward ---病房 */ +/*==============================================================*/ +create table inpatient_ward +( + patient_id int not null, + doctor_id int not null, + be_hospitalized char(1), + primary key (patient_id, doctor_id) +); + +/*==============================================================*/ +/* Table: patient ---患者 */ +/*==============================================================*/ +create table patient +( + patient_id int not null auto_increment, + patient_name char(5) not null, + patient_age int not null, + patient_gender char(1) not null, + patient_number char(18) not null, + patient_tel char(11) not null, + primary key (patient_id) +); + +/*==============================================================*/ +/* Table: pay_the_fees ---缴费 */ +/*==============================================================*/ +create table pay_the_fees +( + pay_id char(6) not null, + patient_id int not null, + charge_id int not null, + primary key (patient_id, charge_id) +); + +/*==============================================================*/ +/* Table: pharmacy ---药房 */ +/*==============================================================*/ +create table pharmacy +( + pharmacy_id int not null auto_increment, + pharmacy_type char(5) not null, + primary key (pharmacy_id) +); + +/*==============================================================*/ +/* Table: prescription ---处方 */ +/*==============================================================*/ +create table prescription +( + patient_id int not null, + doctor_id int not null, + prescription_content varchar(255) not null, + primary key (patient_id, doctor_id) +); + +/*==============================================================*/ +/* Table: registration ---挂号 */ +/*==============================================================*/ +create table registration +( + patient_id int not null, + registration_section char(10) not null, + registration_date datetime not null, + doctor_id int not null, + primary key (patient_id, doctor_id) +); + +/*==============================================================*/ +/* Table: scheme ---治疗方案 */ +/*==============================================================*/ +create table scheme +( + patient_id int not null, + scheme_content varchar(255) not null, + scheme_time date not null, + doctor_id int not null, + primary key (patient_id, doctor_id) +); + +/*==============================================================*/ +/* Table: section ---科室 */ +/*==============================================================*/ +create table section +( + section_id int not null auto_increment, + hospital_id int not null, + section_name char(10) not null, + primary key (section_id) +); + +/*==============================================================*/ +/* Table: storage ---入库 */ +/*==============================================================*/ +create table storage +( + storage_time date not null, + pharmacy_id int not null, + hospital_id int not null, + primary key (pharmacy_id, hospital_id) +); + +/*==============================================================*/ +/* Table: symptom ---症状 */ +/*==============================================================*/ +create table symptom +( + patient_id int not null, + doctor_id int not null, + "describe" varchar(255) not null, + primary key (patient_id, doctor_id) +); + +/*==============================================================*/ +/* Table: working_time ---工作时间 */ +/*==============================================================*/ +create table working_time +( + doctor_id int not null, + section_id int not null, + working_date date not null, + working_time time not null, + primary key (doctor_id, section_id) +); +~~~ + -- Gitee