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); }
public WebPreOrderList WebGetPreList(int hospid, string patid) { WebPreOrderList ret = new WebPreOrderList(); try { ServiceIF serv = new ServiceIF(); OrderTool_Serv.Class.Search search = new OrderTool_Serv.Class.Search(); search.HospID = hospid; search.PatID = patid; PreOrder[] tmpList = null; ResultData inRet = serv.GetPreOrder_Serv(search, out tmpList); if (inRet.Result) { if (string.IsNullOrEmpty(patid)) { LogControl.WriteLog(LogType.ORE, "WebGetPreList", "【オーダー候補一覧取得】 施設ID:" + hospid + " 件数:" + tmpList.Length); } else { LogControl.WriteLog(LogType.ORE, "WebGetPreList", "【オーダー候補取得】 施設ID:" + hospid + " 患者ID:" + patid + " 件数(過去含む):" + tmpList.Length); } ret.Items = tmpList; } else { ret.Message = inRet.Message; } ret.Result = inRet.Result; } catch (Exception e) { ret.Result = false; ret.Message = "処理中に障害が発生いたしました。\nシステム管理者にお問い合わせください。"; LogControl.WriteLog(LogType.ERR, "WebGetPreList", e.Message); } return(ret); }
public WebPatientList WebGetPatList(int hospid) { WebPatientList ret = new WebPatientList(); try { ServiceIF serv = new ServiceIF(); OrderTool_Serv.Class.Search search = new OrderTool_Serv.Class.Search(); search.HospID = hospid; Patient[] tmpList = null; ResultData inRet = serv.GetPatient_Serv(search, out tmpList); if (inRet.Result) { LogControl.WriteLog(LogType.ORE, "WebGetPatList", "【患者一覧取得】 施設ID:" + hospid); ret.Items = tmpList; } 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); }
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); }
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); }
private static PreOrder[] getPreOrderList(AccDbConnection con, Search search) { List <PreOrder> ret = new List <PreOrder>(); // コマンドオブジェクト生成 using (var cmd = con.CreateCommand()) { // SQL生成 // ---------------------------- // ---------------------------- StringBuilder selSQL = new StringBuilder(); selSQL.Append("SELECT"); selSQL.Append(" O.id"); selSQL.Append(",O.hospid"); selSQL.Append(",O.patkey"); selSQL.Append(",O.patage"); selSQL.Append(",O.modality"); selSQL.Append(",O.studydate"); selSQL.Append(",O.studytime"); selSQL.Append(",O.bodypart"); selSQL.Append(",O.studytype"); selSQL.Append(",O.imgcnt"); selSQL.Append(",O.isemergency"); selSQL.Append(",O.ismail"); selSQL.Append(",O.comment"); selSQL.Append(",O.status"); selSQL.Append(",P.key"); selSQL.Append(",P.patid"); selSQL.Append(",P.patname"); selSQL.Append(",P.patname_h"); selSQL.Append(",P.patname_r"); selSQL.Append(",P.patsex"); selSQL.Append(",P.patbirth"); selSQL.Append(" FROM"); selSQL.Append(" PreOrder As O"); selSQL.Append(" INNER JOIN"); selSQL.Append(" Patient As P"); selSQL.Append(" ON"); selSQL.Append(" O.patkey=P.Key"); string strWhere = " WHERE"; if (search.HospID > 0) { selSQL.Append(strWhere); selSQL.Append(" O.hospid="); selSQL.Append(cmd.Add(search.HospID).ParameterName); strWhere = " AND"; } if (search.OrderID > 0) { selSQL.Append(strWhere); selSQL.Append(" O.id="); selSQL.Append(cmd.Add(search.OrderID).ParameterName); strWhere = " AND"; } if (!string.IsNullOrEmpty(search.PatID)) { selSQL.Append(strWhere); selSQL.Append(" P.patid="); selSQL.Append(cmd.Add(search.PatID).ParameterName); strWhere = " AND"; } if (search.Status != -1) { selSQL.Append(strWhere); selSQL.Append(" O.status="); selSQL.Append(cmd.Add(search.Status).ParameterName); strWhere = " AND"; } selSQL.Append(" ORDER BY"); selSQL.Append(" O.studydate"); selSQL.Append(" DESC"); selSQL.Append(",O.studytime"); selSQL.Append(" DESC"); cmd.CommandText = selSQL.ToString(); // SQL実行 using (var dr = cmd.ExecuteReader()) // 該当データがある場合、返却値を設定 while (dr.Read()) { PreOrder tmpOrder = new PreOrder(); tmpOrder.OrderID = Convert.ToInt32(dr["id"]); tmpOrder.HospID = Convert.ToInt32(dr["hospid"]); tmpOrder.Key = Convert.ToInt32(dr["key"]); tmpOrder.PatID = dr["patid"].ToString(); if (dr["patname"] != DBNull.Value) { tmpOrder.PatName = dr["patname"].ToString(); } if (dr["patname_h"] != DBNull.Value) { tmpOrder.PatName_H = dr["patname_h"].ToString(); } if (dr["patname_r"] != DBNull.Value) { tmpOrder.PatName_R = dr["patname_r"].ToString(); } tmpOrder.Sex = Convert.ToInt32(dr["patsex"]); if (dr["patbirth"] != DBNull.Value) { tmpOrder.BirthDay = dr["patbirth"].ToString(); } if (dr["patage"] != DBNull.Value) { tmpOrder.PatAge = Convert.ToInt32(dr["patage"]); } tmpOrder.Modality = dr["modality"].ToString(); tmpOrder.Date = dr["studydate"].ToString(); if (dr["studytime"] != DBNull.Value) { tmpOrder.Time = dr["studytime"].ToString(); } if (dr["bodypart"] != DBNull.Value) { tmpOrder.BodyPart = dr["bodypart"].ToString(); } if (dr["studytype"] != DBNull.Value) { tmpOrder.Type = dr["studytype"].ToString(); } if (dr["imgcnt"] != DBNull.Value) { tmpOrder.ImgCnt = Convert.ToInt32(dr["imgcnt"]); } tmpOrder.IsEmergency = Convert.ToInt32(dr["isemergency"]); tmpOrder.IsMail = Convert.ToInt32(dr["ismail"]); if (dr["comment"] != DBNull.Value) { tmpOrder.Comment = dr["comment"].ToString(); } if (dr["status"] != DBNull.Value) { tmpOrder.Status = Convert.ToInt32(dr["status"]); } ret.Add(tmpOrder); } } return(ret.ToArray()); }