This spell is a problem. And the problem is that it's one of the best healing spells in the game. It provides huge amount of utility, including control of several types, fast motion, flight, and other environmental accomodations, but the core problem is that the way that fifth edition implemented shape-changing is mechanically terrible, in a way that hurts wild-shape druids and polymorph in similar ways.

Polymorph is a fourth-level spell, which lets you (a) turn an ally into an arbitrary beast of CR up their level for up to an hour, or (b) turn an enemy into an arbitrary beast of CR down to 0 for up to an hour. When they change form, they acquire a new pool of hitpoints (either a lot or very few, depending on the form), and when that pool runs out, they are returned to their old form.

That is bonkers. It mixes one of the highest utility spells available at its level with a reasonably solid lockdown control spell AND you can use it to give a dying character a massive pile of effectively temporary hp. Added to that, the flexibility comes with a real-world cost - you can use the form of any beast, which means that you have a huge amount to choose from, need to track dozens of stat blocks, and any time you add another book to your stack, you risk unbalancing the entire system by adding new beasts with interesting abilities or stats. (Definitely don't allow Tome of Beasts if you play with stock Polymorph!).

I've tried a few different things to tone this down - one of the more impactful changes I made (which did help a fair amount) was to consider each possible form one could polymorph a target into as a different spell to prepare. That solved several problems - the prep-time was fixed, and the over-flexibility was largely resolved, but we still had the issue that the most effective emergency healing spell was clearly not designed to be used for that at all.

So here's my current revision to the thing:

First, update the saving throw language to add "and may attempt another saving throw each time they take any damage caused by an ally of the caster."

Second, on replace the entire third paragraph (about 'assumes the hit points') with:

The target may choose assume the maximum hit points of its new form - if it does
so, change its current hit points so that the ratio of hit points to maximum hit
points is kept consistent (round down). When changing back, use the same
approach - if you are at half health when polymorph is cast on you, you will
still be at half health in your new form, even if that means more _actual_ hit
points; if you are at 20% of your maximum health when the spell ends, then you
will be at 20% of your normal maximum hit points afterwards. If you revert as a
result of dropping to 0 hit points, you are considered to have been in the form
in question when you received the damage.

Notably, this means that (a) you can be a squirrel with a hundred hit points, (b) your enemy can choose to keep their hit points when you make them a frog, and (c) if you turn into something huge with tons of hit points, those aren't free hit points (though they do trade favorably).

I've still got to do some play-testing - I'm pretty confident that this will behave appropriately when used on allies (in that it will function as a shape- changing spell, and not as a bag of hit points), but I'm not as sure that it's both still useful and not abuseable against enemies (compared to similarly- leveled control spells, like Banish).

Personally, I also intend to limit the caster to specific forms ahead of time, and make 'specific voluminous knowledge' about the creature in question part of the requirements of the spell - then I can let them add new creatures as a downtime activity, and expect them to always have statblocks prepared, instead of shuffling through the manual searching for a solution to the current problem during a session. But I don't think that needs to be part of the spell rules.