Disclosure: I have worked on large medical research projects as legal and ethical advisor. I have also worked on projects looking purely at privacy in research.
There isn't a functional way to get around the problems you mention. For the information to be effective, the only thing that can be missing is your name - that is the only thing that is irrelevant to finding out health information. Everything else - weight, height, sex, sexuality, DoB, location, occupation, genetic information, amount/method/destination of travel, illnesses, etc, may be relevant when included in a big enough pool (e.g. all NHS patients), and analysed in enough depth.
Virtually to a person, medical researchers are trustworthy - they are driven by finding a cure/treatment for whatever it is that has floated their boat. The individuals that have supplied the data don't really exist for them - the data are all that matter. And, as I mentioned in a reply above, there is *no*major medical research being done without the involvement of multiple partners, including private companies - IT companies, pharmaceutical/medical instrument manufacturers, external laboratories. The way I tend to deal with the privacy problem is to make those those with the most to lose responsible for it - usually the doctors. Only certain combinations of information can be released at a time - this makes it much more difficult to put together a picture of any individual - and to named researchers only. No ability to download the entire database, and access to raw data only on specific machines with no USB connectivity. But above all, indoctrination that the information is held in trust - it doesn't belong to the researchers, it belongs to the individual. They have been granted permission to use the data in a way that will benefit people, and it would be a betrayal of that trust to misuse it. You would perhaps be astounded how effective that simple mantra is.
However, the questions tend to arise after a certain breakthrough has been made: what if it has been discovered that you are in a category that has been discovered to be at serious risk of developing something nasty - let's say one of the dementias - for which a treatment has just been found? Do you want to be able to be informed of that? If so, how is that information going to get back to you? Is it a breach of confidentiality if you get a letter from your GP suggesting that you make an appointment to discuss some health issues, or is it a breach of duty if you don't?
OK, the chances of anyone having read this far are rapidly approaching zero, so I'll stop.