A second opinion was an analysis given by a doctor other than the patient's current doctor, by reviewing their medical records and providing an opinion on the diagnosis, prognosis, and recommended treatments.
In 2365, Data told Guinan a joke ("A guy walks into the doctor's office. The doctor tells him you need an operation. The guy says I want a second opinion. The doctor said, okay, you're ugly too."), but it wasn't funny the way he said it. (TNG: "The Outrageous Okona")
In 2371, Lieutenant B'Elanna Torres visited The Doctor aboard the USS Voyager, telling him that she needed a second opinion regarding a sample of residue collected from a nebula. He asked who had given her the first opinion and she told him it was herself. (VOY: "The Cloud")