refactor patients form controller