Health care services in any country influence a considerable part of the economic, social, and political systems; researchers are trying to improve the quality of health care to realize the patients' needs and service quality in various fields. This study is conducted to provide an optimal system to reduce waiting time and increase the level of services according to various system conditions and increase the output rate in a medical center according to a key performance indicator, i.e., the patient's average waiting time. Discrete-event simulation has been applied to analyze the process, and simulation optimization has been employed to achieve optimal values. The tools used include ARENA software to simulate and OptQuest to optimize the simulation model. The system has been simulated separately for two purposes: a) resource optimization and b) resource planning according to the system state, and the results indicate that the system state-dependent model is the ideal model to reduce the waiting time for people and increase the output rate without decreasing the quality of service. State-dependent modeling approach has an advantage that if the resources are employed in shifts in the more crowded wards, then the waiting time for patients can be significantly reduced in the health care center.