Section 12G. The disclosure by a physician, health care facility, nursing home or any other medical provider or by an agent of any of the foregoing information concerning the diagnosis, treatment, or condition of a patient in connection with the establishment of eligibility for, or entitlement to, benefits under chapters one hundred and fifteen, one hundred and seventeen, one hundred and eighteen, one hundred and eighteen A, one hundred and eighteen D, one hundred and eighteen E, section 9 of chapter 32 or in connection with any reporting required by law under chapters ninety-four, one hundred and eleven, one hundred and twelve, one hundred and twenty-three, or required by any other law, shall not constitute libel, slander, invasion of privacy, or otherwise be grounds for any civil or criminal liability on the part of any such physician, health care facility, nursing home or any other medical provider or by an agent of any of the foregoing who, without first obtaining consent from a patient or a patient's next of kin, discloses such information to any department, bureau or commission of the commonwealth, board established under chapter 32 or to any federal agency which, by law, requires such information or which provides health care benefits to eligible recipients who apply therefor.