With the increasing demand for hospital services amidst the COVID-19 pandemic, allocation of limited public resources and management of healthcare services are of paramount importance. In the field of patient flow scheduling, previous research primarily focused on classical-based objective functions, while ignoring environmental-based objective functions. This study presents a flexible job shop scheduling problem to optimize patient flow and, thereby, minimize the total carbon footprint, as the sustainability-based objective function. Since flexible job shop scheduling is an NP-hard problem, a metaheuristic optimization algorithm, called Chaotic Salp Swarm Algorithm Enhanced with Opposition-Based Learning and Sine Cosine (CSSAOS), was developed. The proposed algorithm integrates the Salp Swarm Algorithm (SSA) with chaotic maps to update the position of followers, the sine cosine algorithm to update the leader position, and opposition-based learning for a better exploration of the search space. generating more accurate solutions. The proposed method was successfully applied in a real-world case study and demonstrated better performance than other well-known metaheuristic algorithms, including differential evolution, genetic algorithm, grasshopper optimization algorithm, SSA based on opposition-based learning, quantum evolutionary SSA, and whale optimization algorithm. In addition, it was found that the proposed method is scalable to different sizes and complexities.