Whew, what a story. Seems to happen all too often in this game when you start out.
Anyway, dwarves can be told to stay indoors in one of two ways. One of which (the easier of the two) is to raise a drawbridge or have front doors that are forbidden. The drawbridge has the drawback of having your melee fighters unable to reach the siege, not to mention locking yourself in until the siege passes is pretty boring. The doors are more entertaining because, through careful management, you can get your fighters through and lock them again. This drawback with this is that the doors can be destroyed in later sieges (when goblins bring building destroyers) and that if, somehow, a goblin makes it past the door you, according to the wiki, lose control of the door until a dwarf reclaims it. Generally a combination of the bridge and doors works well for the entrance to the fort
The more difficult, yet much more efficient of the two is the burrowing system. Check the wiki for how to set it up and how it works, but essentially once it's set up you can set an alert in the military menu whenever you want and all dwarves will stay in the burrow. I will caution that dwarves will sometimes path a few paces outside of the burrow, so I tend to cut off the burrow a few spaces short of any drawbridges leading outside to avoid any unfortunate atom-smashing of my civilians. Even though this system takes a while to get used to, and you have to remember to expand the burrow each time you add to your fort, it is definately something that you can set up and fall back on without thinking too much about it, so you don't have to pull levers and lock doors every time something needs to be done.
Tantrum spirals are very difficult to abate. One way I've found is that you can burrow unhappy dwarves in their rooms, assuming their rooms are nice enough. This is a pretty bad idea if you have a ton of masterwork furniture since the crafters might get pissy if the dwarves start tantruming and tearing up their art, but if you lock them in they can't hurt someone else and extend the spiral. Just be sure to let them out when they've calmed down so that they can eat and drink. While I've heard a ton of tricks like this, from making lavish dishes in the kitchen to placing artifact weapons in weapon traps in high traffic areas (to allow the dwarves to admire the fine zinc shortsword or some other such worthless weapons) the only trick I've found to work 90% of the time is simply to let your fort die off and wait for migrants while the last few stark raving mad dwarves run around naked. The migrants always come in a decent mood and as long as you have them haul the corpses and get rid of the miasma they should do fine, and the insane dwarves, as long as they aren't killing themselves or attempting to kill others, tend to survive long enough for a wave to come. The only problem with this is that when you're getting sieged every few seasons 10 legendary soap makers won't help all that much, but it certainly keeps you in the game. I tend to think of it as a reclaim without all of the fuss and monsters lurking about.
Sorry if I repeated anything others have said,
three four others posted while I was writing and while I've edited it a little bit I don't want to get overtaken by the wave of helpfulness