'Search for Hospitals
- can be called direct
- can be called from search_by_keyword'

def search_hospital(self, message, pquery=None, name=None):

    message_body = message.body
    if (not message_body):
        return None
    if ((not pquery) or (not name)):
        (pquery, name) = self._parse_keywords(message_body)
    T = current.T
    db = current.db
    s3db = current.s3db
    reply = None
    result = []
    table = s3db.hms_hospital
    stable = s3db.hms_status
    query = ((table.deleted == False) & current.auth.s3_accessible_query('read', table))
    rows = db(query).select(table.id, table.name, table.aka1, table.aka2, table.phone_emergency)
    _name = soundex(str(name))
    for row in rows:
        if ((_name == soundex(row.name)) or (_name == soundex(row.aka1)) or (_name == soundex(row.aka2))):
            result.append(row)
    if (len(result) == 0):
        return T('No    Match')
    elif (len(result) > 1):
        return T('Multiple    Matches')
    else:
        hospital = result[0]
        status = db((stable.hospital_id == hospital.id)).select(stable.facility_status, stable.clinical_status, stable.security_status, limitby=(0, 1)).first()
        reply = ('%s    %s    (%s)    ' % (reply, hospital.name, T('Hospital')))
        if ('phone' in pquery):
            reply = ((reply + 'Phone->') + str(hospital.phone_emergency))
        if ('facility' in pquery):
            reply = ((reply + 'Facility    status    ') + str(stable.facility_status.represent(status.facility_status)))
        if ('clinical' in pquery):
            reply = ((reply + 'Clinical    status    ') + str(stable.clinical_status.represent(status.clinical_status)))
        if ('security' in pquery):
            reply = ((reply + 'Security    status    ') + str(stable.security_status.represent(status.security_status)))
    return reply
