@Ticked I don’t understand why you’re attempting to build the query yourself, when the relations should be set up on the models?
If you do set up the relations on the models (a Hospital belongs to many Treatment, and vice versa) then you can fetch all hospitals, and group the resultant collection by the hospital name:
$hospitals = Hospital::with('treatment')->get()->groupBy('name');
This will give a collection where the key is the hospital name, and the the value is a collection of treatments, which you can now iterate over in your Blade template:
<ul class="list-unstyled">
@foreach($hospitals as $hospital => $treatments)
<li>
<h4>{{ $hospital }}</h4>
<ul class="list-unstyled treatments-group">
@foreach($treatments as $treatment)
<li>
<a href="#">
<h5>
<i class="fa fa-file-text-o"></i>
{{ $treatment->name }}
</h5>
<p>{{ $treatment->friendly_name }}</p>
</a>
</li>
@endforeach
</ul>
</li>
@endforeach
</ul>