the number of times that patient 54631 had been prescribed sodium bicarbonate during the last hospital visit.
select count(*) from prescriptions where prescriptions.hadm_id in ( select admissions.hadm_id from admissions where admissions.subject_id = 54631 and admissions.dischtime is not null order by admissions.admittime desc limit 1 ) and prescriptions.drug = 'sodium bicarbonate'