The crew inside the cockpit can override someone trying to get in the cockpit. They just showed it on CNN. The switch is usually on “Normal” meaning that the pilot can leave the cockpit and would be able to get back into the cockpit via the code keyed into the keypad, even if the other pilot was in distress. Anyone with the keycode could get it. If the switch is moved to “Lock” the pilot inside the cockpit has the ability to disable the keypad and lock the the other pilot out. It would have to be a deliberate act to do so.
Sounds like terrorism, not a medical situation.
Ding, ding, ding. We have a winner!
Unless this particular airplane wasn't set up that way...but it strains credulity that one of the pilots would leave the cockpit and then not be able to get back in by any means other than just relying on the co-pilot to open the door again.
Prayers for the victims, their families, local townspeople, and recovery workers...what a terrible thing to happen.