Fix biggest SQL queries in Appointment

Signed-off-by: Atanas Kerezov <kerezov.atanas@gmail.com>