Dr. Alvin Rajkomar was doing rounds with his team at the University of California, San Francisco Medical Center when he came upon a puzzling case: a frail, elderly patient with a dangerously low sodium level.
As a third-year resident in internal medicine, Dr. Rajkomar was the senior member of the team, and the others looked to him for guidance. An infusion of saline was the answer, but the tricky part lay in the details. Concentration? Volume? Improper treatment could lead to brain swelling, seizures or even death.
Dr. Rajkomar had been on call for 24 hours and was exhausted, but the clinical uncertainty was "like a shot of adrenaline," he said. He reached into a deep pocket of his white coat and produced not a well-thumbed handbook but his iPhone.
With a tap on an app called MedCalc, he had enough answers within a minute to start the saline at precisely the right rate.
The history of medicine is defined by advances born of bioscience. But never before has it been driven to this degree by digital technology.
The proliferation of gadgets, apps and Web-based information has given clinicians — especially young ones like Dr. Rajkomar, who is 28 — a black bag of new tools: new ways to diagnose symptoms and treat patients, to obtain and share information, to think about what it means to be both a doctor and a patient.
And it has created something of a generational divide. Older doctors admire, even envy, their young colleagues' ease with new technology. But they worry that the human connections that lie at the core of medical practice are at risk of being lost.
"Just adding an app won't necessarily make people better doctors or more caring clinicians," said Dr. Paul C. Tang, chief innovation and technology officer at Palo Alto Medical Foundation in Palo Alto, Calif. "What we need to learn is how to use technology to be better, more humane professionals."
Dr. Paul A. Heineken, 66, a primary care physician, is a revered figure at the San Francisco V.A. Medical Center. He is part of a generation that shared longstanding assumptions about the way medicine is practiced: Physicians are the unambiguous source of medical knowledge; notes and orders are written in paper records while standing at the nurses' station; and X-rays are film placed on light boxes and viewed over a radiologist's shoulder.
One recent morning, while leading trainees through the hospital's wards, Dr. Heineken faced the delicate task of every teacher of medicine — using the gravely ill to impart knowledge.
The team arrived at the room of a 90-year-old World War II veteran who was dying — a ghost of a man, his face etched with pain, the veins in his neck protruding from the pressure of his failing heart.
Dr. Heineken apologized for the intrusion, and the patient forced a smile. The doctor knelt at the bedside to perform the time-honored tradition of percussing the heart. "Do it like this," he said, placing his left hand over the man's heart, and tapping its middle finger with the middle finger of his right.
One by one, each trainee took a turn. An X-ray or echocardiogram would do the job more accurately. But Dr. Heineken wanted the students to experience discovering an enlarged heart in a physical exam.
Dr. Heineken fills his teaching days with similar lessons, which can mean struggling upstream against a current of technology. Through his career, he has seen the advent of CT scans, ultrasounds,M.R.I.'s and countless new lab tests. He has watched peers turn their backs on patients while struggling with a new computer system, or rush patients through their appointments while forgetting the most fundamental tools — their eyes and ears.
For these reasons, he makes a point of requiring something old-fashioned of his trainees.
"I tell them that their first reflex should be to look at the patient, not the computer," Dr. Heineken said. And he tells the team to return to each patient's bedside at day's end. "I say, 'Don't go to a computer; go back to the room, sit down and listen to them. And don't look like you're in a hurry.' "
One reason for this, Dr. Heineken said, is to adjust treatment recommendations based on the patient's own priorities. "Any difficult clinical decision is made easier after discussing it with the patient," he said.
It is not that he opposes digital technology; Dr. Heineken has been using the Department of Veterans Affairs' computerized patient record system since it was introduced 15 years ago. Still, his cellphone is an old flip model, and his experience with text messaging is limited.
His first appointment one recent day was with Eric Conrad, a 65-year-old Vietnam veteran with severe emphysema. First came a conversation. Dr. Heineken had his patient sit on a chair next to his desk. Despondent, the patient looked down at his battered Reeboks, his breaths shallow and labored.
Dr. Heineken has been seeing Mr. Conrad since 1993, and since then, he said, "we've been fighting a saw-tooth battle with his weight."
In an instant, the computer generated a chart showing the jagged history of weight successfully gained, then lost. Dr. Heineken pivoted the computer screen so the patient could see a steady gain in recent months. "It's looking a lot better than it has," he said. Mr. Conrad's face brightened slightly.
Then Dr. Heineken turned his back to the computer and sat so close to the patient that they were knee to knee. Mr. Conrad drilled his gaze into his physician's eyes, looking for answers.
It was not until Dr. Heineken was ready to listen to Mr. Conrad's lungs that he asked him to move to the examining table.
"I love him to death," Mr. Conrad said about Dr. Heineken. "He's right to the point, good news or bad news."
Thirty-eight years and a technological revolution separate Dr. Heineken from Dr. Rajkomar.
The son of an electrical engineer from Mauritius, Alvin Rajkomar grew up in Silicon Valley and taught himself to program at age 12. As an undergraduate at Harvard, he started out in physics but became hooked on medicine in Mauritius, where he spent a few days one summer shadowing his uncle, a physician at a community clinic.
"There were no fancy medications or procedures," he said. "Just the art of doctoring."
In 2009, in his third year of medical school at Columbia, he was among the first in the hospital to use an iPhone as a clinical tool. "Every time you looked something up you'd get scolded," he said. "At that point, people believed that if you had your phone out you weren't working."
Among the new crop of device-happy physicians, Dr. Rajkomar is now an elder statesman of sorts, showing trainees his favorite apps, along with shortcuts through the electronic medical record and computerized prescribing system.
He stores every clinical nugget he finds on an application called Evernote, an electronic filing cabinet. "I use Evernote as a second brain," he said. "I now have a small textbook of personalized, auto-indexed clinical pearls that I carry with me at all times on my iPhone."
Along with MedCalc, the clinical calculator, Dr. Rajkomar's phone has ePocrates, an app for looking up drug dosages and interactions; and Qx Calculate, which he uses to create risk profiles for his patients. His favorite technology is his electronic stethoscope, which amplifies heart sounds while canceling out ambient noise.
Not that he is indiscriminate in his use of technology. When he decided the electronic health record was taking too long to load on his iPad, he went back to taking notes by hand, on paper. But he is experimenting with writing by hand on a Samsung mini-tablet.
He is aware of the pitfalls of computerized records, particularly the "if the problem is X, then do Y" templates, which encourage a cut-and-paste approach to daily progress notes. While efficient, they can give rise to robotic bookkeeping without regard to how the patient is faring.
Tablet computers that are linked to electronic health records are making their way into the hands of medical trainees around the country. All internal-medicine residents at the University of Chicago and Johns Hopkins are given iPads; entering medical students at Stanford are given vouchers they can use to buy one.
A University of Chicago study this year in Archives of Internal Medicine found that residents with iPads were able to enter orders in a more timely manner, and a majority of residents perceived that the iPads improved their work efficiency. At the U.C.S.F. Medical Center, some physicians use iPads, and many use one of the hospital's computers on wheels.
Dr. Rajkomar's outpatient clinic is four miles west of the U.C.S.F. hospital, at the San Francisco V.A., where he works down the hall from Dr. Heineken.
Where Dr. Heineken is competent with the V.A.'s electronic health record system, Dr. Rajkomar is a virtuoso, a Vladimir Horowitz of the computer keyboard. He can keep his eyes fixed so steadily on the patient that the typing goes all but unnoticed.
As the conversation with the patient goes, so goes Dr. Rajkomar's interaction with the computer. Lab results? On the screen in a flash. A list of past and current medications and dosages? Voilà!
Yet he also knows when the computer needs to be set aside. During a visit, when a patient confided that his wife was taking his pain medication, Dr. Rajkomar excused himself and walked down the hall to consult with the pharmacist about a plan to keep that from happening.
Dr. Rajkomar knows he has a great deal to learn about being a physician, especially patients' social and psychological complexities.
"One patient fired me," he said, smiling as he added, "Dr. Heineken gets those patients."