/*
Phase 6 - Visits Intelligence recommendations
Run only after DBA review. Do not create blindly on production.
These indexes support the newly bound Visits workspace queries.
*/

/* RCP_SERVICE_RESERVATION monthly OPD / ER trend */
-- CREATE INDEX IX_RSR_EXPECTED_STATUS ON RCP_SERVICE_RESERVATION
--     (EXPECTEDDONEDATE, SERVSTATUS, SCHED_SERIAL, HOSP_ID, PATIENTID, VISIT_ID);

/* Emergency filters */
-- CREATE INDEX IX_RSR_EMERGENCY_CLINIC ON RCP_SERVICE_RESERVATION
--     (OUTPTA_EMERGENCY_TYPE, CLINIC_ID, EXPECTEDDONEDATE);

/* RCP_VISIT join + classcode */
-- CREATE INDEX IX_RCP_VISIT_JOIN_CLASS ON RCP_VISIT
--     (HOSP_ID, PATIENTID, VISIT_ID, CLASSCODE);

/* Admissions movement */
-- CREATE INDEX IX_RCP_VISIT_ADMISSION_DATE ON RCP_VISIT
--     (VISIT_START_DATE, HOSP_ID, PATIENTID, VISIT_ID);

-- CREATE INDEX IX_RCP_ENTRYEXIT_JOIN ON RCP_ENTRYEXIT
--     (BRANCHID, PATIENTID, VISIT_ID, BABY_NORMAL_BED);

/* Doctor / specialty KPI source used by top specialties */
-- CREATE INDEX IX_KPI_DOC_PERF_YEAR_SPEC ON KPI_DOCTOR_PERF_DETAIL_JOB
--     (YEARID, SPECIAL_SPEC_ID, SPECIAL_SPEC_EN_NAME, TOTAL_OP_VISITS);
