The Massachusetts attorney general’s office and Department of Public Health have scheduled a combined public hearing for Aug. 9 on the application of Boston’s fast-growing Steward Health Care System to buy the bankrupt Quincy Medical Center. Trustees of Quincy Medical voted last month to sell the 121-year-old community hospital to the for-profit Steward chain. The hospital filed for bankruptcy protection July 1 in a bid to shed debt before the sale is completed. Because the sale would involve changing a nonprofit hospital into an investor-owned institution, it requires a recommendation from Attorney General Martha Coakley to the Supreme Judicial Court of Massachusetts, which must approve the sale. Steward would also have to be granted a new hospital license by the Public Health Department.