Example #1
0
        /// <summary>
        /// 执行审核脚本(校验规则)
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public DataTable CheckOut(DataTable data)
        {
            DataColumn checkID   = new DataColumn("CHECK_ID", typeof(string));
            DataColumn checkName = new DataColumn("CHECK_NAME", typeof(string));
            DataColumn error     = new DataColumn("CS_ERROR", typeof(string));
            DataColumn classify  = new DataColumn("CHECK_CLASSIFY", typeof(string));

            if (data != null && data.Rows.Count > 0)
            {
                DataTable result = data.Clone();
                result.Columns.Add(checkID);
                result.Columns.Add(checkName);
                result.Columns.Add(error);
                result.Columns.Add(classify);
                DataTable script = Model.GetAllScript();
                if (script != null && script.Rows.Count > 0)
                {
                    CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在努力审核....", 0, data.Rows.Count);
                    for (int i = 0; i < data.Rows.Count; i++)
                    {
                        bool isCheckSuccess = true;
                        foreach (DataRow scriptDr in script.Rows)
                        {
                            //DataTable dt = new DataTable();
                            //dt = data.Clone();
                            //dt.ImportRow(data.Rows[i]);  //将DataRow转换成DataTable
                            //DataRow[] drs = dt.Select(scriptDr["CS_TEXT"].ToString());
                            DataTable viewData = Model.GetPatientInView(data.Rows[i]["P3"].ToString(), data.Rows[i]["P2"].ToString(), scriptDr["CS_TEXT"].ToString());
                            if (viewData.Rows.Count == 0)  //根据脚本没查到,证明审核不过
                            {
                                DataRow resultDr = result.NewRow();
                                resultDr["P3"]             = data.Rows[i]["P3"]; //病案号
                                resultDr["P2"]             = data.Rows[i]["P2"]; //次数
                                resultDr["CHECK_ID"]       = scriptDr["CHECK_ID"];
                                resultDr["CHECK_NAME"]     = scriptDr["CHECK_NAME"];
                                resultDr["CS_ERROR"]       = scriptDr["CS_ERROR"];
                                resultDr["CHECK_CLASSIFY"] = scriptDr["CHECK_CLASSIFY"];
                                result.Rows.Add(resultDr);
                                isCheckSuccess = false;
                            }
                        }
                        if (isCheckSuccess)                 //审核通过,修改此病人审核状态为审核通过
                        {
                            Model.AddPatient(data.Rows[i]); //将此病人copy到本地库
                            //Model.ModifyPatientCheckState(data.Rows[i]["P3"].ToString(), data.Rows[i]["P2"].ToString());
                        }
                        waitUC.Do("执行进度(" + i + "/" + data.Rows.Count + ")");
                    }
                    waitUC.ParentForm.Close();
                    return(result);
                }
            }
            return(null);
        }
Example #2
0
        /// <summary>
        /// 将dataTable转换成DBF文件
        /// </summary>
        /// <param name="data"></param>
        public void CreateDBF(DataTable data)
        {
            string savePath = CJia.HISOLAP.Tools.ConfigHelper.GetAppStrings("DBFSavePath");
            //string str_oleConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\;Extended Properties=dBASE IV;";
            string str_oleConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + savePath + ";Extended Properties=dBASE IV;";

            System.Data.OleDb.OleDbConnection ole_conn = new System.Data.OleDb.OleDbConnection(str_oleConn);
            try
            {
                ole_conn.Open();
                string fileName = "HQMS_" + StartDate.ToString("yyyy.MM.dd") + "~" + EndDate.ToString("yyyy.MM.dd");
                string sqlCreat = "create table " + fileName + "({0})";
                string columns  = "";
                foreach (DataColumn col in data.Columns)
                {
                    columns += col.ColumnName;
                    columns += " char(200),";
                }
                columns  = columns.Remove(columns.Length - 1, 1);
                sqlCreat = string.Format(sqlCreat, columns);
                System.Data.OleDb.OleDbCommand cmd1 = new System.Data.OleDb.OleDbCommand
                                                          (sqlCreat, ole_conn);
                cmd1.ExecuteNonQuery();
                CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在努力上报....", 0, data.Rows.Count);
                this.Enabled = false;
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    string sqlInsert = "insert into " + fileName + " values({0})";
                    string invalues  = "";
                    foreach (DataColumn col in data.Columns)
                    {
                        invalues += "'" + data.Rows[i][col].ToString() + "',";
                    }
                    invalues  = invalues.Remove(invalues.Length - 1, 1);
                    sqlInsert = string.Format(sqlInsert, invalues);
                    System.Data.OleDb.OleDbCommand cmd2 = new System.Data.OleDb.OleDbCommand
                                                              (sqlInsert, ole_conn);
                    cmd2.ExecuteNonQuery();
                    waitUC.Do("执行进度(" + i + "/" + data.Rows.Count + ")");
                }
                waitUC.ParentForm.Close();
                this.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                ole_conn.Close();
            }
        }
Example #3
0
 /// <summary>
 /// 上传图片到服务器上
 /// </summary>
 public void CopyFilesToNet(DataTable data)
 {
     CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在努力上传....", 0, data.Rows.Count);
     this.Enabled = false;
     for (int i = 0; i < data.Rows.Count; i++)
     {
         string fileName = data.Rows[i]["Pic_Path"].ToString();
         FtpHelp.UploadFile(fileName, data.Rows[i]["STORAGE_PATH"].ToString(), HostName, UserName, Password);
         waitUC.Do("执行进度(" + i + "/" + data.Rows.Count + ")");
     }
     waitUC.ParentForm.Close();
     this.Enabled = true;
 }
Example #4
0
 /// <summary>
 /// 上传图片到服务器上
 /// </summary>
 public void CopyFilesToNet(DataTable data)
 {
     CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在努力上传....", 0, data.Rows.Count);
     this.Enabled = false;
     for (int i = 0; i < data.Rows.Count; i++)
     {
         CreaterFolder(CJia.Health.Tools.ConfigHelper.GetAppStrings("IP_PATH") + "\\" + data.Rows[i]["STORAGE_PATH"].ToString());
         string fileName = data.Rows[i]["Pic_Path"].ToString();
         File.Copy(fileName, CJia.Health.Tools.ConfigHelper.GetAppStrings("IP_PATH") + "\\" + data.Rows[i]["STORAGE_PATH"] + "\\" + data.Rows[i]["Pic_Name"], true);
         waitUC.Do("执行进度(" + i + "/" + data.Rows.Count + ")");
     }
     waitUC.ParentForm.Close();
     this.Enabled = true;
 }
Example #5
0
 private void btnMerge_Click(object sender, EventArgs e)
 {
     if (pictureView.GetFocusedDataRow() != null && PictureInfo != null && PictureInfo.Rows.Count > 0)
     {
         bool isModify = false;
         CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在处理....", 0, PictureInfo.Rows.Count);
         this.Enabled = false;
         Image         img;
         List <string> SMpageList = new List <string>();
         List <string> PZpageList = new List <string>();
         try
         {
             foreach (DataRow dr in PictureInfo.Rows)
             {
                 int j = PictureInfo.Rows.IndexOf(dr);
                 waitUC.Do("执行进度(" + j + "/" + PictureInfo.Rows.Count + ")");
                 if (dr["Pic_Name"].ToString().Substring(0, 2) != "PZ")
                 {
                     img = Tools.Help.GetImageByUri(dr["Pic_Path"].ToString(), UserName, Password);
                     string isjjfb = CJia.Health.Tools.ConfigHelper.GetAppStrings("isJJCJBlank");
                     if (isjjfb == "0")//妇保
                     {
                         if (isBlankPage((Bitmap)img, 400))
                         {
                             SMpageList.Add(dr["Pic_Page"].ToString());//把空白图片的页码存起来
                         }
                     }
                     else //创佳
                     {
                         if (isBlankPage((Bitmap)img, 200))
                         {
                             SMpageList.Add(dr["Pic_Page"].ToString());//把空白图片的页码存起来
                         }
                     }
                 }
             }
             waitUC.ParentForm.Close();
             this.Enabled = true;
         }
         catch
         {
             MessageBox.Show("图片不存在或已删除,请与管理员联系。。。");
             waitUC.ParentForm.Close();
             this.Enabled = true;
         }
         if (SMpageList.Count > 0)//排除设置为非空白页的页码
         {
             if (NoBlankPage != null && NoBlankPage.Count > 0)
             {
                 foreach (string noBP in NoBlankPage)
                 {
                     try
                     {
                         SMpageList.Remove(noBP);
                     }
                     catch
                     {
                         continue;
                     }
                 }
             }
         }
         foreach (DataRow dr in PictureInfo.Rows)
         {
             if (dr["Pic_Name"].ToString().Substring(0, 2) == "PZ")
             {
                 if (!PZpageList.Contains(dr["Pic_Page"].ToString()))
                 {
                     PZpageList.Add(dr["Pic_Page"].ToString());
                 }
             }
         }
         if (SMpageList.Count == 0 && PZpageList.Count == 0)
         {
             if (Message.ShowQuery("只存在扫描的图片,是否继续合并?", Message.Button.YesNo) == Message.Result.Yes)
             {
                 Merge("104");
                 isModify = true;
             }
         }
         else if (SMpageList.Count == 0 && PZpageList.Count != 0)
         {
             if (Message.ShowQuery("只存在拍照的图片,是否继续合并?", Message.Button.YesNo) == Message.Result.Yes)
             {
                 foreach (DataRow dr in PictureInfo.Rows)
                 {
                     if (dr["Pic_Name"].ToString().Substring(0, 2) == "PZ")
                     {
                         RemovePZ(dr);
                     }
                 }
                 Merge("104");
                 isModify = true;
             }
         }
         else if (SMpageList.Count != 0 && SMpageList.Count == PZpageList.Count && PZpageList.Count != 0)
         {
             for (int i = 0; i < SMpageList.Count; i++)
             {
                 foreach (DataRow dr in PictureInfo.Rows)
                 {
                     if (dr["Pic_Name"].ToString().Substring(0, 2) != "PZ")
                     {
                         if (dr["Pic_Page"].ToString() == SMpageList[i])
                         {
                             //File.Delete(dr["Pic_Path"].ToString());//删除空白图片
                             FtpHelp.DeleteFile(dr["Pic_Path"].ToString(), UserName, Password);
                         }
                     }
                     if (dr["Pic_Name"].ToString().Substring(0, 2) == "PZ")
                     {
                         if (dr["Pic_Page"].ToString() == PZpageList[i])
                         {
                             try
                             {
                                 string SMPage = SMpageList[i];
                                 ModifyImageInfo(dr, SMPage);
                             }
                             catch
                             {
                             }
                         }
                     }
                 }
             }
             Merge("104");
             isModify = true;
         }
         else
         {
             string str = "";
             SMAllpageList = SMpageList;
             if (SMpageList.Count > 0)
             {
                 foreach (string s in SMpageList)
                 {
                     str = str + s + ",";
                 }
                 str = str.Remove(str.Length - 1, 1);
             }
             lblMesg.Text = str;
             if (Message.ShowQuery("空白图片张数与拍照图片页码张数不符,是否对此份病案重新录入?空白图片页码为" + str + "", Message.Button.YesNo) == Message.Result.Yes)
             {
                 Merge("107");
             }
             //MessageBox.Show("空白图片张数与拍照图片页码张数不符,合并失败,请对此份病案重新录入");
             //Merge("107");
             //DataTable data = CreatePictureDate();//重新加载图片
             pictureGrid.DataSource = PictureInfo;
             isModify = false;
         }
         if (isModify)
         {
             MessageBox.Show("合并成功");
             Match();//处理审核未通过的图片
             BindNull();
             //DataTable data = CreatePictureDate();
             //pictureGrid.DataSource = data;
         }
     }
 }
Example #6
0
        public DataTable CheckOut2(DataTable data)
        {
            DataColumn checkID   = new DataColumn("CHECK_ID", typeof(string));
            DataColumn checkName = new DataColumn("CHECK_NAME", typeof(string));
            DataColumn error     = new DataColumn("CS_ERROR", typeof(string));
            DataColumn classify  = new DataColumn("CHECK_CLASSIFY", typeof(string));

            if (data != null && data.Rows.Count > 0)
            {
                DataTable result = data.Clone();
                result.Columns.Add(checkID);
                result.Columns.Add(checkName);
                result.Columns.Add(error);
                result.Columns.Add(classify);
                DataTable script = Model.GetAllScript();
                if (script != null && script.Rows.Count > 0)
                {
                    CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在努力审核....", 0, data.Rows.Count);
                    for (int i = 0; i < data.Rows.Count; i++)
                    {
                        bool   isCheckSuccess = true;
                        long   k   = Model.GetCheckResult(data.Rows[i]["P3"].ToString(), data.Rows[i]["P2"].ToString());
                        string str = Convert.ToString(k, 2);//十进制>>二进制
                        if (str.Length > 0 && str != "0")
                        {
                            char[] chars = str.ToCharArray();
                            for (int m = chars.Length - 1; m >= 0; m--)
                            {
                                if (chars[m] == '0')
                                {
                                    DataRow dr       = script.Rows[chars.Length - m - 1];
                                    DataRow resultDr = result.NewRow();
                                    resultDr["P3"]             = data.Rows[i]["P3"]; //病案号
                                    resultDr["P2"]             = data.Rows[i]["P2"]; //次数
                                    resultDr["CHECK_ID"]       = dr["CHECK_ID"];
                                    resultDr["CHECK_NAME"]     = dr["CHECK_NAME"];
                                    resultDr["CS_ERROR"]       = dr["CS_ERROR"];
                                    resultDr["CHECK_CLASSIFY"] = dr["CHECK_CLASSIFY"];
                                    result.Rows.Add(resultDr);
                                    isCheckSuccess = false;
                                }
                            }
                        }
                        else//返回值为0,表示所有审核脚本都不通过
                        {
                            foreach (DataRow dr in script.Rows)
                            {
                                DataRow resultDr = result.NewRow();
                                resultDr["P3"]             = data.Rows[i]["P3"]; //病案号
                                resultDr["P2"]             = data.Rows[i]["P2"]; //次数
                                resultDr["CHECK_ID"]       = dr["CHECK_ID"];
                                resultDr["CHECK_NAME"]     = dr["CHECK_NAME"];
                                resultDr["CS_ERROR"]       = dr["CS_ERROR"];
                                resultDr["CHECK_CLASSIFY"] = dr["CHECK_CLASSIFY"];
                                result.Rows.Add(resultDr);
                                isCheckSuccess = false;
                            }
                        }
                        if (isCheckSuccess)                 //审核通过,修改此病人审核状态为审核通过
                        {
                            Model.AddPatient(data.Rows[i]); //将此病人copy到本地库
                        }
                        waitUC.Do("执行进度(" + i + "/" + data.Rows.Count + ")");
                    }
                    waitUC.ParentForm.Close();
                    return(result);
                }
            }
            return(null);
        }
Example #7
0
 private void btnMerge_Click(object sender, EventArgs e)
 {
     if (pictureView.GetFocusedDataRow() != null && PictureInfo != null && PictureInfo.Rows.Count > 0)
     {
         bool isModify = false;
         CJia.Controls.UCForWaitingForm waitUC = new CJia.Controls.UCForWaitingForm("正在进行合并....", 0, PictureInfo.Rows.Count);
         this.Enabled = false;
         Bitmap        myBitmap;
         List <string> SMpageList = new List <string>();
         List <string> PZpageList = new List <string>();
         foreach (DataRow dr in PictureInfo.Rows)
         {
             int j = PictureInfo.Rows.IndexOf(dr);
             waitUC.Do("执行进度(" + j + "/" + PictureInfo.Rows.Count + ")");
             if (dr["Pic_Name"].ToString().Substring(0, 2) != "PZ")
             {
                 FileStream fs = new FileStream(dr["Pic_Path"].ToString(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                 myBitmap = new Bitmap(fs);
                 fs.Close();
                 if (isBlankPage(myBitmap, 100))
                 {
                     SMpageList.Add(dr["Pic_Page"].ToString());//把空白图片的页码存起来
                 }
             }
         }
         waitUC.ParentForm.Close();
         this.Enabled = true;
         foreach (DataRow dr in PictureInfo.Rows)
         {
             if (dr["Pic_Name"].ToString().Substring(0, 2) == "PZ")
             {
                 if (!PZpageList.Contains(dr["Pic_Page"].ToString()))
                 {
                     PZpageList.Add(dr["Pic_Page"].ToString());
                 }
             }
         }
         if (SMpageList.Count != 0 && SMpageList.Count == PZpageList.Count && PZpageList.Count != 0)
         {
             isModify = true;
             for (int i = 0; i < SMpageList.Count; i++)
             {
                 foreach (DataRow dr in PictureInfo.Rows)
                 {
                     if (dr["Pic_Name"].ToString().Substring(0, 2) != "PZ")
                     {
                         if (dr["Pic_Page"].ToString() == SMpageList[i])
                         {
                             File.Delete(dr["Pic_Path"].ToString());//删除空白图片
                         }
                     }
                     if (dr["Pic_Name"].ToString().Substring(0, 2) == "PZ")
                     {
                         if (dr["Pic_Page"].ToString() == PZpageList[i])
                         {
                             try
                             {
                                 string SMPage = SMpageList[i];
                                 ModifyImageInfo(dr, SMPage);
                             }
                             catch
                             {
                             }
                         }
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show("空白图片张数与拍照图片页码张数不符,不能继续进行合并");
             isModify = false;
         }
         if (isModify)
         {
             DataTable data = CreatePictureDate(txtFolder.Text);
             pictureGrid.DataSource = data;
         }
     }
 }