/// <summary>
        /// Select process method and sub method include get by patientId or assesssmentid
        /// </summary>
        /// <param name="assessmentId"></param>
        /// <returns></returns>
        private clsPatientModel GetByAssessmentId(int assessmentId)
        {
            clsPatientModel result    = new clsPatientModel();
            DataTable       dataTable = new DataTable();

            connect = new clsConnectorData();
            connect.Link();
            connect.con.Open();
            connect.cmd.CommandText = clsQuery.GetAssessementEntryByAssessmentId;
            connect.cmd.Parameters.Add(new System.Data.OleDb.OleDbParameter("@assessment", assessmentId));
            connect.dta = new System.Data.OleDb.OleDbDataAdapter(connect.cmd);
            connect.dta.Fill(dataTable);
            connect.con.Close();

            if (dataTable.Rows.Count > 0)
            {
                result.PatientId  = Convert.ToInt32(dataTable.Rows[0][1]);
                result.Assessment = new List <clsAssessmentModel>()
                {
                    new clsAssessmentModel()
                    {
                        AssessementId  = Convert.ToInt32(dataTable.Rows[0][0]),
                        AssessmentDate = Convert.ToDateTime(dataTable.Rows[0][2])
                    }
                };
            }

            return(result);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                patients       = new List <clsPatientModel>();
                appointment    = new clsAppointment();
                patientDetails = new clsPatientDetails();

                DateTime from = Convert.ToDateTime(dpFrom.Value);
                DateTime to   = Convert.ToDateTime(dpTo.Value);

                if ((from > to) || (from == to))
                {
                    throw new Exception("Invalid date");
                }

                var patientsRow = appointment.Retrieve();
                if (patientsRow.Count > 0)
                {
                    foreach (var item in patientsRow)
                    {
                        item.PatientDetails = new clsPatientDetailsModel();
                        item.PatientDetails = patientDetails.GetByPatientId(item.PatientId);
                    }
                }

                foreach (var item in patientsRow)
                {
                    foreach (var appointment in item.Appointments)
                    {
                        if ((appointment.Appointment.Date >= from.Date) && (appointment.Appointment.Date <= to.Date))
                        {
                            clsPatientModel sort = new clsPatientModel
                            {
                                PatientDetails = new clsPatientDetailsModel(),
                                Appointments   = new List <clsAppointmentModel>(),

                                PatientId = item.PatientId
                            };
                            sort.PatientDetails = item.PatientDetails;
                            sort.Appointments.Add(appointment);

                            patients.Add(sort);
                        }
                    }
                }

                AssignToGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// Navigation
        /// </summary>
        private void Navigation()
        {
            if (selectedPatient == 0)
            {
                this.Close();
            }

            patientDetail = new clsPatientDetails();
            dateEntry     = new clsDateEntry();
            medicalRecord = new clsMedicalRecord();
            assessment    = new clsAssessment();
            appointment   = new clsAppointment();
            prescription  = new clsPrescription();

            patient = new clsPatientModel()
            {
                Appointments   = new List <clsAppointmentModel>(),
                Assessment     = new List <clsAssessmentModel>(),
                DateEntry      = new clsDateEntryModel(),
                MedicalRecords = new clsPatientMedicalRecordModel(),
                PatientDetails = new clsPatientDetailsModel(),
                PatientId      = selectedPatient,
                Prescription   = new clsPrescriptionModel()
            };

            switch (navigateFrom)
            {
            case NavigationType.Appointments:
            case NavigationType.Patients:
            case NavigationType.Search:
                patient.PatientDetails = patientDetail.GetByPatientId(selectedPatient);
                patient.DateEntry      = dateEntry.GetbyPatientId(selectedPatient);
                patient.MedicalRecords = medicalRecord.GetByPatientId(selectedPatient);
                patient.Prescription   = prescription.GetByPatientId(selectedPatient);
                patient.Assessment     = assessment.GetByPatientId(selectedPatient);
                patient.Appointments   = appointment.GetByPatientId(selectedPatient);
                break;

            case NavigationType.NewPatient:
                break;

            case NavigationType.RnageOfMotion:
                break;

            case NavigationType.ViewPatient:
                break;

            default:
                break;
            }
        }
        private void btnClear_Click(object sender, EventArgs e)
        {
            patient = new clsPatientModel()
            {
                Appointments   = new List <clsAppointmentModel>(),
                Assessment     = new List <clsAssessmentModel>(),
                DateEntry      = new clsDateEntryModel(),
                MedicalRecords = new clsPatientMedicalRecordModel(),
                PatientDetails = new clsPatientDetailsModel(),
                PatientId      = 0,
                Prescription   = new clsPrescriptionModel()
            };

            ///Patient details
            txtSurname.Clear();
            txtName.Clear();
            txtTel.Clear();
            txtMobile1.Clear();
            txtMobile2.Clear();
            txtAge.Clear();
            txtOccupation.Clear();

            ///medical record
            txtDiagnosis.Clear();
            txtBriefHistory.Clear();
            txtPastMedicalHistory.Clear();
            cbxSwelling.Checked   = false;
            cbxTenderness.Checked = false;
            cbxSensation.Checked  = false;
            txtSensation.Clear();

            ///motion
            grdAssessement.DataSource = null;
            grdAssessement.Columns.Clear();
            grdAssessement.Rows.Clear();
            grdAssessement.DataBindings.Clear();
            if (patient != null)
            {
                if (patient.Assessment != null)
                {
                    patient.Assessment = new List <clsAssessmentModel>();
                }
            }

            ///prescription
            txtAdvise.Clear();
            txtPrescription.Clear();
        }
Beispiel #5
0
        public List <clsPatientModel> Retrieve()
        {
            List <clsPatientModel> result = new List <clsPatientModel>();
            clsPatientModel        data   = new clsPatientModel();
            DataTable dataTable           = new DataTable();

            connect = new clsConnectorData();
            connect.Link();
            connect.con.Open();
            connect.cmd.CommandText = clsQuery.RetrievePatientDetails;
            connect.dta             = new System.Data.OleDb.OleDbDataAdapter(connect.cmd);
            connect.dta.Fill(dataTable);
            connect.con.Close();

            if (dataTable != null || dataTable.Rows.Count > 0)
            {
                foreach (DataRow item in dataTable.Rows)
                {
                    data = new clsPatientModel()
                    {
                        PatientId      = Convert.ToInt32(item[0]),
                        PatientDetails = new clsPatientDetailsModel()
                        {
                            Name       = item[1].ToString(),
                            Surname    = item[2].ToString(),
                            Tel        = item[3].ToString(),
                            Mobile1    = item[4].ToString(),
                            Mobile2    = item[5].ToString(),
                            DOB        = string.IsNullOrWhiteSpace(item[6].ToString()) ? DateTime.Now : Convert.ToDateTime(item[6].ToString()),
                            Age        = string.IsNullOrWhiteSpace(item[7].ToString()) ? 0 : Convert.ToInt32(item[7].ToString()),
                            Occupation = item[8].ToString()
                        }
                    };

                    result.Add(data);
                }
            }

            return(result);
        }
        //private void xuiButton1_Click(object sender, EventArgs e)
        //{
        //    RangeOfMotion range = new RangeOfMotion(this, NavigationType.Appointments);
        //    range.ShowDialog();
        //}

        //public void SetLabel(string label)
        //{
        //    //lblTest.Text = label;
        //}

        private void RetrieveTodayAppointment()
        {
            patients       = new List <clsPatientModel>();
            appointment    = new clsAppointment();
            patientDetails = new clsPatientDetails();

            var patientsRow = appointment.Retrieve();

            if (patientsRow.Count > 0)
            {
                foreach (var item in patientsRow)
                {
                    item.PatientDetails = new clsPatientDetailsModel();
                    item.PatientDetails = patientDetails.GetByPatientId(item.PatientId);
                }
            }

            foreach (var item in patientsRow)
            {
                foreach (var appointment in item.Appointments)
                {
                    if (appointment.Appointment.Date == DateTime.Today.Date)
                    {
                        clsPatientModel sort = new clsPatientModel
                        {
                            PatientDetails = new clsPatientDetailsModel(),
                            Appointments   = new List <clsAppointmentModel>(),

                            PatientId = item.PatientId
                        };
                        sort.PatientDetails = item.PatientDetails;
                        sort.Appointments.Add(appointment);

                        patients.Add(sort);
                    }
                }
            }
        }
Beispiel #7
0
        public List <clsPatientModel> Retrieve()
        {
            List <clsPatientModel> result = new List <clsPatientModel>();
            DataTable dataTable           = new DataTable();

            connect = new clsConnectorData();
            connect.Link();
            connect.con.Open();
            connect.cmd.CommandText = clsQuery.RetrieveAppointment;
            connect.dta             = new System.Data.OleDb.OleDbDataAdapter(connect.cmd);
            connect.dta.Fill(dataTable);
            connect.con.Close();

            if (dataTable != null || dataTable.Rows.Count > 0)
            {
                foreach (DataRow item in dataTable.Rows)
                {
                    clsPatientModel patient = new clsPatientModel()
                    {
                        PatientId    = Convert.ToInt32(item[1]),
                        Appointments = new List <clsAppointmentModel>()
                        {
                            new clsAppointmentModel()
                            {
                                AppointmentId  = Convert.ToInt32(item[0]),
                                HasAppointment = true,
                                Appointment    = Convert.ToDateTime(item[2])
                            }
                        }
                    };

                    result.Add(patient);
                }
            }

            return(result);
        }