If I understand correctly, a single patient would be one feature, so one column, and they had interations with hospitals over short periods; followed by no interations (and therefore no data) over longer periods.
Due to the sparsity of data along each single time-series, perhaps you could look into ways to encode the information a little more consicely. I think this approach may lead to fairly good results because you are only aiming to categorise the patients into one of two groups.
This could perhaps be done by converting your base data into more insightful statistics. For example, for each patient, you could compute some standard values:
- Number of time periods with(-out) hospital interaction
- Number of different codes (assuming the code refers to the ailment or something useful?)
- Average length of gap between periods of activity
- Average length of periods of activity
For the above, you'd need to probably heuristcally define what a "period of activity" is, e.g. 5 data points within 100 timesteps. Otherwise you're in a "gap" between such periods.
This would dramitically reduce the amount of datapoints and lend itself quite well and allow you to use simpler classification methods, such as GLMs, logistic regression (as you only have two classes) or perhaps a simple feed-forward neural network.
The idea is to extract as much of the temporal aspect from the data as possible during this feature engineering/pre-processing, such that formal time-series modelling would become unnecessary.
If you want to try normal time-series, such as regression models, you need to remember that they return a numerical value by default (regression problem versus classification), so you would need to decide on a threshold to put patients in one of the two groups.
Try trying to encode the missing data simply as a count of timesteps between datapoints would not work because of the fact that each patient has different timelines, so the resulting data would have strongly varying dimensions, making many models unusable.