One in five doctors has been sexually harassed or witnessed it at work, with offences including explicit text messages or emails or being groped, propositioned or repeatedly asked to go on a date, a survey has found.

The perpetrators are mostly patients but sometimes they are fellow medics or nurses, according to a survey of 1,378 hospital doctors and GPs across the UK.

A fifth (21%) of those surveyed had experienced or seen sexual harassment in the past three years and 24% had witnessed such behaviour.

Overall, 17% had suffered sexual harassment by a patient and 3% by someone else in their workplace.

The online survey was carried out over the summer by Medscape, which provides news, information and education for health professionals.

The most common forms of harassment by patients involved acting in an overtly sexual manner (53%), asking the doctor out on a date (29%), and trying to touch, grope or rub against them (24%). In one in eight incidents, the patient asked the medic to meet for a sexual encounter. A small number (6%) involved the doctor receiving a sexual email or letter, or a provocative photograph, from the patient.

When the perpetrators were fellow health professionals, the most common incidents involved someone deliberately infringing on their body space (46%), unwanted groping, hugging or physical contact (44%), comments about someone’s body (34%), and being repeatedly asked for a date (32%).

One female doctor recalled: “General inappropriate comments, occasionally sexual. Hugging, hand on thigh, attempts to embarrass, bottom pinching.” Another described her harassment as: “Frequent putting arms around me, trying to hug, shuffling seat too close, frequent ‘accidental’ touching.”

One male doctor recalled how his “perpetrator made inappropriate comments about how I looked buff after I started working out. She also went on to engage in inappropriate touching.” Another said: “My boss gives me a lot of unwanted attention and she touched my hands and different parts of my body almost every day.”

The findings follow research which the union Unison published in June that found one in 12 NHS staff had suffered sexual harassment at work.

In July, the British Medical Association (BMA), the doctors trade union, commissioned an independent investigation into claims by two leading female GPs of sexism and sexual harassment by male colleagues.

Hundreds of female family doctors contacted Dr Zoe Norris and Dr Katie Bramall-Stainer, who are members of the general practice committee (GPC), the body which represents all GPs, after they went public with details of their experiences of misogynistic behaviour and the sexist culture of the male-dominated committee.

The Guardian revealed in February that more than 500 hospital doctors a year in England are accused of bullying and sexually harassing colleagues, but only one in six are disciplined.

More than half (56%) of respondents to Medscape’s survey said they had not reported the harassment. Many said the impact on them included anxiety, avoiding working with certain colleagues and thinking about quitting.

Dr Helena McKeown, the BMA’s chief officer, said: “Sexist, disrespectful and discriminatory behaviour has no place in the health service or medical profession.

“Sexual harassment can be extremely distressing for those affected and this has wider implications on patient safety and quality of care, as this study highlights.”

Doctors who experience sexual harassment need much better support to cope, and it has to become easier for them to report it, she added.

An NHS England spokesperson said: “No one working for the NHS should have to tolerate sexual harassment from either patients or fellow healthcare colleagues and if there is any suggestion of criminal behaviour, the NHS will work with the police and Crown Prosecution Service to secure swift prosecutions.”

It is putting £2m a year into a programme which provides mental health support for victims of harassment or violence.