Corneal infection is a major public health concern worldwide and the most common cause of unilateral corneal blindness. Toxic effects of different microorganisms, such as bacteria and fungi, worsen keratitis leading to corneal perforation even with optimal drug treatment. The cornea forms the main refractive surface of the eye. Diseases affecting the cornea can cause severe visual impairment. Therefore, it is crucial to analyze the risk of corneal perforation and visual impairment in corneal ulcer patients for making early treatment strategies. The modeling of a fully automated prognostic model system was performed in two parts. In the first part, the dataset contained 4973 slit lamp images of corneal ulcer patients in three centers. A deep learning model was developed and tested for segmenting and classifying five lesions (corneal ulcer, corneal scar, hypopyon, corneal descementocele, and corneal neovascularization) in the eyes of corneal ulcer patients. Further, hierarchical quantification was carried out based on policy rules. In the second part, the dataset included clinical data (name, gender, age, best corrected visual acuity, and type of corneal ulcer) of 240 patients with corneal ulcers and respective 1010 slit lamp images under two light sources (natural light and cobalt blue light). The slit lamp images were then quantified hierarchically according to the policy rules developed in the first part of the modeling. Combining the above clinical data, the features were used to build the final prognostic model system for corneal ulcer perforation outcome and visual impairment using machine learning algorithms such as XGBoost, LightGBM. The ROC curve area (AUC value) evaluated the model’s performance. For segmentation of the five lesions, the accuracy rates of hypopyon, descemetocele, corneal ulcer under blue light, and corneal neovascularization were 96.86, 91.64, 90.51, and 93.97, respectively. For the corneal scar lesion classification, the accuracy rate of the final model was 69.76. The XGBoost model performed the best in predicting the 1-month prognosis of patients, with an AUC of 0.81 (95% CI 0.63–1.00) for ulcer perforation and an AUC of 0.77 (95% CI 0.63–0.91) for visual impairment. In predicting the 3-month prognosis of patients, the XGBoost model received the best AUC of 0.97 (95% CI 0.92–1.00) for ulcer perforation, while the LightGBM model achieved the best performance with an AUC of 0.98 (95% CI 0.94–1.00) for visual impairment.