Estimating treatment effects is a common practice in making causal inferences. However, it is a challenging task for observational studies because the underlying models for outcome and treatment assignment are unknown. The concept of potential outcomes has been widely adopted in the literature on causal inferences. Building on potential outcomes, we propose a simple nonparametric least-squares spline-based causal inference method to estimate heterogeneous treatment effects in this manuscript. We use empirical process theory to study its asymptotic properties and conduct simulation studies to evaluate its operational characteristics. Based on the estimated heterogeneous treatment effects, we further estimate the average treatment effect and show the asymptotic normality of the estimator. Finally, we apply the proposed method to assess the biological anti-rheumatic treatment effect on children with newly onset juvenile idiopathic arthritis disease using electronic health records from a longitudinal study at Cincinnati Children's Hospital Medical Center.