if ($_POST['txtTelefono'] == "") {
     $per_telefono = 0;
 } else {
     $per_telefono = $_POST['txtTelefono'];
 }
 $per_procedencia = $_POST['cmbPais'];
 $per_sexo = $_POST['rdSexo'];
 $per_direccion = $objUti->eliminaEspacios($_POST['txtDireccion']);
 $pac_id = $objPac->nuevoPac_id($objCon);
 $pre_id = $_POST['cmbPrevision'];
 $ins_id = $_POST['cmbInstitucion'];
 $nac_id = $_POST['cmbPais'];
 try {
     $objCon->beginTransaction();
     if (isset($_POST['rn']) && $_POST['rn'] != "") {
         $datosRN = $objPac->ultimoRN($objCon);
         if (count($datosRN) == 0) {
             $max = "RN1";
         } else {
             $max = 0;
             for ($i = 0; $i < count($datosRN); $i++) {
                 $ide = $datosRN[$i]['rn'];
                 $tamStr = strlen($ide);
                 $maxAux = 0;
                 for ($p = 0; $p < $tamStr; $p++) {
                     if ($p > 1) {
                         $maxAux .= $ide[$p];
                     }
                 }
                 if ($max < $maxAux) {
                     $max = $maxAux;