We have found the perfect business. We thought it would involve palm trees, soft breezes, and tanning oil, but Health Systems International (HSI) is even more appealing than that.

Don't let HSI's stately New Haven office building, or its claim to be just "a computer software corporation specializing in the health-care industry," fool you. This is the ultimate company.

In essence, HSI designs the framework that governs how hospitals get paid, and then sells the hospitals software so they can comply with those established descriptions.

How it found itself in this enviable situation is a study in luck and timing. Richard Averill, now HSI vice-chairman, was developing practical models for understanding health-care costs back in the 1970s at Yale University, when even the government realized health costs were absurd. Federal officials started looking for someone to design a system to help control Medicare costs. Who better, they asked, than Richard Averill who had already developed a program employed by the state of New Jersey?

Averill's work led to the wholesale adoption of DRGs (diagnosis-related groups), a fancy name for a formula that pigeonholes a patient's hospital treatment into one of 473 slots and calculates how much it should cost. For example, an appendectomy performed in an urban hospital without complications should cost, on average, no more than $2,929. For patients with complications: $6,817. Hospitals are now paid according to the DRG assessment, and not, as was done before, on the basis of their costs.

All this is fine and would have made Averill a footnote to history, except for one thing. Hospitals need software to follow the guidelines. If Medicare is going to pay only according to a preset formula, hospitals must assign each patient's case to the appropriate DRG -- otherwise they might not get paid. And who better to design and sell that software than Richard Averill? So five years ago he left Yale to join HSI, which, though now facing competition from 3M and Ernst & Whinney, remains the market leader. Being the company that made up the rules is a strong selling point.

"The especially nice thing about all this," says Averill, "is that the DRG software gets our foot in the door and allows us to try to sell other computer software that hospitals might need." To date, it appears HSI's attempts have been successful. The privately held company reports about $7 million in revenues for 1987 and claims pretax profits of 10%.

Now, the government is looking at ways of controlling outpatient costs and is thinking along the lines of DRGs. HSI is already working on a model.