Welcome to HCM
First of all I would like to know about the bowel habit and nature of stool of your daughter.Hard stool often causes local injury
and causes pain around anus .When the soft mucosa or tissue is injured then every time she went to toilet for defecation she fears about the pain.So if the stool is very hard then it should be taken care first.For 7 year old baby diet containing high fiber should be taken along with proper(regular) toilet training and sometimes few drugs may help her.
The another possibility is worm infestation and it can be managed easily by single dose of antihelminthic(Albendazole
)drug.Usually no surgical condition is occur in this age group.
Finally I always request you to visit to your pediatrics for the best solution.