At present, the secondary application of electronic medical records is focused on auxiliary medical diagnosis to improve the accuracy of clinical diagnosis. The main research in this article is the prediction method of gestational diabetes based on electronic medical record data. In the original data, the ID number of the medical examiner did not match the medical examination record. In order to ensure the accuracy of the data, this part of the record was removed. First, the preparation stage before building the model is to determine the baseline accuracy of the original data, test the effectiveness of the machine learning algorithm, and then balance the target data set to solve the bias caused by the imbalance between data classes and the illusion of excessive model prediction results. Then, the disease prediction model is constructed by dividing the data set, selecting parameters and algorithms, and visualizing the model. Finally, the effect of predictive model construction is comprehensively judged based on multiple evaluation indicators and control experimental models. In this paper, the RF model can be used to rank the importance of the feature importance of the output feature on the importance of the classification result of the input feature. In order to test the accuracy of regression prediction, the experiment uses absolute mean error and root mean square error to evaluate the accuracy of fasting blood glucose prediction. A logistic regression model is constructed through the training set, and the test set data are brought into the prediction model for prediction. Experimental data show that when the features filtered by WBFS are used, the accuracy, F1 value, and AUC value of logistic regression are 0.809, 0.881, and 0.825, respectively, which is an increase of about 12% compared with when the feature is not used. The results show that the electronic medical record data drive can effectively improve the accuracy of predicting gestational diabetes.