How would you like to get or process the data further?
Using an own colalte_fn for your DataLoader you can just return the medical history as you’ve saved it:
# Create Data
data = [[[random.randint(0, 100)], torch.randint(0, 500, (random.randint(3, 10),)).tolist()]
        for _ in range(random.randint(20, 30))]


class MyDataset(Dataset):
    def __init__(self, data):
        self.data = data
        
    def __getitem__(self, index):
        data = self.data[index]
        return data
    
    def __len__(self):
        return len(self.data)


def my_collate(batch):
    return list(batch)

dataset = MyDataset(data)
loader = DataLoader(
    dataset,
    batch_size=10,
    shuffle=False,
    collate_fn=my_collate
)

x = next(iter(loader))
print(x)

I’m not sure the code is that useful for you, as now you are basically getting the data as a nested list.
Do you want to create one tensor for each patient and feed it to the model?
Or would an approach from NLP be more appropriate where we should use padding for the shorter medical recordings?