Effect of inpatient and outpatient care on treatment outcome in tuberculosis: a cohort study