Relationship between chronic diseases and depression: the mediating effect of pain