Think yourself lucky Crabbyfoot - when I was working in the NHS I was told that we had to ask patients every time they attended an appointment - "Have you changed sex since I last saw you?"
I refused point blank to do it, on the grounds that it would be impossible to do my job if I could not establish and maintain a therapeutic relationship - and how could I do that if my patients thought I had gone stark, staring bonkers?
In your situation, if you felt you absolutely had to ask about "gender identity" and didn't want to upset or confuse your patients maybe you could get away with something like:
"Oh! It says on this form I have to ask your "gender identity"? Would that be "female", Mrs Trellis?" (said with a quizzical look, pausing briefly for a laugh, a look of fleeting bewilderment or the chance for Mrs Trellis to volunteer whatever response she felt appropriate - then move swiftly on!)
A potential issue, though rather remote as vanishingly few will claim to have a "gender identity", is that directly questioning patients about their "gender identities" might be experienced as intrusive, even distressingly "outing".
This would be a good reason for replacing a direct question with something more open and potentially much more useful, such as, "Is there anything else that you think I need to know?"
If Mrs Trellis does not volunteer that she was born a man, for example, then record "Gender Identity" as "Female".
Alternatively, you could try to find out from your colleagues what sort of responses their patients gave, surreptitiously sounding out if there would be support for "feedback" to your bosses about the appropriateness and relevance of asking your elderly patients about their "gender identity".
OMG - this has reminded me of a social worker who covered the same wards as me in Elderly Care, who asked all her patients/clients when they last had sex with their "spouse". She persisted in doing this, claiming that it was essential she knew, despite most patients being very angry with her at her impudence, or upset to the point of tears and too distressed to continue the interview, or in one case being outraged at the suggestion that she had sex with animals!