The invention provides a closed-loop endoscopic capsule. The endoscopic capsule includes a sensor recording biological information reflecting the inner condition of a gastrointestinal tract, an expander which is inflatable and holds the endoscopic capsule in the gastrointestinal tract, a medication releaser releasing medication for treatment, and a controller for processing the recorded biological information to generate control signals for the expander and the releaser. Provided is also an endoscopic system that includes the endoscopic capsule, an external station for data processing, and a mobile device for human-machine interaction.