Patients aged @-@ years with a body-mass index of @ kg/m ( @ ) or more and a history of type @ diabetes lasting at least @ years were randomly assigned ( @:@:@ ) , via a computer-generated randomisation procedure , to receive either medical treatment or surgery by Roux-en-Y gastric bypass or biliopancreatic diversion .