Sunteți pe pagina 1din 8

Table of Contents

Goal of Project.......................................................................................................................... 1
1.1

Project Description............................................................................................................1

1.2

Report................................................................................................................................ 1

1.2.1

Test Data:...................................................................................................................1

1.2.2

Experiences................................................................................................................6

1.3

Analysis, summarizations and conclusions......................................................................7

1|Page

1 Goal of Project
The project is to create a mini world of a hospital and the various entities in it. These are are; patients, doctors, nurses, medical labs,
scientists, lab tests, lab reports, diagnosis test, Treatments and billing among other data. Once these are created it wish to gain
experience using MySQl to create and modify the database system using several commands and print a report based on successes of
these commands.

1.1

Project Description

A patient is admitted into a hospital at a specific date. This hospital is in a region close to where the patient lives. This patients
address has its name and address key (primary key). Each hospitals is managed by staff(scientists, doctors, nurses) who have their
own staff id and has a maximum recommended capacity. In the hospital one is either a patient or a staff member. A hospital contains
different wings and has a number of them. A wing has a set maximum patient capacity and a wing id(primary key) however. Each
patient is assigned to a wing in the hospital. A patient's personal records are stored separately from their hospital specific and
includes Name Address, age MCP number, email address and phone number.
The hospital staff are either lab scientists, doctors or nurses. All staff are grouped by categories of role.
A doctor is assigned one or more patients, is identified by their name, doctor id(primary key) which references their staff id in the
general system. A doctor also has an area of speciality, even if that area is general. This doctor consults a medical lab identified by its
Wing id -which is the primary key), lab id and name about a patient.
Each lab is run by lab scientists who have their own name, scientist_id(primary key) which references their staff id in the general
system and lab they work in.
The lab runs a diagnostic using tests. These tests can be anything and there can be more than one been run and they are performed by
lab scientists within a specific medical lab. These diagnostics are identified by a patient who it is for a test id and also include a
reference which has comments by that lab scientist including its own diagnostic id as a primary key. The diagnostics are compiled
into reports based on report id, name, diagnostic id, lab name, Treatment name and date. These reports are requested by doctors and
the patient is shown information it contains. A treatment id maps to specific recommended treatments for the patient (there may be
more than one).
While the patient is admitted they are assigned a room and therefore the who attends to them in their hospital room. Each patient
room is specified by a floor, patient id (primary key) and room id(primary key). Patient personal records such as age, sex, address,
email address and phone number including patient id are stored about a patient separately from information about their admittance
to the hospital.
The nurse is specified by a name, nurse id(primary key) which references their staff id in the general system. Nurses are assigned to
patient rooms and each room can have multiple nurses attending to it. Each medical test is specified by the lab location, and
test_id(primary key) who is running such test and name of the test. All staff take shifts in the hospital and have a start time and
number of hours they usually attend to and that includes the shift id numbers. Each staff also had staff records associated with them.
The records include:
staff id(primary key), address, pay-class, birth date, sex, MCP number, phone number, email.
All staff in the hospital are assigned a wing.
A patient their bill. The bill has a name and amount associated with it.

1.2

Report

1.2.1
Tables:
Hospital

Test Data:

2|Page
Name
St clare

Region
Labrador

Capacity
600

Patient
Name
Mike
Luu

MCP no
123456789
333444555

Patient Record
Name
Mike

Address
55 pepper street,

Birthdate
1960-09-11

Email
aabb@gmail.co

Phone no
709222333

Patient_id
123000

sex
Male

Luu

lab city
87 violin avenue,

1954-12-29

m
bbcc@gmail.com

709333444

345000

Male

Patient id
123000
345000

Admission date
1998-11-12
1997-09-07

lab city

Nurse
Nurse_id
40404
50505
30303

Name
Marrisa
Jane
Alice

Doctor
Name
Douglas
Toby

Doctor_id
9009
9007

Doctor Speciality
Doctor_id
9009
9007

speciality
General
General

Scientist
Name
Chris
Gordon
Luke

Scientist_id
1000
1001
2000

Lab_id
100
200
100

Room_Assign
Nurse_id
40404
50505
30303
40404
50505

Room_id
3
9
80
9
3

Room
Room_id
003
009
080

Wing_id
1
1
2

Floor
3
4
3

Nurse_id
40404
50505
30303

Staff
Staff_id
40404
50505
30303

Category
Nurse
Nurse
Nurse

Hospital_name
St clare
St clare
St clare

Wing_id
1
1
2

Room id
3
9

Hospital name
StClare
St Clare

Doctor id
9009
9007

3|Page
9009
9007
1000
1001
2000

Doctor
Doctor
Scientist
Scientist
scientist

St clare
St clare
St clare
St clare
St clare

1
1
1
2
1

Staff_Records
Phone no.
709100200

Email
abc@clare.com

Sex
Female

MCP no.
001001001

Staff_id
40404

address
12 Pike avenue,

birthdate
1986-04-06

709200300

bcd@clare.com

Female

002002002

50505

Goose bay
21 Spoon street,

1983-10-25

709300400

cde@clare.com

Female

003003003

30303

Goose bay
12 lakeview

1958-05-03

709600600

fgh@clare.com

Male

0006006006

9009

terrace, Lab city


21 lab city fort,

1942-02-28

709006007

ghi@clare.com

Male

007007007

9007

lab city
12 jackal cove,

1988-12-30

709800900

ijk@clare.com

Male

009009009

1000

Churchill Falls
21 Mikie street,

1967-05-05

709900100

jkl@clare.com

Male

101101101

1001

Lab city
11 four street,

1990-01-01

709900200

klm@clare.com

Male

110110110

2000

Lab city
10 fifety avenue,

1980-09-12

Lab City

Wing
Wing_id
1
2
3
4

Name
North
South
East
West

Capacity
100
200
100
200

Medical_lab
Lab_id
100
200
300

Wing_id
1
2
1

name
Markus Lab
Grey Lab
Markey Lab

Shift
Shift_id
1001
2002
3003
4004
5005

Starttime
21:00:00
17:00:00
03:00:00
08:00:00
12:00:00

Hours
9
9
9
9
9

Bill
Bil_id
00020
00030

Patient_id
123000
345000

Amount
30000
50000

Shift_Assign

Hospital name
St clare
St clare
St clare
St clare

4|Page
Shift_id
1001
2002
3003
4004
5005
4004
4004
4004

Report
Name
Blood thining
High

Staff_id
40404
50505
30303
9009
9007
1000
1001
2000

Report_id
01011
02011

Patient_id
123000
345000

Doctor_id
9009
9007

Diagnostic_id
419
519

Cholesterol

Diagnostic
Patient_id
123000

Test_id
747

Diagnostic_id
419

Reference
sickle cells

Lab_id
100

discovered in
patient, low
345000

787

519

thickness too
Dangerous level of
fat build-up around
heart a on neck

Test
Testname
Blood Check
Fat test
Urine test

Test_id
747
787
618

Lab_id
100
200
100

Treatment
Treatment_id
7005

Report_id
01011

name
Blood transfusion
with A blood type
within the next

8905

02011

week
Recommended fat
loss diet admittance
to bi-pass surgery

Works on
Scientist_id
1000
1001
2000
2000
1000

Test_id
747
787
618
747
618

200

Date
1998-11-23
1997-10-01

5|Page

1.2.2

Experiences

As this was my first time using MySQL I had trouble getting the syntax correct for a lot of my commands, i received many
errors when entering, manipulating the updating my database. The following are a collection of these such errors:
mysql> alter table Staff_Recordss add primary key(staff_id);
ERROR 1146 (42S02): Table 'hospital_project.staff_recordss' doesn't exist
mysql> alter table Staff_Records add primary key(staff_id);
Query OK, 0 rows affected (0.11 sec)

mysql> alter table Staff_Records add foreign key(staff_id) references Staff(staf


f_id);
ERROR 1215 (HY000): Cannot add foreign key constraint

mysql> alter table Staff Records add foreign key(staff_id);


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'Recor
ds add foreign key(staff_id)' at line 1

mysql> alter table Staff Records add foreign key(staff_id) references Staff(staf
f_id);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'Recor
ds add foreign key(staff_id) references Staff(staff_id)' at line 1

mysql> alter table Staff_Records add foreign key(staff_id) references Staff(staf


f_id);
ERROR 1215 (HY000): Cannot add foreign key constraint

mysql> alter table Staff_Records add staff_id;


ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 1
mysql> alter table Staff_Record add foreign_key(staff_id) references Staff(staff
_id);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

6|Page

corresponds to your MySQL server version for the right syntax to use near '(staf
f_id) references Staff(staff_id)' at line 1

As a whole using the internet, particularly w3schools.com , roseindia.net and stackoverflow.com i was able to learn the
mysql constraints and syntax for correcting using the database structure.

1.3

Analysis, summarizations and conclusions

Overall the database designed is very robust and while it does not cater the entire needs of a typical hospital is a well formed template
of such a type of entity. The description and EER diagram of my database had to be adopted several times in my project to remove
redundancies and several present constraints in the database.

S-ar putea să vă placă și