Nearly 10,000 patients involved in research studies were affected in an incident that exposed their names, diagnoses, and tests, Massachusetts General Hospital said Thursday.