Ejemplo n.º 1
0
        public WebResult SetViewOrder(string[] values)
        {
            WebResult ret = new WebResult();

            try
            {
                ServiceIF serv = new ServiceIF();
                OrderTool_Serv.Class.Search search = new OrderTool_Serv.Class.Search();

                search.HospID = Convert.ToInt32(values[0]);
                search.PatID  = values[1];
                PreOrder[] orderList = null;

                serv.GetPreOrder_Serv(search, out orderList);

                foreach (var order in orderList)
                {
                    if (order.Date == values[2] && order.Modality == values[3])
                    {
                        order.Status = 5;
                        serv.SetPreOrder_Serv(order);

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

            return(ret);
        }
Ejemplo n.º 2
0
        public WebResult DelPreOrder(string orderNo)
        {
            WebResult ret = new WebResult();

            try
            {
                string orderPath = "";
                string imagePath = "";
                orderPath = ConfigurationManager.AppSettings["OrderDir"];
                orderPath = Path.Combine(orderPath, orderNo.Trim() + ".csv");

                imagePath = ConfigurationManager.AppSettings["ImagePath"];
                imagePath = Path.Combine(imagePath, orderNo.Trim());

                PreOrder tmp = ReadCSV(orderPath);

                tmp.Status = 3;

                WriteCSV(tmp, "", "", "", tmp.ImgCnt.ToString(), "");

                if (File.Exists(orderPath))
                {
                    File.Delete(orderPath);
                }

                if (Directory.Exists(imagePath))
                {
                    string[] files = Directory.GetFiles(imagePath);

                    foreach (var file in files)
                    {
                        File.Delete(file);
                    }
                }

                LogControl.WriteLog(LogType.ORE, "DelPreOrder", "【オーダー削除】 オーダーNo:" + orderNo);
            }
            catch (Exception e)
            {
                ret.Result  = false;
                ret.Message = "処理中に障害が発生いたしました。\nシステム管理者にお問い合わせください。";
                LogControl.WriteLog(LogType.ERR, "DelPreOrder", e.Message);
            }
            return(ret);
        }
Ejemplo n.º 3
0
        public WebResult WebDelScanImage(string file, string orderno, string patid, string date, string mod)
        {
            WebResult ret = new WebResult();

            try
            {
                string imageDir = ConfigurationManager.AppSettings["ImagePath"];

                if (string.IsNullOrEmpty(orderno))
                {
                    imageDir = Path.Combine(imageDir, patid + "_" + date + "_" + mod);
                }
                else
                {
                    imageDir = Path.Combine(imageDir, orderno);
                }

                string[] files = null;

                if (string.IsNullOrEmpty(file))
                {
                    files = Directory.GetFiles(imageDir);
                }
                else
                {
                    files = Directory.GetFiles(imageDir, file);
                }

                foreach (var fi in files)
                {
                    File.Delete(fi);
                }
            }
            catch (Exception e)
            {
                ret.Result  = false;
                ret.Message = "スキャン画像削除中にエラーが発生しました。\n再度削除しなおしてください。";
                LogControl.WriteLog(LogType.ERR, "WebDelScanImage", e.Message);
                LogControl.WriteLog(LogType.ERR, "WebDelScanImage", e.StackTrace);
            }

            return(ret);
        }
Ejemplo n.º 4
0
        public WebResult SetPreOrder(string[] values)
        {
            WebResult ret = new WebResult();

            try
            {
                PreOrder order = new PreOrder();
                string   msg   = "";
                string   msg3  = "";

                List <string> pastIds = new List <string>();

                order.StudyInstanceUID = values[0];
                order.OrderNo          = values[1].Trim();
                order.PatID            = values[2];
                order.PatName          = values[3];
                order.PatName_H        = values[4];
                order.PatAge           = Convert.ToInt32(values[5]);
                order.BirthDay         = values[6];
                order.Modality         = values[7];
                order.Date             = values[8];
                order.Time             = values[9];
                order.BodyPart         = values[10];
                order.Type             = values[11];
                order.ImgCnt           = Convert.ToInt32(values[12]);
                order.IsEmergency      = Convert.ToInt32(values[13]);
                order.Comment          = values[14];
                order.Sex        = Convert.ToInt32(values[15]);
                order.Department = values[16];
                order.Doctor     = values[17];
                msg = values[18];

                string orderPath = "";
                orderPath = ConfigurationManager.AppSettings["OrderDir"];
                orderPath = Path.Combine(orderPath, order.OrderNo + ".csv");

                if (!File.Exists(orderPath))
                {
                    order.Status = 1;
                }
                else
                {
                    order.Status = 2;
                }

                if (values.Length > 19)
                {
                    for (int i = 19; i < values.Length; i++)
                    {
                        pastIds.Add(values[i]);
                    }
                }

                LogControl.WriteLog(LogType.ORE, "SetPreOrder", "【オーダー登録】オーダー番号:" + order.OrderNo + "患者ID:" + order.PatID + " モダリティ:" + order.Modality + " 検査日:" + order.Date);

                Search search = new Search();

                var msg4 = "";

                if (!string.IsNullOrEmpty(msg))
                {
                    msg4 = "比較参照お願いします。(" + msg + ")";
                }

                string cA = order.ImgCnt.ToString();
                string cB = msg;

                if (string.IsNullOrEmpty(msg))
                {
                    msg = order.ImgCnt.ToString();
                }
                else
                {
                    msg = order.ImgCnt.ToString() + "(" + msg + ")";
                }

                WriteCSV(order, msg, msg3, msg4, cA, cB);

                if (order.Status == 1 || order.Status == 2)
                {
                    C_Find.Setting();
                    foreach (var past in pastIds)
                    {
                        DicomQRItem[] studyDatas = null;

                        studyDatas = C_Find.C_FindFromStudy("", "", "", "", past);

                        PreOrder tmp = new PreOrder();

                        tmp = order;

                        for (int i = 0; i < studyDatas.Length; i++)
                        {
                            StudyData tmpStudy = new StudyData();
                            tmpStudy.SetStudy(studyDatas[i].Tags);

                            DicomQRItem[] tmpDat = C_Find.C_FindFromSeries(tmpStudy.UID);
                            tmpStudy.SetSeries(tmpDat);

                            tmp.Date     = tmpStudy.Tags[(uint)Tags.STUDYDATE];
                            tmp.Modality = tmpStudy.Modality;
                        }

                        WriteCSV_Past(tmp, msg, msg3, msg4, cA, cB);
                    }

                    string UIDfile = Path.Combine(ConfigurationManager.AppSettings["UIDDir"], order.OrderNo + ".txt");

                    if (File.Exists(UIDfile))
                    {
                        File.Delete(UIDfile);
                    }

                    using (var sw = new StreamWriter(UIDfile))
                    {
                        sw.WriteLine(order.StudyInstanceUID);
                    }
                }
                ret.Result = true;
            }
            catch (Exception e)
            {
                ret.Result  = false;
                ret.Message = "処理中に障害が発生いたしました。\nシステム管理者にお問い合わせください。";
                LogControl.WriteLog(LogType.ERR, "WebGetList", e.Message);
                LogControl.WriteLog(LogType.ERR, "WebGetList", e.StackTrace);
            }

            return(ret);
        }
Ejemplo n.º 5
0
        public WebResult SetPreOrder(string[] values)
        {
            WebResult ret = new WebResult();

            try
            {
                ServiceIF serv  = new ServiceIF();
                PreOrder  order = new PreOrder();
                string    msg   = "";
                string    msg2  = "";
                string    msg3  = "";

                List <string> pastIds = new List <string>();

                order.HospID = Convert.ToInt32(values[0]);
                if (!string.IsNullOrEmpty(values[1]))
                {
                    order.OrderID = Convert.ToInt32(values[1]);
                }
                else
                {
                    order.OrderID = 0;
                }
                order.PatID       = values[2];
                order.PatName     = values[3];
                order.PatName_H   = values[4];
                order.PatAge      = Convert.ToInt32(values[5]);
                order.BirthDay    = values[6];
                order.Modality    = values[7];
                order.Date        = values[8];
                order.Time        = values[9];
                order.BodyPart    = values[10];
                order.Type        = values[11];
                order.ImgCnt      = Convert.ToInt32(values[12]);
                order.IsEmergency = Convert.ToInt32(values[13]);
                order.IsMail      = Convert.ToInt32(values[14]);
                order.Comment     = values[15];
                order.Sex         = Convert.ToInt32(values[16]);
                order.Status      = 1;
                if (values[17] != "")
                {
                    msg2 = "別途依頼票あり";
                }

                if (order.IsMail == 1)
                {
                    msg3 = values[19] + " " + values[18];
                }

                if (values.Length > 20)
                {
                    for (int i = 20; i < values.Length; i++)
                    {
                        pastIds.Add(values[i]);
                    }
                }

                int key = 0;

                serv.SetPatient_Serv(order, out key);
                order.Key = key;

                ResultData inRet = serv.SetPreOrder_Serv(order);

                if (inRet.Result)
                {
                    LogControl.WriteLog(LogType.ORE, "SetPreOrder", "【オーダー登録】 施設ID:" + order.HospID + " 患者ID:" + order.PatID + " モダリティ:" + order.Modality + " 検査日:" + order.Date);

                    OrderTool_Serv.Class.Search search = new OrderTool_Serv.Class.Search();
                    search.PatID = order.PatID;

                    PreOrder[] tmpOrders;

                    serv.GetPreOrder_Serv(search, out tmpOrders);
                    var msg4 = "";
                    foreach (var odr in tmpOrders)
                    {
                        if (pastIds.Contains(odr.OrderID.ToString()))
                        {
                            odr.Status = 2;
                            serv.SetPreOrder_Serv(odr);

                            if (!string.IsNullOrEmpty(msg))
                            {
                                msg  += "、";
                                msg4 += "、";
                            }
                            msg  += odr.Date.Substring(4, 2) + "/" + odr.Date.Substring(6, 2);
                            msg4 += odr.Date.Substring(0, 4) + "/" + odr.Date.Substring(4, 2) + "/" + odr.Date.Substring(6, 2);
                            if (order.Modality != odr.Modality)
                            {
                                msg4 += " ";
                                msg4 += odr.Modality;
                                msg  += " ";
                                msg  += odr.Modality;
                            }
                            msg += " ";
                            msg += odr.ImgCnt.ToString();
                        }
                        else if (order.Date == odr.Date &&
                                 order.Modality == odr.Modality &&
                                 order.PatID == odr.PatID &&
                                 order.Time == odr.Time)
                        {
                            if (order.OrderID == 0)
                            {
                                order.OrderID = odr.OrderID;
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(msg4))
                    {
                        msg4 = "比較参照お願いします。(" + msg4 + ")" + msg2;
                    }
                    else
                    {
                        msg4 = msg2;
                    }

                    string cA = order.ImgCnt.ToString();
                    string cB = msg;

                    if (string.IsNullOrEmpty(msg))
                    {
                        msg = order.ImgCnt.ToString();
                    }
                    else
                    {
                        msg = order.ImgCnt.ToString() + "(" + msg + ")";
                    }

                    WriteCSV(order, msg, msg2, msg3, msg4, cA, cB);

                    ret.Result = inRet.Result;
                }
                else
                {
                    ret.Message = inRet.Message;
                }

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

            return(ret);
        }