Google has been given access to an estimated 1.6 million NHS patient records, it has been revealed.
The data-sharing agreement, revealed by New Scientist, includes full names as well as patient histories.
Google says it will use the data to develop an early warning system for patients at risk of developing acute kidney injuries.
But critics have questioned why it needs the data of all patients to create such a specific app.
Under the data-sharing agreement, Google's artificial intelligence division DeepMind will have access to all of the data of patients from the Royal Free, Barnet and Chase Farm hospitals in London going back over the past five years and continuing until 2017.
It plans to use the data to develop an app known as Streams that will alert doctors when someone is at risk of developing acute kidney injury (AKI).
The data remains encrypted, meaning that Google employees should not be able to identify anyone, according to the Royal Free Trust.
It said that doctors from the Trust approached DeepMind about the development of the app.
In a statement, it said: "Our arrangement with DeepMind is the standard NHS information-sharing agreement set out by NHS England's corporate information governance department, and is the same as the other 1,500 agreements with third-party organisations that process NHS patient data.
"As with all information sharing agreements with non-NHS organisations, patients can opt out of any data-sharing system by contacting the trust's data protection officer."
Sam Smith, a co-ordinator of patient data campaign group MedConfidential, said: "The big question is why they want it. This a very rich data set. If you are someone who went to the A&E department, why is your data in this?"
Google said that it needed general data in order to identify patients who might be at risk of developing AKI.
AKI is a contributing factor in up to 20% of emergency hospital admissions, according to the NHS. It estimates that around a quarter of cases are preventable.
It is not clear how exactly Google will use the data to provide this early warning system but the BBC understands that no artificial intelligence will be used.
Dominic King, a senior scientist at Google DeepMind, said: "Access to timely and relevant clinical data is essential for doctors and nurses looking for signs of patient deterioration. This work focuses on acute kidney injuries that contribute to 40,000 deaths a year in the UK, many of which are preventable.
"The kidney specialists who have led this work are confident that the alerts our system generates will transform outcomes for their patients. For us to generate these alerts it is necessary for us to look at a range of tests taken at different time intervals."
Google has not ruled out the use of the data for other purposes but said it will only ever be used for improving healthcare and will never be linked to other Google accounts or products.
Google does have big ambitions in healthcare.
In 2013 it launched Calico, a firm set up to look at ways to tackle ageing while X, Google's research arm, launched Baseline in 2014 - an ambitious plan to map genetic information to gain a picture of what makes humans healthy.