A total of 51,170 acts of violence were directed at NHS staff across health boards in Scotland over the past five years.