示例#1
0
        //Refresh datagridview in heath file tab
        private void refreshDataViewHeathFile()
        {
            try
            {
                // Get heath file's datatable
                DataTable heathFileTable = HeathFile.GetListHeathFile();

                // Add Vietnamese column's name
                heathFileTable.Columns.Add("Mã bệnh án", typeof(string), "[HEATHFILEID]");
                heathFileTable.Columns.Add("Mã bệnh nhân", typeof(string), "[PATIENTID]");
                heathFileTable.Columns.Add("Ngày lập", typeof(DateTime), "[DATE]");
                heathFileTable.Columns.Add("Tình trạng bệnh nhân", typeof(string), "[PATIENTSTATE]");
                heathFileTable.Columns.Add("Tiền sự bệnh lý", typeof(string), "[PREHISTORY]");
                heathFileTable.Columns.Add("Bệnh mắc phải", typeof(string), "[DISEASE]");
                heathFileTable.Columns.Add("Hướng điều trị", typeof(string), "[TREATMENT]");
                // Set data source to dataview for searching
                dataViewHeathFile.DataSource = heathFileTable.DefaultView;

                // Hide English columns'name
                for (int i = 0; i < 7; i++)
                {
                    dataViewHeathFile.Columns[i].Visible = false;
                }
            }
            catch
            {
                MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        //Add a new heath file
        private void buttonHealthFile_Click(object sender, EventArgs e)
        {
            if (dataViewPatient.SelectedRows.Count > 0)
            {
                int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value);
                int state     = Patient.GetPatient(patientID).State;

                if (state == 1)
                {
                    if (!HeathFile.DidPatientHaveHF(patientID))
                    {
                        FormHFDetail formHFD = new FormHFDetail(patientID);
                        formHFD.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Bệnh nhân đã có bệnh án", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Bệnh nhân chưa nhập viện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
示例#3
0
 //For edit feature
 private void SetHFDetail(HeathFile hfDetail)
 {
     textBoxHFID.Text         = hfDetail.HeathFileID.ToString();
     textBoxPatientID.Text    = hfDetail.PatientID.ToString();
     dateCreate.Value         = hfDetail.Date;
     textBoxPatientState.Text = hfDetail.PatientState;
     textBoxPrehistory.Text   = hfDetail.PreHistory;
     textBoxDisease.Text      = hfDetail.PreHistory;
     textBoxTreatment.Text    = hfDetail.Treament;
 }
示例#4
0
        private void buttonHealthFileEdit_Click(object sender, EventArgs e)
        {
            if (dataViewHeathFile.SelectedRows.Count > 0)
            {
                int          heathFileID  = Convert.ToInt32(dataViewHeathFile.SelectedRows[0].Cells[0].Value);
                FormHFDetail formHFDetail = new FormHFDetail(HeathFile.GetHeathFile(heathFileID), "edit");
                formHFDetail.ShowDialog();

                refreshDataViewHeathFile();
            }
        }
示例#5
0
        private void buttonHealthFileDelete_Click(object sender, EventArgs e)
        {
            if (dataViewHeathFile.SelectedRows.Count > 0)
            {
                int          heathFileID  = Convert.ToInt32(dataViewHeathFile.SelectedRows[0].Cells[0].Value);
                DialogResult dialogResult = MessageBox.Show("Xác nhận xóa bệnh án", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        if (HeathFile.DeleteHeathFile(heathFileID) > 0)
                        {
                            MessageBox.Show("Xóa bệnh án thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Không thể xóa bệnh án này", "Lỗi dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                refreshDataViewHeathFile();
            }
        }
示例#6
0
        private void buttonOk_Click(object sender, System.EventArgs e)
        {
            if (!superValidator1.Validate())
            {
                return;
            }
            if (Patient.IsPatientExist(int.Parse(textBoxPatientID.Text)))
            {
                try
                {
                    if (UserAction == "edit")
                    {
                        HeathFile newHF = new HeathFile();
                        newHF.HeathFileID  = int.Parse(textBoxHFID.Text);
                        newHF.PatientID    = int.Parse(textBoxPatientID.Text);
                        newHF.PatientState = textBoxPatientState.Text;
                        newHF.PreHistory   = textBoxPrehistory.Text;
                        newHF.Disease      = textBoxDisease.Text;
                        newHF.Treament     = textBoxTreatment.Text;
                        newHF.Date         = dateCreate.Value;
                        DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin bệnh án", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (dialogResult == DialogResult.Yes)
                        {
                            if (HeathFile.UpdateHeathFile(newHF) > 0)
                            {
                                MessageBox.Show("Cập nhập thông tin bệnh án thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    else
                    {
                        if (HeathFile.DidPatientHaveHF(int.Parse(textBoxPatientID.Text)))
                        {
                            MessageBox.Show("Bệnh nhân đã có bệnh án", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            HeathFile newHF = new HeathFile();
                            newHF.HeathFileID  = 0;
                            newHF.PatientID    = int.Parse(textBoxPatientID.Text);
                            newHF.PatientState = textBoxPatientState.Text;
                            newHF.PreHistory   = textBoxPrehistory.Text;
                            newHF.Disease      = textBoxDisease.Text;
                            newHF.Treament     = textBoxTreatment.Text;
                            newHF.Date         = dateCreate.Value;
                            if (HeathFile.InsertHeathFile(newHF) > 0)
                            {
                                MessageBox.Show("Thêm bệnh án thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Bệnh nhân không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            this.Close();
        }
示例#7
0
 public FormHFDetail(HeathFile hfDetail, String userAction)
 {
     InitializeComponent();
     this.UserAction = userAction;
     SetHFDetail(hfDetail);
 }