Memorize and Rank: Elevating Large Language Models for Clinical Diagnosis Prediction