It's in the AMA's code of ethics in Chapter 9 section 7.1: Medical Testimony:
9.7.1 Medical Testimony Medical evidence is critical in a variety of legal and administrative proceedings. As citizens and as professionals with specialized knowledge and experience, physicians have an obligation to assist in the administration of justice.
Whenever physicians serve as witnesses they must:
(a) Accurately represent their qualifications.
(b) Testify honestly.
(c) Not allow their testimony to be influenced by financial compensation. Physicians must not accept compensation that is contingent on the outcome of litigation.
Physicians who testify as fact witnesses in legal claims involving a patient they have treated must hold the patient’s medical interests paramount by:
(d) Protecting the confidentiality of the patient’s health information, unless the physician is authorized or legally compelled to disclose the information.
(e) Delivering honest testimony. This requires that they engage in continuous self-examination to ensure that their testimony represents the facts of the case.
(f) Declining to testify if the matters could adversely affect their patients’ medical interests unless the patient consents or unless ordered to do so by legally constituted authority.
(g) Considering transferring the care of the patient to another physician if the legal proceedings result in placing the patient and the physician in adversarial positions.
Physicians who testify as expert witnesses must:
(h) Testify only in areas in which they have appropriate training and recent, substantive experience and knowledge.
(i) Evaluate cases objectively and provide an independent opinion.
(j) Ensure that their testimony:
- (i) reflects current scientific thought and standards of care that have gained acceptance among peers in the relevant field;
- (ii) appropriately characterizes the theory on which testimony is based if the theory is not widely accepted in the profession;
- (iii) considers standards that prevailed at the time the event under review occurred when testifying about a standard of care.
Organized medicine, including state and specialty societies and medical licensing boards, has a responsibility to maintain high standards for medical witnesses by assessing claims of false or misleading testimony and issuing disciplinary sanctions as appropriate.
Technically, a physician
can testify in a case that their patient is involved in and doesn't directly go against the code of ethics if you are testifying on behalf of your patient per the bolded. However, because of the potential to harm or inadvertently affect the patient-physician relationship, it's generally accepted that physicians do not testify in court proceedings of their patients except as witnesses of fact, and often times lawyers or courts will provide documentation specifying the specific facts in question regarding their diagnosis or treatment.
In general, it is inappropriate for a patient's physician to testify as an expert witness or to make statements outside of medical facts obtained through patient encounters. The possible effects of testimony towards the physician-patient relationship by doing so is exactly why expert witnesses are a thing. Questions like: "What is their diagnosis?", "What are the symptoms?", "How effective has their treatment been?" are fair questions for a patient's treating physician to answer in court. Questions like: "Do you think their diagnosis played a role in X event?" "Are patients with Y diagnosis more likely to commit crime Z?" or "Do you think your patient is responsible for their actions?" are not appropriate questions for a treating physician to answer and should be deferred to someone who has performed an independent evaluation.
Link:
https://www.ama-assn.org/sites/ama-...-browser/code-of-medical-ethics-chapter-9.pdf