Dynamic Server Assignment in Multiclass Queues with Shifts, with Applications to Nurse Staffing in Emergency Departments