'Qui' is used when the noun phrase/pronoun heading the relative clause is the implied subject of the relative clause, whether inanimate or animate. e.g. quand on void quelqu'un qui se noie il faut essayer de le sauver
Here it is clear that 'quelqu'un' is the subject (as it is them that has hurt themselves) and so we use 'qui'.
'Que' is used when the noun phrase/pronoun heading a relative clause is the direct object of the clause, whether inanimate or animate. e.g. c'est une poste que j'aurais aimé avoir
Here 'une poste' is receiving the action rather than doing the action, and is therefore the object of the relative clause