Abstract:Background and Aims Mixed hemorrhoids are among the most common benign anorectal diseases, and Milligan-Morgan hemorrhoidectomy remains a classical surgical treatment. However, postoperative constipation is still a common complication that adversely affects postoperative recovery and quality of life. Currently, studies focusing on risk prediction of postoperative constipation in patients with damp-heat type mixed hemorrhoids are limited. This study aimed to identify risk factors for postoperative constipation and construct predictive models based on Logistic regression and large language model (LLM) to evaluate their predictive performance and provide references for early postoperative intervention.Methods Clinical data of 734 patients with damp-heat type mixed hemorrhoids who underwent Milligan-Morgan hemorrhoidectomy at the Department of Traditional Chinese Medicine, Affiliated Hospital of Yangzhou University, from September 2022 to December 2024 were retrospectively collected. Patients were randomly divided into a training set (n=513) and a testing set (n=221) at a ratio of 7:3. Demographic characteristics, comorbidities, laboratory indicators, and perioperative medication data were collected. Postoperative constipation was defined as the study endpoint. Univariate and multivariate Logistic regression analyses were performed to identify independent risk factors and establish a nomogram prediction model. Receiver operating characteristic (ROC) curves were used to evaluate model performance. In addition, an LLM-based prediction model using Llama-3.1-8B-Instruct was constructed, and its accuracy, recall, and F1 score were assessed.Results No statistically significant differences were observed in baseline characteristics between the training and testing sets (all P>0.05). Among the training cohort, 163 patients (31.77%) developed postoperative constipation. Univariate Logistic regression analysis showed that hemoglobin level and anemia were significantly associated with postoperative constipation (both P<0.05). Multivariate Logistic regression analysis further demonstrated that decreased hemoglobin level and anemia were independent risk factors for postoperative constipation in patients with damp-heat type mixed hemorrhoids after surgery (both P<0.05). The Logistic regression prediction model achieved AUC values of 0.78 and 0.76 in the training and testing sets, respectively, indicating good predictive performance. The LLM model achieved optimal performance at 65 training epochs with a learning rate of 5.00E-05, yielding an accuracy of 85.99%, recall of 89.40%, and F1 score of 87.66%.Conclusion Decreased hemoglobin level and anemia are important risk factors for postoperative constipation in patients with damp-heat type mixed hemorrhoids undergoing Milligan-Morgan hemorrhoidectomy. Both the Logistic regression and LLM-based models demonstrated favorable predictive performance, while the LLM model showed higher predictive accuracy. These findings may provide a reference for early identification and individualized intervention in high-risk patients with postoperative constipation.