Junior doctors have voted to accept a government pay deal worth a rise of 22.3% on average over two years.