A federal judge ruled yesterday that a lawsuit on behalf of prisoners denied mental health care can head to trial as a class action on behalf of all prisoners, noting that there is evidence of systemic “deliberate indifference” to the mental health needs of the prisoners.