I am writing a medical application, and I want to encrypt the name of the patient from everyone except the doctor, his secretary, and the patient himself. I want to encrypt it in a way that even I (the website administrator) can't decrypt this info, and thus in case of a hack, the names of the patients would be safe.
My initial idea was to encrypt the name with the key being the plain password of the patient, but then i had no way of decrypting it from the doctor's side, then I thought I would forget about the patient and encrypt it's name with the doctor's plain password and have him do the account creation for the patient, but then there was the problem of his secretary not being able to decrypt it, and also, if I am to do a search functionnality, I can't search for the patients' names if they were encrypted.
Any ideas?