An Emergency Department (ED) is a health care service that delivers time-critical care to unscheduled patient arrivals. Due to an ever increasing number of arrivals, the number of patients often exceed the physical and staffing capacity resulting in long waiting times, patients leaving without being seen by medical staff and higher mortality levels. In this work we investigate the scheduling of staff and equipment resources in EDs. We propose a spatial agent-based simulation framework to quantify the impacts of staff decision processes, such as patient selection, on patient length of stay and waiting times. To explore the ED administration intuition that patient throughput could be increased by prioritizing short patient visits, and corroborate our findings from our simulations that the order in which providers see their next patient affects the length of time patients spend in the ED, we proposed a real-time scheduler that prioritizes short visits. We concluded that Emergency Departments need an online system that is constantly adapting to find an optimal scheduling of patient tasks to available resources. To that effect we propose a mixed-integer linear programming model (MILP) to find an optimal schedule of tasks to resources that minimizes the time spent in the ED for every patient.