Factors associated with functional impairment of elderly patients in the emergency departments