Athenahealth Inc., a Watertown company that provides electronic record and billing systems to hospitals and other medical industry clients, said it has agreed to buy Epocrates Inc., which has developed point-of-care medical applications that about 330,000 doctors use as reference tools, in many cases on their iPhones. The companies' boards of directors have agreed to a price of $11.75 per share, in cash, for an aggregate purchase price of about $293 million; the purchase price represents a 22 percent premium over Friday's closing price for Epocrates shares on NASDAQ, Athenahealth said in a press release. The transaction is expected to close early in the second quarter, Athenahealth said.