The alarm bells could not get any louder.

Two winters ago, hundreds of patients had to wait more than 12 hours in A&E departments in Scotland, and staff and patients warned there was a gathering crisis in the NHS. Now the signs of strain in the service are even more acute, with thousands being treated in the wrong wards and thousands more stuck in hospital when they are ready to go home.

The figures for this summer are particularly troubling, with records obtained by The Herald showing that in July and August, 3,309 patients had to be looked after in the wrong department for their condition - a practice known as boarding, which has been shown to increase a patient's risk of dying. The figures also show that in July, 1,706 patients were stuck in hospital even though they were well enough to be discharged; in August, the figure was 1,703.

That so many patients are being left in these difficult and potentially dangerous situations should be worrying at any time of year, but it is especially so in July and August when hospitals are less prone to the kind of pressures seen in the winter months. The obvious question is: if it is this bad in the summer, what could it be like in December?

The figures are also evidence of a serious and ongoing problem with the working of the NHS in Scotland: the lack of good co-ordination between hospital and community-based care. In some cases, patients will stay in hospital too long because staff are over-worked and there may not always be not enough focus on moving patients through the system efficiently. But in most cases, boarding is happening because community care is not ready at the right time.

The Scottish Government has recognised this problem and has a vision to move more services into the community by 2020 to help people avoid admission to hospital.

But as yet there is still no coherent plan to put the vision into practice and there cannot be until there is a review to ensure hospitals have the right beds in place at the right time to cope with Scotland's ageing population. There must also be a review of community care capacity to determine how it needs to expand and change.

The Herald has been calling for such a review as part of our NHS: Time for Action campaign and the need for the review is now acute. Theresa Fyffe, director of the Royal College of Nursing Scotland, believes admitting thousands of patients to the wrong ward is not only bad for patient care, it is a symptom of a sick system. But we will not know how sick it is until a comprehensive review of care in hospitals and the community is carried out.

The figures published today are not the first signs of the crisis; they are simply more evidence of a system under stress. What is now needed urgently is an investigation into where demand is greatest. Only then will the NHS be able to move towards the model of care that is needed to cope with Scotland's changing, ageing population.