She is not stubborn, she is only 4 years old.
She does not understand what it is to feel like she needs to urinate. This is not unusual. It is a maturity issue.
Our daughter was also very bright.. always ahead in other ways, she could read, do simple math, her artwork was advanced and detailed, but she was not interested or able to potty train until she was almost 4.. And then she was potty trained.. fully , day and night in 2 days. It was her that led the way. She was in day care and seeing the potties all lined up and the children going to the potty with a book, just finally clicked for her.
Until your child can figure out the feeling of needing to have need to urinate.. As well as how to hold it and control it till she gets undressed and onto the potty, it is just going to be something she has to figure out.
Think about how you would put into words how it feels to have to urinate. There are no words to describe it, you just know the feeling.
I am going to guess the constipation is the result of her afraid to go potty in her panties, fear of disappointing you. And getting a punishment.
She cannot perform when under pressure. And so she just holds it in, causing the constant constipation.
I cannot even think how you would punish a 4 year old for not being able to control her bodily functions.
Be sure to tell the doctor exactly what you have posted here. It will help give lots of insight.