The definition of primary care is a subset of medicine of which fulfills the medical needs of the general population.
EM certainly seems to fit this criteria, but isn't primary care. Any insights I'm missing?
Besides what others have said about EM not being about longitudinal care, part of the problem also has to do with what defines an "emergency." You have to realize that when you deal with the general public, you are usually not dealing with people who have the level of knowledge of your medical colleagues here. Less educated people in particular may not have the ability to recognize A) what an emergency actually is, and B) whether their symptoms in fact correspond to an emergency. But really, anyone who is a layperson can panic about a symptom and show up in the ER, simply because they don't know what's wrong with them and they're scared.
You also have to add in the psych factor, as many frequent users of the ER have comorbid psych issues (including substance abuse) along with their other complaints. A PCP can "fire" a patient from their practice, but the ER doc never has that option. It's illegal for them to turn anyone away.
And finally, there is the convenience issue. Sometimes people can't get in to their PCP, or they can't get off work, or they need something that can't be done by their PCP. Heck, sometimes PCPs send their patients to the ER on purpose because they need testing that the PCP can't provide, or to otherwise expedite their workup. Whether that's an appropriate use of the ER or not is a matter of debate, but it's hard to blame a patient who is following their PCP's instructions to go to the nearest ER for a CT scan right away.
Regarding questions of whether internists and other PCPs can run codes, the answer is yes, they can. If someone shows up to their PCP's office and drops dead on the office floor, the PCP will sure as heck start chest compressions and hook them up to the AED. That being said, an office-based PCP is hopefully not having patients code and die in their office on a regular basis, so they don't do a lot of codes. Whereas, on the inpatient hospital floors, the hospitalists often do run the codes. Obviously someone who dies in the ER would be coded by the ER doc.
Regarding the question of whether a hospitalist is a PCP, the answer to that is generally no. A hospitalist is a specialist in inpatient medical care. Once the patient leaves the hospital, their regular PCP takes over their care again. While some (usually rural) hospitalists also have outpatient practices and are therefore PCPs as well, most hospitalists do not do both primary care and hospital medicine any more than most other IM specialists do both.