The density of CD4+, CD8+, and CD206+ cells at the TC; CD206+ cells at the IMs; and tumor-node-metastasis (TNM) staging were independent risk factors for patient outcomes, and the c-index of the risk nomogram for predicting the survival probability based on the TME features and TNM staging was 0.772 (95% confidence interval: 0.713–0.832). The gene discussed is CD8A; the disease is neoplasm.