A national nonprofit that accredits health care facilities has given Bridgewater State Hospital 45 days to respond to the findings of a surprise inspection prompted by what it called “patient safety concerns.” Failing to do so could cost the facility run by the state prisons agency its accreditation. The Joint Commission did not release details of what it described as “a preliminary report” from the May 30 inspection, which came after articles in The Boston Globe about a patient death and widespread use of restraints on mentally ill patients. The facility has also faced several lawsuits. A Department of Correction spokesman acknowledged the inspection, and said the commission’s concerns are being addressed. Bridgewater is a medium-security prison housing men involved with the criminal justice system who are diagnosed as mentally ill.