Background: Despite medical progress, mortality from gastrointestinal perforation was relatively high. Our study's objective was to identify risk factors associated with a poor prognosis for gastrointestinal perforation. Methods: Patients diagnosed with gastrointestinal perforation at the Longchuan County People's Hospital between January 2019 and February 2022 were the subject of a retrospective analysis of their laboratory data. Patients were grouped based on length of hospital stay, septic shock, and mortality. Results: A total of 240 patients participated in our study. Using univariate and multivariate analysis, we identified several risk factors for gastrointestinal perforation associated with a dismal prognosis. Lower digestive tract perforation (OR=2.418, 95% CI 1.119-5.227, P=0.025), low total protein (OR=0.934, 95% CI 0.879-0.992, P=0.026) and low hemoglobin (OR=0.985, 95% CI 0.971-0.999, P=0.039) were linked to a longer length of stay, especially hemoglobin (OR=0.978, 95% CI 0.966-0.991, P=0.001) in upper digestive tract. High ratio of neutrophils to lymphocytes (NLR) (OR=1.043, 95% CI 1.012-1.076, P=0.007), high lymphocyte-to-monocyte ratio (LMR) (OR=2.158, 95% CI 1.495-3.115, P<0.001) and low prognostic nutrition index (PNI) (OR=0.814, 95% CI 0.751-0.833, P<0.001) predicted septic shock. In upper digestive tract, PLR (OR=1.001, 95% CI 1.000-1.002, P=0.067), LMR (OR=2.160, 95% CI 1.440-3.240, P<0.001) and PNI (OR=0.843, 95% CI 0.767-0.926, P<0.001) were risk factors for septic shock, and total protein (OR=0.796, 95% CI 0.686-0.923, P=0.003) was a risk factor for septic shock in lower digestive tract. High NLR (OR=1.056, 95% CI 1.019-1.093, P=0.003), high LMR (OR=1.760, 95% CI 1.177-2.632, P=0.006) and low PNI (OR=0.832, 95% CI 0.754-0.918, P<0.001) were the risk factors of mortality. In subgroup analysis of perforation site, albumin (OR=0.820, 95% CI 0.719-0.934, P=0.003) and LMR (OR=1.506, 95% CI 1.069-2.123, P=0.019) were risk factors for mortality in upper digestive tract and PNI (OR=0.636, 95% CI 0.445-0.908, P=0.013) was a risk factor for mortality in lower digestive tract. Conclusion: Our research found that the perforation site, total protein, albumin, hemoglobin, NLR, LMR, PLR and PNI were risk factors for gastrointestinal perforation with a poor prognosis.