patient 49140 was during the first hospital visit in the emergency room?
select count(*)>0 from admissions where admissions.subject_id = 49140 and admissions.admission_location = 'emergency room admit' and admissions.dischtime is not null order by admissions.admittime asc limit 1