In the aftermath of mass-casualty events, key resources (such as ambulances and operating rooms) can be overwhelmed by the sudden jump in patient demand. To ration these resources, patients are assigned different priority levels, a process that is called triage. According to triage protocols in place, each patient's priority level is determined based on that patient's injuries only. However, recent work from the emergency medicine literature suggests that when determining priorities, resource limitations and the scale of the event should also be taken into account in order to do the greatest good for the greatest number. This article investigates how this can be done and what the potential benefits would be. We formulate the problem as a priority assignment problem in a clearing system with multiple classes of impatient jobs. Jobs are classified based on their lifetime (i.e., their tolerance for wait), service time, and reward distributions. Our objective is to maximize the expected total reward, e.g., the expected total number of survivors. Using sample-path methods and stochastic dynamic programming, we identify conditions under which the state information is not needed for prioritization decisions. In the absence of these conditions, we partially characterize the optimal policy, which is possibly state dependent, and we propose a number of heuristic policies. By means of a numerical study, we demonstrate that simple state-dependent policies that prioritize less urgent jobs when the total number of jobs is large perform well, especially when jobs are time-critical.