Appointment scheduling and capacity planning in primary care clinics