Better engineers, physicians, economists, and science fiction writers than post on this board have tried to figure out the answer to this question. I don't think youre going to find a clear answer. My guess:
Short term: Specialties that focus on analyzing inputs off a computer screen are at the highest risk. Anesthesilogy gets simplified to the point where it can be done exclusively by CRNAs, who are in turn replaced by nurses, who are finally replaced by techs with a high school degree plus six months training. Diagnostic radiologists are replaced by diagnostic radiology programs. Both are gone fast.
Mid term: Generally people, extrapolating on existing trends, guess that the diagnostic specialties diappear before the the procedural ones. The logic is that we have seen an exponential increase in the pattern recognition capacity of computers, but robototics has been a relatively static field. On the other hand I think we might be about to reach the end of Moore's law, while robotics seems like its on the brink of a renaissance. Sooner or later computers will take over both specialties (like towards the end of your life) but I bet that the mechanical issues of robotics falls before the issues of deciphering emotional, human communication in diagnostic medicine. Surgery goes, then Medicine and Peds.
Long term: Implicit in your question is the assumption that human ability is a static benchmark that automated ability is measured against. I'm guessing about 50 years from now human ability is going to start advancing and diversifying, following its own Moore's law. in 100 year the question of humans vs machines is going to be irrelevant: mechanical and biological systems are going to be largely integrated.
So my advice: avoid diagnostic radiology and otherwise hope for the best.