Unfortunately, technological advances are slow to come to healthcare for a variety of reasons. Shoot, my hospitals JUST got the automated perscription system which eliminates any medication error that may result from trying to read the doctor's handwritting.
Surgical procedures like the "penis incident" could be avoided with simple technology
PATENT PENDING 
, like scanning the bar code on the patient's ID bracelet (with a device similiar to what is used in Wal-mart for price checks). Once scanned, on the screen it should indicate what surgical procedure that the patient is scheduled to have. This would eliminate any errors due to mis-filed/labeled patient files.