For decades, doctors have embedded pacemakers, cochlear implants and cardiac defibrillators into their patients’ bodies. More recently, consumers have started tracking their own heart rates and number of steps taken with watches, bracelets, cellphones and other wearable devices.