Beispiel #1
0
        private bool CheckInfo()
        {
            if (txtTenSieuAm.Text.Trim() == string.Empty)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng nhập tên siêu âm.", IconType.Information);
                txtTenSieuAm.Focus();
                return(false);
            }

            string loaiSieuAmGUID = _isNew ? null : _drLoaiSieuAm["LoaiSieuAmGUID"].ToString();
            Result result         = SieuAmBus.CheckTenSieuAmExist(loaiSieuAmGUID, txtTenSieuAm.Text);

            if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST)
            {
                if (result.Error.Code == ErrorCode.EXIST)
                {
                    MsgBox.Show(this.Text, "Tên siêu âm này đã tồn tại rồi. Vui lòng nhập tên khác.", IconType.Information);
                    txtTenSieuAm.Focus();
                    return(false);
                }
            }
            else
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("SieuAmBus.CheckTenSieuAmExist"), IconType.Error);
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        private void OnDisplayLoaiSieuList()
        {
            Result result = SieuAmBus.GetLoaiSieuAmList();

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    dgLoaiSieuAm.DataSource = result.QueryResult;
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetLoaiSieuAmList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetLoaiSieuAmList"));
            }
        }
        private void DisplayMauBaoCao()
        {
            Cursor.Current = Cursors.WaitCursor;
            if (cboLoaiSieuAm.Text.Trim() == string.Empty)
            {
                _textControl.ResetContents();
                return;
            }

            if (_loaiSieuAmGUID != string.Empty && _htMauBaoCao.ContainsKey(_loaiSieuAmGUID))
            {
                byte[] buff = null;
                _textControl.Save(out buff, TXTextControl.BinaryStreamType.MSWord);
                _htMauBaoCao[_loaiSieuAmGUID] = buff;
            }


            bool isNam = _gioiTinh.ToLower() == "nam" ? true : false;

            _loaiSieuAmGUID = cboLoaiSieuAm.SelectedValue.ToString();
            Result result = SieuAmBus.GetMauBaoCao(_loaiSieuAmGUID, isNam);

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("SieuAmBus.GetMauBaoCao"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetMauBaoCao"));
            }
            else
            {
                MauBaoCao mauBaoCao = result.QueryResult as MauBaoCao;
                if (mauBaoCao == null)
                {
                    _textControl.ResetContents();
                }
                else
                {
                    byte[] buff = null;
                    if (!_htMauBaoCao.ContainsKey(_loaiSieuAmGUID))
                    {
                        buff = mauBaoCao.Template.ToArray();
                        _htMauBaoCao.Add(_loaiSieuAmGUID, buff);
                    }
                    else
                    {
                        buff = (byte[])_htMauBaoCao[_loaiSieuAmGUID];
                    }

                    _textControl.Load(buff, TXTextControl.BinaryStreamType.MSWord);
                }
            }
        }
Beispiel #4
0
        private void OnChuyenKetQuaKham()
        {
            if (!_isChuyenBenhAn)
            {
                return;
            }

            List <DataRow> deletedRows = new List <DataRow>();
            DataTable      dt          = dgSieuAm.DataSource as DataTable;

            foreach (DataRow row in dt.Rows)
            {
                if (Boolean.Parse(row["Checked"].ToString()))
                {
                    deletedRows.Add(row);
                }
            }

            if (dgSieuAm.RowCount <= 0 || deletedRows == null || deletedRows.Count <= 0)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu ít nhất 1 kết quả siêu âm cần chuyển.", IconType.Information);
                return;
            }

            if (_patientRow2 == null)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn bệnh nhân nhận kết quả siêu âm chuyển đến.", IconType.Information);
                return;
            }

            string fileNum = _patientRow2["FileNum"].ToString();

            if (MsgBox.Question(Application.ProductName, string.Format("Bạn có muốn chuyển những kết quả siêu âm đã chọn đến bệnh nhân: '{0}'?", fileNum)) == DialogResult.No)
            {
                return;
            }

            Result result = SieuAmBus.ChuyenBenhAn(_patientRow2["PatientGUID"].ToString(), deletedRows);

            if (result.IsOK)
            {
                DisplayAsThread();
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.ChuyenBenhAn"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.ChuyenBenhAn"));
            }
        }
        private void DisplayLoaiSieuAm()
        {
            bool   isNam  = _gioiTinh.ToLower() == "nam" ? true : false;
            Result result = SieuAmBus.GetLoaiSieuAmList(isNam);

            if (!result.IsOK)
            {
                MsgBox.Show(this.Text, result.GetErrorAsString("SieuAmBus.GetLoaiSieuAmList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetLoaiSieuAmList"));
                return;
            }
            else
            {
                cboLoaiSieuAm.DataSource = result.QueryResult;
            }
        }
Beispiel #6
0
        private void OnDelete()
        {
            List <string>  deletedServiceList = new List <string>();
            List <DataRow> deletedRows        = new List <DataRow>();
            DataTable      dt = dgLoaiSieuAm.DataSource as DataTable;

            foreach (DataRow row in dt.Rows)
            {
                if (Boolean.Parse(row["Checked"].ToString()))
                {
                    deletedServiceList.Add(row["LoaiSieuAmGUID"].ToString());
                    deletedRows.Add(row);
                }
            }

            if (deletedRows.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những loại siêu âm mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = SieuAmBus.DeleteLoaiSieuAm(deletedServiceList);
                    if (result.IsOK)
                    {
                        foreach (DataRow row in deletedRows)
                        {
                            dt.Rows.Remove(row);
                        }
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.DeleteLoaiSieuAm"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.DeleteLoaiSieuAm"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những loại siêu âm cần xóa.", IconType.Information);
            }
        }
Beispiel #7
0
        private void OnDisplayKetQuaSieuAmList()
        {
            Result result = SieuAmBus.GetKetQuaSieuAmList(_patientGUID, _fromDate, _toDate);

            if (result.IsOK)
            {
                MethodInvoker method = delegate
                {
                    ClearData();
                    DataTable dt = result.QueryResult as DataTable;
                    dgSieuAm.DataSource = dt;

                    if (_isPrint)
                    {
                        DataRow[] rows = dt.Select(string.Format("KetQuaSieuAmGUID='{0}'", _ketQuaSieuAm.KetQuaSieuAmGUID.ToString()));
                        if (rows != null && rows.Length > 0)
                        {
                            OnPrint(rows[0]);
                        }
                    }
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList"));
            }
        }
Beispiel #8
0
        private void OnDisplayMauBaoCao()
        {
            if (dgLoaiSieuAm.SelectedRows == null || dgLoaiSieuAm.SelectedRows.Count <= 0)
            {
                _drLoaiSieuAm = null;
                //txtTenSieuAm.Text = string.Empty;
                //txtMauBaoCao_Chung.Text = string.Empty;
                //txtMauBaoCao_Nam.Text = string.Empty;
                //txtMauBaoCao_Nu.Text = string.Empty;
                //_textControl1.ResetContents();
                //_textControl2.ResetContents();
                return;
            }

            _drLoaiSieuAm = (dgLoaiSieuAm.SelectedRows[0].DataBoundItem as DataRowView).Row;

            if (_flag)
            {
                return;
            }

            string loaiSieuAmGUID = _drLoaiSieuAm["LoaiSieuAmGUID"].ToString();

            Result result = SieuAmBus.GetMauBaoCaoList(loaiSieuAmGUID);

            if (result.IsOK)
            {
                List <MauBaoCao> mauBaoCaoList = (List <MauBaoCao>)result.QueryResult;
                txtTenSieuAm.Text   = _drLoaiSieuAm["TenSieuAm"].ToString();
                numThuTu.Value      = Convert.ToInt32(_drLoaiSieuAm["ThuTu"]);
                chkInTrang2.Checked = Convert.ToBoolean(_drLoaiSieuAm["InTrang2"]);

                chkNam.Checked = false;
                chkNu.Checked  = false;
                foreach (var mauBaoCao in mauBaoCaoList)
                {
                    DoiTuong doiTuong = (DoiTuong)mauBaoCao.DoiTuong;
                    TXTextControl.TextControl textControl = null;
                    switch (doiTuong)
                    {
                    case DoiTuong.Chung:
                        raChung.Checked = true;
                        textControl     = _textControl1;
                        break;

                    case DoiTuong.Nam:
                        chkNam.Checked  = true;
                        raNamNu.Checked = true;

                        foreach (TabPage tabPage in tabMauBaoCao.TabPages)
                        {
                            if (tabPage.Text == "Mẫu báo cáo (Nam)")
                            {
                                textControl = (tabPage.Controls[0] as TXTextControl.TextControl);
                                break;
                            }
                        }
                        break;

                    case DoiTuong.Nu:
                        chkNu.Checked = true;

                        raNamNu.Checked = true;

                        foreach (TabPage tabPage in tabMauBaoCao.TabPages)
                        {
                            if (tabPage.Text == "Mẫu báo cáo (Nữ)")
                            {
                                textControl = (tabPage.Controls[0] as TXTextControl.TextControl);
                                break;
                            }
                        }
                        break;
                    }

                    textControl.Load(mauBaoCao.Template.ToArray(), TXTextControl.BinaryStreamType.MSWord);
                    textControl.Tables.GridLines = false;
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetMauBaoCaoList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetMauBaoCaoList"));
            }
        }
Beispiel #9
0
        private void OnEdit()
        {
            _isNew = false;
            if (_drLoaiSieuAm == null)
            {
                MsgBox.Show(Application.ProductName, "Vui lòng chọn loại siêu âm cần cập nhật.", IconType.Information);
                return;
            }

            if (!CheckInfo())
            {
                return;
            }

            LoaiSieuAm loaiSieuAm = new LoaiSieuAm();

            loaiSieuAm.LoaiSieuAmGUID = Guid.Parse(_drLoaiSieuAm["LoaiSieuAmGUID"].ToString());
            loaiSieuAm.UpdatedBy      = Guid.Parse(Global.UserGUID);
            loaiSieuAm.UpdatedDate    = DateTime.Now;
            loaiSieuAm.TenSieuAm      = txtTenSieuAm.Text.Trim();
            loaiSieuAm.ThuTu          = (int)numThuTu.Value;
            loaiSieuAm.InTrang2       = chkInTrang2.Checked;
            loaiSieuAm.Status         = (byte)Status.Actived;

            List <MauBaoCao> mauBaoCaoList = new List <MauBaoCao>();

            byte[] buff = null;
            _textControl1.Save(out buff, TXTextControl.BinaryStreamType.MSWord);
            MauBaoCao mauBaoCao = new MauBaoCao();

            mauBaoCao.Template = new System.Data.Linq.Binary(buff);
            mauBaoCao.DoiTuong = (int)DoiTuong.Chung;


            if (raNamNu.Checked)
            {
                if (chkNam.Checked)
                {
                    mauBaoCao.DoiTuong = (int)DoiTuong.Nam;
                    mauBaoCaoList.Add(mauBaoCao);
                }

                if (chkNu.Checked)
                {
                    buff = null;
                    _textControl2.Save(out buff, TXTextControl.BinaryStreamType.MSWord);
                    mauBaoCao          = new MauBaoCao();
                    mauBaoCao.Template = new System.Data.Linq.Binary(buff);
                    mauBaoCao.DoiTuong = (int)DoiTuong.Nu;

                    mauBaoCaoList.Add(mauBaoCao);
                }
            }
            else
            {
                mauBaoCaoList.Add(mauBaoCao);
            }

            Result result = SieuAmBus.InsertLoaiSieuAm(loaiSieuAm, mauBaoCaoList);

            if (result.IsOK)
            {
                _flag = true;
                OnDisplayLoaiSieuList();
                _flag = false;

                SetCurrentLoaiSieuAm(loaiSieuAm.LoaiSieuAmGUID.ToString());
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.InsertLoaiSieuAm"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.InsertLoaiSieuAm"));
            }
        }
Beispiel #10
0
        private void OnSaveInfo()
        {
            try
            {
                _ketQuaSieuAm.PatientGUID = Guid.Parse(_patientGUID);
                _ketQuaSieuAm.Status      = (byte)Status.Actived;

                if (_isNew)
                {
                    _ketQuaSieuAm.CreatedDate = DateTime.Now;
                    _ketQuaSieuAm.CreatedBy   = Guid.Parse(Global.UserGUID);
                }
                else
                {
                    _ketQuaSieuAm.UpdatedDate = DateTime.Now;
                    _ketQuaSieuAm.UpdatedBy   = Guid.Parse(Global.UserGUID);
                }

                MethodInvoker method = delegate
                {
                    _ketQuaSieuAm.NgaySieuAm      = dtpkNgaySieuAm.Value;
                    _ketQuaSieuAm.BacSiSieuAmGUID = Guid.Parse(cboBSSieuAm.SelectedValue.ToString());
                    _ketQuaSieuAm.LoaiSieuAmGUID  = Guid.Parse(cboLoaiSieuAm.SelectedValue.ToString());

                    if (cboBSCD.SelectedValue != null && cboBSCD.Text.Trim() != string.Empty)
                    {
                        _ketQuaSieuAm.BacSiChiDinhGUID = Guid.Parse(cboBSCD.SelectedValue.ToString());
                    }

                    _ketQuaSieuAm.LamSang = txtLamSang.Text;

                    byte[] buff = null;
                    _textControl.Save(out buff, TXTextControl.BinaryStreamType.MSWord);
                    _ketQuaSieuAm.KetQuaSieuAm1 = new System.Data.Linq.Binary(buff);

                    _ketQuaSieuAm.Hinh1 = null;
                    _ketQuaSieuAm.Hinh2 = null;

                    if (picHinh1.Image != null)
                    {
                        _ketQuaSieuAm.Hinh1 = new System.Data.Linq.Binary(Utility.GetBinaryFromImage(picHinh1.Image));
                    }

                    if (picHinh2.Image != null)
                    {
                        _ketQuaSieuAm.Hinh2 = new System.Data.Linq.Binary(Utility.GetBinaryFromImage(picHinh2.Image));
                    }

                    Result result = SieuAmBus.InsertKetQuaSieuAm(_ketQuaSieuAm);
                    if (!result.IsOK)
                    {
                        MsgBox.Show(this.Text, result.GetErrorAsString("SieuAmBus.InsertKetQuaSieuAm"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.InsertKetQuaSieuAm"));
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                    }
                };

                if (InvokeRequired)
                {
                    BeginInvoke(method);
                }
                else
                {
                    method.Invoke();
                }
            }
            catch (Exception e)
            {
                MsgBox.Show(this.Text, e.Message, IconType.Error);
                Utility.WriteToTraceLog(e.Message);
            }
        }
Beispiel #11
0
        private bool OnTaoHoSo(DataRow row)
        {
            string patientGUID = row["PatientGUID"].ToString();

            Result result = ReportBus.GetNgayKhamCuoiCung(patientGUID);

            if (!result.IsOK)
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetNgayKhamCuoiCung"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetNgayKhamCuoiCung"));
                return(false);
            }

            List <DateTime> ngayKhamCuoiCungList = (List <DateTime>)result.QueryResult;

            string maBenhNhan  = row["FileNum"].ToString();
            string tenBenhNhan = Utility.ConvertToUnSign(row["FullName"].ToString());
            string path        = string.Format("{0}\\{1}@{2}", Global.HoSoPath, maBenhNhan, tenBenhNhan);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string ketQuaKhamTongQuatFileName = string.Format("{0}\\Temp\\KetQuaKhamSucKhoeTongQuat.xls", Application.StartupPath);//string.Format("{0}\\KetQuaKhamSucKhoeTongQuat_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));

            if (!Exports.ExportExcel.ExportKetQuaKhamTongQuatToExcel(ketQuaKhamTongQuatFileName, row, ngayKhamCuoiCungList))
            {
                return(false);
            }

            string pdfFileName = string.Format("{0}\\KetQuaKhamSucKhoeTongQuat_{1}.pdf", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));

            if (!Exports.ConvertExcelToPDF.Convert(ketQuaKhamTongQuatFileName, pdfFileName, Utility.GetPageSetup(Const.KhamSucKhoeTongQuatTemplate)))
            {
                return(false);
            }

            //Kết quả nội soi
            if (ngayKhamCuoiCungList[5] != Global.MinDateTime)
            {
                DateTime fromDate = new DateTime(ngayKhamCuoiCungList[5].Year, ngayKhamCuoiCungList[5].Month, ngayKhamCuoiCungList[5].Day, 0, 0, 0);
                DateTime toDate   = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59);

                result = KetQuaNoiSoiBus.GetKetQuaNoiSoiList2(patientGUID, fromDate, toDate);
                if (!result.IsOK)
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaNoiSoiBus.GetKetQuaNoiSoiList2"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaNoiSoiBus.GetKetQuaNoiSoiList2"));
                    return(false);
                }

                DataTable dt = result.QueryResult as DataTable;
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        LoaiNoiSoi loaiNoiSoi           = (LoaiNoiSoi)Convert.ToInt32(dr["LoaiNoiSoi"]);
                        string     ketQuaNoiSoiFileName = string.Format("{0}\\Temp\\KetQuaNoiSoi.xls", Application.StartupPath);
                        //string.Format("{0}\\KetQuaNoiSoi_{1}_{2}.xls", path, loaiNoiSoi.ToString(), DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        PageSetup p = null;

                        switch (loaiNoiSoi)
                        {
                        case LoaiNoiSoi.Tai:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiTaiToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiTaiTemplate);
                            break;

                        case LoaiNoiSoi.Mui:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiMuiToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiMuiTemplate);
                            break;

                        case LoaiNoiSoi.Hong_ThanhQuan:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiHongThanhQuanToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiHongThanhQuanTemplate);
                            break;

                        case LoaiNoiSoi.TaiMuiHong:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiTaiMuiHongToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiTaiMuiHongTemplate);
                            break;

                        case LoaiNoiSoi.TongQuat:
                            if (!Exports.ExportExcel.ExportKetQuaNoiSoiTongQuatToExcel(ketQuaNoiSoiFileName, row, dr))
                            {
                                return(false);
                            }
                            p = Utility.GetPageSetup(Const.KetQuaNoiSoiTongQuatTemplate);
                            break;
                        }

                        pdfFileName = string.Format("{0}\\KetQuaNoiSoi_{1}_{2}.xls", path, loaiNoiSoi.ToString(), DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        if (!Exports.ConvertExcelToPDF.Convert(ketQuaNoiSoiFileName, pdfFileName, p))
                        {
                            return(false);
                        }
                    }
                }
            }

            //Kết quả soi CTC
            if (ngayKhamCuoiCungList[6] != Global.MinDateTime)
            {
                DateTime fromDate = new DateTime(ngayKhamCuoiCungList[6].Year, ngayKhamCuoiCungList[6].Month, ngayKhamCuoiCungList[6].Day, 0, 0, 0);
                DateTime toDate   = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59);

                result = KetQuaSoiCTCBus.GetKetQuaSoiCTCList2(patientGUID, fromDate, toDate);
                if (!result.IsOK)
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList2"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList2"));
                    return(false);
                }

                DataTable dt = result.QueryResult as DataTable;
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string ketQuaSoiCTCFileName = string.Format("{0}\\Temp\\KetQuaSoiCTC.xls", Application.StartupPath);
                        //string.Format("{0}\\KetQuaSoiCTC_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        if (!Exports.ExportExcel.ExportKetQuaSoiCTCToExcel(ketQuaSoiCTCFileName, row, dr))
                        {
                            return(false);
                        }

                        pdfFileName = string.Format("{0}\\KetQuaSoiCTC_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms"));
                        if (!Exports.ConvertExcelToPDF.Convert(ketQuaSoiCTCFileName, pdfFileName, Utility.GetPageSetup(Const.KetQuaSoiCTCTemplate)))
                        {
                            return(false);
                        }
                    }
                }
            }

            //Kết quả siêu âm
            if (ngayKhamCuoiCungList[7] != Global.MinDateTime)
            {
                DateTime fromDate = new DateTime(ngayKhamCuoiCungList[7].Year, ngayKhamCuoiCungList[7].Month, ngayKhamCuoiCungList[7].Day, 0, 0, 0);
                DateTime toDate   = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59);

                result = SieuAmBus.GetKetQuaSieuAmList2(patientGUID, fromDate, toDate);
                if (!result.IsOK)
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList2"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList2"));
                    return(false);
                }

                DataTable dt = result.QueryResult as DataTable;
                if (dt != null && dt.Rows.Count > 0)
                {
                    MethodInvoker method = delegate
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            string tenSieuAm            = Utility.ConvertToUnSign(dr["TenSieuAm"].ToString());
                            string ketQuaSieuAmFileName = string.Format("{0}\\KetQuaSieuAm_{1}_{2}.pdf", path, tenSieuAm,
                                                                        DateTime.Now.ToString("ddMMyyyyHHmmssms"));

                            _uPrintKetQuaSieuAm.PatientRow = row;
                            _uPrintKetQuaSieuAm.ExportToPDF(dr, ketQuaSieuAmFileName);
                        }
                    };
                    if (InvokeRequired)
                    {
                        BeginInvoke(method);
                    }
                    else
                    {
                        method.Invoke();
                    }
                }
            }

            return(true);
        }