Was added factory, which contains auxiliary methods. Moved query to the server from PatientListController to db-factory.