Classification algorithms for categorical predictors with extremely high cardinality 
I am kinda confused with the above data. I have categorical predictors with so many unique groups, for example Treatment code variable has 15000+ unique codes, and Drug code variable has 800 unique code. Moreover, patient 1 was diagnosed with heart failure in two consecutive years 2019, and 2020, but she diagnosed with Kidney disease in 2021. She is in common in two diagnose classes. Is it possible to create a binary classifier to predict heart disease and Kidney disease? I made up this data for the simplicity. Also, how can we incorporate year column in the model. I appreciate your help.

When dealing with unusual high cardinality features (i.e. categorical variables with a large number of distinct categories) two common approaches is the use of feature hashing (FH) and target encoding (TE). In short, feature hashing allows us to place similar items in the same bucket than dissimilar items reducing the dimensionality of our originally (very) high dimensional feature. Target encoding is even more extreme, taking our originally (very) high dimensional feature and condensing into a single numerical feature based on the conditional (regularised) mean of the target variable. Both methodologies have been greatly expanded (e.g. feature hashing leading to locality-sensitive hashing and target encoding leading to various regularisation version (e.g. the James-Stein encoder). Note that especially TE will generate a single variable out of a potentially very dimensional feature, FH on the other hand is controlled directly in terms of sparsity by the number of buckets we use.
A final note based on a situation where we have duplicates and/or corrupted data. All real-world samples suffer from  such issues, short of resolving them during our data preprocessing steps, seemingly very similar input features might be associated with different outcomes (as the OP puts it: "one patient is common in two diagnose classes"). This is "fine", real data have unmeasured confounder and mediator variables or just have intrinsic variability we cannot directly account for based on the underlying physical process. That is normal and our learning procedure should be robust enough accommodate it, either via regularisation or simply probabilistic forecasting.
