Hy-Vee said Friday it will acquire patient files of 22 Shopko pharmacies in Minnesota and four other states.

The deal comes just days after Shopko announced that it is closing 39 stores in 19 states.

“As we continue to grow our pharmacy business, we pride ourselves on providing an excellent experience to our customers,” Chief Executive Randy Edeker said in a statement.

The Hy-Vees in Minnesota that will get Shopko’s book of business and the dates Hy-Vee can start refilling prescriptions are: Mankato Hilltop (Dec. 19), Marshall (Dec. 20), Rochester Crossroads (Dec. 20), Fairmont (Dec. 20), Winona (Jan. 4), Albert Lea (Jan. 4), Rochester 37th Street (Jan. 8), and Austin (Jan. 9).

Hy-Vee is making a similar purchase of Shopko pharmacies in Wisconsin, Iowa, South Dakota and Illinois, chiefly in locations where it has stores near a Shopko site.

Shopko customers affected by the deal will receive letters from Hy-Vee explaining the details, but they are free to transfer their business to any pharmacy outside of Hy-Vee.

Supermarket retailer Kroger is also acquiring some of Shopko’s pharmacy business.

It will purchase 42 of Shopko’s 227 pharmacy locations and offer the services in its Roundy’s division stores such as Pick ’n Save, Copps and Metro Market.

In Minnesota, Shopko will close stores in Mahnomen and Paynesville. Liquidation sales are in progress with the stores closing by the end of February. Shopko operates nearly 40 stores in Minnesota.