First Minister John Swinney formally opened the 27-bed facility near Alford.