NHS ordered to ensure doctors record tens of millions of patients body mass index so they can identify if their weight is putting them at risk