By David Stanway and Yifan Wang

SHANGHAI, April 25 (Reuters) – Shanghai’s COVID-19 lockdown misery dragged into a fourth week, as orders on Monday for mass testing in Beijing’s biggest district sparked fears that the Chinese capital could be destined for a similar fate.

In their battle to stamp out the virus, authorities in Shanghai said they would reserve the harshest restrictions for smaller areas around confirmed cases, raising hopes of some respite among the millions of people currently living in strictly quarantined neighbourhoods.

“Every compound, every gate, every door must be strictly managed,” Qi Keping, vice-head of Shanghai’s northeastern commercial district of Yangpu, told a daily newsconference, describing the new, more targeted approach, and saying it would “better achieve differentiated prevention”.

In Beijing, all 3.45 million people living or working in Chaoyang district were ordered to have three tests this week, as authorities warned that the virus had crept into the city largely undetected during the previous week, with a few dozen cases reported.

Fearing they were about to taste the misery suffered in Shanghai, many people in the capital began stockpiling food, toilet paper and other basic goods.

China stocks (.CSI300)(.SSEC) slumped to two year lows on heightened worries of a potential outbreak in Beijing.

Blanket restrictions over large areas have fuelled frustration and anger in Shanghai, a city of 25 million people.

Over the weekend, authorities in China’s commercial capital sealed off entrances of public housing blocks and closed off entire streets with two-metre-tall green wire mesh fences, with videos circulating online showing residents protesting from their balconies.

Police in hazmat suits have been patrolling the streets, setting up road blocks and asking pedestrians to go home.

While some people are allowed to leave their homes, most living under lockdown in Shanghai are either confined to home or cannot leave their residential compound. Even those who can go out have few place to go, with shops and most other venues closed.

Explaining the need for a new approach, Qi singled out the Tongji New Village area in her district, saying that although all its 6,000 residents were under complete lockdown, only a few residential buildings were reporting positive cases and curbs could be more focused on those.

Qi spoke alongside other city officials.

One woman in Shanghai’s Changning district, who declined to be named, said Qi’s comments gave her something to cling on to.

“Though I’m still sealed up now, I’m crying with joy,” she said via WeChat.

Shanghai is carrying out daily COVID tests and accelerating transfers of positive cases to quarantine facilities, sometimes outside the city. In the past week, authorities have transferred entire communities, including uninfected people, saying they need to disinfect their homes, residents said.

Health officials said demand for ambulance and emergency services in hospitals was more than 12 times higher than a year ago, putting strains on the system despite a four-fold increase in manpower, longer working shifts and a 50% increase in ambulances.

“Although the measures have eased the supply strains to some extent, there is still a big discrepancy with the actual needs of the public,” Zhao Dandan, deputy director of the Shanghai Municipal Health Commission, told the same news conference.

The Shanghai government reported 51 new COVID deaths on April 24, the highest daily tally so far.

That takes the official death toll to 138, all reported from April 17 onwards, although many residents have said relatives or friends died after catching COVID as early as March, casting doubt over the statistics.

Local asymptomatic cases fell to 16,983 from 19,657 the day before. Symptomatic infections rose to 2,472, from 1,401.

Cases outside quarantined areas dropped to 217 from 280. Other cities that have been under lockdown began easing restrictions once such cases hit zero.

Research by Gavekal Dragonomics published on Friday estimated that out of China’s top 100 cities by economic output, 57 had “relatively tough” COVID restrictions in place last week, down from 66 the week before.