E cient patient scheduling has significant operational, clinical and economical benefits on health care systems by not only increasing the timely access of patients to care but also reducing costs. However, patient scheduling is complex due to its stochastic nature, the existence of multiple stages of care, and the multiple interdependencies between these stages. Patient appointment (allocation) scheduling refers to the assignment of specific appointment start times to a set of patients scheduled for a particular day while advance patient scheduling refers to the assignment of future appointment days to patients. These two problems have generally been addressed separately despite each being highly dependent on the form of the other. This paper develops a framework that seeks to bridge the two problems. It incorporates random arrivals with multiple patient types and priorities as well as random appointment durations. We take into account the waiting time until the day of service as well as the idle time and overtime of medical resources on the day of service. We use approximate dynamic programming and determine advance schedules with stochastic appointment durations. We first extend the current literature by providing theoretical and numerical results for the case with multi-class, multi-priority patients and deterministic service times. We then adapt the model to incorporate stochastic service times and perform a comprehensive numerical analysis on a number of scenarios. We compare policies obtained from our models against benchmark policies used in practice. In addition, we present results based on a medium-size clinic in Ontario, Canada.