Type 2 diabetes (T2D) has caused severe health problems to millions of patients. In recent years, electronic health records (EHRs) and precision medicine have played important roles in recommendations of T2D treatments. However, current methods have limitations in jointly analyzing various types of patient-specific characteristics in EHRs and estimating optimal individualized treatment rules (ITRs) for multicategory treatments. In this study, we propose a latent process model to deal with data challenges in EHRs and analyze correlated mixed-type health markers in an integrative way. Furthermore, we cluster patients based on their health status, which can be captured by the latent variables. Within each patient group, we estimate optimal ITRs by extending a matched learning model for comparing binary treatments to handle multicategory treatments, using a one-versus-one approach. Each matched learning for two treatments is implemented by a weighted support vector machine with matched pairs of patients. Lastly, we showed the utility of our method to select the optimal treatments from four classes of drugs and achieve better control of glycated hemoglobin by an application of EHRs.