Beispiel #1
0
        private static IList <LabTest> buildLabTestList(MySqlCommand cmd)
        {
            var labTests = new List <LabTest>();

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                var apptIdOrdinal       = reader.GetOrdinal("apptID");
                var testTypeCodeOrdinal = reader.GetOrdinal("testTypeCode");
                var resultsOrdinal      = reader.GetOrdinal("results");
                var abnormalityOrdinal  = reader.GetOrdinal("abnormality");
                var datetimeOrdinal     = reader.GetOrdinal("testDatetime");
                var testTypeNameOrdinal = reader.GetOrdinal("name");

                while (reader.Read())
                {
                    var labTest = new LabTest();

                    var testType = new TestType
                    {
                        Code = DbDefault.GetInt(reader, testTypeCodeOrdinal),
                        Name = DbDefault.GetString(reader, testTypeNameOrdinal)
                    };
                    labTest.TestType = testType;

                    labTest.AppointmentID = DbDefault.GetInt(reader, apptIdOrdinal);
                    labTest.Results       = DbDefault.GetString(reader, resultsOrdinal);
                    labTest.Abnormality   = DbDefault.GetString(reader, abnormalityOrdinal);
                    labTest.Date          = DbDefault.GetDatetime(reader, datetimeOrdinal);

                    labTests.Add(labTest);
                }

                return(labTests);
            }
        }
        private static IList <Appointment> buildAppointmentList(MySqlCommand cmd)
        {
            var appointments = new List <Appointment>();

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                int apptIDOrdinal   = reader.GetOrdinal("apptID");
                int datetimeOrdinal = reader.GetOrdinal("datetime");
                int reasonsOrdinal  = reader.GetOrdinal("reasons");
                int doctorIDOrdinal = reader.GetOrdinal("doctorID");
                int fnameOrdinal    = reader.GetOrdinal("fname");
                int lnameOrdinal    = reader.GetOrdinal("lname");
                int initialOrdinal  = reader.GetOrdinal("initialDiagnosis");
                int finalOrdinal    = reader.GetOrdinal("finalDiagnosis");

                while (reader.Read())
                {
                    Appointment appointment = new Appointment();

                    appointment.ID                         = DbDefault.GetInt(reader, apptIDOrdinal);
                    appointment.Date                       = DbDefault.GetDatetime(reader, datetimeOrdinal);
                    appointment.Reasons                    = DbDefault.GetString(reader, reasonsOrdinal);
                    appointment.Doctor.ID                  = DbDefault.GetInt(reader, doctorIDOrdinal);
                    appointment.Doctor.Bio.FirstName       = DbDefault.GetString(reader, fnameOrdinal);
                    appointment.Doctor.Bio.LastName        = DbDefault.GetString(reader, lnameOrdinal);
                    appointment.Diagnosis.InitialDiagnosis = DbDefault.GetString(reader, initialOrdinal);
                    appointment.Diagnosis.FinalDiagnosis   = DbDefault.GetString(reader, finalOrdinal);

                    appointments.Add(appointment);
                }

                return(appointments);
            }
        }
        private static RoutineCheck buildRoutineCheck(MySqlCommand cmd)
        {
            var routineCheck = new RoutineCheck();

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                int nurseIDOrdinal = reader.GetOrdinal("nurseID");
                int fnameOrdinal   = reader.GetOrdinal("fname");
                int lnameOrdinal   = reader.GetOrdinal("lname");
                int bloodPressureSystolicOrdinal  = reader.GetOrdinal("bloodPressureSystolic");
                int bloodPressureDiastolicOrdinal = reader.GetOrdinal("bloodPressureDiastolic");
                int bodyTempOrdinal = reader.GetOrdinal("bodyTemp");
                int pulseOrdinal    = reader.GetOrdinal("pulse");
                int weightOrdinal   = reader.GetOrdinal("weight");
                int symptomsOrdinal = reader.GetOrdinal("symptoms");

                while (reader.Read())
                {
                    routineCheck.Nurse.ID               = DbDefault.GetInt(reader, nurseIDOrdinal);
                    routineCheck.Nurse.Bio.FirstName    = DbDefault.GetString(reader, fnameOrdinal);
                    routineCheck.Nurse.Bio.LastName     = DbDefault.GetString(reader, lnameOrdinal);
                    routineCheck.BloodPressureSystolic  = DbDefault.GetInt(reader, bloodPressureSystolicOrdinal);
                    routineCheck.BloodPressureDiastolic = DbDefault.GetInt(reader, bloodPressureDiastolicOrdinal);
                    routineCheck.BodyTemp               = DbDefault.GetDouble(reader, bodyTempOrdinal);
                    routineCheck.Pulse    = DbDefault.GetInt(reader, pulseOrdinal);
                    routineCheck.Weight   = DbDefault.GetDouble(reader, weightOrdinal);
                    routineCheck.Symptoms = DbDefault.GetString(reader, symptomsOrdinal);
                }

                return(routineCheck);
            }
        }
        private static void setupDiagnosis(Diagnosis diagnosis, MySqlCommand cmd)
        {
            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                int initialDiagnosisOrdinal = reader.GetOrdinal("initialDiagnosis");
                int finalDiagnosisOrdinal   = reader.GetOrdinal("finalDiagnosis");

                while (reader.Read())
                {
                    diagnosis.InitialDiagnosis = DbDefault.GetString(reader, initialDiagnosisOrdinal);
                    diagnosis.FinalDiagnosis   = DbDefault.GetString(reader, finalDiagnosisOrdinal);
                }
            }
        }
        private static IList <Patient> buildPatientList(MySqlCommand cmd)
        {
            IList <Patient> patients = new List <Patient>();

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                int patientIDOrdinal = reader.GetOrdinal("patientID");

                int bioIDOrdinal       = reader.GetOrdinal("ID");
                int fnameOrdinal       = reader.GetOrdinal("fname");
                int lnameOrdinal       = reader.GetOrdinal("lname");
                int dobOrdinal         = reader.GetOrdinal("DOB");
                int phoneNumberOrdinal = reader.GetOrdinal("phone#");
                int genderOrdinal      = reader.GetOrdinal("gender");

                int addressIDOrdinal = reader.GetOrdinal("addressID");
                int address1Ordinal  = reader.GetOrdinal("address1");
                int address2Ordinal  = reader.GetOrdinal("address2");
                int cityOrdinal      = reader.GetOrdinal("city");
                int stateOrdinal     = reader.GetOrdinal("state");
                int zipOrdinal       = reader.GetOrdinal("zip");

                while (reader.Read())
                {
                    Patient patient = new Patient();
                    patient.ID = DbDefault.GetInt(reader, patientIDOrdinal);

                    patient.Bio.FirstName   = DbDefault.GetString(reader, fnameOrdinal);
                    patient.Bio.LastName    = DbDefault.GetString(reader, lnameOrdinal);
                    patient.Bio.DOB         = DbDefault.GetDatetime(reader, dobOrdinal);
                    patient.Bio.PhoneNumber = DbDefault.GetString(reader, phoneNumberOrdinal);
                    patient.Bio.Gender      = DbDefault.GetString(reader, genderOrdinal);

                    patient.Bio.Address.AddressID = DbDefault.GetInt(reader, addressIDOrdinal);
                    patient.Bio.Address.Address1  = DbDefault.GetString(reader, address1Ordinal);
                    patient.Bio.Address.Address2  = DbDefault.GetString(reader, address2Ordinal);
                    patient.Bio.Address.City      = DbDefault.GetString(reader, cityOrdinal);
                    patient.Bio.Address.State     = DbDefault.GetString(reader, stateOrdinal);
                    patient.Bio.Address.Zip       = DbDefault.GetInt(reader, zipOrdinal);
                    patients.Add(patient);
                }
                return(patients);
            }
        }
        private static IList <TestType> buildTestTypeList(MySqlCommand cmd)
        {
            var testTypes = new List <TestType>();

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                int codeOrdinal = reader.GetOrdinal("code");
                int nameOrdinal = reader.GetOrdinal("name");

                while (reader.Read())
                {
                    var testType = new TestType();

                    testType.Code = DbDefault.GetInt(reader, codeOrdinal);
                    testType.Name = DbDefault.GetString(reader, nameOrdinal);

                    testTypes.Add(testType);
                }

                return(testTypes);
            }
        }
        private static IList <Doctor> buildDoctorList(MySqlCommand cmd)
        {
            var doctors = new List <Doctor>();

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                int doctorIDOrdinal = reader.GetOrdinal("doctorID");
                int fnameOrdinal    = reader.GetOrdinal("fname");
                int lnameOrdinal    = reader.GetOrdinal("lname");

                while (reader.Read())
                {
                    var doctor = new Doctor();

                    doctor.ID            = DbDefault.GetInt(reader, doctorIDOrdinal);
                    doctor.Bio.FirstName = DbDefault.GetString(reader, fnameOrdinal);
                    doctor.Bio.LastName  = DbDefault.GetString(reader, lnameOrdinal);

                    doctors.Add(doctor);
                }

                return(doctors);
            }
        }