You should read ES's post from today. Not the only problem where birthday parties are concerned...
I'll say to you the same thing I said to ES about the parties. Don't take her to them for a year. She needs time to mature. There is no point in going through this, for either of you.
Birthday parties are one thing. The doctor and dentist is totally another. You tell her as you are walking out the door that it's time to see the dentist or doctor (you don't stress her out by telling her the day before) and that if she does not behave and do what you tell her to do, that not only will she be in BIG TROUBLE, she will lose her "currency". That's the threat. She will probably not believe you and will act awful anyway. So you to prove to her that you will not put up with this and show her when you get home what BIG TROUBLE really is.
When you get her home, she goes in her room for the rest of the day. I really mean it. The only thing she gets to do is go to the toilet and eat her lunch in her room. You must be very strict in telling her that she disobeyed you and was rude to the doctor or dentist.
This is the only thing I would punish her for. Why? Because going to the doctor or dentist and cooperating with them is non-negotiable. Part of the reason that she does this is because she is allowed to. When you make a clear distinction in regards to healthcare from everything else, she will "get" that she HAS to deal with this one aspect. Otherwise, when she needs medical care the most, she will not know how to make herself handle it, and then she WILL be traumatized. If you MAKE her handle it now with easy doctor appointments, she will be ready if she hurts herself or gets sick enough to need to go to the hospital.
I had to do this with my son when he decided he didn't want speech therapy anymore. He was 4. Speech therapy cost over $100 per session. He simply refused and cried. Yes, that's different than your daughter. But I did exactly what I am telling you - and it worked. In an hour, he was begging to go back to the clinic. I told him that some other child who behaved was with her and it was too late for him. The next session wouldn't be until Friday. I made him stay in his room just like I had told him I would - NO exceptions. He NEVER did it again. Not for the speech therapist, not for the doctor, not for the dentist, not for the OT. It only took ONCE to let him know that I meant business.
If I hadn't, not only would he have pulled this stunt again, but the therapist would have released us. She cannot spend her time spinning wheels with a non-compliant child.
This is very different advice than I gave ES. A birthday party is totally different. Medical appointments fall into a totally different category. The rest will eventually work itself out as she gets older.
Good luck.