Medical text classification involves organizing medical documents into specific categories to streamline information retrieval and support clinical decision-making. Traditional deep learning (DL) techniques, including adapting pre-trained language models (PLMs), have demonstrated notable effectiveness in this domain. However, they require extensive domain-specific training data, often perform subpar across various languages, and involve high costs and complexities in deploying large-scale models. In this study, we employed four datasets: Clinical Trials on Cancer, encompassing 6 million statements from interventional cancer clinical trial protocols; the Illness-dataset, consisting of 22,660 categorized tweets from 2018 and 2019; the Multi-View Active Learning for Short Medical Text Classification in User-Generated Data, an extended version of the Illness-dataset including 22,660 documents from the same period; and the Symptom2Disease dataset, containing 1,200 data points used to predict diseases based on symptom descriptions. This study uses ChatGPT, particularly its ChatGPT-3.5 and ChatGPT-4 versions, as a viable alternative for classifying medical texts. We investigate essential aspects, including the construction of prompts, the parsing of responses, and the various strategic use of GPT models to optimize outcomes. Through comparative analysis with established methods like PLM fine-tuning and prompt-tuning, our findings indicate that ChatGPT addresses these challenges efficiently and matches the performance of traditional methods. Furthermore, the enhanced capabilities of the proposed MediGPT (Medical Generative Pre-Trained Transformers) have led to performance improvements of 10.5%, 15.1%, 10.8%, and 12.4% across the datasets, highlighting its adaptability and robustness in diverse medical text scenarios without the need for specialized domain adjustments. This research underscores the capability of ChatGPT to facilitate a versatile AI framework in medical text processing, which could revolutionize medical informatics practices.