Last week I was ready to quit medicine. I was seeing a new patient with diabetes, heart disease, anemia, hypertension, osteopenia, hypothyroidism, reflux, depression and pain in every part of her body. From a bag she produced 18 pill bottles — from about as many doctors — and piled them onto my desk. She pulled out a form from her job that needed to be filled out, plus a prior-approval form that her insurance company required, as well as a stack of photocopied records from the other doctors. She didn’t speak English, so we waded through her complicated medical history via a telephone interpreter. I don’t like to write while I am talking with a patient, but I couldn’t afford to fall behind in my documentation, so I typed madly into the 50 required fields of our electronic medical record while the patient recounted her complex medical history.

In the middle of this, the computer seized up, then turned a shade of gray that in an ICU would elicit the code team. I didn’t want to lose the interpreter on the phone, so I fiddled with the control-alt-delete buttons while I continued the interview, moving on to the refresh buttons, the escape buttons, finally squatting awkwardly under the desk to yank the on-off switch of the computer.

Forty-five minutes into our 15-minute visit, with an interpreter telephone in one ear translating back and forth into Bengali, my office phone in the other ear, on hold to tech support, my desk swimming with insurance forms, pill bottles, MRI reports, and mammogram referrals, the computer flashing ominous error messages, plus six more patients waiting outside, eight phone messages from yesterday still to return, I thought: “That’s it, I quit!”

It’s a thought that crosses the minds of the majority of doctors, it seems. Patients have more complex medical conditions, practices are much busier, insurance companies require more paperwork, administrative mandates multiply like rabbits, electronic medical records are more byzantine, support systems are fewer — and the 15-minute visit hasn’t gotten any longer.

A survey of more than 13,000 doctors by the Physicians Foundation found that more than two-thirds of them feel negatively about their profession. Too much paperwork and regulations, plus the burden of defensive medicine, are the strongest contributors to this bleak outlook. These erode the doctor-patient relationship and the clinical autonomy that doctors have always cherished. What once seemed a higher calling increasingly feels like an assembly-line job.

What does this mean for patients? For those of you who’ve had trouble getting an appointment with your doctor, consider this: on average, American doctors spend more than 22% of their time on nonclinical paperwork. That’s the equivalent of 165,000 doctors idling with busy work instead of seeing patients.

Many of the things that ail the medical profession — sicker patients, convoluted insurance requirements — are not so easy to change. But some things are. Electronic medical records, if done smartly, could ease the paperwork burden. Team-based approaches involving nurses, social workers and care managers could distribute the workload in a way that is less taxing on the doctor and more beneficial for the patient.

The good news is that doctors are not a homogeneous bunch. The Physicians Foundation study found that female doctors were more optimistic about medicine than their male counterparts. Doctors under 40 were more satisfied than older doctors, suggesting that younger people in the profession are more used to these demands. Salaried doctors were happier than doctors in private practice. Primary-care doctors had higher morale than specialists.

The rate of women in medical schools has been increasing steadily such that women are about 50% of medical students. Primary-care fields — internal medicine, ob-gyn, pediatrics, family medicine — are already dominated by women. And the trend of medicine is toward the salaried model, with new “accountable-care organizations” placing primary care front and center.

Putting this together, the newer generation of female, salaried, primary-care doctors have the most optimistic outlook on medicine. This bodes well for patients, whose doctors will increasingly fall into this category. Perhaps the current epidemic of physician disillusionment will abate as the new waves of doctors remake the face of medicine. This of course does not dismiss the shortcomings of medicine that frustrate doctors on a daily basis, but it does suggest that all is not dismal. To me, the most salient finding of the Physicians Foundation study was that when asked what was the most satisfying aspect of medical practice, the No. 1 answer was relationships with patients. This is what keeps us going even on the most trying of days.

When I finally ended the visit with my patient, we were both worn out. We’d made some headway, but there were more issues unresolved than resolved. However, the fact that we’d plowed through the morass together, however agonizingly, seemed to provide common ground. We smiled wearily at each other, but our parting handshake was solid. We were now in this together.