Diabetic patients can receive multiple/different treatments. However, there is no universal solution for all patients, i.e., one prescription can treat some patients, but it may not be effective for others. Therefore, if we can stratify those patients into several sub-classes, the patients in each sub-class can receive the optimal treatment. There are two main challenges: (1) counterfactual inference when a patient can only take one treatment at a time, i.e., a long time is required to collect an adequate amount of patient data for analysis; (2) the confounding effects of covariates on the treatment. To address these challenges, we propose a method entitled constrained optimization for stratified treatment rules (COSTAR). The proposition is to view the realized treatment outcome as observable but the unrealized as missing values. Thus, the problem becomes finding the optimal treatment with missing outcomes and covariate balance constraints. Through the method COSTAR, the experiment res