Contracts worth £3 billion to create digital health records have been awarded to two US tech giants despite lower offers from UK-based suppliers.