Pain clinics wrote 1,000s of prescriptions