/// <summary>
        /// hàm thực hiện thay đổi khi di chuyển trên lưới
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void grdPatients_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                if (grdPatients.CurrentRow != null)
                {
                    //Lấy tất cả Test Result của BN đang được chọn
                    selectedPatientId = grdPatients.CurrentRow.Cells[LPatientInfo.Columns.PatientId].Value.ToString();
                    _testAllResult    = TestInfoBusiness.GetIndividualTestResult(Utility.Int32Dbnull(selectedPatientId, 0), "-1");

                    _patientTestTypeRegistered = TestInfoBusiness.GetPatientTestTypeList(selectedPatientId);

                    //Lấy về mảng các loại xét nghiệm của bệnh nhân
                    var ids = (from row in _patientTestTypeRegistered.AsEnumerable()
                               select row[TTestTypeList.Columns.TestTypeId].ToString()).ToArray();


                    //Duyệt từng Tab để set visible
                    for (int i = 1; i < sttResult.Tabs.Count; i++)
                    {
                        sttResult.Tabs[i].Visible = ids.Contains(sttResult.Tabs[i].Tag);
                    }
                    sttResult_SelectedTabChanged(null, null);
                }
            }
            catch (Exception ex)
            {
                SetWarningStatus(new WarningBoxStatus(ex.Message, true));
            }
        }
예제 #2
0
 private void grdAllTodayTestInfo_SelectionChanged(object sender, EventArgs e)
 {
     if (grdAllTodayTestInfo.CurrentRow != null)
     {
         _dtTestResult = TestInfoBusiness.GetTestResultByTestId(grdAllTodayTestInfo.CurrentRow.Cells["colTestID_XN"].Value.ToString());
     }
 }
        private void DeletePatient()
        {
            DataGridViewRow currentRow       = grdPatientList.CurrentRow;
            DataGridViewRow currentTestInfor = grdTestType.CurrentRow;

            if (currentRow != null)
            {
                int       rowIndex    = grdPatientList.CurrentRow.Index;
                string    patientId   = Lablink.Utilities.UI.GetCellValue(currentRow.Cells["colPatient_ID"]);
                DataTable dtTestInfor = TestInfoBusiness.GetTestInfoToPatient(patientId);
                if (dtTestInfor.Rows.Count > 0)
                {
                    MessageBox.Show("Bệnh nhận đã đăng ký xét nghiệm. Không thể xóa được !", "Thông báo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    PatientBusiness.DeletePatient(patientId);
                    //PatientBusiness.DeletePatient(
                    //    dtPatientList.Rows[rowIndex][LPatientInfo.Columns.PatientId].ToString());
                    dtPatientList.Rows.RemoveAt(rowIndex);
                    dtPatientList.AcceptChanges();
                }
                if (grdPatientList.Rows.Count <= 0)
                {
                    barcode1.Data = "0000000000";
                }
            }
        }
 private void FillStatusListBox()
 {
     _dtTestStatus = TestInfoBusiness.GetTestStatusList();
     DataBinding.BindData(clbStatus, _dtTestStatus, "TestStatus_ID",
                          "TestStatus_Name");
     SetAllCheckedBoxTrue(clbStatus);
 }
예제 #5
0
        //Xử lý sự kiện khi click vào lưới dữ liệu danh sách bệnh nhân
        private void GrdPatientsSelectionChanged(object sender, EventArgs e)
        {
            try
            {
                //superTabControl1.SuspendLayout();


                //superTabControl1.TabStrip.BeginUpdate();

                //Clear all tab
                ClearAllTabPage();

                //Lấy về PatientID
                if (grdPatients.CurrentRow != null)
                {
                    decimal patientId = Convert.ToDecimal(grdPatients.CurrentRow.Cells["Patient_ID"].Value);
                    //lấy về danh sách các loại xét nghiệm của bệnh nhân đó
                    string testtypeids = GetTestIdString();
                    _testTypeList = TestInfoBusiness.GetTestTypeIdFromDateToDate(patientId, testtypeids,
                                                                                 dtpFromDate.Value,
                                                                                 dtpTodate.Value);

                    AddNewUserTab("Tất cả", "-1");

                    foreach (DataRow dr in _testTypeList.Rows)
                    {
                        string testName =
                            dr[TTestTypeList.Columns.TestTypeName].ToString().ToUpper().Replace("XÉT NGHIỆM", "").Trim();
                        string testId = dr[TTestInfo.Columns.TestId].ToString();
                        AddNewUserTab(testName, testId);
                    }

                    //Lấy về TAB đầu tiên được chọn
                    SuperTabItem controls = (from control in superTabControl1.Tabs.OfType <SuperTabItem>()
                                             select control).First();

                    //Giả lập sự kiện Click trên Tab đầu tiên

                    if (controls != null)
                    {
                        controls.Focus();
                        TabClick(controls, new EventArgs());
                    }
                }
                //superTabControl1.ResetTabStripColor();
                //superTabControl1.TabStrip.EndUpdate();
                //superTabControl1.ResumeLayout();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw ex;
            }
        }
예제 #6
0
        private void GridInTabCellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                var grd = sender as DataGridViewX;
                //MessageBox.Show(grd.Rows .Count.ToString());
                //MessageBox.Show(e.ColumnIndex.ToString() + e.RowIndex.ToString());
                if (e.ColumnIndex == 1)
                {
                    DataRow dr = (grd.DataSource as DataTable).Rows[e.RowIndex];

                    //Nếu đã có Detail_ID thì Update
                    int    testDetailId = Convert.ToInt32(dr[TResultDetail.Columns.TestDetailId]);
                    string barcode      = dr[TResultDetail.Columns.Barcode].ToString().Trim();
                    string result       = dr[TResultDetail.Columns.TestResult].ToString().Trim();
                    if (testDetailId > 0)
                    {
                        if (result.Trim() != "")
                        {
                            DeviceHelper.SpUpdateTestResult(testDetailId, barcode, result);
                        }
                        else
                        {
                        }
                    }

                    //Nếu chưa có Detail_ID thì Insert
                    else
                    {
                        //Lấy về Test_ID
                        long   testId       = Convert.ToInt32(dr[TResultDetail.Columns.TestId]);
                        long   patientId    = Convert.ToInt32(dr[TResultDetail.Columns.PatientId]);
                        short  testTypeId   = Convert.ToInt16(dr[TResultDetail.Columns.TestTypeId]);
                        string testSequence = dr[TResultDetail.Columns.TestSequence].ToString();
                        string testDate     = (Convert.ToDateTime(dr[TResultDetail.Columns.TestDate])).ToString("dd/MM/yyyy");
                        short  dataSequence = Convert.ToInt16(dr[TResultDetail.Columns.DataSequence]);
                        string paraName     = dr[TResultDetail.Columns.ParaName].ToString();
                        string measureUnit  = dr[TResultDetail.Columns.MeasureUnit].ToString();
                        string normalLevel  = dr[TResultDetail.Columns.NormalLevel].ToString();
                        string normalLevelW = dr[TResultDetail.Columns.NormalLevelW].ToString();
                        DeviceHelper.SpInsertResult(testId, patientId, testTypeId,
                                                    testSequence, testDate, dataSequence,
                                                    barcode, paraName, result, measureUnit,
                                                    normalLevel, normalLevelW);
                        testDetailId = TestInfoBusiness.GetTestDetailId(barcode, paraName);
                        dr[TResultDetail.Columns.TestDetailId] = testDetailId;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void GetPatientInfo(object sender, DoWorkEventArgs e)
        {
            _grdPatientsSource.Clear();
            string testIdString;

            testIdString = string.Empty;
            try
            {
                // Lấy về danh sách các test iD được check
                testIdString = GetIdString(dtTestTypeList, clbTestType, TTestTypeList.Columns.TestTypeId);

                // Nếu loại xét nghiệm chưa được chọn thì hiển thị thông báo
                if (testIdString.Trim() == string.Empty)
                {
                    throw new Exception("Bạn phải chọn loại xét nghiệm");
                }

                // Lấy về trạng thái kết quả được tìm kiếm
                int age = 0;
                try
                {
                    age = Convert.ToInt32(txtAge.Text);
                }
                catch (Exception)
                {
                    age = 0;
                }

                int hasTest = -1;
                //if (clbStatus.GetItemChecked(0) && !clbStatus.GetItemChecked(1)) hasTest = 0;
                //else if (!clbStatus.GetItemChecked(0) && clbStatus.GetItemChecked(1)) hasTest = 1;

                string strStatus = GetIdString(_dtTestStatus, clbStatus, LTestStatus.Columns.TestStatusId);

                int sex = Convert.ToInt32(GetControlPropertyThreadSafe(cboSex, "SelectedValue"));
                _tblPatients = TestInfoBusiness.GetTestInfoGroupedBySID(dtpFromDate.Value, dtpTodate.Value, testIdString,
                                                                        txtBarcode.Text, txtPID.Text, txtName.Text, age,
                                                                        sex, strStatus);


                //grdAllTodayTestResult.DataSource = dt;
                //grdAllTodayTestResult.AutoGenerateColumns = true;
            }
            catch (Exception ex)
            {
                SetWarningStatus(new WarningBoxStatus(ex.Message, true));
            }
        }
        private void DeletePatientTestType()
        {
            DataGridViewRow currentrow = grdTestType.CurrentRow;

            //if (grdTestType.CurrentRow != null)
            if (currentrow != null)
            {
                int rowIndex = grdTestType.CurrentRow.Index;
                //  int row = Convert.ToInt32(grdTestType.CurrentRow.Cells["colBarcode"].ToString());

                testId = Lablink.Utilities.UI.GetCellValue(currentrow.Cells["colTest_ID"]);
                pid    = Lablink.Utilities.UI.GetCellValue(currentrow.Cells["colBarcode"]);

                DataTable dt1 =
                    TestInfoBusiness.GetTestResultByBarcode(pid);
                //DataTable dt =
                //    TestInfoBusiness.GetTestResultByTestId(
                //        dtRegisteredTestType.Rows[rowIndex][TTestInfo.Columns.TestId].ToString());
                if (dt1.Rows.Count > 0)
                {
                    Utility.ShowMsg("Xét nghiệm có kết quả. Không thể xóa được !", "Thông báo");
                }
                if (dtRegTest.Rows.Count > 0)
                {
                    Utility.ShowMsg("Loại xét nghiệm đã có đăng ký test?", "Thông báo");
                }
                else
                {
                    if (Utility.AcceptQuestion("Bạn có muốn xóa loại xét nghiệm này ko?", "Thông báo", true))
                    {
                        TestInfoBusiness.DeleteTesInfor(Convert.ToInt32(testId));
                        grdTestType.Rows.Remove(currentrow);
                    }

                    //TestInfoBusiness.DeleteTestInfo(
                    //    dtRegisteredTestType.Rows[rowIndex][TTestInfo.Columns.TestId].ToString());
                    // dtRegisteredTestType.Rows.RemoveAt(rowIndex);
                }
                dtRegisteredTestType.AcceptChanges();
                //Khi BN ko còn đăng ký XN nào thì đưa SID về Empty
                if (dtRegisteredTestType.Rows.Count == 0)
                {
                    dtPatientList.Rows[grdPatientList.CurrentRow.Index]["SID"] = string.Empty;
                    dtPatientList.AcceptChanges();
                }
            }
        }
예제 #9
0
        private void GridInTab_KeyUp(object sender, KeyEventArgs e)
        {
            var grd = sender as DataGridViewX;

            if ((e.KeyCode == Keys.Delete) && (grd.CurrentRow != null))
            {
                if (
                    MessageBox.Show("Bạn có muốn xóa kết quả này ?", "Thông Báo", MessageBoxButtons.OKCancel,
                                    MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    DataRow dr           = (grd.DataSource as DataTable).Rows[grd.CurrentRow.Index];
                    string  testDetailId = dr[TResultDetail.Columns.TestDetailId].ToString();
                    TestInfoBusiness.DeleteTestResult(testDetailId);
                    (grd.DataSource as DataTable).Rows.Remove(dr);
                }
            }
        }
예제 #10
0
 private void btnPrintByPatient_Click(object sender, EventArgs e)
 {
     try
     {
         if (grdPatients.CurrentRow != null)
         {
             int       patientId = Convert.ToInt32(grdPatients.CurrentRow.Cells["Patient_ID"].Value);
             DateTime  dat       = Convert.ToDateTime(grdPatients.CurrentRow.Cells["clDate"].Value);
             DataTable result    = TestInfoBusiness.GetDataForPrint(patientId, -1, dat);
             GetDataForPrint(result);
         }
     }
     catch (Exception ex)
     {
         SetWarningStatus(new WarningBoxStatus(ex.Message, true));
     }
 }
예제 #11
0
        /// <summary>
        /// Load thông tin về các loại xét nghiệm vào combobox
        /// </summary>
        /// <param name="fromDate">Ngày bắt đầu</param>
        /// <param name="toDate">Ngày kết thúc</param>
        private void FillTestTypeList()
        {
            try
            {
                //Lấy về data table chứa dữ liệu
                //DateTime? pfromdate=null, ptodate=null;
                DataTable dataTable = TestInfoBusiness.LoadTestType(null, null);

                //Fill DataTable vào Checklistbox

                //Xóa trắng Checklistbox
                clbTestType.Items.Clear();

                //Xóa trắng mảng lưu trữ testtype ID
                _arrTestTypeList.Clear();
                _arrTestTypeList.Add("-3");

                //Kiểm tra nếu tìm thấy dữ liệu thì tiến hành load vào Checklistbox);
                if (dataTable.Rows.Count > 0)
                {
                    //Bổ sung phần tử đầu tiên (có vai trò điều khiển)
                    clbTestType.Items.Add("Tất cả", true);

                    //Load dữ liệu đọc được từ Datatable ở trên
                    foreach (DataRow dr in dataTable.Rows)
                    {
                        clbTestType.Items.Add(
                            dr[TTestTypeList.Columns.TestTypeName].ToString().ToUpper().Replace("XÉT NGHIỆM", "").Trim(),
                            true);
                        _arrTestTypeList.Add(dr[TTestTypeList.Columns.TestTypeId].ToString());
                    }
                }

                //Thiết lập chiều rộng tự động cho lưới hiển thị
                clbTestType.ColumnWidth = MkStrWidth(clbTestType) + 20;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #12
0
 private DataTable GetRegListByTestID(int input)
 {
     dtDevice = new DataTable();
     return(dtDevice = TestInfoBusiness.GetTRegListByTestID(input));
 }
예제 #13
0
        private void FillToGrid(object sender, DoWorkEventArgs e)
        {
            //Bỏ Handler của Grid
            grdPatients.SelectionChanged -= GrdPatientsSelectionChanged;
            _grdPatientsSource.Clear();
            string testIdString;

            testIdString = string.Empty;
            try
            {
                //var dt = grdPatients.DataSource as DataTable;
                //if (dt != null) dt.Clear();
                // Lấy về danh sách các test iD được check
                testIdString = GetTestIdString();

                // Nếu loại xét nghiệm chưa được chọn thì hiển thị thông báo
                if (testIdString.Trim() == string.Empty)
                {
                    throw new Exception("Bạn phải chọn loại xét nghiệm");
                }

                // Lấy về trạng thái kết quả được tìm kiếm
                int hasTest = -1, age = 0;
                try
                {
                    age = Convert.ToInt32(txtAge.Text);
                }
                catch (Exception)
                {
                    age = 0;
                }


                // Nếu Check tất cả các loại xét nghiệm
                //DataTable result = null;
                if (cboTatca.Checked)
                {
                    hasTest = -1;
                }
                // Chỉ check ô có kết quả
                else if (cboCoKetQua.Checked)
                {
                    hasTest = 1;
                }

                // Chỉ check Chưa có kết quả
                else if (cboChuaCoKetQua.Checked)
                {
                    hasTest = 0;
                    //dgvPatientList.DataSource = result;
                }
                //todo: Get Sex
                //int sex = Convert.ToInt32(cboSex.SelectedValue);
                int sex = Convert.ToInt32(GetControlPropertyThreadSafe(cboSex, "SelectedValue"));
                _tblPatients = TestInfoBusiness.GetPatientList(dtpFromDate.Value, dtpTodate.Value, testIdString,
                                                               txtBarcode.Text, txtPID.Text, txtName.Text, age,
                                                               sex, hasTest);
            }
            catch (Exception ex)
            {
                SetWarningStatus(new WarningBoxStatus(ex.Message, true));
            }
        }
예제 #14
0
        /// <summary>
        /// Handles ControlBox sample item selection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Help_Click(object sender, EventArgs e)
        {
            try
            {
                //Lấy về Button được nhấn
                var bi = sender as ButtonItem;

                //Nếu Tag của Button != -1 thì xử lý
                if ((bi != null) && bi.Tag.ToString() != "-1")
                {
                    SuperTabItem  tab       = GetSelectedTabItem();
                    DataGridViewX gridViewX = GetGridinSelectedTab(tab);
                    var           dt        = gridViewX.DataSource as DataTable;

                    int rowCount = gridViewX.Rows.Count;

                    //Lấy về tên các kết quả đã có trên lưới
                    EnumerableRowCollection <string> oldResult = (from dr in dt.AsEnumerable()
                                                                  select dr[TResultDetail.Columns.ParaName]).Cast <string>
                                                                     ();

                    string patientId, testTypeId, barcode, testId;
                    testId     = tab.Tag.ToString();
                    patientId  = grdPatients.CurrentRow.Cells["Patient_ID"].Value.ToString();
                    testTypeId = TestInfoBusiness.GetTestTypeIdFromTestId(testId);
                    barcode    = TestInfoBusiness.GetBarcodeFromTestId(testId);

                    //DataTable modifiedTable = dt.GetChanges(DataRowState.Modified);
                    //DataTable newTable = dt.GetChanges(DataRowState.Added);

                    DataTable tblDataControlToAdd = TestInfoBusiness.GetDataControlsFromDeviceId(bi.Tag.ToString(),
                                                                                                 oldResult);
                    foreach (DataRow dataRow in tblDataControlToAdd.Rows)
                    {
                        DataRow dr = dt.NewRow();
                        dr[TResultDetail.Columns.TestDetailId] = -1;
                        dr[TResultDetail.Columns.TestId]       = Convert.ToInt32(testId);
                        dr[TResultDetail.Columns.PatientId]    = Convert.ToInt32(patientId);
                        dr[TResultDetail.Columns.TestTypeId]   = Convert.ToInt32(testTypeId);
                        dr[TResultDetail.Columns.TestDate]     = DateTime.Now;
                        dr[TResultDetail.Columns.TestSequence] = -1;
                        dr[TResultDetail.Columns.DataSequence] = -1;
                        dr[TResultDetail.Columns.TestResult]   = string.Empty;
                        dr[TResultDetail.Columns.NormalLevelW] = dataRow[DDataControl.Columns.NormalLevelW];
                        dr[TResultDetail.Columns.NormalLevel]  = dataRow[DDataControl.Columns.NormalLevel];
                        dr[TResultDetail.Columns.MeasureUnit]  = dataRow[DDataControl.Columns.MeasureUnit];
                        dr[TResultDetail.Columns.ParaName]     = dataRow[DDataControl.Columns.DataName];
                        dr[TResultDetail.Columns.ParaStatus]   = 1;
                        dr[TResultDetail.Columns.Note]         = string.Empty;
                        dr[TResultDetail.Columns.PrintData]    = 1;
                        dr[TResultDetail.Columns.Barcode]      = barcode;
                        dr[TResultDetail.Columns.UpdateNum]    = 1;
                        dt.Rows.Add(dr);
                    }
                    gridViewX.Focus();
                    gridViewX.CurrentCell = gridViewX.Rows[rowCount].Cells["colKetQua"];
                }
            }
            catch (ArgumentOutOfRangeException)
            {
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #15
0
        private void TabClick(object sender, EventArgs e)
        {
            //Lấy về GridviewX của Tab đang được chọn
            var tab = sender as SuperTabItem;

            if (tab != null)
            {
                // Lấy về TesttypeID từ TestID
                string testTypeId = TestInfoBusiness.GetTestTypeIdFromTestId(tab.Tag.ToString());


                //Xóa các Button đã tạo trước đó
                superTabControl1.ControlBox.SubItems.Clear();


                //Bổ sung Button Items

                //Nếu là tab tất cả thì không thêm nút
                if (testTypeId != "-1")
                {
                    //Thêm nút bấm :D
                    var btnThemKetQuaCuaXetNghiem = new ButtonItem();

                    btnThemKetQuaCuaXetNghiem.Text                = @"Thêm kết quả";
                    btnThemKetQuaCuaXetNghiem.Tag                 = @"-1";
                    btnThemKetQuaCuaXetNghiem.ButtonStyle         = eButtonStyle.ImageAndText;
                    btnThemKetQuaCuaXetNghiem.Click              += Help_Click;
                    btnThemKetQuaCuaXetNghiem.SubItemsExpandWidth = 50;

                    //Lấy về các thiết bị chạy TesttypeId trên
                    DataTable tblDevices = TestInfoBusiness.GetDevicesFromTestTypeId(testTypeId);

                    foreach (DataRow dr in tblDevices.Rows)
                    {
                        var sbi = new ButtonItem();
                        sbi.Text = dr[DDeviceList.Columns.DeviceName].ToString();
                        //Tag của Button là DeviceID
                        sbi.Tag = dr[DDeviceList.Columns.DeviceId].ToString();
                        sbi.AutoCollapseOnClick = true;
                        sbi.Click += Help_Click;
                        btnThemKetQuaCuaXetNghiem.SubItems.Add(sbi);
                    }
                    superTabControl1.ControlBox.SubItems.Add(btnThemKetQuaCuaXetNghiem); //Kết thúc thêm nút bấm
                }

                if (grdPatients.CurrentRow != null)
                {
                    string        patientId = grdPatients.CurrentRow.Cells["Patient_ID"].Value.ToString();
                    DataTable     result    = TestInfoBusiness.GetTestResultByTestType(patientId, testTypeId);
                    DataGridViewX grd       = GetGridinSelectedTab(tab);
                    //Gán DataSource cho Grid
                    if (grd != null)
                    {
                        //grd.Focus();
                        grd.DataSource = result;
                        grd.Refresh();
                        //if (grd.Rows.Count > 0) grd.CurrentCell = grd.Rows[0].Cells[1];
                        if (testTypeId != "-1")
                        {
                            grd.Columns["colLoaiXetNghiem"].Visible = false;
                        }
                    }
                }
            }
        }
예제 #16
0
        private void UpdateRegTest()
        {
            try
            {
                try
                {
                    int Test_ID = 0;
                    if (grdTestType.CurrentRow != null)
                    {
                        Test_ID =
                            Utility.Int32Dbnull(
                                Utility.GetValueFromGridColumn(grdTestType, "colTest_ID", grdTestType.CurrentRow.Index),
                                -1);
                    }
                    dtRegTest = TestInfoBusiness.GetTestReg(Test_ID);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                if (grdTestType.CurrentRow != null)
                {
                    var frm = new frm_CreateRegList();

                    frm.v_TestType_Id =
                        Utility.Int32Dbnull(
                            Utility.GetValueFromGridColumn(grdTestType, "TestType_ID", grdTestType.CurrentRow.Index), -1);
                    frm.g_dtResultDetail = dtRegTest;
                    frm.em_Action        = action.doNothing;
                    //  frm.v_Barcode = Utility.GetValueFromGridColumn(grdTestType, "colBarcode", grdTestType.CurrentRow.Index);
                    frm.v_Test_ID =
                        Utility.Int32Dbnull(
                            Utility.GetValueFromGridColumn(grdTestType, "colTest_ID", grdTestType.CurrentRow.Index), -1);
                    frm.v_Patient_ID =
                        Utility.Int32Dbnull(
                            Utility.GetValueFromGridColumn(grdTestType, "colsPatient_ID", grdTestType.CurrentRow.Index),
                            -1);
                    frm.ShowDialog();
                    if (frm.b_Status)
                    {
                        dtRegTest = frm.g_dtResultDetail;
                        em_Action = frm.em_Action;

                        dtRegTest.AcceptChanges();
                    }
                    foreach (DataRow dr in dtRegTest.Rows)
                    {
                        //foreach (DataRow drv  in dtRegTest.Rows)
                        //{
                        //    drv["CHON"] = "1";
                        ////}
                        //dtRegTest.AcceptChanges();
                        //if (dr["CHON"] == "1")
                        //{
                        int InsertReg =
                            TestInfoBusiness.InsertRegList(Utility.Int32Dbnull(dr[TRegList.Columns.TestId], 0),
                                                           Utility.Int32Dbnull(dr[TRegList.Columns.DeviceId], 0),
                                                           dr[TRegList.Columns.Barcode].ToString(),
                                                           dr[TRegList.Columns.AliasName].ToString(),
                                                           dr[TRegList.Columns.ParaName].ToString(), true);
                        //}
                    }
                    Utility.SetDataSourceForDataGridView(grdTRegList, dtRegTest, false, true, "", "");
                }
                //ModifyCommand();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void PrintAction(bool Quick)
        {
            try
            {
                if (grdPatients.CurrentRow != null)
                {
                    var frm = new FrmTestTypeSelection();
                    frm.dtTestTypeCLB = _patientTestTypeRegistered;
                    frm.ShowInTaskbar = false;
                    frm.ShowDialog();

                    if (!frm.vCancel)
                    {
                        int       patientId = Convert.ToInt32(grdPatients.CurrentRow.Cells["Patient_ID"].Value);
                        DataTable result    = TestInfoBusiness.GetIndividualTestResult(patientId, frm.strSelectedTestType);
                        if (result.Rows.Count > 0)
                        {
                            DataRow PatientInfo = TestInfoBusiness.GetPatientInfo(patientId);
                            var     crpt        = new crpt_IndividualTestResult();

                            crpt.SetDataSource(result);
                            // crpt.SetDataSource(_testAllResult);
                            crpt.SetParameterValue("ShowSubReport", 1);

                            crpt.SetParameterValue("ShowMainReport", 0);
                            crpt.SetParameterValue("ParentBranchName", LablinkBusinessConfig.GetParentBranchName());
                            crpt.SetParameterValue("BranchName", LablinkBusinessConfig.GetBranchName());
                            // string sss = LablinkBusinessConfig.GetPhone();
                            crpt.SetParameterValue("Address", LablinkBusinessConfig.GetAddress());
                            crpt.SetParameterValue("sPhone", LablinkBusinessConfig.GetPhone());

                            crpt.SetParameterValue("Patient_Name",
                                                   PatientInfo[LPatientInfo.Columns.PatientName].ToString());
                            crpt.SetParameterValue("Patient_Age", PatientInfo[LPatientInfo.Columns.Age].ToString());
                            crpt.SetParameterValue("Patient_Diagnose",
                                                   PatientInfo[LPatientInfo.Columns.Diagnostic].ToString());
                            crpt.SetParameterValue("Patient_Address",
                                                   PatientInfo[LPatientInfo.Columns.Address].ToString());
                            crpt.SetParameterValue("Patient_Department",
                                                   PatientInfo[LDepartment.Columns.SName].ToString());
                            crpt.SetParameterValue("Patient_Sex", PatientInfo["Sex_Name"].ToString());
                            crpt.SetParameterValue("Patient_Insurance",
                                                   PatientInfo[LPatientInfo.Columns.InsuranceNum].ToString());
                            crpt.SetParameterValue("Patient_Room", PatientInfo[LPatientInfo.Columns.Room].ToString());
                            crpt.SetParameterValue("Patient_Bed", PatientInfo[LPatientInfo.Columns.Bed].ToString());


                            if (!Quick)
                            {
                                var objForm = new frmPrintPreview("", crpt, true, true);
                                objForm.ShowDialog();
                            }
                            else
                            {
                                //objForm.crptViewer.ReportSource = crpt;
                                crpt.PrintToPrinter(1, false, 0, 0);
                            }

                            Utility.DefaultNow(this);
                        }
                        else
                        {
                            SetWarningStatus(new WarningBoxStatus("Bệnh nhân không có kết quả", true));
                        }
                    }
                }
                else
                {
                    SetWarningStatus(new WarningBoxStatus("Không có bệnh nhân", true));
                }
            }
            catch (Exception ex)
            {
                SetWarningStatus(new WarningBoxStatus(ex.Message, true));
            }
        }
예제 #18
0
        private void AddTestType(object sender, EventArgs e)
        {
            if (!Invalidata())
            {
                return;
            }
            if (grdPatientList.CurrentRow != null)
            {
                int rowIndex = grdPatientList.CurrentRow.Index;

                var btni  = (ButtonItem)sender;
                var pItem = new TTestInfo();
                pItem.TestTypeId = Convert.ToDecimal(btni.Name);
                int test = 0;
                if (string.IsNullOrEmpty(txtBarcode.Text))
                {
                    pItem.Barcode =
                        PatientBusiness.GetBarCodeTestInfo(
                            Convert.ToInt32(Utility.GetValueFromGridColumn(grdPatientList, "colPatient_ID",
                                                                           grdPatientList.CurrentRow.Index)),
                            SystemParaBarcode.ParaBacode, 0);
                }
                else
                {
                    pItem.Barcode =
                        PatientBusiness.GetBarCodeTestInfo(
                            Convert.ToInt32(Utility.GetValueFromGridColumn(grdPatientList, "colPatient_ID",
                                                                           grdPatientList.CurrentRow.Index)),
                            Utility.Int32Dbnull(txtBarcode.Text, 0), 1);
                }
                barcode = PatientBusiness.GetBarCodeTestInfo(
                    Convert.ToInt32(Utility.GetValueFromGridColumn(grdPatientList, "colPatient_ID",
                                                                   grdPatientList.CurrentRow.Index)),
                    SystemParaBarcode.ParaBacode, 0);

                if (!_lstBarcode.Contains(barcode))
                {
                    _lstBarcode.Add(barcode);
                }
                barcode1.Data = barcode;
                barcode2.Data = barcode;
                //barcode2.Data = barcode;
                //pItem.Barcode = txtSid == null ? string.Empty : txtSid.Text;
                pItem.PatientId = Convert.ToInt32(dtPatientList.Rows[rowIndex][LPatientInfo.Columns.PatientId]);
                //pItem.AssignId = Convert.ToInt32(cboAssignDoctor.SelectedValue);
                //pItem.DiagnosticianId = Convert.ToInt32(cboDiagnoseDoctor.SelectedValue);
                pItem.AssignId        = Convert.ToInt32(-1);
                pItem.DiagnosticianId = Convert.ToInt32(-1);
                pItem.ParaId          = string.IsNullOrEmpty(txtBarcode.Text) ? 0 : 1;
                string testID = TestInfoBusiness.InsertTestInfo(pItem);

                DataRow dr = dtRegisteredTestType.NewRow();
                dr[TTestInfo.Columns.TestId]           = testID;
                dr[TTestInfo.Columns.Barcode]          = pItem.Barcode;
                dr[TTestInfo.Columns.TestTypeId]       = btni.Name;
                dr[TTestTypeList.Columns.TestTypeName] = btni.Text;
                dr[TTestInfo.Columns.TestStatus]       = 0;
                dr[TTestInfo.Columns.PatientId]        = pItem.PatientId;
                dr[TTestInfo.Columns.AssignId]         = pItem.AssignId;

                dr[TTestInfo.Columns.DiagnosticianId]  = pItem.DiagnosticianId;
                dr[LTestStatus.Columns.TestStatusName] =
                    dtTestStatus.Rows[0][LTestStatus.Columns.TestStatusName].ToString();
                //dr[TTestTypeList.Columns.TestTypeName] = btni.Text;
                dtRegisteredTestType.Rows.Add(dr);
                dtRegisteredTestType.AcceptChanges();
                grdTestType.Focus();
                //grdTestType.DataSource = dtRegisteredTestType;
            }
        }
예제 #19
0
 private void GetAllTodayTestResult()
 {
     _dtAllTodayTestResult = TestInfoBusiness.GetAllTodayTestResult();
 }