This paper presents an optimization model for determining the optimal time-varying numbers of cashiers and pharmacists in a large hospital. The objective of this model is to minimize the weighted sum of the waiting cost incurred by patients and the operating costs incurred by the hospital. A point-wise fluid-based approximation approach is adopted to construct a dynamic queuing network that takes into account time-varying (or non-stationary) arrivals of patients and describes time-varying queue lengths. The dynamic queuing network is then encapsulated in the optimization model that determines the optimal time-varying numbers of cashiers and pharmacists. A test problem instance is designed based on a large hospital in the city of Taipei, and the MINOS solver of GAMS is applied to solve the problem instance. Sensitivity analyses are also conducted to examine the impacts of customer arrival rates and service rates on the waiting cost and operational cost. Numerical results show that the optimization model can provide an optimal allocation of manpower that significantly reduces both waiting and operating costs.