A 70-year-old man with long-standing type 2 diabetes and hypertension living in a remote community presents with progressive memory impairment, fluctuating attention, and sleep-wake cycle disturbance over several days following a urinary tract infection. On examination he is disorientated and has inattention. Which diagnosis best explains his current presentation?