This is a case of Trichophagia, which is the compulsive eating of hair, associated with Trichotillomania (urges to pull out hair).
That human hairball that obstructs the gastrointestinal system is called trichobezoar.
In trichophagia, people ingest the hair that they pull out; in extreme cases such as this one, the hair extends through the pyloric sphincter into the small bowel causing symptoms and signs of partial or complete gastric outlet obstruction, which must be surgically removed from the stomach.
Bezoars that extend through the pylorus in the form of a tail into the small bowel are known as the Rapunzel syndrome.
They cause potentially life-threatening complications such as intestinal obstruction, gastric bleeding, and perforation and must be removed once the diagnosis is made, especially when they become embedded in the gastric mucosa. Gastric trichobezoars may attain large sizes before becoming symptomatic.
The whole mass weighing about 3 kg was removed surgically through an upper midline incision gastrotomy to prevent further complications such as intestinal obstruction and possible perforation.