Complex confounding structures are often embedded in electronic medical record (EMR) data. A robust yet efficient double deep learning approach is proposed to adjust the complex confounding structures in comparative effectiveness analysis of EMR data. Specifically, deep neural networks are employed to estimate the conditional expectation of both the outcome and the treatment allocation given observed baseline covariates under the semiparametric framework (Robinson, 1988). An improved estimation scheme is further developed to enhance the performance under finite sample scenarios. Comprehensive numerical studies have shown the superior performance of the proposed methods, as compared with other existing methods, with remarkably reduced bias and mean squared error in parameter estimates. An application to a post-surgery pain study is also conducted by using the proposed methods and other competing methods. Finally, an R package, Deep Treatment Learning “deepTL”, is developed to implement the proposed method.