Thanks for query,
From your history it seems that you might have dermatitis
around anal region.
is very painful and you may have a strip of blood coming out with stool.
There may passing of blood before passing stool.
Consult your doctor and get examined.
Ok and bye.