As the COVID19 spreads across the world, prevention measures are becoming the essential weapons to combat the pandemic in the period of crisis . The lockdown measure is the most controversial one as it imposes an overwhelming impact on our economy and society . Especially when and how to enforce the lockdown measures are the most challenging questions considering both economic and epidemiological costs . In this paper, we extend the classic SIR model to find optimal decision making to balance between economy and people's health during the outbreak of COVID-19 . In our model, we intend to solve a two phases optimization problem: policymakers control the lockdown rate to maximize the overall welfare of the society; people in different health statuses take different decisions on their working hours and consumption to maximize their utility . We develop a novel method to estimate parameters for the model through various additional sources of data . We use the Cournot equilibrium to model people's behavior and also consider the cost of death in order to leverage between economic and epidemic costs . The analysis of simulation results provides scientific suggestions for policymakers to make critical decisions on when to start the lockdown and how strong it should be during the whole period of the outbreak . Although the model is originally proposed for the COVID19 pandemic, it can be generalized to address similar problems to control the outbreak of other infectious diseases with lockdown measures.