Пример #1
0
        private void OnAddService()
        {
            if (dgMauHoSo.SelectedRows == null || dgMauHoSo.SelectedRows.Count <= 0)
            {
                return;
            }
            if (cboMaHopDong.SelectedValue == null)
            {
                return;
            }

            List <string> addedServices = GetAddedServices();
            dlgServices   dlg           = new dlgServices(addedServices, _hopDongGUID);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                List <DataRow> rows   = dlg.Services;
                Result         result = MauHoSoBus.AddServices(_mauHoSoGUID, _hopDongGUID, rows);
                if (result.IsOK)
                {
                    DisplayChiTietMauHoSo(_mauHoSoGUID);
                }
                else
                {
                    MsgBox.Show(Application.ProductName, result.GetErrorAsString("MauHoSoBus.AddServices"), IconType.Error);
                    Utility.WriteToTraceLog(result.GetErrorAsString("MauHoSoBus.AddServices"));
                }
            }
        }
Пример #2
0
        private void DisplayChiTietMauHoSo(string mauHoSoGUID)
        {
            Result result = MauHoSoBus.GetChiTietMauHoSoList(mauHoSoGUID, _hopDongGUID);

            if (result.IsOK)
            {
                ClearDetailData();
                dgService.DataSource = result.QueryResult;
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("MauHoSoBus.GetChiTietMauHoSoList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("MauHoSoBus.GetChiTietMauHoSoList"));
            }
        }
Пример #3
0
        private void OnDeleteService()
        {
            if (dgMauHoSo.SelectedRows == null || dgMauHoSo.SelectedRows.Count <= 0)
            {
                return;
            }
            if (cboMaHopDong.SelectedValue == null)
            {
                return;
            }

            List <string>  keys        = new List <string>();
            List <DataRow> deletedRows = new List <DataRow>();
            DataTable      dt          = dgService.DataSource as DataTable;

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

            if (keys.Count > 0)
            {
                if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những dịch vụ mà bạn đã đánh dấu ?") == DialogResult.Yes)
                {
                    Result result = MauHoSoBus.DeleteServices(_mauHoSoGUID, _hopDongGUID, keys);
                    if (result.IsOK)
                    {
                        foreach (DataRow row in deletedRows)
                        {
                            dt.Rows.Remove(row);
                        }
                    }
                    else
                    {
                        MsgBox.Show(Application.ProductName, result.GetErrorAsString("MauHoSoBus.DeleteServices"), IconType.Error);
                        Utility.WriteToTraceLog(result.GetErrorAsString("MauHoSoBus.DeleteServices"));
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những dịch vụ cần xóa.", IconType.Information);
            }
        }
Пример #4
0
        public void DisplayInfo()
        {
            UpdateGUI();

            OnDisplayHopDongList();

            Result result = MauHoSoBus.GetMauHoSoList();

            if (result.IsOK)
            {
                ClearData();
                dgMauHoSo.DataSource = result.QueryResult;
            }
            else
            {
                MsgBox.Show(Application.ProductName, result.GetErrorAsString("MauHoSoBus.GetMauHoSoList"), IconType.Error);
                Utility.WriteToTraceLog(result.GetErrorAsString("MauHoSoBus.GetMauHoSoList"));
            }
        }
Пример #5
0
        private void OnExportToWord()
        {
            List <DataRow> checkedRows = _dictPatient.Values.ToList();

            if (checkedRows.Count > 0)
            {
                FolderBrowserDialog dlg = new FolderBrowserDialog();
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    foreach (DataRow row in checkedRows)
                    {
                        string contractMemberGUID = row["ContractMemberGUID"].ToString();
                        string fileNum            = row["FileNum"].ToString();
                        string fullName           = Utility.ConvertToUnSign2(row["FullName"].ToString());
                        Result result             = MauHoSoBus.GetMauChayHoSo(contractMemberGUID, _hopDongGUID);
                        if (!result.IsOK)
                        {
                            MsgBox.Show(Application.ProductName, result.GetErrorAsString("MauHoSoBus.GetMauChayHoSo"), IconType.Error);
                            Utility.WriteToTraceLog(result.GetErrorAsString("MauHoSoBus.GetMauChayHoSo"));
                            return;
                        }

                        List <MauHoSo> mauHoSoList = result.QueryResult as List <MauHoSo>;
                        if (mauHoSoList == null || mauHoSoList.Count <= 0)
                        {
                            continue;
                        }

                        result = MauHoSoBus.GetDichVuChayMauHoSo(contractMemberGUID, _hopDongGUID);
                        if (!result.IsOK)
                        {
                            MsgBox.Show(Application.ProductName, result.GetErrorAsString("MauHoSoBus.GetDichVuChayMauHoSo"), IconType.Error);
                            Utility.WriteToTraceLog(result.GetErrorAsString("MauHoSoBus.GetDichVuChayMauHoSo"));
                            return;
                        }

                        DataTable dtAllService = result.QueryResult as DataTable;
                        DataRow[] serviceRows3 = dtAllService.Select(string.Format("Loai=3"));
                        if (serviceRows3 != null && serviceRows3.Length > 0)
                        {
                            foreach (DataRow r in serviceRows3)
                            {
                                string serviceName         = r["Name"].ToString();
                                bool   isNormal_Abnormal   = Convert.ToBoolean(r["Normal_Abnormal"]);
                                bool   isNegative_Positive = Convert.ToBoolean(r["Negative_Positive"]);
                                if (!isNormal_Abnormal && !isNegative_Positive)
                                {
                                    MsgBox.Show(Application.ProductName, string.Format("Dịch vụ: '{0}' chưa được cấu hình. Vui lòng cấu hình cho dịch vụ này.", serviceName),
                                                IconType.Information);
                                    return;
                                }
                            }
                        }

                        foreach (MauHoSo mauHoSo in mauHoSoList)
                        {
                            try
                            {
                                object fileName = GetMauHoSoTemplate(mauHoSo);
                                Utility.CopyTemplates(fileName.ToString());

                                object reportFileName = string.Format("{0}\\{1}_{2}_{3}.doc", dlg.SelectedPath, Path.GetFileNameWithoutExtension(fileName.ToString()),
                                                                      fileNum, fullName);

                                File.Copy(fileName.ToString(), reportFileName.ToString(), true);

                                if (mauHoSo.Loai == 1)
                                {
                                    DataRow[] serviceRows = dtAllService.Select(string.Format("Loai=1"));
                                    ExportWord.PrintXetNghiem(reportFileName, row, serviceRows, string.Empty, false);
                                }
                                else if (mauHoSo.Loai == 2)
                                {
                                    DataRow[] serviceRows = dtAllService.Select(string.Format("Loai=2"));
                                    ExportWord.PrintChecklist(reportFileName, row, serviceRows, string.Empty, false);
                                }
                                else if (mauHoSo.Loai == 3)
                                {
                                    DataRow[] serviceRows = dtAllService.Select(string.Format("Loai=3"));
                                    ExportWord.PrintKetQuaCanLamSang(reportFileName, row, serviceRows, string.Empty, false);
                                }
                                else
                                {
                                    ExportWord.PrintMauHoSoChung(reportFileName, row, string.Empty, false);
                                }
                            }
                            catch (Exception ex)
                            {
                                MsgBox.Show(Application.ProductName, ex.Message, IconType.Error);
                                Utility.WriteToTraceLog(ex.Message);
                            }
                        }
                    }
                }
            }
            else
            {
                MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những bệnh nhân cần xuất.", IconType.Information);
            }
        }