update visits controller and algorithm

match medicine names.