Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .devcontainer/db/scripts/development.sql
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ TRUNCATE TABLE `sharing_patient_policy_consent`;
TRUNCATE TABLE `sharing_policy_definition`;
TRUNCATE TABLE `sharing_value_set`;
TRUNCATE TABLE `site`;
TRUNCATE TABLE `specialistsJavascript`;
TRUNCATE TABLE `study`;
TRUNCATE TABLE `studydata`;
TRUNCATE TABLE `studylogin`;
Expand Down Expand Up @@ -7130,7 +7129,6 @@ INSERT INTO `security` VALUES (129,'restapi','-83711487-4636101-80-20963498-45-1
INSERT INTO `serviceSpecialists` VALUES (2,1),(2,2),(4,1),(4,2),(5,1),(5,2),(6,1),(6,2),(1,1),(1,2),(3,1),(3,2);
INSERT INTO `sharing_clinic_info` VALUES (1,'0.1.2.3.4','Clinic Name','OSCAR_App','OSCAR_Facility','1.0.1','OSCAR','1.0.2');
INSERT INTO `site` VALUES (1,'MHI Beaches','MHIB','4165559696','555-555-5555','#FF0000','1874 Queen ','TO','ON','M4M1H9',1,NULL,NULL,NULL,''),(2,'MHI Midtown','MHIM','','','#0D7700','','','ON','',1,NULL,NULL,NULL,'');
INSERT INTO `specialistsJavascript` VALUES (1,'1','function makeSpecialistslist(dec){\n if(dec==\'1\') \n{K(-1,\"----Choose a Service-------\");D(-1,\"--------Choose a Specialist-----\");}\nelse\n{K(-1,\"----All Services-------\");D(-1,\"--------All Specialists-----\");}\nK(3,\"Acarology\");\nD(3,\"1\",\"12345679\",\"C, John\",\"1234569870\",\"Toronto\");\nD(3,\"2\",\"555-555-5555\",\"L, Danny\",\"9876453120\",\"Kitchener\");\n\nK(2,\"Cardiology\");\nD(2,\"1\",\"12345679\",\"C, John\",\"1234569870\",\"Toronto\");\nD(2,\"2\",\"555-555-5555\",\"L, Danny\",\"9876453120\",\"Kitchener\");\n\nK(4,\"Cetology\");\nD(4,\"1\",\"12345679\",\"C, John\",\"1234569870\",\"Toronto\");\nD(4,\"2\",\"555-555-5555\",\"L, Danny\",\"9876453120\",\"Kitchener\");\n\nK(5,\"Embryology\");\nD(5,\"1\",\"12345679\",\"C, John\",\"1234569870\",\"Toronto\");\nD(5,\"2\",\"555-555-5555\",\"L, Danny\",\"9876453120\",\"Kitchener\");\n\nK(6,\"Geology\");\nD(6,\"1\",\"12345679\",\"C, John\",\"1234569870\",\"Toronto\");\nD(6,\"2\",\"555-555-5555\",\"L, Danny\",\"9876453120\",\"Kitchener\");\n\nK(1,\"Radiology\");\nD(1,\"1\",\"12345679\",\"C, John\",\"1234569870\",\"Toronto\");\nD(1,\"2\",\"555-555-5555\",\"L, Danny\",\"9876453120\",\"Kitchener\");\n\n\n}\n');
INSERT INTO `table_modification` VALUES (1,NULL,'99998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment>YES</comment><id>32</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>99998</provider_no><status>A</status><timestamp>2023-12-05 19:39:08.0</timestamp></entry></result>\r\n'),(2,NULL,'99998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment>HI</comment><id>32</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>99998</provider_no><status>A</status><timestamp>2023-12-05 19:39:25.0</timestamp></entry></result>\r\n'),(3,NULL,'99998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment>zYES</comment><id>32</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>99998</provider_no><status>N</status><timestamp>2023-12-05 19:39:47.0</timestamp></entry></result>\r\n'),(4,NULL,'999998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment /><id>30</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>999998</provider_no><status>F</status><timestamp>2023-12-05 19:40:04.0</timestamp></entry></result>\r\n'),(5,NULL,'999998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment /><id>30</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>999998</provider_no><status>F</status><timestamp>2023-12-05 19:40:05.0</timestamp></entry></result>\r\n'),(6,NULL,'999998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment /><id>30</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>999998</provider_no><status>F</status><timestamp>2023-12-05 19:40:06.0</timestamp></entry></result>\r\n'),(7,NULL,'999998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment /><id>30</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>999998</provider_no><status>F</status><timestamp>2023-12-05 19:40:06.0</timestamp></entry></result>\r\n'),(8,NULL,'999998',NULL,'delete','providerLabRouting',NULL,'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<result><entry><comment /><id>30</id><lab_no>55</lab_no><lab_type>DOC</lab_type><provider_no>999998</provider_no><status>F</status><timestamp>2023-12-05 19:40:06.0</timestamp></entry></result>\r\n');
INSERT INTO `tickler` VALUES (1,7,NULL,'Test tickler','A','2023-08-30 22:27:10','2023-08-30 00:00:00','999998','Normal','999998',NULL,'2023-08-30 22:27:10');
INSERT INTO `tickler_category` VALUES (1,'To Call In','Call this patient in for a follow-up visit',''),(2,'Reminder Note','Send a reminder note to this patient',''),(3,'Follow-up Billing','Follow-up Additional Billing','');
Expand Down
28 changes: 13 additions & 15 deletions database/mysql/oscarinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ CREATE TABLE IF NOT EXISTS consultationServices (
serviceId int(10) NOT NULL auto_increment,
serviceDesc varchar(255) default NULL,
active char(2) default NULL,
PRIMARY KEY (serviceId)
PRIMARY KEY (serviceId),
KEY idx_consultationServices_active_desc (active, serviceDesc)
) ;

--
Expand Down Expand Up @@ -7272,8 +7273,13 @@ CREATE TABLE IF NOT EXISTS professionalSpecialists (
`eformId` int(10) DEFAULT NULL,
`hideFromView` tinyint(1) NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT 0,
`province` varchar(55),
PRIMARY KEY (`specId`)
`province` varchar(55),
PRIMARY KEY (`specId`),
KEY idx_professionalSpecialists_name (`lName`, `fName`),
KEY idx_professionalSpecialists_referralNo (`referralNo`),
KEY idx_professionalSpecialists_specType (`specType`),
KEY idx_professionalSpecialists_institution (`institutionId`),
KEY idx_professionalSpecialists_department (`departmentId`)
);

--
Expand Down Expand Up @@ -7678,18 +7684,10 @@ CREATE TABLE IF NOT EXISTS `SecurityArchive` (
--

CREATE TABLE IF NOT EXISTS serviceSpecialists (
serviceId int(10) default NULL,
specId int(10) default NULL
) ;

--
-- Table structure for table `specialistsJavascript`
--

CREATE TABLE IF NOT EXISTS specialistsJavascript (
`id` int(10) not null auto_increment primary key,
setId char(1) default NULL,
javascriptString mediumtext
serviceId int(10) DEFAULT NULL,
specId int(10) DEFAULT NULL,
KEY idx_serviceSpecialists_serviceId (serviceId),
KEY idx_serviceSpecialists_specId (specId)
) ;

--
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
--
-- Consultation system performance improvements
--
-- This migration adds indexes to the consultation-related tables for faster queries.
-- No data is modified or deleted - only indexes are added.
--
-- Note: Uses DROP INDEX IF EXISTS before CREATE INDEX to make this migration
-- is safe to run multiple times or on new databases.
--

-- ============================================================================
-- PART 1: serviceSpecialists junction table
-- ============================================================================

-- Index on serviceId for lookups ("find all specialists for a service")
DROP INDEX IF EXISTS idx_serviceSpecialists_serviceId ON serviceSpecialists;
CREATE INDEX idx_serviceSpecialists_serviceId ON serviceSpecialists(serviceId);

-- Index on specId for reverse lookups ("find all services for a specialist")
DROP INDEX IF EXISTS idx_serviceSpecialists_specId ON serviceSpecialists;
CREATE INDEX idx_serviceSpecialists_specId ON serviceSpecialists(specId);

-- ============================================================================
-- PART 2: consultationServices table
-- ============================================================================

-- Index for findActive() and findByDescription() queries
-- Covers: WHERE active='1' ORDER BY serviceDesc
DROP INDEX IF EXISTS idx_consultationServices_active_desc ON consultationServices;
CREATE INDEX idx_consultationServices_active_desc ON consultationServices(active, serviceDesc);

-- ============================================================================
-- PART 3: professionalSpecialists table
-- ============================================================================

-- Index for name searches (findByFullName, findByLastName, search)
-- Covers: WHERE lName LIKE ? [AND fName LIKE ?] ORDER BY lName
DROP INDEX IF EXISTS idx_professionalSpecialists_name ON professionalSpecialists;
CREATE INDEX idx_professionalSpecialists_name ON professionalSpecialists(`lName`, `fName`);

-- Index for referral number lookups (findByReferralNo, getByReferralNo)
DROP INDEX IF EXISTS idx_professionalSpecialists_referralNo ON professionalSpecialists;
CREATE INDEX idx_professionalSpecialists_referralNo ON professionalSpecialists(`referralNo`);

-- Index for specialty searches (findBySpecialty)
DROP INDEX IF EXISTS idx_professionalSpecialists_specType ON professionalSpecialists;
CREATE INDEX idx_professionalSpecialists_specType ON professionalSpecialists(`specType`);

-- Index for institution foreign key lookups
DROP INDEX IF EXISTS idx_professionalSpecialists_institution ON professionalSpecialists;
CREATE INDEX idx_professionalSpecialists_institution ON professionalSpecialists(`institutionId`);

-- Index for department foreign key lookups
DROP INDEX IF EXISTS idx_professionalSpecialists_department ON professionalSpecialists;
CREATE INDEX idx_professionalSpecialists_department ON professionalSpecialists(`departmentId`);

-- ============================================================================
-- PART 4: Cleanup deprecated table
-- ============================================================================

-- Drop the specialistsJavascript table - no longer used.
-- This table stored pre-generated JavaScript for caching, which has been replaced
-- by direct database queries with proper indexing.
DROP TABLE IF EXISTS specialistsJavascript;

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public String execute()
consultationServiceDao.persist(cs);
request.setAttribute("SERVADD", service);

EctConConstructSpecialistsScriptsFile constructSpecialistsScriptsFile = new EctConConstructSpecialistsScriptsFile();
constructSpecialistsScriptsFile.makeString(request.getLocale());
return SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ public String execute()
}
}
professionalSpecialistDao.merge(professionalSpecialist);

EctConConstructSpecialistsScriptsFile constructSpecialistsScriptsFile = new EctConConstructSpecialistsScriptsFile();
constructSpecialistsScriptsFile.makeString(request.getLocale());
} else {
logger.error("missed a case, whichType=" + whichType);
}
Expand Down
Loading
Loading