GATEWAY-3180 subtask GATEWAY-3374: Patient Discovery - code and unit tes...

...ts complete.