Use Python to join objects with hierarchy in outliner
If an object has no parent its parent attribute will be  None.  If it has children its len(ob.children) will be greater than 0.  

Then we can select all top level obs as having no parent and children, select all their children, deselect non meshes and join

import bpy

context = bpy.context
scene = context.scene
# select scene objects that have no parent and children
obs = [o for o in scene.objects if not o.parent and len(o.children)]

for o in obs:
    # deselect all
    bpy.ops.object.select_all(action='DESELECT')
    scene.objects.active = o
    # select all children recursively
    bpy.ops.object.select_grouped(type='CHILDREN_RECURSIVE')
    # select parent too
    o.select = True
    for so in context.selected_objects:
        #deselect if not mesh
        if so.type != 'MESH':
            so.select = False
    #if there are some mesh children
    if len(context.selected_objects):
        scene.objects.active = context.selected_objects[0]        
        # join them
        bpy.ops.object.join()