It depends where you are getting surgery. If you are getting surgery on your face, I would recommend waiting to do microneedling until after you have recovered. Microneedling patients are generally fully healed before seven days, but with the inflammation that accompanies most facial surgery I would not risk irritating your face beforehand. If your surgery is elsewhere on the body, microneedling on the face seven days before surgery should be fine.
It depends on what kind of procedure you're getting but in general the healing time for micro needling is less than seven days. If you do the micro needling with PRP you can significantly cut down on the healing time. Best of luck!