I don't know if by supplying a doctors note indicating the issue you may be able to work out something with the seller and get a partial refund of your escrow, something to try.
Regarding the 18,000 I would get a Real Estate attorney to look at the contract and explore options. I know the contract allows for breaking it if you find "issues" during the inspection that make you change your mind regarding buying. There is another clause that allow you to cancel the contract if there are issues obtaining the financing.
In other words, there might be several legal opportunities to get you out of the contract.
Sounds like you put a deposit on a new build home?
I would reread your contract to see what happends if you don't send the 2nd deposit.
Then contact a Real Estate attorney and have him read also to make sure there are no penilities
for not sending the balance.
Before you do anything else, seek the advice of a Real Estate attorney. Depending on what type of contract you signed will depend on the consequences you might face. Health issues generally aren't a good enough of reason to get out of a binding contract. However, some contracts have clauses which will allow you to back out for certain reasons (inspection, financing, etc).