Fix panel sorting func in buildPatientSetQuery()