updated searchPatient to check typ of calling window(or control)