Пример #1
0
        public WebViewList WebGetViewList(string hospcd)
        {
            WebViewList ret = new WebViewList();

            try
            {
                string path = ConfigurationManager.AppSettings["RetPath"];

                if (!Directory.Exists(path))
                {
                    LogControl.WriteLog(LogType.ERR, "WebGetViewList", "【所見取得】 フォルダなし:" + path);
                    return(ret);
                }

                string[]    filePaths = Directory.GetFiles(path);
                List <View> tmpList   = new List <View>();

                filePaths = filePaths.OrderByDescending(f => File.GetLastWriteTime(f)).ToArray();
                int maxCnt = Convert.ToInt32(ConfigurationManager.AppSettings["MaxCnt"]);
                int cnt    = 0;
                foreach (var file in filePaths)
                {
                    if (cnt == maxCnt)
                    {
                        break;
                    }
                    cnt++;

                    string   name = Path.GetFileNameWithoutExtension(file);
                    string[] vals = name.Split('_');

                    if (vals.Length < 4)
                    {
                        continue;
                    }

                    View tmp = new View();

                    tmp.PatID    = vals[0];
                    tmp.PatName  = vals[1];
                    tmp.Modality = vals[2];
                    tmp.Date     = vals[3];
                    tmp.OrderID  = vals[4] + "_" + vals[5];

                    string   dir      = ConfigurationManager.AppSettings["PDFPath"];
                    string[] tmpFiles = Directory.GetFiles(dir, name + ".*");

                    if (tmpFiles == null || tmpFiles.Length == 0)
                    {
                        tmp.Status = 0;
                    }
                    else
                    {
                        tmp.Status = 1;
                    }

                    tmpList.Add(tmp);
                }

                ret.Items  = tmpList.ToArray();
                ret.Result = true;
            }
            catch (Exception e)
            {
                ret.Result  = false;
                ret.Message = "処理中に障害が発生いたしました。\nシステム管理者にお問い合わせください。";
                LogControl.WriteLog(LogType.ERR, "WebGetViewList", e.Message);
            }

            return(ret);
        }
Пример #2
0
        public WebViewList WebGetViewList(string hospcd)
        {
            WebViewList ret = new WebViewList();

            try
            {
                string path = System.IO.Path.Combine(ConfigurationManager.AppSettings["RetPath"], hospcd);

                if (!System.IO.Directory.Exists(path))
                {
                    LogControl.WriteLog(LogType.ERR, "WebGetViewList", "【所見取得】 フォルダなし:" + path);
                    return(ret);
                }

                string[]    filePaths = System.IO.Directory.GetFiles(path);
                List <View> tmpList   = new List <View>();

                ServiceIF serv     = new ServiceIF();
                HospMst[] hospList = null;

                int hospid = 0;

                serv.GetHospList_Serv(out hospList);
                foreach (var hosp in hospList)
                {
                    if (hosp.CD == hospcd)
                    {
                        hospid = hosp.HospID;
                        break;
                    }
                }

                filePaths = filePaths.OrderByDescending(f => System.IO.File.GetLastWriteTime(f)).ToArray();
                int maxCnt = Convert.ToInt32(ConfigurationManager.AppSettings["MaxCnt"]);
                int cnt    = 0;
                foreach (var file in filePaths)
                {
                    if (cnt == maxCnt)
                    {
                        break;
                    }
                    cnt++;

                    string   name = System.IO.Path.GetFileNameWithoutExtension(file);
                    string[] vals = name.Split('_');

                    if (vals.Length < 4)
                    {
                        continue;
                    }

                    View tmp = new View();

                    tmp.PatID    = vals[0];
                    tmp.Date     = vals[1];
                    tmp.Modality = vals[2];
                    tmp.OrderID  = vals[3];
                    if (!string.IsNullOrEmpty(vals[4]))
                    {
                        tmp.ReadDate     = vals[4].Substring(0, 8);
                        tmp.ReadDateTime = vals[4];
                    }


                    OrderTool_Serv.Class.Search search = new OrderTool_Serv.Class.Search();
                    search.PatID  = tmp.PatID;
                    search.HospID = hospid;

                    Patient[] patList = null;

                    serv.GetPatient_Serv(search, out patList);
                    if (patList.Length > 0)
                    {
                        tmp.PatName = patList[0].PatName;
                    }
                    else
                    {
                        tmp.PatName = "";
                    }

                    string   dir      = System.IO.Path.Combine(ConfigurationManager.AppSettings["PDFPath"], hospcd);
                    string[] tmpFiles = System.IO.Directory.GetFiles(dir, name + ".*");

                    if (tmpFiles == null || tmpFiles.Length == 0)
                    {
                        tmp.Status = 0;
                    }
                    else
                    {
                        tmp.Status = 1;
                    }

                    tmpList.Add(tmp);
                }

                ret.Items  = tmpList.ToArray();
                ret.Result = true;
            }
            catch (Exception e)
            {
                ret.Result  = false;
                ret.Message = "処理中に障害が発生いたしました。\nシステム管理者にお問い合わせください。";
                LogControl.WriteLog(LogType.ERR, "WebGetViewList", e.Message);
            }

            return(ret);
        }