When submitting the application for residency, the applicant fills and signs a sworn declaration, where there is a question regarding having had any contagious disease or mental or physical disorder of public health concern, which is submitted along with the certificate of good health. Please be aware that immigration has the discretion to deny an applicant whose health condition can be considered a hazard to public safety.
Any contagious disease might be a problem. Other than that (other kind of conditions), it won’t affect your residency application.
It is a certificate of good health that needs to be issued by a Panamanian doctor. Usually doctors don't run any tests for this certificate. They just ask questions about your health and if you have any serious diseases and health problems. This is just a requirement and doesn't affect the application. For example, one of the most common visas is the retired visa, where the applicants are least in their 60s and it's common that they have some kind of medical condition.