Obamacare is driving a transformation in the way pharmacies do business, so get ready.

The healthcare reform law will expand access to medical services for millions of people. That's going to place added pressure on primary healthcare providers and challenge the system to meet the new demand.

So it may not be surprising that the nation's three major drugstore chains are gearing up to play a bigger role. They're placing retail health clinics in their stores, pushing their pharmacists to be more proactive with their prescription customers, and even entering partnerships with big medical groups.

One other thing: They're battling for market share. If there's a vacant street corner in your neighborhood where a gas station lost its lease, don't be surprised if it sprouts a new CVS, Rite Aid or Walgreens within a couple of months.

Those three national pharmacy chains have been jostling with one another over prime locations for years. Recently the competition has stepped up.

"Retail competition is coming to healthcare, and pharmacies are on the leading edge," says Adam J. Fein, a healthcare industry consultant who runs the Drug Channels blog.

The chains are aiming to become your one-stop shop for all your prescriptions. In California and most other states they already can vaccinate you against common diseases like flu. They're adding other services of the type that physicians traditionally claim as their monopoly, such as managing diabetes and other chronic diseases.

Most dramatically, Walgreens announced in January that it had formed Accountable Care Organizations in partnership with three big medical groups in New Jersey, Texas and Florida. These organizations, which are encouraged under Obamacare, replace Medicare's traditional fee-for-service model with pay-for-performance: When they deliver better patient results at less cost, they get to keep some of the savings.

Pharmacies charge nominal fees for routine vaccinations to cover the cost of the medication, but by law they're not allowed to charge for healthcare advice. The industry wants to change that. "To make that role viable, we'd like to get the pharmacists compensated," says Harry Leider, Walgreens' chief medical officer.

That's a major thrust of the industry's lobbying at the federal and state levels and it's got powerful support in Washington, notably in the surgeon general's office. In a 2011 report, the surgeon general's office of the chief pharmacist said pharmacies were well-positioned to help fill some of the gaps as demand for healthcare grows.

Who opposes this trend? That's right, your local medical association. The physicians lobby contends that expanding the pharmacists' role would fragment patients' care, fomenting conflicts between two different levels of provider and possibly resulting in contradictory services.

But on balance, expansion of the retail pharmacist's role is likely to be positive for consumers. Consolidating a patient's prescriptions at one location helps pharmacists monitor refills and stay on the lookout for harmful interactions. This is good because patients' failure to comply with their doctors' orders is a big cause of poor medical outcomes, as is multiple doctors prescribing at cross-purposes for a single patient. And anything that makes vaccinations and other preventive measures more accessible is a plus.

This transformation is coming on top of other changes that placed the traditional corner drugstore on steroids therapy. Drugstores always stocked a broader inventory than merely prescription and patent medicines, but in recent decades they started offering almost anything that qualified as an impulse buy — packaged foods, cigarettes, candy, batteries, cosmetics and seasonal goods like greeting cards and holiday gewgaws. All three chains tend to report their highest sales in the quarter that includes Christmas — at CVS, that quarter accounted for nearly one-third of operating profit last year.

"They've become convenience stores," observes Wendy Leibmann of WSL Strategic Retail, a New York retailing consultant. "The drugstore used to be a place people went every 30 days to get my prescription refilled, so they put food in the front to get people to come more often."

That explains the standard floor plan of the chain drugstore. The pharmacy section is in the back so you'll have to navigate past racks of toothbrushes, shampoos and deodorants before you collect your refill. The pharmacy is both a profit center — it typically occupies 10% of the floor space but delivers 70% of revenue and more than 50% of profits — and a customer draw.

"When you have a pharmacy in the store, you sell twice the volume of over-the-counter drugs," says David Pinto, editor of the industry journal Chain Drug Review.

The impulse model also explains why chain pharmacies end up facing one another across busy intersections, Leibmann says — they stock merchandise you might not think is worth making a left turn for, but you might pull over if the curb cut is on your side of the street.

My rule of thumb is that in any given middle-income ZIP Code there are three chain drugstores for every two Starbucks. This metric derives from a rigorously scientific study: Within five miles of my house I counted 31 CVS, Rite-Aid and Walgreens locations, and 20 Starbucks, plus two Peet's.

The total number of pharmacy locations may not actually have increased. Instead, we're witnessing the ruthless consolidation of the industry into three dominant chains. Ranked by number of stores, they're Walgreens (7,930, according to its latest annual report), CVS (7,458) and Rite-Aid (4,623). Wal-Mart ranks third among them in total prescriptions filled, but obviously it's a different retail model.

The growth of the national chains has made endangered species of independent druggists and regional chains. Remember Longs Drugs, Sav-On and Thrifty, familiar old names in the California market? Longs was snarfed up by CVS in 2008, just two years after the same chain bought Sav-On. Thrifty disappeared into Rite-Aid in 1996.

The challenge for the big three chains is to distinguish themselves from one another. That's not easy to do with the generic merchandise they all stock in the front of the store, or the prescriptions that they all fill, or shopper loyalty programs (which have also become generic).

One form of differentiation may be in service. The traditional chain store staffs its pharmacy, which accounts for about 10% of its 10,000-12,000 square feet, with five or six highly-paid professionals, then scatters a handful of low-wage clerks around the rest of the store. Now they're moving the pharmacists in front of the drug counter to interact more with customers. As Obamacare kicks in they'll be offering people advice on how to sign up for coverage.

That's unsurprising, for pharmacies are among the businesses for which Obamacare is an almost unalloyed plus: The more insured Americans there are, the more demand there will be for prescriptions. That will accelerate a trend that appeared years ago, as medical care in the U.S. became more pharmaceutical, especially for seniors. The number of prescriptions written per capita rose from 10.1 to 12.6 from 1999 to 2009, according to the Kaiser Family Foundation.

Changes in the drugstore industry aren't going to happen without glitches. There's a fine line between monitoring a customer's prescriptions for his or her benefit and refilling them without permission to capture profits. CVS and other pharmacies have been accused of overzealous prescription refills, as my colleague David Lazarus has reported.

Moreover, the competition for customers is only going to become more fierce. Wal-Mart, Target, the major supermarket chains and mail-order companies are all heavily invested in pharmacy services, so the big three drugstore chains won't have the market to themselves. There are signs that the chains' expansion phase is ending; CVS and Walgreens both say they're ratcheting back the number of new openings this year.

But the jockeying for market share isn't over, and the transformation of the pharmacy may be just beginning. Your corner druggists will be doing more than ever before, and they'll be on more corners too.