Retrieving self-links is a scope that's used from multiple places and factoring it out is pretty easy, so might as well do that:

```ruby
def self.has_self_link
  where('participant_person_links.relationship_code' => 1)
end

def self.associated_with_hospital
  hospitals = PbsList.is_hospital

  has_self_link.joins(:pbs_lists).where('pbs_lists.id' => hospitals)
end
```