Image copyright Getty Images

The number of people waiting more than four hours in Scotland's accident and emergency units reached record high levels in the last week of the year.

The latest weekly figures show that just 78% of patients across Scotland were seen within the target time.

This was well below the Scottish government's 95% target, and the lowest since the weekly figures began in February 2015.

In the same week in 2016 there were 92.5% treated within four hours.

Image caption Health Secretary Shona Robison said it had been a "very challenging" time

Health Secretary Shona Robison told BBC Scotland the latest figures were for the week ending on Hogmanay, which had been a "very challenging" time for the health service.

She said the number of flu cases had been double the same period last year and this had caused "exceptional pressures" for A&E.

Ms Robison also said the freezing weather around Christmas had caused problems which had continued to have an impact.

"There were real pressures but despite that nearly eight out of 10 patients are still being seen, treated and discharged within four hours," Ms Robison said.

"That is a huge achievement for staff, given these winter pressures."

The Scottish Conservatives said the latest figures were "nothing short of a disgrace".

Four-hour-target

In the week before Christmas the figure for those being admitted, transferred or discharged inside the four-hour target was 83.3%, up from the previous record low of 81.1% in the week before.

A&E waiting Patients seen within four hours 95% Scottish government target 78.0% Target reached week ending Dec 31

83.3% Target reached week ending Dec 24

81.1% Target reached week ending Dec 17 PA

The latest figures, for the week ending 31 December, show there were 25,865 attendances at emergency departments across Scotland.

Of these, 5,686 were not dealt with within the four-hour target.

The statistics show that 1,156 (4.5%) patients spent more than eight hours in an emergency department.

There were 272 (1.1%) patients who spent more than 12 hours in A&E.

The worst performing health board area was NHS Forth Valley which saw just 57.3% within the target time.

Greater Glasgow (71.1%), Lothian (76.2%) and Lanarkshire (76.8%) also missed the target time in about a quarter of cases.

NHS Grampian (87.9%), NHS Highland (87.6%) and NHS Tayside (87.3%) were the best performing mainland health boards.

Analysis by data journalist Marc Ellison

With statistics, the devil is always in the details.

The latest tranche of weekly waiting time data is no doubt shocking, with just 78% of patients across Scotland being seen within four hours - down five percentage points on the previous week.

But, dig a little deeper, and you'll find the situation in some areas is even worse.

For example, Forth Valley's casualty waiting rooms saw just 57.3% of patients within the target, down 22 percentage points.

That figure eclipses the 8-point drop on the previous week for NHS Highland and NHS Tayside, who both remained among the best performers despite the big fall.

One can go a step further, and also look at how each individual hospital fared between Christmas and Hogmanay.

Forth Valley Royal's performance was down most (22 percentage points), Raigmore Hospital in Inverness was down 14 points, and Ninewells Hospital in Dundee was 10 percentage points lower than the previous week.

But how does this compare to the corresponding week from December 2016, I hear you ask?

Well, the comparison isn't flattering.

Again NHS Forth Valley heads the leaderboard with a 36 percentage point decrease (it was 93% in week 52 of 2016) in the number of patients seen within four hours.

NHS Lothian and Lanarkshire fare a little better with differences of 20 percentage points and 17 respectively.

But one should note that the data for week 52 covers slightly different dates - 25 December 2016 to 1 January 2017, versus 24 to 31 December 2017.

However, considering the previous year's figures included New Year's Day - a day that might be expected to see a high number of alcohol-induced injuries in A&E - the decrease in patients seen in December 2017 is arguably even more telling.

Case study - Allan Browne, A&E patient

Media playback is unsupported on your device Media caption NHS patient: 'Minor fracture could have been worse'

Allan Browne was among patients affected by long waiting times during the festive period. He told BBC Scotland he went to A&E on Boxing Day with a suspected fractured ankle after slipping on ice.

"When I went it in, it looked not too busy, but the woman at reception told me it could be as much as an eight-hour wait to be seen. Eight hours is a long time.

"She said it was probably not broken and told me it was up to me if I wanted to hang about. I decided not to."

"After a week of not being able to sleep properly because the pain was so sore, I decided I am going to have to go back to A&E to see if I can get an X-ray and just see how long it takes."

This time Mr Browne saw a nurse after about three-and-a-half hours.

"She told me that I had fractured my ankle and that I shouldn't have been walking on it," he said.

He believes the delay in getting proper treatment has lengthened his recovery time.

He added: "I always hear the excuse that this is a 'seasonal problem'. But the season comes around every year. Can't they prepare better for this? Can't they provide more staff?"

The situation elsewhere in the UK

Last month, BBC analysis of NHS data showed that fewer patients in Scotland were waiting longer than four hours in A&E than they did in 2012/3 in contrast to England where the number had more than doubled.

It found England had a 155% rise in long waits between 2012/3 and this year, up to 2.5 million a year.

Hospitals in Wales and Northern Ireland also saw an increase over the period.

In Scotland, the number of patients waiting more than four hours fell by 9% to just over 100,000 a year.