firstly, my bid is actually less than the actual task you want to achieve but, let me tell you the major portions to deal with and also a better way to do it.
1st- creating a database of medicines is far more easy than building one of handwriting of doctors, so this is the first thing to get done.
2nd- we need to perform edge detection and curve fitting algorithms, the latest one being GENETIC-SNAKE algorithm. this is being used to join broken and illegible characters, in our case they would simply be the 26 alphabets.
3rd- after the characters have been made from the illegible handwriting or broken writing, arrange them to form the word, and match it with the medicine database. this could be possible with incomplete words too.
4th-regarding scanning and reading the handwriting, i think the best way is to manually set spacing, lines because these can vary almost every time. so we can manually see a scan and create a rectangle, suppose, around a text and let the system identify the possible outcome of medicine names.
i hope it makes more sense now. if you are interested to discuss more, ping me when you are free. thanks.