; (ii) will provide outpatient services; and (iii) may include a military services program to meet the needs of active and retired military servicemembers; and (B) excludes any facility described in paragraph (1)(B). (3) The term psychiatric hospital means— (A) an institution that— (i) is primarily engaged in providing, by or under the supervision of one or more physicians, psychiatric services for the diagnosis and treatment of mentally ill persons or those suffering from substance abuse disorders; (ii) satisfies the requirements of paragraphs (3) through (9) of subsection (e) of section 1861 of the Social Security Act; (iii) maintains clinical records on all patients and maintains such records as the Secretary finds to be necessary to determine the degree and intensity of the treatment provided to individuals entitled to hospital insurance benefits under part A of title XVIII of the Social Security Act; and (iv) meets such staffing requirements as the Secretary finds necessary for the institution to carry out an active program of treatment for individuals who are furnished services in the institution; or (B) a distinct part of an institution that satisfies clauses (i) and (ii) of subparagraph (A) if such distinct part satisfies clauses (iii) and (iv) of subparagraph (A). (g) Funding limitations The Secretary may provide loans and loan guarantees under this section— (1) only to the extent or in the amounts provided in advance in appropriation Acts