数据库大作业---hys
第 1 页 共 32 页
A Home-Healthcare Information System
BY HYS
A. Design database
1. E-R diagram
2. The structure of the table and the creation of the form
Table home_users
Name
Type
Constraint
condition
Remark
Current_medicat
ion_therapy
Varchar2(100)
Not null
medications
第 2 页 共 32 页
Identify user
number, primary
key, form:
1001;1002...
User’s name
The history of
disease
Treatments and
currently in use
Allergy
symptoms
Specify the
doctor
User’s age
数据库大作业---hys
User_id
Varchar2(10)
Primary key
User_name
Varchar2(20)
unique
Disease_history
Varchar2(100)
Not null
allergies
Varchar2(100)
Order_expert
Varchar2(20)
User_age
Varchar2(5)
/
/
/
Code:
create table home_users(
user_name varchar2(10) unique,
user_id varchar2(20),
disease_history varchar2(100),
currenty_medication_therapy varchar2(100),
数据库大作业---hys
第 3 页 共 32 页
allergies varchar2(50),
order_expert varchar2(20),
user_age varchar2(5),
constraint pk_user primary key( user_id ));
Table online_experts
Name
Type
Constraint
condition
Ex_id
Varchar2(20)
Primary key
Ex_name
Varchar2(20)
unique
Ex_tel
Varchar2(20)
Not null
Credentials_reco
rded
Varchar2(100)
Not null
Remark
Identify online
expert number,
primary key, form:
9001;9002...
Name of an online
expert
Online expert's
phone number
Professional
certificates and
professional
records
数据库大作业---hys
第 4 页 共 32 页
Code:
create table online_experts(
ex_name varchar2(10) unique,
ex_tel varchar2(20) unique,
professional_cre_recorded varchar2(100) not null,
ex_id varchar2(20),
constraint pk_experts primary key ( ex_id ));
Table ex_roles
Name
Type
Constraint
condition
Remark
Online expert
Ex_id
Varchar2(20)
Foreign key
number, foreign
key
Identify the
rol
Varchar2(20)
Primary key
online expert
role, primary key
数据库大作业---hys
第 5 页 共 32 页
Code:
create table ex_roles(
ex_id varchar2(20) unique ,
rol varchar2(50) not null ,
constraint pk_roles primary key( rol )
constraint fk_exid foreign key( ex_id ) references
online_experts( ex_id ));
Table Compliant
Name
Type
Constraint
condition
Remark
Identifies the
Co_id
Varchar2(20)
Primary key
number of users’
complaints ,
数据库大作业---hys
User_name
Varchar2(20)
Not null
Co_text
Varchar2(100)
null
Co_time
Varchar2(20)
Not null
第 6 页 共 32 页
primary key,
form:
2001;2002...
Users’ name
The content of
the complaint
The time of
filling the
complaint
User_id
Varchar2(20)
Foreign key
Users’ number
Code:
create table compliants(
co_id varchar2(20) not null ,
user_name varchar2(20) not null ,
co_text varchar2(100) null ,
co_time varchar2(20),
constraint com_user primary key (co_id),
constraint
home_users
( user_id ));
fk_userid foreign key ( user_id )
references
数据库大作业---hys
第 7 页 共 32 页
Table user_register
Name
Type
Constraint
condition
User_id
Varchar2(20)
Foreign key
User_tel
Varchar2(20)
Not null
Remark
User’s number,
foreign key
User's phone
number
Identifies the
User_name
Varchar2(20)
Primary key
user's name,
primary key
User_address
Varchar2(100)
Not null
User's address
Code:
create table user_register(
user_id varchar2(20) not null ,
user_name varchar2(20) NOT NULL ,
user_address varchar2(100) not null ,
user_tel varchar2(20),
constraint pk_username primary key (user_name),
constraint
key(user_id)
home_users(user_id));
fk_reuserid
foreign
references
数据库大作业---hys
第 8 页 共 32 页
Table Symptoms
Name
Type
User_id
Varchar2(20)
Constraint
condition
Remark
Unique
User's number,
Foreign key
foreign key
The number of
St_id
Varchar2(20)
Primary key
symptom ,
St_text
Varchar2(100)
Not null
primary key
The description
of symptoms
severity
Varchar2(100)
Not null
Severity
St_time
Varchar2(20)
Not null
The time of the
symptoms
Code:
create table symptoms(
user_id varchar2(20) unique ,