Research on event extraction and constraint encoding of legal cases, using Lawformer as a pre-trained language model for legal sentence prediction model, constructing MJP-Law model to predict the sentence of legal cases. The HAN encoder in the model is utilized to extract the inter-sentence relations in the legal case and construct the relations among the law, the charge, and the sentence period. Compare the performance of this paper’s MJP-Law model with other prediction models on law, charge, and sentence period, and explore the effects of the three subtasks of law, charge, and sentence period on the model through ablation experiments, and compare the prediction effects of a single MJP model and the MJP-Law model on low-frequency charges. In this paper, the MJP-Law model outperforms other prediction models in terms of prediction performance on statute, offense, and sentence. The four models of “MJP-Law”, “MJP-Law_law”, “MJP-Law_SG” and “MJP” had the same prediction performance, which were 95.54%, 89.86%, 89.73% and 89.81%, respectively. “MJP-Law” and “MJP-Law_law”, “MJPLaw_SG” and “MJP” have the same performance in law prediction. After removing the sentencing guidelines and legal sentences, the macro F1 values of the MJP-Law model all showed a decrease.The predictive performance of the MJP-Law model on low-frequency offenses was better than that of the single MJP model.