It was thoughtless of him to say such a thing to a sick person.
Literal
Sick-person [to-に] such-thing [object-を] say [nominalizer-なんて] he [in-には] compassion [subject-が] was-not.
なんて after the verb clause expresses surprise or criticism — 'to think that he would say such a thing!' 思いやりがなかった ('lacked compassion') is the judgment. The sentence criticizes someone for being insensitive toward a patient.