PSNI officers spent the equivalent of six months on duty in hospitals while accompanying patients with mental health problems, according to new figures.