public void ConsultarPacientes(String Dato, int Limpiar) {
        Paciente paciente;
        ArrayList<Paciente> pacientes = null;
        int i, tam;
        String query = null, query2 = null;
        //try {
        tam = Dato.length();
        if (tam == 0) {
            pt.TablaPacientes1(jtPacientes);//TablaPacientes();
//            DeshabilitarAñadirHistoria();
        } else {
            pt.TablaPacientes1(jtPacientes);//TablaPacientes();
            paciente = new Paciente();
            switch (Limpiar) {
                case 0:
//                limpiarSiDNI();
                    //query="SELECT  p.dni,p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\", hc.\"codCarpeta\",hc.\"codHistoria\" FROM \"HistoriaClinica\" as hc inner join \"Paciente\" as p on hc.dni=p.dni  where hc.dni like '"+Dato+"%';";
                    query = "SELECT p.dni, p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\",hc.\"codHistoria\", hc.\"codCarpeta\",hc.\"histAntigua\"\n"
                            + "  FROM \"Paciente\" as p inner join \"HistoriaClinica\" hc on hc.id=p.id where p.dni like '" + Dato + "%';";
                    break;
                case 1:
                    limpiarSiNumCarpeta();
                    //query="SELECT  p.dni,p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\", hc.\"codCarpeta\",hc.\"codHistoria\" FROM \"HistoriaClinica\" as hc inner join \"Paciente\" as p on hc.dni=p.dni  where hc.\"codCarpeta\" like '"+Dato+"%';";
                    query = "SELECT p.dni, p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\",hc.\"codHistoria\", hc.\"codCarpeta\",hc.\"histAntigua\"\n"
                            + "  FROM \"Paciente\" as p inner join \"HistoriaClinica\" hc on hc.id=p.id where hc.\"codCarpeta\"='" + Dato + "';";
                    break;
                case 2:
                    limpiarSiHistClinica();
                    //query="SELECT  p.dni,p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\", hc.\"codCarpeta\",hc.\"codHistoria\" FROM \"HistoriaClinica\" as hc inner join \"Paciente\" as p on hc.dni=p.dni  where hc.\"codHistoria\" like '"+Dato+"%';";
                    query = "SELECT p.dni, p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\",hc.\"codHistoria\", hc.\"codCarpeta\",hc.\"histAntigua\"\n"
                            + "  FROM \"Paciente\" as p inner join \"HistoriaClinica\" hc on hc.id=p.id where hc.\"codHistoria\" like '" + Dato + "%';";
                    break;
                case 3:
                    limpiarSiHistAnt();
                    //query="SELECT  p.dni,p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\", hc.\"codCarpeta\",hc.\"codHistoria\" FROM \"HistoriaClinica\" as hc inner join \"Paciente\" as p on hc.dni=p.dni  where hc.\"codHistoria\" like '"+Dato+"%';";
                    query = "SELECT p.dni, p.\"ApPaterno\", p.\"ApMaterno\", p.\"Nombres\",hc.\"codHistoria\", hc.\"codCarpeta\",hc.\"histAntigua\"\n"
                            + "  FROM \"Paciente\" as p inner join \"HistoriaClinica\" hc on hc.id=p.id where hc.\"histAntigua\" like '" + Dato + "%';";
                    break;
            }
            //pacientes=paciente.ConsultarPacientes(query,0);
//            pacientes=paciente.ConsultarPacientes(query,0);
//            if(pacientes!=null){
//                for(i=0;i<pacientes.size();i++){
//                    paciente=pacientes.get(i);
//                    Object fila[]={paciente.getDNI(),paciente.getApPat().trim()+" "+paciente.getAptMat().trim()+" "+paciente.getNombre().trim(),paciente.getCf().getCarpetaFamiliar(),paciente.getHc().getHc(),paciente.getHc().getCf()};
//                    ((DefaultTableModel)jtPacientes.getModel()).addRow(fila);
//                }
//            }
//        }
//        } catch (SQLException ex) {
//            Logger.getLogger(frmPrincipal.class.getName()).log(Level.SEVERE, null, ex);
//        }
        }
    }