update the patient flag query