To provide health services, hospitals consume electrical power and contribute to the CO2 emission. This paper aims to develop a modelling approach to optimize hospital services while reducing CO2 emissions. To capture treatment processes and the production of carbon dioxide, a hybrid method of data mining and simulation–optimization techniques is proposed. Different clustering algorithms are used to categorize patients. Using quality indicators, clustering methods are evaluated to find the best cluster sets, and then patients are categorized accordingly. Discrete-event simulation is applied to each patient category to estimate performance measures such as number of patients being served, waiting times, and length of stay, as well as the amount of CO2 emission. To optimize performance measures of patient flow, metaheuristic searches have been used. The dataset of Bushehr Heart Hospital is considered as a case study. Based on K-means, K-medoid, Hierarchical clustering, and Fuzzy C-means clustering methods, patients are categorized into two groups of high-risk and low-risk patients. The number of patients being served, total waiting time, length of stay, and CO2 emitted during care processes are improved for both groups. The proposed hybrid method is an effective method for hospitals to categorize patients based on care processes. The problems and the proposed solution approach reported in this study could be applicable to other hospitals, worldwide to help both optimize the patient flow and minimize the environmental consequences of care services.