Пример #1
0
        public static ListaEspera Select_Paciente(string cpfPaciente)
        {
            ListaEspera lista = null;
            var         c     = new MySqlCommand();

            c.CommandText = $"select * from {Name}  " +
                            $"where {nameof(Paciente)} = @cpf;";
            c.Parameters.AddWithValue("@cpf", cpfPaciente);
            QueryR("Erro ao obter lista de espera a partir de cpf do paciente.", c, (r) => {
                lista = GetLista(r);
            });
            return(lista);
        }
Пример #2
0
        public static ListaEspera Select(int senha)
        {
            ListaEspera lista = null;
            var         c     = new MySqlCommand();

            c.CommandText = $"select * from {Name} where {nameof(Senha)} = @senha;";
            c.Parameters.AddWithValue("@senha", senha);
            QueryR("Erro ao obter linha de lista de espera", c, (r) => {
                try {
                    lista = GetLista(r);
                } catch (Exception) { }
            });
            return(lista);
        }
        public static void CreateTable()
        {
            var le = new ListaEspera();
            var f  = new Funcionarios();

            SQLOperations.NonQuery($"Erro ao criar associação de {Name}",
                                   $"create table if not exists {Name} (" +
                                   $"  {nameof(Senha)} int, " +
                                   $"  {nameof(Funcionario)} varchar(15)," +
                                   $"  primary key ({nameof(Senha)})," +
                                   $"  foreign key ({nameof(Senha)}) references {ListaEspera.Name} ({nameof(le.Senha)}) on delete cascade on update cascade," +
                                   $"  foreign key ({nameof(Funcionario)}) references {Funcionarios.Name} ({nameof(f.CPF)}) on delete cascade on update cascade" +
                                   $");");
        }
Пример #4
0
        public static void CreateTable()
        {
            var le = new ListaEspera();
            var pc = new ProcedimentoConvenio();

            NonQuery($"Erro ao criar a associação de paciente e procedimentos.", $"create table if not exists {nameof(PacienteProcedimentos)} (" +
                     $"  {nameof(Senha)} int," +
                     $"  {nameof(Procedimento)} int," +
                     $"  {nameof(Convenio)} int," +
                     $"  {nameof(_Status)} enum('Pendente', 'Em andamento', 'Pronto')," +
                     $"  primary key ({nameof(Senha)}, {nameof(Procedimento)})," +
                     $"  foreign key ({nameof(Senha)}) references {ListaEspera.Name} ({nameof(le.Senha)}) on delete cascade on update cascade," +
                     $"  foreign key ({nameof(Procedimento)}, {nameof(Convenio)}) references {ProcedimentoConvenio.Name} ({nameof(pc.Procedimento)}, {nameof(pc.Convenio)}) on delete cascade on update cascade" +
                     $");");
        }
        public static void CreateTable()
        {
            var le = new ListaEspera();
            var e  = new Especializacoes();

            NonQuery("Erro ao criar associação de lista de espera e especialização.", (c) => {
                c.CommandText = $"create table if not exists {nameof(ListaEspera_Especializacao)} (" +
                                $"  {nameof(Senha)} int," +
                                $"  {nameof(Especializacao)} nvarchar(50)," +
                                $"  primary key ({nameof(Senha)})," +
                                $"  foreign key ({nameof(Senha)}) references {ListaEspera.Name} ({nameof(le.Senha)}) on delete cascade on update cascade," +
                                $"  foreign key ({nameof(Especializacao)}) references {Especializacoes.Name} ({nameof(e.Especializacao)}) on delete cascade on update cascade " +
                                $");";
                return(c);
            });
        }
Пример #6
0
        public static void EnsureCreation()
        {
            //try {
            SQLOperations.MessageExceptions = true;
            SQLOperations.ThrowExceptions   = true;
            //SQLOperations.NonQuery("Erro ao criar banco de dados.", $"create database if not exists {Name};");
            Pessoas.p.CreateTable();
            Pacientes.CreateTable();
            Funcionarios.CreateTable();
            Medicos.CreateTable();
            Recepcionista.CreateTable();
            Tecnico_Enfermagem.CreateTable();
            (new Administradores()).GetCT()();
            TempPacientes.CreateTable();
            ListaEspera.CreateTable();
            Salas.CreateTable();
            Paciente_Sala.CreateTable();
            Convenios.CreateTable();
            ProcedimentosLab.CreateTable();
            ProcedimentoConvenio.CreateTable();
            PacienteProcedimentos.CreateTable();
            Enderecos.CreateTable();
            Anexos.CreateTable();
            Especializacoes.CreateTable();
            MedicoEspecializacoes.CreateTable();
            Agendamentos.CreateTable();
            AgendamentoPaciente.CreateTable();
            AgendamentoTempPaciente.CreateTable();
            AgendamentoFuncionario.CreateTable();
            ListaEspera_Funcionario.CreateTable();
            ListaEspera_Especializacao.CreateTable();
            Historico_Consultas.CreateTable();
            Historico_ProcedimentosLab.CreateTable();
            Pagamentos.CreateTable();
            //Fonoaudiologos.CreateTable();
            Nutricionistas.CreateTable();
            Psicologos.CreateTable();
            Ausentes.CreateTable();

            /*} catch (Exception ex) {
             *  MessageBox.Show(ex.Message);
             * }
             * finally {*/
            SQLOperations.ThrowExceptions = false;
            //}
        }
Пример #7
0
        private static ListaEspera GetLista(MySqlDataReader r)
        {
            ListaEspera lista = null;

            if (r.Read())
            {
                lista = new ListaEspera()
                {
                    Senha      = r.GetInt32(0),
                    Paciente   = r.GetString(1),
                    _DateTime  = r.IsDBNull(2) ? DateTime.MinValue : r.GetMySqlDateTime(2).GetDateTime(),
                    _Status    = r.IsDBNull(3)? PStatus.Atendido : SetPStatus(r.GetString(3)),
                    Fila       = r.IsDBNull(4)? Fila.Nulo : ES.GetFila(r.GetString(4)),
                    Prioridade = r.IsDBNull(5)? false : r.GetBoolean(5)
                };
            }
            return(lista);
        }
Пример #8
0
        public static void FullInsert(string funcionario, string paciente, Profissao profissao, DateTime dateTime)
        {
            throw new NotImplementedException();
            Insert(funcionario, paciente, profissao, dateTime);
            var r = Select(paciente, dateTime.AddMinutes(-1), dateTime.AddMinutes(1));

            if (r.Count == 0)
            {
                MessageBox.Show("Falha ao obter identificador de historico inserido. A consulta precisa ser adicionada manualmente ao registro de 'à receber' e 'à pagar'");
            }
            else
            {
                var row = r[r.Count - 1];
                var le  = ListaEspera.Select_Paciente(paciente);
                var esp = ListaEspera_Especializacao.Select(le.Senha);
                if (esp != null)
                {
                    Update_Especialização(row.ID, esp.Especializacao);
                }
            }
        }