updated query for patient search