He got his memory back but to everyone in the world but him and melinda (and close friends) he is still Sam. He just used his emt knowledge and went to med school as Sam. They had the baby before the 5 year time jump, right as he was starting med school.

The show went majorly down hill when they killed off the character and had him reincarnated. So stupid if you ask me.