I don't know of any formula to follow but there's a few rules to it.
A) Never refer...ever. There is no behavioral science question where you should refer the patient to a psychiatrist or a social worker or another specialist. The answer in these situations is always face the bullet.
along with the previous...
B) Let the patient work it out with you there. A lot of emotional situations will have options about leaving an agnry, depressed, hysterical patient until they compose themselves. This is NEVER the correct answer. Also, never try to interrupt them. Just sit their and let them vent.
Here's an example:
"Mrs. S is your patient who you removed a suspicious mole from her back on the last visit. On a return visit, you inform her that her pathology results demonstrate that the mole was malignant melanoma and that by the depth it is likely it has already metastasized. Mrs. S begins crying in hysterical sobs and screams "Why God me?".
Your next course should be
A) Tell the patient you are very sorry, and give her a few moments a lone to grapple with her diagnosis.
B) Give her the names of an oncologist and a grief counselor.
C) Sit quietly with the patient until she is ready to talk and offer her a box of tissues.
D) Ask if she would like to meet with a religious figure.
Of course, the answer is C.
Other rules:
NEVER make the patient make an unpopular decision in front of the family. If you have to get rid of a family member to be confidential YOU be the badguy and ask them to leave, don't make the patient do it.
If something is going wrong and a patient is mad at you, ALWAYS first apologize and comment on their feelings. Seriously I had so many questions where the answer was "I can see you're angry, I'm sorry that your wait was so long." NEVER explain away the reason "I'm seeing many patients today and running late.