Should individual rights be compromised to control the spread of communicable diseases for the good of society?

Should individual rights be compromised to control the spread of communicable diseases for the good of society?