More than £4 million has been spent tackling pest control across NHS buildings in Scotland in five years, with rats, maggots and mice amongst the issues.