Ways to arrange books
All the books can be arranged in $(2+3+2)!=7!$ ways
There are $3$ branches, three units of books: $\{$History$\}$,$\{$Geography$\}$,$\{$Science$\}$- Arranging branches $=3!$ ways.
Arranging the books within the branches:
History: $2!$
Geography: $3!$
Science:$2!$
Total $=3!(2!\times3!\times2!)=144$ ways
How many ways can the books be arranged? As you said = $(2+3+2)! = 7!$
If the books of the same subject need to be arranged together you need to calculate de permutations for the groups and multiply them by the permutations within every category.
$3! (2! \times 3! \times 2!) = 144$ ways
Groups permutatios x (history permutations x geography permutations x science permutations)
If the books of the same subject must be placed together, there are in essence three "packs," and these can be ordered in just $3! = 6$ ways, where I assume that the order within a pack is irrelevant. If that order is not irrelevant, you then have $3!=6$ ways to arrange the packs, then within the associate packs you have $2!=2$, and $3!=6$ and $2!=2$ ways to order the books. Thus the total is $3! 2! 3! 2! = 144$ ways.
If the seven books are distinct, one can indeed order them in $7!$ ways.