Go A Lawyer ASAP.
I have been a software developer in a large organization for more than a decade.
Then presumably you have at least an acceptable track record with them as you'd have been let go a long time back if not.
I have ADHD and see’s a psychiatrist every 3 weeks.
Your medical condition is no-one's business unless it directly impacts your ability to work or requires special conditions to work in.
Boss is now demanding access to all my health records or said he will fire me.
Your medical record are not their business unless they can show your a cause for needing such records.
He has also locked my Active Directory account (he says temporary) and deactivated my building pass until I sign the document for HR to obtain all my medical records.
That, in my jurisdiction, would be blatant constructive dismissal.
They are preventing you from working. Make sure you continue to report for work and make a record of everytime you are refused access. Email HR everytime they refuse you access to work and ask them to justify this. No phone calls.
I have till Monday (less than a week) to sign the document.
Talk to a lawyer and ideally one engaged in employment law.
If they fire you it would, frankly, be no bad thing as they are clearly awful employers. As you've been there ten years it suggests a change in management up the line and not for the best.
If you are fired you still have legal recourse.
I am located in Australia.
There are typically independent agencies that offer basic legal advce to people on their rights and are often free. Look for these.
Should I sign the document so my employer has access to all my medical records and all the psychiatrist's notes on me?
No without your own solicitor's legal advice to do so.
Note that the document does not explicitly request the psychiatrist's notes.
I cannot say never as I don't know the detail of Australian employement law, but I can think of no jurisdiction where detailed notes of a psychiatrist are going to be legitimately made available to a company. They're probably the single most private form of record available. Even the police would have difficulty obtaining such notes in an investigation. In some jurisdictions this would require a court order to obtain and would be extremely hard to get. They're trying to get you to volunteer this info which is extremely devious IMO.
Legal advice - now.
I would suggest emailing the head of HR directly stating flatly that you will need to seek independant legal advice before proceeding. I would suggest indicating your are astonished that such private material could be demanded and that at present it is your employer who is preventing you from working and not in any way your choice.
Regardless of what their reply get that legal advice.
Keep records of communications and decline any verbal communication as they are easily denied afterward. Emails only.
Lawyer. Now.