Exemplo n.º 1
0
        /// <summary>
        /// 处理扫描后的文件生成Info_MedicalRecords的集合。
        /// </summary>
        public static ArrayList GetScanFiles(string directoryPath)
        {
            ArrayList scanFiles = new ArrayList();

            if (!Directory.Exists(directoryPath))
            {
                return(scanFiles);
            }
            DirectoryInfo dir = new DirectoryInfo(directoryPath);

            FileInfo[] filesInfo = dir.GetFiles();
            for (int i = 0; i < filesInfo.Length; i++)
            {
                Info_MedicalRecords imr = new Info_MedicalRecords();

                //文件名
                imr.FileName = filesInfo[i].Name;
                string[] n = Tools_FileOperation.FileNameAnalyse(filesInfo[i].Name);

                //病人ID
                imr.PatientID = n[1];

                //VisitID
                //int型转换
                try
                {
                    imr.VisitID = int.Parse(n[2]);
                }
                catch (Exception ex)
                {
                    continue;
                }

                //文书类型编码
                imr.TextTypeCode = n[3];

                //文件顺序
                //int型转换
                try
                {
                    imr.FileOrder = int.Parse(n[4]);
                }
                catch (Exception ex)
                {
                    imr.FileOrder = 0;
                }

                scanFiles.Add(imr);
            }
            return(scanFiles);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 生成文件名称树形结构
        /// </summary>
        /// <param name="info_MedicalRecords">Info_MedicalRecords的集合</param>
        /// <param name="nodes">TreeView的根结点集合</param>
        public static void ShowFilesView(ArrayList info_MedicalRecords, NodeCollection nodes)
        {
            nodes.Clear();
            foreach (Info_MedicalRecords imr in info_MedicalRecords)
            {
                bool isHave = false;
                Node node   = new Node();

                for (int i = 0; i < nodes.Count; i++)
                {
                    try
                    {
                        string[] tag = nodes[i].Tag.ToString().Split('-');
                        if (imr.PatientID.Equals(tag[0]) && imr.VisitID == int.Parse(tag[1]))
                        {
                            isHave = true;

                            //病人姓名
                            imr.PatientName = node.Text;
                            node            = nodes[i];
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        continue;
                    }
                }
                if (!isHave)
                {
                    //数据库查询病人姓名
                    string sql = "select t.patient_name from t_in_patient t where t.his_id = '"
                                 + imr.PatientID
                                 + "-"
                                 + imr.VisitID + "'";
                    DataSet ds = App.GetDataSet(sql);
                    if (ds.Tables.Count > 0)
                    {
                        imr.PatientName = ds.Tables[0].Rows[0]["patient_name"].ToString();
                    }

                    node.Text = imr.PatientName + " " + imr.PatientID + "(" + imr.VisitID + ")";

                    node.Tag             = imr.PatientID + "-" + imr.VisitID.ToString();
                    node.CheckBoxVisible = true;
                    nodes.Add(node);
                }
                Tools_FileOperation.GetFilesTree(imr, node.Nodes);
            }
        }
Exemplo n.º 3
0
        //public static void FileNameAnalyse()
        //{
        //    string[] names;
        //    try
        //    {

        //        names = fileName.Substring(0, fileName.LastIndexOf('.')).Split('_');
        //        return names;
        //    }
        //    catch (Exception ex)
        //    {
        //        names = new string[0];
        //        return names;
        //    }

        //}
        #endregion

        #region 判断扫面后图片是否倒置
        /// <summary>
        /// 判断image图片是否是倒置的
        /// 0表示图片为倒置的;1表示图片为正;2表示图片为错误,需要删除
        /// </summary>
        /// <param name="image"></param>

        public static int PicInversion(Image image)
        {
            string test = Tools_FileOperation.QRCodeAnalyse(image, "top");

            if (test.Equals("error"))
            {
                test = Tools_FileOperation.QRCodeAnalyse(image, "down");
                if (test.Equals("error"))
                {
                    return(2);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                return(1);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 生成文件树形结构 +1重载
 /// </summary>
 public void LoadTree()
 {
     Tools_FileOperation.ShowFilesView(patients, this.files_Tree.Nodes);
 }