The delivery of health care services, especially for patients with chronic conditions and/or requiring cyclical treatment, can be accomplished by resorting to two organizational models: center-based care and home-based care. In developed countries, government pressure to reduce healthcare spending and the COVID-19 pandemic have led to the spread of home-based care. This type of care is proven to outperform the center-based one in terms of cost-effectiveness, patient satisfaction, and adherence to treatment guidelines. However, even for treatments usually suitable to be delivered at home, the patient's health status or other constraints may make it inappropriate to deliver service at the patient's home. This calls for a new organizational model, referred to as flexible care, where home-based and center-based care are not seen as mutually exclusive models but as options that can be activated according to the patient's and provider's needs. This paper presents a novel network-based deterministic optimization model and two matheuristics to address a scheduling problem typically faced by providers adopting a flexible care model. The model considers a provider relying on a treatment room with a fixed number of medical chairs, a fleet of vehicles, and a team of operators. It allows for determining on which days of the planning horizon, in which setting (home or center), and by which operator each patient will be treated. The model takes into account patients’ preferences and considers two objective functions: minimizing provider costs and patients’ travel time. In addition, we propose a two-stage mixed-integer stochastic programming model with recourse actions. This model allows incorporating the uncertainty due to the occurrence of adverse events. Adverse events are sudden changes in the patient's condition randomly happening at a specific point in the planning horizon. These events render the patient unsuitable for home care and require them to be visited at the center from that moment onward. The models have been inspired by a real case and tested on multiple random instances.