Rearrange the following sentences to form a meaningful paragraph:
P: The doctor examined the patient.
Q: He prescribed some medicines.
R: The patient thanked the doctor.
S: He advised proper rest and diet.