New York is quietly building one of the nation’s largest computer databases of medical records, a system that when finished will allow patients and doctors alike to see complete health histories in one place and promises to save millions in costs by avoiding redundant tests and unneeded hospital admissions.