In this paper we present a Bayesian optimization framework that iteratively "learns" good schedules for healthcare professionals of outpatient healthcare in a hospital, that minimize the overall number of patients in queue — we understand that a patient in schedule is one in queue. The hospital has several medical specialties and each is modeled as having two activities: admissions and checkups. At each activity, patients wait in queue for medical attention, and after their service they are either discharged, scheduled for a checkup, or referred to another specialty. Importantly, we consider that each doctor can serve over several specialties, so the optimization has to take into account all specialties simultaneously. We propose a modular methodology that first forecasts patients' demand, then proposes a schedule for healthcare professionals, then simulates the performance of the hospital under such schedule, and finally a Bayesian optimization module iterates through the previous steps and "learns" which are the best schedules. Furthermore, each module is fairly simple, easy to modify and adapt to the hospital's constraints, and can even be used standalone — this is an advantage for countries with low technological sophistication and penetration. We test our methodology on data from the year 2019 of a small-sized public hospital in Chile with 15 medical specialties. Our computational experiments show a reduction in 8% of the patients' queue just by redistributing the existing allocation of medical hours within a specialty. Additionally, we examine the case where extra medic hours are allowed, leading to a 25% reduction in the estimated queue length.