Diagnosis and treatment of gastrointestinal tract