John Swinney has said attacks on patients and staff “cannot be tolerated” following reports of sexual assaults in Scotland's hospitals.