They can't take 'all of the money' only that portion reflecting the care they have provided. Thus, if you were billed $5,000 and receive a settlement of $15,000 you would get $10,000.00 after they take back the $5,000 they paid for your care.
This is why it is important to make certain you have a skilled malpractice attorney involved in a case, they can 1) make certain that your damages are fully addressed in a settlement, and 2) can explain the outcome of a settlement before you agree to it.
I am licensed in New Mexico and Pennsylvania, and therefore any discussion of issues related to other states must considered within that context. In addition, my comments are not intended to create a legal representation but merely to respond to the limited facts presented by the question. Any opinion herein is not meant as a precise statement of legal rights or as a recommendation of any particular course of action. A more complete legal review can be obtained through local counsel.