You can solve this with ajax, if you have already done the so famous fields select "State X Municipality", follow the same reasoning.
Clicking the button will trigger an event that will have an ajax that will point to a php file, where you will get the parameter and with it will mount the specific query and return the database data.
// cadastrarPaciente.js
$("#uf").on("change", function(){
$.get("modulos/pacientes/ajax_listarCidade.php",
{uf: $("#uf").val()},
function(dados){
$("#cod_cidade").empty();
$("#cod_cidade").append(dados);
});
});
// ajax_listarCidade.php
$PArray['uf'] = $_REQUEST['uf'];
$sql = "SELECT cod_mun, nome_mun FROM TMunicipio WHERE uf = '{$PArray['uf']}'";
...
Just follow this reasoning.