The doctor said, "Do you have a headache now?"
The sentence can be written in indirect speech as:-
1
The doctor asked the patient if he had a headache then.
2
The doctor asked the patient if he has a headache now.
3
The doctor asked the patient if he had a headache now.
4
The doctor asked the patient that he had a headache then.