General-Purpose Retrieval-Enhanced Medical Prediction Model Using Near-Infinite History