From 5e04f75c0bdadec6b0cbb1c22a8fb4b79467303d Mon Sep 17 00:00:00 2001
From: ahmadaldhalaan <46313624+ahmadaldhalaan@users.noreply.github.com>
Date: Fri, 20 Nov 2020 11:05:15 +1100
Subject: [PATCH] updated deadPatient SQL files and updated
 ViewPatientOfficeVisitHistoryActionTest and MedicalReportFilterTest to
 reflect database changes

---
 iTrust/sql/data/deadPatient1.sql                  | 15 +++++++++++----
 iTrust/sql/data/deadPatient10.sql                 | 14 ++++++++++----
 iTrust/sql/data/deadPatient2.sql                  | 14 ++++++++++----
 iTrust/sql/data/deadPatient3.sql                  | 15 +++++++++++----
 iTrust/sql/data/deadPatient4.sql                  | 15 +++++++++++----
 iTrust/sql/data/deadPatient5.sql                  | 15 +++++++++++----
 iTrust/sql/data/deadPatient6.sql                  | 15 +++++++++++----
 iTrust/sql/data/deadPatient7.sql                  | 14 +++++++++++---
 iTrust/sql/data/deadPatient8.sql                  | 15 +++++++++++----
 iTrust/sql/data/deadPatient9.sql                  | 14 ++++++++++----
 .../ViewPatientOfficeVisitHistoryActionTest.java  |  2 +-
 .../unit/report/MedicalReportFilterTest.java      |  2 +-
 12 files changed, 109 insertions(+), 41 deletions(-)

diff --git a/iTrust/sql/data/deadPatient1.sql b/iTrust/sql/data/deadPatient1.sql
index ca62187..4621ff8 100644
--- a/iTrust/sql/data/deadPatient1.sql
+++ b/iTrust/sql/data/deadPatient1.sql
@@ -1,8 +1,15 @@
+DELETE FROM users WHERE MID = 81;
+DELETE FROM officevisits WHERE PatientID = 81;
 DELETE FROM patients WHERE MID = 81;
 
-INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (81,'Male','2019-07-01',84.50);
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (81, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (81,'Male','2019-07-01',84.50) 
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (201,9000000000,81);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20771,'2019-07-01',9000000000,'died','1',81)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient10.sql b/iTrust/sql/data/deadPatient10.sql
index a50864f..2f9d356 100644
--- a/iTrust/sql/data/deadPatient10.sql
+++ b/iTrust/sql/data/deadPatient10.sql
@@ -1,9 +1,15 @@
+DELETE FROM users WHERE MID = 90;
+DELETE FROM officevisits WHERE PatientID = 90;
 DELETE FROM patients WHERE MID = 90;
 
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (90, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
 INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (90,'Male','2019-01-01',487.00);
+    VALUES (90,'Male','2019-01-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (210,9000000001,90);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20780,'2019-01-01',9000000003,'died','1',90)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient2.sql b/iTrust/sql/data/deadPatient2.sql
index c549a93..b8986ae 100644
--- a/iTrust/sql/data/deadPatient2.sql
+++ b/iTrust/sql/data/deadPatient2.sql
@@ -1,9 +1,15 @@
+DELETE FROM users WHERE MID = 82;
+DELETE FROM officevisits WHERE PatientID = 82;
 DELETE FROM patients WHERE MID = 82;
 
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (82, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
 INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (82,'Male','2018-07-01',11.40);
+    VALUES (82,'Male','2018-07-01',11.40)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (202,9000000000,82);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20772,'2018-07-01',9000000000,'died','1',82)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient3.sql b/iTrust/sql/data/deadPatient3.sql
index 86785ac..e8a44af 100644
--- a/iTrust/sql/data/deadPatient3.sql
+++ b/iTrust/sql/data/deadPatient3.sql
@@ -1,8 +1,15 @@
+DELETE FROM users WHERE MID = 83;
+DELETE FROM officevisits WHERE PatientID = 83;
 DELETE FROM patients WHERE MID = 83;
 
-INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (83,'Female','2018-07-01',11.40);
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (83, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (83,'Female','2018-07-01',11.40)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (203,9000000000,83);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20773,'2018-07-01',9000000000,'died','1',83)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient4.sql b/iTrust/sql/data/deadPatient4.sql
index ef931b2..8eb604f 100644
--- a/iTrust/sql/data/deadPatient4.sql
+++ b/iTrust/sql/data/deadPatient4.sql
@@ -1,8 +1,15 @@
+DELETE FROM users WHERE MID = 84;
+DELETE FROM officevisits WHERE PatientID = 84;
 DELETE FROM patients WHERE MID = 84;
 
-INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (84,'Male','2018-12-01',11.40);
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (84, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (84,'Male','2018-12-01',11.40)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (204,9000000000,84);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20774,'2018-12-01',9000000000,'died','1',84)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient5.sql b/iTrust/sql/data/deadPatient5.sql
index 1cfb936..e8c854e 100644
--- a/iTrust/sql/data/deadPatient5.sql
+++ b/iTrust/sql/data/deadPatient5.sql
@@ -1,8 +1,15 @@
+DELETE FROM users WHERE MID = 85;
+DELETE FROM officevisits WHERE PatientID = 85;
 DELETE FROM patients WHERE MID = 85;
 
-INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (85,'Male','2020-01-01',84.50);
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (85, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (85,'Male','2020-01-01',84.50)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (205,9000000000,85);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20775,'2020-01-01',9000000000,'died','1',85)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient6.sql b/iTrust/sql/data/deadPatient6.sql
index acc6de6..b773a97 100644
--- a/iTrust/sql/data/deadPatient6.sql
+++ b/iTrust/sql/data/deadPatient6.sql
@@ -1,8 +1,15 @@
+DELETE FROM users WHERE MID = 86;
+DELETE FROM officevisits WHERE PatientID = 86;
 DELETE FROM patients WHERE MID = 86;
 
-INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (86,'Male','2018-12-01',487.00);
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (86, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (86,'Male','2018-12-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (206,9000000000,86);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20776,'2018-12-01',9000000000,'died','1',86)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient7.sql b/iTrust/sql/data/deadPatient7.sql
index 90d7a12..51217ef 100644
--- a/iTrust/sql/data/deadPatient7.sql
+++ b/iTrust/sql/data/deadPatient7.sql
@@ -1,8 +1,16 @@
+DELETE FROM users WHERE MID = 87;
+DELETE FROM officevisits WHERE PatientID = 87;
 DELETE FROM patients WHERE MID = 87;
 
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (87, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
+
 INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (87,'Female','2019-12-01',487.00);
+    VALUES (87,'Female','2019-12-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20777,'2019-12-01',9000000003,'died','1',87)
+    ON DUPLICATE KEY UPDATE id = id;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (207,9000000001,87);
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient8.sql b/iTrust/sql/data/deadPatient8.sql
index cdb5b5b..0542fb5 100644
--- a/iTrust/sql/data/deadPatient8.sql
+++ b/iTrust/sql/data/deadPatient8.sql
@@ -1,8 +1,15 @@
+DELETE FROM users WHERE MID = 88;
+DELETE FROM officevisits WHERE PatientID = 88;
 DELETE FROM patients WHERE MID = 88;
 
-INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (88,'Female','2020-07-01',487.00);
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (88, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
+INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
+    VALUES (88,'Female','2020-07-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (208,9000000001,88);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20778,'2020-07-01',9000000003,'died','1',88)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/sql/data/deadPatient9.sql b/iTrust/sql/data/deadPatient9.sql
index 1eb7f10..46f0010 100644
--- a/iTrust/sql/data/deadPatient9.sql
+++ b/iTrust/sql/data/deadPatient9.sql
@@ -1,9 +1,15 @@
+DELETE FROM users WHERE MID = 89;
+DELETE FROM officevisits WHERE PatientID = 89;
 DELETE FROM patients WHERE MID = 89;
 
+INSERT INTO users(MID, password, role, sQuestion, sAnswer) 
+	VALUES (89, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'patient', 'what is your favorite color?', 'blue')
+    ON DUPLICATE KEY UPDATE MID = MID;
 
 INSERT INTO patients (MID, Gender, DateOfDeath, CauseOfDeath) 
-VALUES (89,'Male','2020-01-01',487.00);
+    VALUES (89,'Male','2020-01-01',487.00)
+    ON DUPLICATE KEY UPDATE MID = MID;
 
-
-INSERT INTO officevisits(id,HCPID,PatientID)
-VALUES (209,9000000001,89);
\ No newline at end of file
+INSERT INTO officevisits(id,visitDate,HCPID,notes,HospitalID,PatientID)
+    VALUES (20779,'2020-01-01',9000000003,'died','1',89)
+    ON DUPLICATE KEY UPDATE id = id;
\ No newline at end of file
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java
index c94a1dc..a215b9c 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPatientOfficeVisitHistoryActionTest.java
@@ -41,7 +41,7 @@ public class ViewPatientOfficeVisitHistoryActionTest extends TestCase{
 	 */
 	public void testGetPatients() throws Exception {
 		List<PatientVisitBean> list = action.getPatients();
-		assertEquals(57, list.size());
+		assertEquals(67, list.size());
 		assertEquals("31", list.get(21).getLastOVDateD());
 		assertEquals("03", list.get(21).getLastOVDateM());
 	}
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java
index e91b276..7ae6a6a 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/report/MedicalReportFilterTest.java
@@ -68,7 +68,7 @@ public class MedicalReportFilterTest extends TestCase {
 	public void testFilterByLowerOfficeVisit() throws Exception {
 		filter = new MedicalReportFilter(MedicalReportFilterType.LOWER_OFFICE_VISIT_DATE, "01/01/2012", factory);
 		List<PatientBean> res = filter.filter(allPatients);
-		assertEquals(14, res.size());
+		assertEquals(24, res.size());
 		assertTrue(res.get(0).getMID() == 100L);
 	}
 
-- 
GitLab