Massachusetts stuck to its goal of keeping health care spending growth no higher than 3.1 percent in 2018, yet still struggled to hold down spending on drugs and hospitals.