refactor patient edit