how do doctors keep themselves safe from infections

Contact Precautions
For anyone with symptoms that might be spread by contact. This includes patients with diarrhea, especially if known to be caused by Clostridium difficile, norovirus, and rotavirus. This also includes patients with some skin infections, especially lice and scabies. This can also include some respiratory viruses, like enterovirus and adenovirus, which can spread by sneeze or touch to tabletops, doorknobs, and other objects, which we call fomites (objects that can transfer infections).

These precautions also may be used for drug-resistant organisms, like MRSA (Methicillin-resistant Staphylococcal aureus), CRE (Carbapenem-resistant Enterobacteriaceae), VRE (Vancomycin-resistant Enterococci).

Anyone entering a patient’s room should wear gloves (and a gown).
Safe contact precautions depend on safe removal of protective coverings, especially gloves.

Droplet Precautions
For infections spread by droplets propelled often by coughing and sneezing (from germs in the nose and sinus down to the lungs).

These precautions cover patients with, or with signs or symptoms of: influenza, other respiratory viruses (parainfluenza virus, adenovirus, respiratory syncytial virus (RSV), human metapneumovirus, mumps) and bacteria (whooping cough or pertussis). Other patients with Neisseria meningitides, group A streptococcus - need these precautions for the first 24 hours of treatment.

Don’t stand 3-6 feet from a patient. Talking, sneezing, or coughing can send infectious germs 3 feet towards you.
Anyone entering the patient’s room wears a surgical mask
Patients may share a room if someone else has the same infection. Otherwise, they are normally isolated.
Droplets are smaller but bigger than 5 microns. That is to say larger 1/200th of a millimeter.

Airborne Precautions
These precautions are needed for tiny germs that cluster in tiny little dollops that let them float in the air. These little dollops, called nuclei, usually come out when breathing (coughing, sneezing or talking) and can across distances beyond what a simple sneeze can propel germs. Very few infectious germs can do this. Only chickenpox (until lesions crust) or herpes zoster (shingles) in an immunocompromised person or disseminated, measles, and tuberculosis (TB) are generally found in hospitals.

These nuclei are much like droplets, but just tinier. They are normally less than 5 microns - or 1/200th of a millimeter. Sometimes, however, they can be a bit larger. The smaller the nuclei, the deeper the disease can reach down into the lungs.

In limited circumstances, infections can be aerosolized and made airborne. Hantavirus from rodents can be aerosolized by say vacuuming mice bedding or anthrax spores when in powders. Smallpox was - but was eradicated. Tularemia can be aerosolized from say rabbits if maybe a lawn mower destroys a nest.

When healthcare providers do procedures that can create a mist fine droplets of infectious material - such as intubating an influenza patient - they may use airborne precaution masks, as well as goggles to protect themselves, even when influenza is spread largely through droplets that are not aerosolized. The CDC also had recommended special masks be used for H1N1 in 2009.

Airborne precautions involve isolating a patient into a separate negative pressure room. Such rooms have the air drawn out and then not redirected into any adjoining rooms or the hallway in order to keep everyone safe.
Patients should travel out of their rooms, if necessary, wearing a mask.
Anyone entering the room should wear a special mask, an N-95 mask. These masks can filter out very fine particles. They should be “fit tested” to determine if they will block germs from flowing in. (Those with small faces or facial hair may not have a good enough mask fit).
There may be filters with UV (Ultra-Violet) lights to kill the organisms, such as with TB.