Moved patient search logic from routing file to controller.