-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackup-cse360.sql
228 lines (193 loc) · 8.29 KB
/
backup-cse360.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
-- phpMyAdmin SQL Dump
-- version 4.1.14
-- http://www.phpmyadmin.net
--
-- Database: `cse360`
--
CREATE DATABASE IF NOT EXISTS `cse360` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `cse360`;
-- Table structure for table `alerts'
CREATE TABLE IF NOT EXISTS `alerts` (
`alert_id` int(11) NOT NULL AUTO_INCREMENT,
`AlertActive` tinyint(1) NOT NULL DEFAULT '1',
`alert_reason` varchar(5000) DEFAULT NULL,
`doctor_id` int(11) NOT NULL DEFAULT '0',
`patient_id` int(11) NOT NULL,
`alertDateAndTime` varchar(255) DEFAULT NULL,
PRIMARY KEY (`alert_id`),
UNIQUE KEY `alertId_UNIQUE` (`alert_id`),
KEY `patient_id` (`patient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2000 ;
-- Table structure for table `appointment`
CREATE TABLE IF NOT EXISTS `appointment` (
`serialNumber` int(100) NOT NULL AUTO_INCREMENT,
`date` varchar(100) NOT NULL,
`time` varchar(100) NOT NULL,
`doctorID` int(10) NOT NULL,
`reason` varchar(500) DEFAULT NULL,
`patientID` int(10) DEFAULT NULL,
PRIMARY KEY (`serialNumber`),
KEY `doctorID` (`doctorID`),
KEY `patientID` (`patientID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=60 ;
-- Table structure for table `labtest`
CREATE TABLE IF NOT EXISTS `labtest` (
`serialNumber` int(100) NOT NULL AUTO_INCREMENT,
`patientID` int(10) NOT NULL,
`staffID` int(10) NOT NULL,
`labType` varchar(500) DEFAULT NULL,
`labReport` varchar(5000) DEFAULT NULL,
`date` varchar(500) DEFAULT NULL,
PRIMARY KEY (`serialNumber`),
KEY `patientID` (`patientID`),
KEY `labTest_ibfk_2` (`staffID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- Table structure for table `patient`
CREATE TABLE IF NOT EXISTS `patient` (
`serialNumber` int(100) NOT NULL AUTO_INCREMENT,
`patientID` int(10) NOT NULL,
`medicalHistory` varchar(5000) DEFAULT NULL,
`occupation` enum('patient') NOT NULL,
`address` varchar(200) DEFAULT NULL,
`SSN` varchar(50) DEFAULT NULL,
`gender` varchar(100) DEFAULT NULL,
`insurance` varchar(100) DEFAULT NULL,
`age` varchar(10) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`healthConditions` varchar(5000) DEFAULT NULL,
`date` varchar(500) DEFAULT NULL,
PRIMARY KEY (`serialNumber`),
UNIQUE KEY `patientID` (`patientID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- Table structure for table `person`
CREATE TABLE IF NOT EXISTS `person` (
`userID` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`occupation` enum('labstaff','doctor','patient','hsp') NOT NULL DEFAULT 'patient',
`password` varchar(100) NOT NULL,
`emailID` varchar(100) NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1001 ;
-- Dumping data for table `person`
INSERT INTO `person` (`userID`, `name`, `occupation`, `password`, `emailID`) VALUES
(501, 'Doctor Ryan:Ang', 'doctor', 'go', 'ryan@asu.edu'),
(502, 'Doctor Daniel:DSouza', 'doctor', 'go', 'Dan1@asu.edu'),
(503, 'Doctor James:Hutchins', 'doctor', 'go', 'james1@asu.edu'),
(504, 'Doctor Cameron:Dudley', 'doctor', 'go', 'cameron1@asu.edu'),
(505, 'Doctor Haisheng:Lin', 'doctor', 'go', 'Haishen1@asu.edu'),
(506, 'Doctor Jaime:Romero', 'doctor', 'go', 'Jaime@asu.edu'),
(507, 'Doctor Vincent:Rose', 'doctor', 'go', 'Vrose@asu.edu'),
(508, 'Doctor Abyhishek:Venkata', 'doctor', 'go', 'Aby@asu.edu'),
(509, 'Doctor Rie:Hinze', 'doctor', 'go', 'Rie12@asu.edu'),
(510, 'Doctor Stephanie:Bui', 'doctor', 'go', 'Steph@asu.edu'),
(511, 'The 11th Doctor:', 'doctor', 'go', 'WHERE@at.now'),
(512, 'Hannah:', 'hsp', 'go', 'ryaaan@asu.edu'),
(513, 'Rick:', 'hsp', 'go', 'ryanad@asu.edu'),
(514, 'Kevin:', 'hsp', 'go', 'ryanad@asu.edu'),
(515, 'Eric:', 'hsp', 'go', 'ryanad@asu.edu'),
(516, 'John:', 'hsp', 'go', 'ryanad@asu.edu'),
(517, 'Gabriela:', 'labstaff', 'go', 'ryanad@asu.edu'),
(518, 'Troy:', 'labstaff', 'go', 'ryanad@asu.edu'),
(519, 'Derrick:', 'labstaff', 'go', 'ryanad@asu.edu'),
(520, 'Terrence:', 'labstaff', 'go', 'ryanad@asu.edu'),
(521, 'Doctor Dre:', 'labstaff', 'go', 'ryanad@asu.edu');
CREATE TABLE IF NOT EXISTS `master` (
`type` varchar(500) DEFAULT NULL,
`password` varchar(500) DEFAULT NULL
);
INSERT INTO `master` (`type`, `password`) VALUES
('MasterPanel', 'RyanR0cks');
-- Table structure for table `prescription`
CREATE TABLE IF NOT EXISTS `prescription` (
`serialNumber` int(100) NOT NULL AUTO_INCREMENT,
`patientID` int(10) NOT NULL,
`staffID` int(10) NOT NULL,
`type` varchar(500) DEFAULT NULL,
`quantity` varchar(500) DEFAULT NULL,
`date` varchar(500) DEFAULT NULL,
PRIMARY KEY (`serialNumber`),
KEY `patientID` (`patientID`),
KEY `prescription_ibfk_2` (`staffID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- Table structure for table `staff`
CREATE TABLE IF NOT EXISTS `staff` (
`serialNumber` int(100) NOT NULL AUTO_INCREMENT,
`staffID` int(10) NOT NULL,
`occupation` enum('labstaff','doctor','hsp') NOT NULL,
`specialty` varchar(100) NOT NULL,
`patientID` int(10) DEFAULT NULL,
`schedule` varchar(100) DEFAULT NULL,
`emergencyWardDoctor` enum('yes','no') DEFAULT 'yes',
PRIMARY KEY (`serialNumber`),
UNIQUE KEY `staffID` (`staffID`),
KEY `patientID` (`patientID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=22 ;
-- Dumping data for table `staff`
INSERT INTO `staff` (`serialNumber`, `staffID`, `occupation`, `specialty`, `patientID`, `schedule`, `emergencyWardDoctor`) VALUES
(1, 501, 'doctor', 'Emergency', NULL, NULL, 'no'),
(2, 502, 'doctor', 'GeneralCare', NULL, NULL, 'no'),
(3, 503, 'doctor', 'Neurologist', NULL, NULL, 'no'),
(4, 504, 'doctor', 'GeneralCare', NULL, NULL, 'no'),
(5, 505, 'doctor', 'GeneralCare', NULL, NULL, 'no'),
(6, 506, 'doctor', 'X-Ray', NULL, NULL, 'no'),
(7, 507, 'doctor', 'X-Ray', NULL, NULL, 'no'),
(8, 508, 'doctor', 'Pediatrician', NULL, NULL, 'no'),
(9, 509, 'doctor', 'Emergency', NULL, NULL, 'yes'),
(10, 510, 'doctor', 'Pediatrician', NULL, NULL, 'yes'),
(11, 511, 'doctor', 'Pediatrician', NULL, NULL, 'no'),
(12, 512, 'hsp', 'hsp', NULL, NULL, 'no'),
(13, 513, 'hsp', 'hsp', NULL, NULL, 'no'),
(14, 514, 'hsp', 'hsp', NULL, NULL, 'no'),
(15, 515, 'hsp', 'hsp', NULL, NULL, 'no'),
(16, 516, 'hsp', 'hsp', NULL, NULL, 'no'),
(17, 517, 'labstaff', 'labstaff', NULL, NULL, 'no'),
(18, 518, 'labstaff', 'labstaff', NULL, NULL, 'no'),
(19, 519, 'labstaff', 'labstaff', NULL, NULL, 'no'),
(20, 520, 'labstaff', 'labstaff', NULL, NULL, 'no'),
(21, 521, 'labstaff', 'labstaff', NULL, NULL, 'no');
-- Table structure for table `statistics`
CREATE TABLE IF NOT EXISTS `statistics` (
`serialNumber` int(10) NOT NULL AUTO_INCREMENT,
`patientPopulation` int(10) DEFAULT NULL,
`patientType` varchar(500) DEFAULT NULL,
`admissionRates` double DEFAULT NULL,
`healthOutcomes` varchar(500) DEFAULT NULL,
`date` varchar(500) DEFAULT NULL,
PRIMARY KEY (`serialNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
-- Dumping data for table `statistics`
INSERT INTO `statistics` (`serialNumber`, `patientPopulation`, `patientType`, `admissionRates`, `healthOutcomes`, `date`) VALUES
(1, 25, NULL, 2.2, 'positive', NULL);
-- Constraints for table `alerts`
--
ALTER TABLE `alerts`
ADD CONSTRAINT `alerts_ibfk_1` FOREIGN KEY (`patient_id`) REFERENCES `patient` (`patientID`);
--
-- Constraints for table `appointment`
--
ALTER TABLE `appointment`
ADD CONSTRAINT `appointment_ibfk_1` FOREIGN KEY (`doctorID`) REFERENCES `staff` (`staffID`),
ADD CONSTRAINT `appointment_ibfk_2` FOREIGN KEY (`patientID`) REFERENCES `patient` (`patientID`);
--
-- Constraints for table `labtest`
--
ALTER TABLE `labtest`
ADD CONSTRAINT `labTest_ibfk_1` FOREIGN KEY (`patientID`) REFERENCES `patient` (`patientID`),
ADD CONSTRAINT `labTest_ibfk_2` FOREIGN KEY (`staffID`) REFERENCES `staff` (`staffID`);
--
-- Constraints for table `patient`
--
ALTER TABLE `patient`
ADD CONSTRAINT `patient_ibfk_1` FOREIGN KEY (`patientID`) REFERENCES `person` (`userID`) ON DELETE CASCADE;
--
-- Constraints for table `prescription`
--
ALTER TABLE `prescription`
ADD CONSTRAINT `prescription_ibfk_1` FOREIGN KEY (`patientID`) REFERENCES `patient` (`patientID`),
ADD CONSTRAINT `prescription_ibfk_2` FOREIGN KEY (`staffID`) REFERENCES `staff` (`staffID`);
--
-- Constraints for table `staff`
--
ALTER TABLE `staff`
ADD CONSTRAINT `staff_ibfk_1` FOREIGN KEY (`staffID`) REFERENCES `person` (`userID`) ON DELETE CASCADE ,
ADD CONSTRAINT `staff_ibfk_2` FOREIGN KEY (`patientID`) REFERENCES `patient` (`patientID`);