TRUNK-4145: change and restrictions to or restrictions and retun distinc...

...t tuples

https://tickets.openmrs.org/browse/TRUNK-4145

https://tickets.openmrs.org/browse/TRUNK-4146