IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

40
MBS ISBP IS 6156 Group Assignment Databases for Management Information Systems Lecturer: Dr. Ciara Heavin 20 March 2015 Student Information: Jean Donnelly 90079094 Timothy Walsh 102859661 Brendan McSweeney 114223513

Transcript of IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

Page 1: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

MBS ISBP IS 6156 Group Assignment

Databases for Management Information Systems

Lecturer: Dr. Ciara Heavin

20 March 2015

Student Information:

Jean Donnelly 90079094

Timothy Walsh 102859661

Brendan McSweeney 114223513

Page 2: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

Table of Contents Introduction ............................................................................................................................................................ 1

Part 1: Entity Relationship Diagram ........................................................................................................................ 1

Part 2: Database Tables .......................................................................................................................................... 4

Patient Table ...................................................................................................................................................... 4

Admission Table ................................................................................................................................................. 5

Assessment Table ............................................................................................................................................... 7

Consultant Table ................................................................................................................................................ 8

Procedure Table ................................................................................................................................................. 9

Booking Table ................................................................................................................................................... 10

Service Table .................................................................................................................................................... 11

Utilisation Table ............................................................................................................................................... 12

Employee Table ................................................................................................................................................ 14

Sample Table .................................................................................................................................................... 14

Test Result Table .............................................................................................................................................. 16

Test Table ......................................................................................................................................................... 17

Part 3: SQL Queries ............................................................................................................................................... 19

Query 1 Identification of Patients at Risk through Blood Testing ............................................................ 19

Query 2 Identification of Patients at Risk through Air-Transmitted Infection ......................................... 20

Query 3 Identification of Patients at Risk from Infection through Consultant ........................................ 21

Query 4 Identification of Patients at Risk of Infection at time of Taking Blood Sample .......................... 22

Query 5 Identification of Under-Utilised Hospital Services ..................................................................... 22

Query 6 Identification of Over-Utilised Hospital Services ........................................................................ 23

Query 7 Identification of the Operating Theatre with the Highest Usage ............................................... 24

Query 7 Overview of Hospital Services Usage ......................................................................................... 25

Query 8 Number of Bookings per Service per Date ................................................................................. 27

Query 9 Identification of Hospital Services without Bookings ................................................................. 28

Query 10 Identification of Date for 6-week Post-Operative Check-up Appointment ................................ 28

Part 4: Securing Patient Data using Oracle ........................................................................................................... 30

Conclusion ............................................................................................................................................................ 31

References ............................................................................................................................................................ 31

Appendix 1 ............................................................................................................................................................ 32

Appendix 2 ............................................................................................................................................................ 34

Page 3: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

1

Surgical Department Database Development

Introduction

This report describes the design, creation and utilisation of an Oracle database for a hospital's surgical

department. This database holds the Electronic Health Records (EHRs) for all surgical patients,

incorporating their personal, admission, assessment, blood test and treatment data to provide one

unified view of the surgical system. Querying of this database will provide insights into patient care

that minimise the risks posed to patients during their hospital stay. Previous personal experiences of

surgical and medical laboratory environments and documents (Appendix 1) have informed this view

of the EHR database.

The database also holds information on the treatment procedures scheduled for patients in the

department, facilitating views into utilisation of hospital services for management to use in improving

the efficient running of the hospital.

Due to the nature of the EHRs held in the database, privacy and security are critical concerns and this

issue will also be addressed in this report.

Part 1: Entity Relationship Diagram

The scope of this database is a hospitals Surgical Wards. The database maintains patient's Electronic

Health Records (EHRs) comprising information on the patient, his/her assessments, admissions, tests,

results and procedures.

The following Entity Relationship Diagram (ERD) provides a graphical representation of these

normalised database tables, their attributes and the relationships between them. The following

assumptions were made regarding this scenario:

This database scope extends only to a hospitals surgical wards

Patient_ID is assigned by the hospital and is a unique personal identifier that may be used for

that patient for multiple admissions.

The capacity of Services is measured in hours/day and represents the hours per day that it is

available for use.

Utilisation of services is examined historically in this scenario.

Usage is measured in hours.

The usage hours for a service is input at the end of each day if that service is used.

Each blood sample may be divided in order to undergo multiple tests.

Due to limitations in the Microsoft Visio application available for creation of the ERD, some of the

relationships depicted are not as intended. Please note the following:

Booking can be performed by one and only one consultant

Booking refers to one and only one patient

Admission refers to one and only one patient

Page 4: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

2

Sample belongs to one and only one patient

Sample is taken by one and only one employee

Booking is made for one and only one procedure

Booking is made for one and only one service

Page 5: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

3

TestResult

PK,FK1 TestIDPK,FK2 SampleID

Test_Result

Utilisation

PK Utilisation_DatePK,FK1 Service_ID

Usage

Service

PK Service_ID

Service_Name Capacity

Booking

PK BookingID

Booking_DateFK1 ServIDFK2 ProcedureIDFK3 PatientIDFK4 Consultant_ID

Procedure

PK ProcedureID

Procedure_Desc

Patient

PK PatientID

First_Name Last_Name Date_of_Birth Address_Line1 Town County Phone GP_ID

Admission

PK AdmissionID

Admission_Date Discharge_Date Ward No Bed NoFK1 PatientID Health_Ins_Code

Sample

PK SampleID

Test_DateFK1 EmpIDFK2 PatientID

Employee

PK EmpID

EmpFirstName EmpLastName Position

Test

PK TestID

Test_Description LowerLimit UpperLimit Units

Consultant

PK Consultant_ID

ConsFirstName ConsLastName Specialty

Hospital Surgical Ward Database System

Assessment

PK Assessment_DatePK,FK1 Patient_IDPK,FK2 Consultant_ID

FK3 Emp_ID Treatment_Plan

Page 6: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

4

Part 2: Database Tables

A patient's Electronic Health Record (EHR) is compiled from a range of Oracle database tables in which

all patient information and records are held. Various views then can provide a complete record or

partial views that elucidate on particular aspects of the patient record of interest to a subset of staff

or hospital managers.

This section describes the tables created for the Surgical Ward database and shows a sample of the

SQL used to create and modify each table. The Create, initial Insert and Alter tables, if applicable, are

included here for each table with subsequent tables included in Appendix 2. A sample of each table is

also illustrated.

Patient Table

The Patient table holds personal and contact information for each patient.

CREATE TABLE PatientTJB661 (

Patient_ID number (10) primary key Not Null,

First_Name varchar2(50),

Last_Name varchar2(50),

Date_of_Birth date,

Address_Line1 varchar2(50),

Town varchar2(50),

County varchar2(50),

Phone number(20) Not Null,

GP_ID Number (10) Not Null);

INSERT ALL

INTO PATIENTTJB661 VALUES(659222,'John','Smith','29-May-80','5 Oak Lawn','Mallow','Cork',0875623598,9945)

INTO PATIENTTJB661 VALUES(659536,'Mary','Murphy','31-Aug-90','Ard na Ri','Pouladuff','Cork',0852222351,9946)

INTO PATIENTTJB661 VALUES(581229,'Brian','Walsh','10-Aug-90','6 Ard Dara','Blarney','Cork',0866291562,9947)

INTO PATIENTTJB661 VALUES(588772,'Aoife','Ward','09-Sep-87','2 Old Road','Cobh','Cork',0877543249,9948)

INTO PATIENTTJB661 VALUES(627391,'Peter','Cashman','17-Jul-86','Ardfield','Douglas','Cork',0853579054,9949)

Page 7: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

5

INTO PATIENTTJB661 VALUES(650097,'Kate','Ryan','19-Jun-82','2 Low Road','Bantry','Cork',0866642364,9950)

INTO PATIENTTJB661 VALUES(639696,'Barry','Buckley','20-Nov-89','5 New Road','Blackpool','Cork',0855523670,9951)

INTO PATIENTTJB661 VALUES(611396,'Luara','Manley','11-May-91','6 Lee Road','Cork City','Cork',0877512368,9952)

INTO PATIENTTJB661 VALUES(599062,'Dan','Lynch','23-Nov-92','High Road','Macroom','Cork',0855442319,9953)

INTO PATIENTTJB661 VALUES(609655,'Lisa','Healy','15-Jul-88','Woodview','Glanmire','Cork',0866519655,9954)

SELECT 1 FROM DUAL;

Figure 1. Patient Table

Admission Table

On a patient's first surgical admission to this hospital, he/she is allocated a Patient_ID which acts as a

unique identifier for the current and all subsequent admissions. Each admission is allocated a new

Admission_ID. The Admissions table holds the patient's health insurance details as well as admission

details such as the allocated accommodation for the patient for this hospital stay and the relevant

admission and discharge dates.

Create Table AdmissionTJB661 (

Admission_ID Number (10) primary key Not Null,

Patient_ID Number (6) Not Null,

Admission_Date date,

Discharge_Date date,

Ward_No Number (4) Not Null,

Page 8: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

6

Bed_No Number (4) Not Null,

Health_Insurance_Code Varchar2(20));

Insert All

Into AdmissionTJB661 Values(10000,659222,'5-Feb-15','7-Feb-15',10,1000,'VHI221112')

Into AdmissionTJB661 Values(10001,659536,'6-Feb-15','9-Feb-15',10,1001,'LAYA133331')

Into AdmissionTJB661 Values(10002,581229,'11-Feb-15','14-Feb-15',10,1002,'AVIVA155551')

Into AdmissionTJB661 Values(10003,588772,'12-Feb-15','14-Feb-15',11,1003,'GLO199991')

Into AdmissionTJB661 Values (10004,627391,'6-Feb-15','8-Feb-15',11,1004,'VHI442224')

Into AdmissionTJB661 Values(10005,650097,'9-Feb-15','10-Feb-15',11,1005,'VHI223332')

Into AdmissionTJB661 Values(10006,639696,'10-Feb-15','12-Feb-15',11,1006,'GLO771117')

Into AdmissionTJB661 Values(10007,611396,'13-Feb-15','14-Feb-15',12,1007,'AVIVA881118')

Into AdmissionTJB661 Values(10008,599062,'5-Feb-15','7-Feb-15',12,1008,'VHI110001')

Into AdmissionTJB661 Values(10009,609655,'11-Feb-15','12-Feb-15',12,1009,'AVIVA455554')

SELECT * FROM DUAL;

ALTER TABLE AdmissionTJB661

ADD CONSTRAINT

FK_ConAdm1_Patient

Foreign key(Patient_ID)

References PatientTJB661(Patient_ID);

Figure 2. Admission Table

Page 9: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

7

Assessment Table

The patient's EHR includes details of his/her initial consultation with the consultant prior to admission

for surgery. Details of any other medical personnel present are noted in addition to Treatment Plan

notes indicating the procedures scheduled for the patient's treatment.

CREATE TABLE AssessmentTJB661

(Assessment_Date Date Not Null,

Patient_ID Number (10) Not Null,

Consultant_ID Number (10) Not Null,

Emp_ID Number (10),

Primary key(Assessment_Date,Patient_ID,Consultant_ID));

INSERT ALL

INTO AssessmentTJB661 VALUES('30-Jan-15',659222,81265,220221)

INTO AssessmentTJB661 VALUES('25-Jan-15',659536,30510,220393)

INTO AssessmentTJB661 VALUES('30-Jan-15',581229,74581,220515)

INTO AssessmentTJB661 VALUES('01-Feb-15',588772,38264,220221)

INTO AssessmentTJB661 VALUES('15-Jan-15',627391,21493,220591)

INTO AssessmentTJB661 VALUES('31-Jan-15',650097,48522,220444)

INTO AssessmentTJB661 VALUES('02-Feb-15',639696,15599,220591)

INTO AssessmentTJB661 VALUES('22-Jan-15',611396,75526,220600)

INTO AssessmentTJB661 VALUES('30-Jan-15',599062,84263,220444)

INTO AssessmentTJB661 VALUES('28-Jan-15',609655,25252,220221)

SELECT 1 FROM DUAL;

ALTER TABLE AssessmentTJB661

ADD CONSTRAINT

FK_ConAssess1_Patient

Foreign key(Patient_ID)

References PatientTJB661(Patient_ID);

Page 10: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

8

Figure 3. Assessment Table

Consultant Table

The details concerning consultants working in the hospital's surgical wards are recorded in the

Consultant table.

CREATE TABLE ConsultantTJB661

(Consultant_ID number (10)primary key not null,

Consultant_First_Name varchar(50),

Consultant_Last_Name varchar(50)not null,

Consultant_Specialty varchar(50)not null);

INSERT ALL

INTO ConsultantTJB661 VALUES('25252','Harry','Holmes','Dermatology')

INTO ConsultantTJB661 VALUES('84263','Mary','Smith','Dermatology')

INTO ConsultantTJB661 VALUES('75526','John','Dulea','Paediatrics')

INTO ConsultantTJB661 VALUES('15599','Ray','McCarthy','Oncology')

INTO ConsultantTJB661 VALUES('48522','Paul','McDonnell','Neurology')

INTO ConsultantTJB661 VALUES('21493','Sinead','Barry','Cardiology')

INTO ConsultantTJB661 VALUES('38264','Benedict','Sullivan','Oncology')

INTO ConsultantTJB661 VALUES('74581','Catherine','Corcoran','Dermatology')

INTO ConsultantTJB661 VALUES('30510','Kieran','Tarrant','Neurology')

INTO ConsultantTJB661 VALUES('81265','Anne ','DePuis','Cardiology')

SELECT 1 FROM DUAL;

Page 11: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

9

Figure 4. Consultant Table

Procedure Table

The treatment procedures undertaken in these surgical wards are described in the Procedures table.

CREATE TABLE Procedure661TJB

(Procedure_ID number(10) primary key not null,

Procedure_Desc varchar (50));

INSERT ALL

INTO Procedure661TJB VALUES(1311,'Colonoscopy')

INTO Procedure661TJB VALUES(2287,'Appendectomy')

INTO Procedure661TJB VALUES(3921,'Tonsillectomy')

INTO Procedure661TJB VALUES(4326, 'Chest X-ray')

INTO Procedure661TJB VALUES(5679, 'Myringotomy')

INTO Procedure661TJB VALUES(6111,'Splenectomy')

INTO Procedure661TJB VALUES(7481,'Angioplasty')

INTO Procedure661TJB VALUES(8091,'Pericariectomy')

INTO Procedure661TJB VALUES(9002,'MRI Scan')

INTO Procedure661TJB VALUES(1098,'Coronary Artery Surgery')

SELECT 1 FROM DUAL;

Page 12: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

10

Figure 5. Procedure Table

Booking Table The Booking table describes the booking of treatment procedures for particular patients and

consultants on a particular date. The hospital service (i.e. the operating theatre, X-ray or MRI facilities)

booked for the procedure is also recorded here.

CREATE TABLE BookingTJB661

(Booking_ID number(10) primary key not null,

Patient_ID number(10) not null,

Booking_Date date,

Consultant_ID number(10),

Procedure_ID number(10),

Service_ID number(10));

INSERT ALL

INTO BookingTJB661 VALUES(56330,588772,'14-Feb-2015',21493,9002,132)

INTO BookingTJB661 VALUES(56331,639696,'14-Feb-2015',84263,2287,127)

INTO BookingTJB661 VALUES(56332,599062,'14-Feb-2015',74581,7481,125)

INTO BookingTJB661 VALUES(56333,588772,'14-Feb-2015',81265,3921,125)

INTO BookingTJB661 VALUES(56334,611396,'14-Feb-2015',25252,8091,125)

INTO BookingTJB661 VALUES(56335,650097,'15-Feb-2015',15599,4326,130)

INTO BookingTJB661 VALUES(56336,581229,'15-Feb-2015',74581,1098,123)

INTO BookingTJB661 VALUES(56337,659222,'15-Feb-2015',30510,7481,125)

Page 13: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

11

INTO BookingTJB661 VALUES(56338,627391,'15-Feb-2015',84263,6111,123)

INTO BookingTJB661 VALUES(56339,609655,'15-Feb-2015',48522,5679,125)

SELECT 1 FROM DUAL;

ALTER TABLE BookingTJB661

ADD CONSTRAINT

FK_ConBook1_Procedure

Foreign key(Procedure_ID)

References Procedure661TJB(Procedure_ID);

Figure 6. Booking Table

Service Table The hospital services, i.e. the operating theatres, X-ray or MRI scanner units, available in these surgical

wards are detailed in the Service table. The capacity of each (the hours/day that each is available for

use) is also recorded here.

CREATE TABLE ServiceTJB661

(Service_ID number(10) primary key not null,

Service_Name varchar2(50),

Capacity number (10));

Page 14: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

12

INSERT ALL

INTO ServiceTJB661 VALUES(123,'Operating Theatre 1',10)

INTO ServiceTJB661 VALUES(124,'Operating Theatre 2',10)

INTO ServiceTJB661 VALUES(125,'Operating Theatre 3',10)

INTO ServiceTJB661 VALUES(126,'Operating Theatre 4',10)

INTO ServiceTJB661 VALUES(127,'Operating Theatre 5',10)

INTO ServiceTJB661 VALUES(128,'X-ray 1',8)

INTO ServiceTJB661 VALUES(129,'X-ray 2',8)

INTO ServiceTJB661 VALUES(130,'X-ray 3',8)

INTO ServiceTJB661 VALUES(131,'MRI scanner 1',8)

INTO ServiceTJB661 VALUES(132,'MRI scanner 2',8)

SELECT 1 FROM DUAL;

Figure 7. Service Table

Utilisation Table The usage of each service, measured in hours, is recorded at the end of each day if that service is used.

This information is recorded in the Utilisation table.

CREATE TABLE UtilisationTJB661

(Service_ID number(10) not null,

Utilisation_Date date not null,

Usage number (10,2),

Primary key(Service_ID,Utilisation_Date));

Page 15: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

13

INSERT ALL

INTO UtilisationTJB661 VALUES(123,'14-Feb-2015',12.25)

INTO UtilisationTJB661 VALUES(124,'14-Feb-2015',9.0)

INTO UtilisationTJB661 VALUES(125,'14-Feb-2015',10.25)

INTO UtilisationTJB661 VALUES(126,'14-Feb-2015',13.5)

INTO UtilisationTJB661 VALUES(127,'14-Feb-2015',5.5)

INTO UtilisationTJB661 VALUES(128,'14-Feb-2015',3.75)

INTO UtilisationTJB661 VALUES(129,'14-Feb-2015',10.0)

INTO UtilisationTJB661 VALUES(130,'14-Feb-2015',7.75)

INTO UtilisationTJB661 VALUES(131,'14-Feb-2015',5.25)

INTO UtilisationTJB661 VALUES(132,'14-Feb-2015',6.25)

SELECT 1 FROM DUAL;

SELECT 1 FROM DUAL;

ALTER TABLE UtilisationTJB661

ADD CONSTRAINT

FK_ConUtil1_Service

Foreign key(Service_ID)

References ServiceTJB661(Service_ID);

Figure 8. Utilisation Table

Page 16: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

14

Employee Table

The Employee table contains information on nursing and auxiliary staff employed in the surgical

wards.

CREATE TABLE EmployeeTJB661

(Emp_ID number(10) primary key not null,

Emp_First_Name varchar2(50),

Emp_Last_Name varchar2(50),

Position varchar2(50));

INSERT INTO

EmployeeTJB661

VALUES(220591,'Anne','Horgan','Senior Phlebotomist');

Figure 9. Employee Table

Sample Table

The Sample table holds information on blood test samples taken from patients during their hospital

stay. Each patient sample may be divided and undergo multiple blood tests as detailed in the Test

table.

Create Table SampleTJB661

(Sample_ID Number(10) primary key Not Null,

Patient_ID Number(10) Not Null,

Page 17: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

15

Test_Date date,

Employee_ID Number(10)Not Null);

INSERT ALL

INTO SampleTJB661 VALUES (1049,659222,'05-Feb-2015',220591)

INTO SampleTJB661 VALUES (1050,659536,'03-Feb-2015',220515)

INTO SampleTJB661 VALUES (1051,581229,'09-Feb-2015',220393)

INTO SampleTJB661 VALUES (1052,588772,'04-Feb-2015',220221)

INTO SampleTJB661 VALUES (1053,627391,'06-Feb-2015',220221)

INTO SampleTJB661 VALUES (1054,650097,'07-Feb-2015',220444)

INTO SampleTJB661 VALUES (1055,639696,'08-Feb-2015',220591)

INTO SampleTJB661 VALUES (1056,611396,'10-Feb-2015',220591)

INTO SampleTJB661 VALUES (1057,599062,'13-Feb-2015',220600)

INTO SampleTJB661 VALUES (1058,609655,'15-Feb-2015',220444)

SELECT * FROM DUAL;

ALTER TABLE SampleTJB661

ADD CONSTRAINT

FK_ConSamp1_Patient

Foreign key(Patient_ID)

References PatientTJB661(Patient_ID);

Figure 10. Sample Table

Page 18: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

16

Test Result Table

Each blood sample from a patient may be divided and undergo multiple tests, as detailed in the Test

table. Each result for each test is recorded in this Test Result table.

CREATE TABLE TEST_RESULTTJB661

(Test_ID Number (10) Not Null,

Sample_ID Number (10) Not Null,

Test_Result Decimal (5,2) Not Null,

Primary key(Test_ID,Sample_ID));

INSERT ALL

INTO TEST_RESULTTJB661 VALUES(121,1049,6.8)

INTO TEST_RESULTTJB661 VALUES(123,1049,13.4)

INTO TEST_RESULTTJB661 VALUES(129,1050,4.1)

INTO TEST_RESULTTJB661 VALUES(126,1050,3.6)

INTO TEST_RESULTTJB661 VALUES(125,1051,138)

INTO TEST_RESULTTJB661 VALUES(128,1051,2.56)

INTO TEST_RESULTTJB661 VALUES(129,1052,3.7)

INTO TEST_RESULTTJB661 VALUES(130,1052,5.2)

INTO TEST_RESULTTJB661 VALUES(122,1053,4.6)

INTO TEST_RESULTTJB661 VALUES(125,1053,133)

INTO TEST_RESULTTJB661 VALUES(127,1054,101)

INTO TEST_RESULTTJB661 VALUES(123,1054,8.1)

INTO TEST_RESULTTJB661 VALUES(121,1055,9.9)

INTO TEST_RESULTTJB661 VALUES(122,1055,4.9)

INTO TEST_RESULTTJB661 VALUES(123,1056,12.6)

INTO TEST_RESULTTJB661 VALUES(124,1056,141)

INTO TEST_RESULTTJB661 VALUES(125,1057,135)

INTO TEST_RESULTTJB661 VALUES(126,1057,4.8)

INTO TEST_RESULTTJB661 VALUES(129,1058,7.8)

Page 19: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

17

INTO TEST_RESULTTJB661 VALUES(130,1058,3.5)

SELECT * FROM DUAL;

ALTER TABLE Test_ResultTJB661

ADD CONSTRAINT

FK_ConTestRes1_Test

Foreign key(Test_ID)

References TestTJB661(Test_ID);

Figure 11. Test Result Table

Test Table The individual tests that a blood sample may undergo are detailed in this Test table, along with the

upper and lower limits that are recommended for the results of each. The units of measurement for

each test are also specified here.

CREATE TABLE TESTTJB661 (

Test_ID Number (5) primary key Not Null,

Test_Description VARCHAR2(30),

Lower_Limit Decimal (5,2) Not Null,

Upper_Limit Decimal (5,2) Not Null,

Units VARCHAR2(12)

);

Page 20: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

18

INSERT ALL

INTO TESTTJB661 VALUES(121,'WBC White Blood Cells',4.4,11.3,'x10E9/l')

INTO TESTTJB661 VALUES(122,'RBC Red Blood Cells',4.5,5.1,'x10E12/l')

INTO TESTTJB661 VALUES(123,'HB Haemoglobin',12.3,15.3,'g/dl')

INTO TESTTJB661 VALUES(124,'PLT Platelets',140,440,'x10E9/l')

INTO TESTTJB661 VALUES(125,'Sodium',132,144,'pmol/l')

INTO TESTTJB661 VALUES(126,'Potassium',3.5,5.0,'pmol/l')

INTO TESTTJB661 VALUES(127,'Chloride',95,107,'pmol/l')

INTO TESTTJB661 VALUES(128,'Calcium',2.1,2.62,'pmol/l')

INTO TESTTJB661 VALUES(129,'Cholesterol',3.5,5.0,'pmol/l')

INTO TESTTJB661 VALUES(130,'Urea',2.5,7.0,'pmol/l')

SELECT * FROM DUAL;

Figure 12. Test Table

Page 21: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

19

Part 3: SQL Queries This report will provide hospital management with information gleaned from the surgical department

database which minimises patient risk and maximises efficiency of utilisation of hospital services. The

following queries illustrate some examples of the types of SQL queries that can be used to extract

relevant and pertinent information from the system.

Query 1 Identification of Patients at Risk through Blood Testing Patients at risk of a negative outcome may be identified by means of an SQL query on their blood tests

results. On admission of the patient for surgery, a full range of blood tests are carried out and the

results queried in order to confirm that the patient is in optimum health prior to his/her procedure.

Each test result should be within the upper and lower limits for that particular test. Further blood tests

are conducted throughout the patient's hospital stay to ensure that recovery is progressing normally

and that the patient is in good health.

This query identifies patients whose test results fall outside those limits and, if conducted prior to

surgery, whose suitability for the treatment procedure may need be reassessed by their consultant.

SELECT P.Patient_ID,P.First_Name,P.Last_Name,S.Test_Date,T.Test_ID,T.Test_Description,R.Test_Result,T.Lower_Limit,T.Upper_Limit,T.Units

FROM Test_ResultTJB661 R,TestTJB661 T,SampleTJB661 S,PatientTJB661 P

WHERE T.Test_ID = R.Test_ID

AND S.Sample_ID = R.Sample_ID

AND P.Patient_ID = S.Patient_ID

AND (R.Test_Result < T.Lower_Limit

OR R.Test_Result > T.Upper_Limit);

Figure 13. Query 1 Identification of Patients at Risk through Blood Testing

Page 22: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

20

The result of the above query has identified that one patient, Kate Ryan, has haemoglobin levels well

below the lower limit. This indicates that her consultant should reassess her suitability for surgery;

she may require a blood transfusion prior to surgery or surgery may need to be postponed until her

haemoglobin levels recover to within normal limits. If no action is taken, this patient is at risk of

negative outcomes during surgery.

This query also identifies that another patient, Lisa Healy, has a cholesterol level elevated above the

upper limit and is consequently at increased risk of a heart attack. Her consultant needs to take

action to educate Lisa around health and lifestyle choices she can make to lower her cholesterol and

improve her heart health for the future.

Query 2 Identification of Patients at Risk through Air-Transmitted Infection

The accommodation of multiple patients in wards exposes patients to the risk of cross-infection by

airborne pathogens in the event of another patient in the ward suffering from a contagious condition.

On discovering that a patient has received a diagnosis of such a condition, the hospital management

are obliged to notify and test any patient that shared a ward with the infected patient during the time

that that patient may have been infectious.

This example assumes that a patient who was in Ward 10 on 09 February 2015 was subsequently

diagnosed with a highly infectious condition. The SQL query below allows management to identify the

patient information of any patient who was accommodated in Ward 10 on that day.

SELECT P.Patient_ID,P.First_Name,P.Last_Name

FROM PatientTJB661 P,AdmissionTJB661 A

WHERE P.Patient_ID=A.Patient_ID

AND A.Ward_no=10

AND '09-feb-15'between A.Admission_Date and A.Discharge_Date;

Figure 14. Query 2 Identification of Patients at Risk through Air-Transmitted Infection

Page 23: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

21

The result indicates that Mary Murphy was accommodated in Ward 10 on the date in question and

should undergo tests immediately.

Query 3 Identification of Patients at Risk from Infection through Consultant

A risk is posed to any patient who has undergone a treatment procedure under a consultant who, soon afterwards, becomes ill as the consultant may have been unwittingly incubating infection at the time. On discovering that a consultant has become ill, the hospital management are obliged to notify and test any patient that has been in contact with him/her in a particular timeframe. This would allow them to monitor that patient closely for infection and provide the best possible care.

In this example, consultant Mary Smith was taken ill on the evening of 15 Feb 2015. This SQL query selects all patients that underwent a procedure under Dr Smith on that day.

Select P.Patient_ID,P.First_Name,P.Last_Name

from BookingTJB661 B, PatientTJB661 P, Consultanttjb661 C

where C.Consultant_ID=B.Consultant_ID

and P.Patient_ID=B.Patient_ID

and B.Booking_Date='15-feb-15'

and C.Consultant_First_Name='Mary'

and C.Consultant_Last_Name='Smith';

Figure 15. Query 3 Identification of Patients at Risk from Infection through Consultant

Peter Cashman underwent a treatment procedure under Dr. Mary Smith on that date and should be

monitored carefully for signs of infection and/or considered for a prophylactic course of antibiotics.

Page 24: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

22

Query 4 Identification of Patients at Risk of Infection at time of Taking Blood Sample

Stringent hygiene and best practices for the taking of blood samples from patients are in place

throughout the hospital system for the protection of patients. Where these procedures are breached,

some risk is posed to patients.

In this example, it has come to hospital management attention that Nurse Mary Murphy has taken

blood samples from patients without wearing gloves. This query identifies all patients from whom

Mary took blood samples.

SELECT P.Patient_ID,P.First_Name,P.Last_Name,Test_Date

FROM PatientTJB661 P,SampleTJB661 S,EmployeeTJB661 E

WHERE P.Patient_ID=S.Patient_ID

AND E.Emp_ID=S.Employee_ID

AND Emp_First_Name='Mary'

AND Emp_Last_Name='Crowley';

Figure 16. Query 4 Identification of Patients at Risk of Infection at time of Taking Blood Sample

Both Kate Ryan and Lisa Healy have had blood samples drawn by Nurse Mary Crowley and their body

temperature should be carefully monitored for signs of infection for a number of days.

Query 5 Identification of Under-Utilised Hospital Services

The efficient running of the hospital's surgical department requires that any available services (i.e.

operating theatres, X-ray machines or MRI scanners) that are being underused be identified. This

information can then be acted upon to increase the number of bookings to these services that are

facilitated by the system. Should no further demand for these services exist, efficiency can be

increased by the temporary closure of some.

Page 25: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

23

In the surgical department setting, it is challenging to schedule services for some treatment

procedures as the time required to carry out the same procedure varies with each case. Therefore

some buffer has been included here and this SQL query identifies services that are being utilised to

less than 80% of their daily capacity. The results are displayed here in ascending order of most under-

utilised service.

SELECT S.Service_ID,S.Service_Name,U.Utilisation_Date,U.Usage,S.Capacity,ROUND((U.Usage/S.Capacity)*100,0) AS "PERCENTAGE_UTILISATION"

FROM UtilisationTJB661 U,ServiceTJB661 S

WHERE U.Service_ID=S.Service_ID

AND U.Usage < (S.Capacity*0.80)

ORDER BY PERCENTAGE_UTILISATION ASC;

Figure 17. Query 5 Identification of Under-Utilised Hospital Services

The results are displayed here in ascending order of most under-utilised service assisting hospital

management in their identification of the poorest performing services. They can then plan to increase

bookings in the services in question or formulate cost-saving temporary closures as appropriate.

Query 6 Identification of Over-Utilised Hospital Services

The hospital management can optimise the efficient running of the hospital's surgical department by

identifying where services may be consistently over-utilised. They are then in a position to improve

their services usage by balancing the treatment procedure workload more evenly over the services

available to them. Again, due to difficulties in predicting the duration of many procedures, some

leeway has been allowed and services that are being utilised to more than 120% capacity are

identified. The results are displayed here in descending order from the most over-utilised services.

Page 26: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

24

SELECT S.Service_ID,S.Service_Name,U.Utilisation_Date,U.Usage,S.Capacity,ROUND((U.Usage/S.Capacity)*100,0) AS "PERCENTAGE_UTILISATION"

FROM UtilisationTJB661 U,ServiceTJB661 S

WHERE U.Service_ID=S.Service_ID

AND U.Usage > (S.Capacity*1.20)

ORDER BY PERCENTAGE_UTILISATION DESC;

Figure 18. Query 6 Identification of Over-Utilised Hospital Services

The results are displayed here in descending order from the most over-utilised services to assist

hospital management in their deliberations. This information should be considered in conjunction

with the results of Query 5 so that utilisation of similar services can be balanced more effectively.

Query 7 Identification of the Operating Theatre with the Highest Usage

Should hospital management require more granular data to aid their balancing efforts, the Operating

Theatre with the highest usage can be isolated. This query could be amended to select the most

utilised of any type of hospital service.

SELECT U.Utilisation_Date,S.Service_Name,U.Usage

FROM UtilisationTJB661 U,ServiceTJB661 S

WHERE U.SERVICE_ID = S.SERVICE_ID

AND U.Usage=

(SELECT MAX(U.Usage)

FROM UtilisationTJB661 U,ServiceTJB661 S

WHERE S.Service_Name like '%Operating Theatre%'

AND S.Service_ID=U.Service_ID);

Page 27: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

25

Figure 19. Query 7 Identification of the Operating Theatre with the Highest Usage

The results show that the usage of Operating Theatre 4 on 14 February was the highest usage

recorded.

Query 7 Overview of Hospital Services Usage

Some further queries on usage pattern of hospital services provide additional depth and statistical

analysis. These reports provide an effective overview of the utilisation situation when considered by

hospital management as a collection.

SELECT S.SERVICE_NAME, ROUND(MIN(U.USAGE)) AS "MIN_USAGE", ROUND(AVG(U.USAGE)) AS "AVG_USAGE", ROUND(MAX(U.USAGE)) AS "MAX_USAGE"

FROM UTILISATIONTJB661 U, SERVICETJB661 S

WHERE U.SERVICE_ID = S.SERVICE_ID

GROUP BY S.SERVICE_NAME

ORDER BY S.SERVICE_NAME;

Figure 20 Query 7(a) Minimum, Average and Maximum Usage of Hospital Services

Page 28: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

26

This query relating to Minimum, Average and Maximum Usage per Service Points out where there are

large variations in usage of services that may be difficult for hospital management to handle due to

the allocation of staff and other resources. This is a very useful overview report for hospital

management to monitor the ongoing situation.

SELECT U.Utilisation_Date,S.Service_ID,S.Service_Name,U.Usage,S.Capacity

FROM UtilisationTJB661 U,ServiceTJB661 S

WHERE U.Service_ID=S.Service_ID

AND U.Usage > S.Capacity;

Figure 21. Query 7(b) Hospital Services where Usage exceeds Capacity

This report displays a summary of all under-utilised services where usage exceeds capacity so that

hospital management can identify all under-performing services at a glance.

SELECT Service_ID,avg(Usage)

FROM UtilisationTJB661

GROUP BY Service_ID

HAVING avg(Usage)<7;

Page 29: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

27

Figure 22. Query 7(c) Hospital services with Average Daily Usage of less than 7 hours

This query identifies services with average usage of less than 7 hours/day throughout our Utilisation

records. This highlights the most consistently under-utilised services for hospital management to

consider.

Query 8 Number of Bookings per Service per Date

In the case of an Operating Theatre which is dedicated to routine procedures where procedure

duration can be estimated with some degree of accuracy (for example, a colonoscopy), an X-ray

machine or an MRI scanner, it is useful for management to identify the number of bookings that have

been booked for a particular day. This can provide insight into the predicted utilisation of a service for

a future date, thereby facilitating the filling of vacant slots by additional bookings from the waiting

list.

SELECT S.SERVICE_NAME, B.BOOKING_DATE, COUNT(B.BOOKING_ID) AS "NUM_BOOKINGS"

FROM SERVICETJB661 S, BOOKINGTJB661 B

WHERE S.SERVICE_ID = B.SERVICE_ID

GROUP BY S.SERVICE_NAME, B.BOOKING_DATE

ORDER BY S.SERVICE_NAME, B.BOOKING_DATE;

Figure 23. Query 8 Number of Bookings per Service per Date

Page 30: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

28

Query 9 Identification of Hospital Services without Bookings

Efficiency of the running of the surgical department can be further enhanced using the information

available regarding the bookings of hospital services. If a particular service is completely without

bookings on a particular day, hospital management will be able to temporarily close that service for

that day and make cost-saving adjustments to their staffing levels, cleaning services, etc.

This example selects details of all Services which do not have any bookings on 14 February 2015.

SELECT *

FROM SERVICETJB661

WHERE SERVICE_ID NOT IN

(SELECT DISTINCT B.SERVICE_ID

FROM BOOKINGTJB661 B

WHERE B.Booking_Date='14-Feb-15')

ORDER BY SERVICE_ID;

Figure 24. Query 9 Identification of Hospital Services without Bookings

Query 10 Identification of Date for 6-week Post-Operative Check-up Appointment

Patients that undergo surgery require to be seen by their consultant 6-weeks after their operation for

a check-up in order to minimise post-operative risks.

In this example, consultants run clinics for check-ups on Thursdays only so the appointment date will

be scheduled for the first Thursday after a patient's procedure booking date. This SQL query returns

an instruction report for administrative staff who are tasked with sending out check-up appointments

to surgical patients.

Page 31: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

29

SELECT 'Make an appointment for '||P.First_Name||' '||P.Last_Name||' '||'with '||C.Consultant_First_Name||' '||C.Consultant_Last_Name||' on '||((next_day(B.Booking_Date,'Thursday'))+42) AS "INSTRUCTION"

FROM PatientTJB661 P,ConsultantTJB661 C,BOOKINGTJB661 B

WHERE P.Patient_ID=B.Patient_ID

AND C.Consultant_ID=B.Consultant_ID;

Figure 25. Query 10 Identification of Date for 6-week Post-Operative Check-up

Page 32: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

30

Part 4: Securing Patient Data using Oracle The sensitive nature of the data in our EHRs necessitates the most stringent of data security settings.

A variety of security threats from internal and external sources deserve consideration, some human

and others technological. Data management training and regular upskilling is important to offset

human error and misuse while Oracle offers a range of preventive, detective and administrative

features, as described in Forrester's 2010 report (Figure 1) to counteract technological elements.

Figure 26. Three Pillars of Enterprise Database Security (Forrester, 2010)

Oracle security features such as regular patching, strong AAA standards and establishing multi-layer

protection through physical (e.g. device isolation) and technical safeguards (e.g. firewalls, secure

transmission modes and encryption).

The principle of least privilege states that users should be given the least amount of privileges to

perform their jobs. Overly ambitious granting of privileges which may be an issue in hospitals where

there is an often an imbalance between staff levels and work to be completed leaving a system open

for abuse and intrusion. User privileges should be reviewed periodically to determine relevance to

current job responsibilities.

Page 33: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

31

Conclusion This report has described the design and creation of a valuable surgical department database and

illustrated a small sample of the information available to hospital management through its effective

querying and understanding of EHRs. These EHRs are the key to effective and efficient hospital

operations - providing the highest possible level of patient care and making cost savings with minimal

reductions in patient services, while offering the highest level of patient data privacy and security.

It is hoped that this system provides beneficial guidance in control and planning functions in this

department and provides a template for its extension to other hospital departments and functions.

References Forrester Research, 2010. Yuhanna, Noel, "Your Enterprise Database Security Strategy"

Oracle Security Overview 10g Release, Oracle Security Products and Features,

http://docs.oracle.com/cd/B12037_01/network.101/b10777/galsyste.htm. Accessed 19 March

2015

Page 34: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

32

Appendix 1

Page 35: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

33

Page 36: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

34

Appendix 2 Alter Assessment Table

ALTER TABLE AssessmentTJB661

ADD CONSTRAINT

FK_ConAssess1_Patient

Foreign key(Patient_ID)

References PatientTJB661(Patient_ID);

ALTER TABLE AssessmentTJB661

ADD CONSTRAINT

FK_ConAssess2_Consultant

Foreign key(Consultant_ID)

References ConsultantTJB661(Consultant_ID);

ALTER TABLE AssessmentTJB661

ADD CONSTRAINT

FK_ConAssess3_Employee

Foreign key(Emp_ID)

References EmployeeTJB661(Emp_ID);

Insert into Booking Table

INSERT ALL

INTO BookingTJB661 VALUES(56320,588772,'12-Feb-2015',21493,9002,132)

INTO BookingTJB661 VALUES(56321,639696,'12-Feb-2015',84263,2287,127)

INTO BookingTJB661 VALUES(56322,609655,'12-Feb-2015',21493,7481,124)

INTO BookingTJB661 VALUES(56323,627391,'13-Feb-2015',75526,5679,123)

INTO BookingTJB661 VALUES(56324,659222,'13-Feb-2015',25252,8091,125)

INTO BookingTJB661 VALUES(56325,659536,'13-Feb-2015',15599,4326,130)

INTO BookingTJB661 VALUES(56326,588772,'13-Feb-2015',21493,1098,124)

INTO BookingTJB661 VALUES(56327,659222,'13-Feb-2015',30510,7481,125)

Page 37: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

35

INTO BookingTJB661 VALUES(56328,609655,'13-Feb-2015',21493,9002,132)

INTO BookingTJB661 VALUES(56329,650097,'13-Feb-2015',15599,1311,125)

SELECT 1 FROM DUAL;

Alter Booking Table

ALTER TABLE BookingTJB661

ADD CONSTRAINT

FK_ConBook2_Service

Foreign key(Service_ID)

References ServiceTJB661(Service_ID);

ALTER TABLE BookingTJB661

ADD CONSTRAINT

FK_ConBook3_Consultant

Foreign key(Consultant_ID)

References ConsultantTJB661(Consultant_ID);

ALTER TABLE BookingTJB661

ADD CONSTRAINT

FK_ConBook4_Patient

Foreign key(Patient_ID)

References PatientTJB661(Patient_ID);

Insert into Utilisation Table

INSERT ALL

INTO UtilisationTJB661 VALUES(123,'15-Feb-2015',12.00)

INTO UtilisationTJB661 VALUES(124,'15-Feb-2015',9.5)

INTO UtilisationTJB661 VALUES(125,'15-Feb-2015',11.5)

INTO UtilisationTJB661 VALUES(126,'15-Feb-2015',12.25)

INTO UtilisationTJB661 VALUES(127,'15-Feb-2015',6.0)

Page 38: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

36

INTO UtilisationTJB661 VALUES(128,'15-Feb-2015',5.5)

INTO UtilisationTJB661 VALUES(129,'15-Feb-2015',10.75)

INTO UtilisationTJB661 VALUES(130,'15-Feb-2015',8.25)

INTO UtilisationTJB661 VALUES(131,'15-Feb-2015',7.25)

INTO UtilisationTJB661 VALUES(132,'15-Feb-2015',5.25)

Insert into Employee table

INSERT INTO

EmployeeTJB661

VALUES(497365,'Bernadette','Fahy','Senior Phlebotomist');

INSERT INTO

EmployeeTJB661

VALUES(220515,'Mary','Donovan','Staff Nurse');

INSERT INTO

EmployeeTJB661

VALUES(220393,'Evelyn','Cronin','Phlebotomist');

INSERT INTO

EmployeeTJB661

VALUES(220221,'Jo','Hill','Phlebotomist');

INSERT INTO

EmployeeTJB661

VALUES(614252,'Julianne','Twomey','Staff Nurse');

INSERT INTO

EmployeeTJB661

VALUES(220444,'Mary','Crowley','Staff Nurse');

Page 39: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

37

INSERT INTO

EmployeeTJB661

VALUES(365088,'Catherine','Redmond','Phlebotomist');

INSERT INTO

EmployeeTJB661

VALUES(762473,'Una','Mahony','Phlebotomist');

INSERT INTO

EmployeeTJB661

VALUES(220600,'Ciara','Whelan','Phlebotomist');

Alter Sample Table

ALTER TABLE SampleTJB661

ADD CONSTRAINT

FK_ConSamp2_Employee

Foreign key(Employee_ID)

References EmployeeTJB661(Emp_ID);

Alter Test Result Table

ALTER TABLE Test_ResultTJB661

ADD CONSTRAINT

FK_ConTestRes2_Sample

Foreign key(Sample_ID)

References SampleTJB661(Sample_ID);

Page 40: IS 6156 Jean Donnelly 90079094 Brendan McSweeney 114223513 Tim Walsh 102859661

38