Hi,
First and foremost, I can completely understand how you are feeling right now (having had that feeling several times). In terms of scaling and rankings, I don't really know too much about them unfortunately so I can't really give you reassurance in terms of how much it will impact on your ATAR, but I can give you some practical advice on what you should do.
1. You really need to calm yourself down. Breathe deeply a few times, and think about your recent failures logically. It seems hard to realise this, but doing bad in a few exams does NOT mean your life is over. Therefore, you shouldn't be so panicked that you feel as if you are trapped and you don't know what to do.
2. Re-examine your study techniques and really analyse your failures. Where did you go wrong? Did you actually study ahead of time or did you procrastinate and decide to watch game of thrones instead? Did you lose time in the exam? Did you stress out in the midst of your exam and experience a mind blank? And once you figure out what you did wrong, try and find some strategies to prevent you from having the same problem again.
3. Recognise that the HSC is not the be-all and end all of life and that if you don't get the required marks, you still can achieve your career goals. You are just going to have to find a different way. At this moment, as I told you before, I don't know whether you can achieve your goal ATAR, but all I can say is this. You are just going to have to muster some resilience and build your confidence and self esteem up, so that you can last your whole HSC. That is honestly the most important. Work as hard as you can, be positive, and don't give up no matter what. These skills are the ones that are going to help you the most, particular if you want to become a doctor
4. Once you have this perspective, you should be able to relax and calm your mind, so that you don't feel scared. Once you are in this state of calm, I honestly recommend you seek help. And by that I mean, get tutors, ask your teachers to help you out, and just work towards improving. Write as many essays as you possibly can and get feedback on all of them, if your worst subject is English. Do as many practice papers as humanly possible. Work hard with as much positive energy and determination as you can. Become obsessed with improving your exam results. It is hard, but I promise, even if you don't get the result you wanted, at least you will have the satisfaction of saying "I did my best." And honestly speaking, you will be fine no matter what. If you really want to do medicine, you will find a way to achieve your dream. Just keep your passion for med alive, and honestly start UMAT prep (cause that counts more than your ATAR).
5. Believe in yourself no matter what. Stay positive! You can do this! 70 000 students sit the HSC every year. You are not alone. Everyone (even the dux) will be panicking about exams at some point or another. The important thing is, you stay balanced, stay positive, work as hard as you possibly can, and do your best. The mark you get will be a result of that. And even if you don't get the mark, find a different way. Try medical science as a degree, and then transfer into med later on in uni.
Hope this helps!!!