Giant drugmakers will lose billions in sales over the next few years as patents on some of their most lucrative medicines expire.