Remember, if the government is paying for your health care, then you have already given them access to your complete medical record without any special permission needed.
The gun related preventative health questions were pushed to be added to many electronic health record systems during the last administration when doctors/clinics were given the carrot & stick by the gov't (basically adopt gov't approved electronic health records and collect the information we want, and we will help pay for your system essentially...or if you don't do this then we will make further cuts to your reimbursement for seeing Medicare patients.
All things with the gov't start with collecting information and registration. Many docs (except some Marxist pedatricians) are just going through the required preventative screen so that they can get reimbursed for their care. If it were me as a patient, I would decline to answer, but add that if I did own guns, I would keep them safely locked up and teach my kids to respect them.