A Scottish record linkage study of risk factors in medical history and dementia outcome in hospital patients.