コード例 #1
0
ファイル: MysqlOperator.cs プロジェクト: legoli/Diancan
        //设置指定的IndexID记录为活动检查
        public bool Call_SP_Activate_Specified_IndexID(String strIndexID)
        {
            strIndexID = CSTR.trim(strIndexID);
            if (strIndexID.Length <= 0)
            {
                return(false);
            }
            int nIndexID = CSTR.convertToInt(strIndexID);

            if (nIndexID <= 0)
            {
                return(false);
            }

            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return(false);
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "TJ_Queue_Activate_Specified_IndexID";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //in - parameter_Handler_Name
                MySqlParameter parameter_in_index_id = new MySqlParameter("?in_index_id", MySqlDbType.Int32, 11);
                parameter_in_index_id.Direction = ParameterDirection.Input;
                parameter_in_index_id.Value     = nIndexID;
                adapter.SelectCommand.Parameters.Add(parameter_in_index_id);

                //out - out_result_flag
                MySqlParameter parameter_out_result_flag = new MySqlParameter("?out_result_flag", MySqlDbType.Int32, 11);
                parameter_out_result_flag.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_out_result_flag);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //取得Out参数
                int result_flag = CSTR.convertToInt(CSTR.ObjectTrim(parameter_out_result_flag.Value));

                return((result_flag == 1) ? true : false);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.Call_SP_Activate_Specified_IndexID()] " + exp.Message);

                conn = null;
            }

            return(false);
        }
コード例 #2
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        //----------------查找STUDY有无原始的[312][313]房间-------------------------------------------
        private bool StudyHas_312_313_Room()
        {
            //[RoomID]:register_table.CheckRoom
            if (CSTR.IsTableEmpty(register_table))
            {
                return(false);
            }

            //[规则]只要任意Exam的房间串中包含[312]或[313],就是拥有职检检查

            bool bRet = false;

            foreach (DataRow row in register_table.Rows)
            {
                String roomID = CSTR.ObjectTrim(row["CheckRoom"]);
                if (roomID.IndexOf("[312]") >= 0 ||
                    roomID.IndexOf("[313]") >= 0 ||
                    roomID.IndexOf("[308]") >= 0)
                {
                    bRet = true;
                }
            }

            return(bRet);
        }
コード例 #3
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        //获取指定行的字段值: JiaohaoTable_get_Field_String_by_IndexID("63","status")
        public static String JiaohaoTable_Get_Field_Value_by_IndexID(String indexID, String fieldName)
        {
            indexID   = CSTR.trim(indexID);
            fieldName = CSTR.trim(fieldName);
            if (CSTR.isEmpty(indexID))
            {
                return("");
            }
            if (CSTR.isEmpty(fieldName))
            {
                return("");
            }

            //获取JiaohaoTable表
            DataTable cache_tbl = DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(cache_tbl))
            {
                return(null);
            }
            //查询符合条件的行集合
            DataRow[] row_result = cache_tbl.Select(String.Format("IndexID='{0}'", indexID));
            if (CSTR.IsArrayEmpty(row_result))
            {
                return("");
            }
            //从第一行中返回指定的列数据
            return(CSTR.ObjectTrim(row_result[0][fieldName]));
        }
コード例 #4
0
        //获取系统中未完成的[超声科]房间的检查列表
        private List <String> getUltrasoundExamList()
        {
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            DataRow[] rows = tbl.Select("RoomID='[超声科]' and IsOver='0'");
            if (CSTR.IsRowArrEmpty(rows))
            {
                return(null);
            }

            List <String> list = new List <string>();

            foreach (DataRow row in rows)
            {
                String DJLSH = CSTR.ObjectTrim(row["DJLSH"]);
                if (CSTR.isEmpty(DJLSH))
                {
                    continue;
                }
                DJLSH = DJLSH.Replace("'", "");
                list.Add(DJLSH);
            }

            return(list);
        }
コード例 #5
0
ファイル: ExamStatus.cs プロジェクト: legoli/Diancan
        public static Dictionary <Status, bool> getStatus(DataRow row)
        {
            if (null == row)
            {
                return(null);
            }

            bool isNormal    = false;
            bool isActive    = false;
            bool isCalling   = false;
            bool isReadOnce  = false;
            bool isCheckOver = false;
            bool isPass      = false;

            String statusCluster = getStatusCluser(row);

            if (statusCluster.Equals("0000"))
            {
                isNormal = true;
            }
            else if (statusCluster.Equals("1000"))
            {
                isActive = true;
            }
            else if (statusCluster.Equals("1110"))
            {
                isCalling = true;
            }
            else if (statusCluster.Equals("0100"))
            {
                isPass = true;
            }
            else if (statusCluster.Equals("0101"))
            {
                //如果EndTime为空是读卡一次的检查
                if (CSTR.isEmpty(CSTR.ObjectTrim(row["EndTime"])))
                {
                    isReadOnce = true;
                }
                else
                {
                    isCheckOver = true;
                }
            }

            Dictionary <Status, bool> map = new Dictionary <Status, bool>();

            map.Add(Status.Normal, isNormal);
            map.Add(Status.Active, isActive);
            map.Add(Status.Calling, isCalling);
            map.Add(Status.Pass, isPass);
            map.Add(Status.ReadOnce, isReadOnce);
            map.Add(Status.CheckOver, isCheckOver);

            return(map);
        }
コード例 #6
0
ファイル: MysqlOperator.cs プロジェクト: legoli/Diancan
        //定时刷新RoomInfo表数据
        public Dictionary <String, Object> Call_SP_RoomInfo_Reflesh(int last_trigger_RoomInfo_id)
        {
            Dictionary <String, Object> map = new Dictionary <string, object>();

            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return(map);
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "Reflesh_RoomInfo";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //inout - in_trigger_RoomInfo_id
                MySqlParameter parameter_in_trigger_RoomInfo_id = new MySqlParameter("?in_trigger_RoomInfo_id", MySqlDbType.Int32, 11);
                parameter_in_trigger_RoomInfo_id.Direction = ParameterDirection.InputOutput;
                parameter_in_trigger_RoomInfo_id.Value     = last_trigger_RoomInfo_id;
                adapter.SelectCommand.Parameters.Add(parameter_in_trigger_RoomInfo_id);

                //out - out_reflesh_flag
                MySqlParameter parameter_out_reflesh_flag = new MySqlParameter("?out_reflesh_flag", MySqlDbType.Int32, 11);
                parameter_out_reflesh_flag.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_out_reflesh_flag);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //取得Out参数
                int result_flag    = CSTR.convertToInt(CSTR.ObjectTrim(parameter_out_reflesh_flag.Value));
                int result_max_id1 = CSTR.convertToInt(CSTR.ObjectTrim(parameter_in_trigger_RoomInfo_id.Value));

                //构建返回的映射表
                map.Add("flag", result_flag);
                map.Add("max_id_1", result_max_id1);
                map.Add("data_set", ds);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.Call_SP_RoomInfo_Reflesh()] " + exp.Message);

                conn = null;
                map  = null;
            }

            return(map);
        }
コード例 #7
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        public static String RFID_get_ringNo(String rfid)
        {
            DataRow[] rowArr = RFID_get_Rfid_row(rfid);
            if (CSTR.IsRowArrEmpty(rowArr))
            {
                return("");
            }

            String strRet = CSTR.ObjectTrim(rowArr[0]["CardNo"]);

            return(strRet);
        }
コード例 #8
0
ファイル: MysqlOperator.cs プロジェクト: legoli/Diancan
        //Token获取
        public int Call_SP_Token(String strHandlerName)
        {
            if (CSTR.isEmpty(strHandlerName))
            {
                return(0);
            }

            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return(0);
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "Tocken";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //in - parameter_Handler_Name
                MySqlParameter parameter_Handler_Name = new MySqlParameter("?Handler_Name", MySqlDbType.VarChar, 128);
                parameter_Handler_Name.Direction = ParameterDirection.Input;
                parameter_Handler_Name.Value     = strHandlerName;
                adapter.SelectCommand.Parameters.Add(parameter_Handler_Name);

                //out - out_token_flag
                MySqlParameter parameter_out_token_flag = new MySqlParameter("?out_token_flag", MySqlDbType.Int32, 11);
                parameter_out_token_flag.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_out_token_flag);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //取得Out参数
                int result_flag = CSTR.convertToInt(CSTR.ObjectTrim(parameter_out_token_flag.Value));

                return(result_flag);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.Call_SP_Token()] " + exp.Message);

                conn = null;
            }

            return(0);
        }
コード例 #9
0
ファイル: SyncServerTime.cs プロジェクト: legoli/Diancan
        //获取RISServer的当前时间
        private DateTime getRISServerTime()
        {
            DateTime dt = new DateTime();

            try
            {
                //1.连接服务器,取得时间
                ExamQueue queue = new ExamQueue();
                String    sql   = "select date_format(now(),'%Y') as nYear," +
                                  "date_format(now(),'%m') as nMonth," +
                                  "date_format(now(),'%d') as nDay," +
                                  "date_format(now(),'%H') as nHour," +
                                  "date_format(now(),'%i') as nMinute," +
                                  "date_format(now(),'%s') as nSecond";
                DataTable tbl = queue.getDB().query(sql);
                if (CSTR.IsTableEmpty(tbl))
                {
                    return(dt);
                }

                //2.转换
                String strYear   = CSTR.ObjectTrim(tbl.Rows[0]["nYear"]);
                String strMonth  = CSTR.ObjectTrim(tbl.Rows[0]["nMonth"]);
                String strDay    = CSTR.ObjectTrim(tbl.Rows[0]["nDay"]);
                String strHour   = CSTR.ObjectTrim(tbl.Rows[0]["nHour"]);
                String strMinute = CSTR.ObjectTrim(tbl.Rows[0]["nMinute"]);
                String strSecond = CSTR.ObjectTrim(tbl.Rows[0]["nSecond"]);

                if (CSTR.isEmpty(strYear) || CSTR.isEmpty(strMonth) || CSTR.isEmpty(strDay) ||
                    CSTR.isEmpty(strHour) || CSTR.isEmpty(strMinute) || CSTR.isEmpty(strSecond))
                {
                    return(dt);
                }

                //3.生成DateTime格式时间
                int nYear   = Int16.Parse(strYear);
                int nMonth  = Int16.Parse(strMonth);
                int nDay    = Int16.Parse(strDay);
                int nHour   = Int16.Parse(strHour);
                int nMinute = Int16.Parse(strMinute);
                int nSecond = Int16.Parse(strSecond);

                dt = new DateTime(nYear, nMonth, nDay, nHour, nMinute, nSecond);
            }
            catch (Exception exp)
            {
                Console.Out.WriteLine(exp.Message);
            }


            return(dt);
        }
コード例 #10
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        public static bool RoomInfo_is_active(String roomID)
        {
            String sql = String.Format("RoomID='{0}'", roomID);

            DataRow[] sel_rows = DB_Get_JiaohaoRoomInfo_table().Select(sql);
            if (CSTR.IsArrayEmpty(sel_rows))
            {
                return(false);
            }

            String strValue = CSTR.ObjectTrim(sel_rows[0]["RoomState"]);

            return((strValue.Equals("active")) ? true : false);
        }
コード例 #11
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        public static String RoomInfo_get_BackupRoom(String roomID)
        {
            String sql = String.Format("RoomID='{0}'", roomID);

            DataRow[] sel_rows = DB_Get_JiaohaoRoomInfo_table().Select(sql);
            if (CSTR.IsArrayEmpty(sel_rows))
            {
                return("");
            }

            String strValue = CSTR.ObjectTrim(sel_rows[0]["BackupRoom"]);

            return(strValue);
        }
コード例 #12
0
ファイル: ExamStatus.cs プロジェクト: legoli/Diancan
        //取得检查的状态串
        public static String getStatusCluser(DataRow row)
        {
            if (null == row)
            {
                return("");
            }

            String strCluster = String.Format("{0}{1}{2}{3}",
                                              CSTR.ObjectTrim(row["QueueActive"]),
                                              CSTR.ObjectTrim(row["status"]),
                                              CSTR.ObjectTrim(row["IsChecking"]),
                                              CSTR.ObjectTrim(row["IsOver"]));

            return(strCluster);
        }
コード例 #13
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        public static bool RoomInfo_is_need_voice(String roomID)
        {
            String sql = String.Format("RoomID='{0}'", roomID);

            DataRow[] sel_rows = DB_Get_JiaohaoRoomInfo_table().Select(sql);
            if (CSTR.IsArrayEmpty(sel_rows))
            {
                return(false);
            }

            String strValue = CSTR.ObjectTrim(sel_rows[0]["IsNeedVoice"]);

            //return (strValue.Equals("1")) ? true : false;
            return((strValue.Equals("0")) ? false : true);
        }
コード例 #14
0
ファイル: JSON.cs プロジェクト: legoli/Diancan
        //---------<<< 封装 >>>--------------------------------------------------------------------
        public String toJson(DataTable tbl)
        {
            String strRet = "";

            if (CSTR.IsTableEmpty(tbl))
            {
                return("");
            }

            try
            {
                JavaScriptSerializer json = new JavaScriptSerializer();
                json.MaxJsonLength = Int32.MaxValue;//设置JSON串的最大值

                //封装列名
                List <String> columnList = new List <string>();
                foreach (DataColumn column in tbl.Columns)
                {
                    columnList.Add(CSTR.trim(column.ColumnName));
                }
                int columnCount = columnList.Count;

                //封装字段内容
                List <List <String> > rowList = new List <List <string> >();
                foreach (DataRow row in tbl.Rows)
                {
                    List <String> tempList = new List <string>();
                    for (int i = 0; i < columnCount; i++)
                    {
                        tempList.Add(CSTR.ObjectTrim(row[columnList[i]]));
                    }
                    rowList.Add(tempList);//添加一行记录
                }

                //总装
                Dictionary <String, Object> tblMap = new Dictionary <string, object>();
                tblMap.Add("column", columnList);
                tblMap.Add("data", rowList);
                strRet = json.Serialize(tblMap);  //返回一个json字符串
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                strRet = "";
            }

            return(strRet);
        }
コード例 #15
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        //-------------合并register_table房间成为一个串---------------------------------
        private String get_all_RoomID_cluster()
        {
            //[RoomID]:register_table.CheckRoom
            if (CSTR.IsTableEmpty(register_table))
            {
                return(null);
            }

            String str = "";

            foreach (DataRow row in register_table.Rows)
            {
                str += CSTR.ObjectTrim(row["CheckRoom"]);
            }

            return(str);
        }
コード例 #16
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        //-------------把每条记录的房间号按行顺序提取到List<>中---------------------------------
        private List <String> get_RoomID_List()
        {
            //[RoomID]:register_table.CheckRoom
            if (CSTR.IsTableEmpty(register_table))
            {
                return(null);
            }

            List <String> listRoomID = new List <string>();

            foreach (DataRow row in register_table.Rows)
            {
                listRoomID.Add(CSTR.ObjectTrim(row["CheckRoom"]));
            }

            return(listRoomID);
        }
コード例 #17
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        //----------------判断是否为职检---------------------------------------------------------
        private bool StudyIsVocationType()
        {
            //[RoomID]:register_table.CheckRoom
            if (CSTR.IsTableEmpty(register_table))
            {
                return(false);
            }

            //[规则]TFD体检项目:只要任意一个Exam的ExamType属于职检,
            //[规则]SpecialExam: 检查名称中包含职检字样,即为职检检查
            //[规则]TFD体检项目与SpecialExam项目的区分:register_table.DWMC='非天方达'

            bool is_vocation_exam = false;

            foreach (DataRow row in register_table.Rows)
            {
                String DWMC = CSTR.ObjectTrim(row["DWMC"]);
                String ProcedureStepName = CSTR.ObjectTrim(row["TJXMMC"]);

                String TJLB   = CSTR.ObjectTrim(row["TJLB"]);
                int    n_TJLB = CSTR.convertToInt(TJLB);//转换为int_体检类别

                if (DWMC.Equals("非天方达"))
                {
                    //SpecialExam检查项目
                    if (ProcedureStepName.IndexOf("职检") >= 0)
                    {
                        is_vocation_exam = true;
                    }
                }
                else
                {
                    //TFD检查项目
                    if (n_TJLB != -1 && n_TJLB >= 7 && n_TJLB <= 15)
                    {
                        is_vocation_exam = true;
                    }
                }
            }//end foreach

            return(is_vocation_exam);
        }
コード例 #18
0
ファイル: IP_Address.cs プロジェクト: legoli/Diancan
        //获取本机的IP地址
        public List <String> getIP_List()
        {
            String hostName = getLocalHostName();

            //Dns.GetHostAddresses()会返回所有地址,包括IPv4和IPv6
            IPAddress[] addressList = Dns.GetHostAddresses(hostName);
            if (null == addressList)
            {
                return(null);
            }

            List <String> list = new List <string>();

            foreach (IPAddress ip in addressList)
            {
                list.Add(CSTR.ObjectTrim(ip));
            }

            return(list);
        }
コード例 #19
0
ファイル: IP_Address.cs プロジェクト: legoli/Diancan
        //获取本机的局域网IP地址
        public String getLocalIP()
        {
            //本网段的IP地址过滤
            String IPSection = "192.168.";//指定本地局域网的网段的格式

            String      hostName  = getLocalHostName();
            IPHostEntry localHost = Dns.GetHostEntry(hostName);

            if (null == localHost)
            {
                return("");
            }

            foreach (IPAddress ip in localHost.AddressList)
            {
                String strIP = CSTR.ObjectTrim(ip);
                if (strIP.IndexOf(IPSection) >= 0)
                {
                    return(strIP);
                }
            }

            return("");
        }
コード例 #20
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        public static String Exam_Get_RingNo_By_RfidNo(String strRFID)
        {
            strRFID = CSTR.trim(strRFID);
            if (strRFID.Length <= 0)
            {
                return(null);
            }

            String    sql = String.Format("Rfid='{0}' ", strRFID);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            DataRow[] sel_rows = tbl.Select(sql);
            if (CSTR.IsArrayEmpty(sel_rows))
            {
                return(null);
            }

            return(CSTR.ObjectTrim(sel_rows[0]["RfidName"]));
        }
コード例 #21
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        //----------------查找STUDY有无原始的[311]房间-------------------------------------------
        private bool StudyHas_311_alone()
        {
            //[RoomID]:register_table.CheckRoom
            if (CSTR.IsTableEmpty(register_table))
            {
                return(false);
            }

            //[规则]只要任意Exam的房间是单独的[310]或[311],就是独立到[311],而不能到[309]
            //[规则]职检的检查在有[310]时同样执行此规则

            bool bRet = false;

            foreach (DataRow row in register_table.Rows)
            {
                String roomID = CSTR.ObjectTrim(row["CheckRoom"]);
                if (roomID.Equals("[311]"))
                {
                    bRet = true;
                }
            }

            return(bRet);
        }
コード例 #22
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        //登记成功,返回NEW_DJLSH,登记失败,返回null;
        public String register()
        {
            String str_ret_DJLSH = null;

            if (CSTR.IsTableEmpty(register_table))
            {
                return(null);
            }
            if (CSTR.isEmpty(rfid_no))
            {
                return(null);
            }
            if (CSTR.isEmpty(ring_no))
            {
                return(null);
            }

            ExamQueue queue = new ExamQueue();

            try
            {
                //生成每个检查的检查房间-------------------------------------------------------------------------
                List <String> reg_list_RoomID = parse_and_allot_RoomID_for_STUDY();
                if (null == reg_list_RoomID)
                {
                    return(null);
                }
                if (reg_list_RoomID.Count <= 0)
                {
                    return(null);
                }
                //生成每个检查的检查房间-------------------------------------------------------------------------

                //通用数据以第一条记录为准------------------------------------------------------------------------
                DataRow rowFirst = register_table.Rows[0];
                //PatientInfo级别的信息(同一使用第一行的数据)
                String PatientNameChinese = CSTR.ObjectTrim(rowFirst["XM"]);
                String PatientGender      = CSTR.ObjectTrim(rowFirst["XB"]);
                if (PatientGender.Equals("0"))
                {
                    PatientGender = "女";
                }
                else
                {
                    PatientGender = "男";                                      //0:女 1:男 %:未知
                }
                String SFZH  = CSTR.ObjectTrim(rowFirst["SFZH"]);             //身份证号
                String Phone = (CSTR.ObjectTrim(rowFirst["p_Phone"]).Length > //两个电话取长度长的那个
                                CSTR.ObjectTrim(rowFirst["d_Phone"]).Length) ?
                               CSTR.ObjectTrim(rowFirst["p_Phone"]) : CSTR.ObjectTrim(rowFirst["d_Phone"]);
                String PatientIntraID  = CSTR.ObjectTrim(rowFirst["TJBH"]);
                String DJLSH           = CSTR.ObjectTrim(rowFirst["DJLSH"]);
                String TJLB            = CSTR.ObjectTrim(rowFirst["TJLB"]);
                String TJLBMC          = CSTR.ObjectTrim(rowFirst["TJLBMC"]);
                String DWBH            = CSTR.ObjectTrim(rowFirst["DWBH"]);
                String DWMC            = CSTR.ObjectTrim(rowFirst["DWMC"]);
                String ExamAccessionID = this.ring_no;//用于显示序号
                //获取激活时间
                DateTime arrivalTime        = DateTime.Now;
                String   strArrivalTime     = arrivalTime.ToString("HH:mm:ss");          //只取得时间部分,用以生成QueueID
                String   strArrivalDateTime = arrivalTime.ToString("yyyyMMdd HH:mm:ss"); //取得日期及时间(格式化时间)
                //生成QueueID
                String QueueID             = String.Format("time_to_sec('{0}')", strArrivalTime);
                String ExamArrivalDateTime = "NOW()";
                //生成检查来源(类别)
                String PreExamFrom = "个检";//体检来源(类别)
                if (STUDY_is_vacation_exam)
                {
                    PreExamFrom = "职检";
                }
                //PatientInfo级别的信息同一使用第一行的数据为准----------------------------------------------------

                //生成每一个Exam的JiaohaoTable和JiaohaoExamInfo的Insert的Sql语句
                List <String> reg_list_sql_JiaohaoTable       = new List <string>();
                List <String> reg_list_sql_JiaohaoExamInfo    = new List <string>();
                String        reg_str_RoomID_registed_cluster = "";//记录已经登记了的RoomID列表
                for (int i = 0; i < register_table.Rows.Count; i++)
                {
                    //取得行数据
                    DataRow row = register_table.Rows[i];

                    //ExamInfo级别的数据,每个Row会有不同---------------------------------
                    String ModalityID         = CSTR.ObjectTrim(row["CheckRoom"]);
                    String OrderProcedureName = CSTR.ObjectTrim(row["ExamTypeMC"]);
                    String ProcedureStepID    = CSTR.ObjectTrim(row["TJXMBH"]);
                    String ProcedureStepName  = CSTR.ObjectTrim(row["TJXMMC"]);
                    String ExamType           = CSTR.ObjectTrim(row["ExamType"]);
                    String ReorderReason      = "";// CSTR.ObjectTrim(row["TSXX"]);//提示信息
                    //ExamInfo级别的数据,每个Row会有不同---------------------------------

                    //获取RoomID
                    String RoomID = reg_list_RoomID[i];
                    if (CSTR.isEmpty(RoomID) || RoomID.Equals(VALID_ROOM_ID))
                    {
                        //如果是无效房间,则生成空的SQL语句
                        reg_list_sql_JiaohaoExamInfo.Add("");
                        reg_list_sql_JiaohaoTable.Add("");

                        //处理下一个
                        continue;
                    }

                    //有了唯一的RoomID后,定义OrderID,用于同一房间检查的详细信息查询
                    String OrderID = CSTR.trim(DJLSH + RoomID);
                    //ExamID也要写入到JiaohaoExamInfo,用于和IndexID的对应,需要保证每个Exam不同
                    String ExamID = String.Format("{0}.{1}.{2}", OrderID, ProcedureStepID, i.ToString());

                    //合并相同房间的RoomID字段和检查方法字段,保存到JiaohaoTable.ArrayRoomID和JiaohaoTable.ArrayProcedureStepName
                    String ArrayRoomID            = "";
                    String ArrayProcedureStepName = "";
                    for (int reg_point = 0; reg_point < reg_list_RoomID.Count; reg_point++)
                    {
                        String reg_room_id = reg_list_RoomID[reg_point];
                        if (RoomID.Equals(reg_room_id))
                        {
                            String roomid_for_arr        = CSTR.ObjectTrim(register_table.Rows[reg_point]["CheckRoom"]);
                            String procedureName_for_arr = CSTR.ObjectTrim(register_table.Rows[reg_point]["TJXMMC"]);
                            //去掉敏感字符';'
                            roomid_for_arr        = roomid_for_arr.Replace(";", "");
                            procedureName_for_arr = procedureName_for_arr.Replace(";", "");
                            //加入到Array字段
                            if (ArrayRoomID.Length > 0)
                            {
                                ArrayRoomID += ";";
                            }
                            ArrayRoomID += roomid_for_arr;
                            if (ArrayProcedureStepName.Length > 0)
                            {
                                ArrayProcedureStepName += ";";
                            }
                            ArrayProcedureStepName += procedureName_for_arr;
                        }
                    }

                    //检查状态的确定
                    String ExamSatus   = "2"; //默认为未检
                    String status      = "0"; //默认为未检
                    String IsOver      = "0"; //默认为未检
                    String IsNeedQueue = "1"; //默认需要排队
                    String IsNeedVoice = "1"; //默认需要TTS语音

                    //对roomID,查询房间的三个状态 active/needQueue/needVoice
                    bool bActive    = DatabaseCache.RoomInfo_is_active(RoomID);
                    bool bNeedQueue = DatabaseCache.RoomInfo_is_need_queue(RoomID);
                    bool bNeedVoice = DatabaseCache.RoomInfo_is_need_voice(RoomID);

                    //只有NeedQueue为false才无需排队,不论房间是否active或disactive
                    if (bNeedQueue == false)
                    {
                        ExamSatus   = "3";
                        status      = "1";
                        IsOver      = "1";
                        IsNeedQueue = "0";
                        IsNeedVoice = "0";
                    }
                    else
                    {
                        ExamSatus   = "2";
                        status      = "0";
                        IsOver      = "0";
                        IsNeedQueue = "1";
                        if (bNeedVoice)
                        {
                            IsNeedVoice = "1";
                        }
                        else
                        {
                            IsNeedVoice = "0";
                        }
                    }

                    //生成插入到JiaohaoTable的语句
                    String sql_JiaohaoTable = String.Format("insert into JiaohaoTable " +

                                                            " (QueueID,PatientNameChinese,PatientGender," +//1
                                                            "SFZH,Phone,PatientIntraID," +

                                                            "DJLSH,Rfid,RfidName," +//2
                                                            "TJLB,TJLBMC,DWBH," +

                                                            "DWMC,ExamID,OrderID," +//3
                                                            "ExamAccessionID,ExamArrivalDateTime,ModalityID," +

                                                            "OrderProcedureName,ProcedureStepID,ProcedureStepName," +//4
                                                            "ExamType,RoomID,ReorderReason," +

                                                            "PreExamFrom,ExamSatus,status," +//5
                                                            "IsOver,IsNeedQueue,IsNeedVoice," +
                                                            "ArrayRoomID,ArrayProcedureStepName) VALUES " +

                                                            " ({0},'{1}','{2}'," +//1
                                                            " '{3}','{4}','{5}'," +

                                                            " '{6}','{7}','{8}'," +//2
                                                            " '{9}','{10}','{11}'," +

                                                            " '{12}','{13}','{14}'," +//3
                                                            " '{15}',{16},'{17}'," +

                                                            " '{18}','{19}','{20}'," +//4
                                                            " '{21}','{22}','{23}'," +

                                                            "'{24}',{25},{26}," +//5
                                                            "{27},{28},{29}," +
                                                            "'{30}','{31}')",

                                                            QueueID, PatientNameChinese, PatientGender,//1
                                                            SFZH, Phone, PatientIntraID,

                                                            DJLSH, this.rfid_no, this.ring_no,//2
                                                            TJLB, TJLBMC, DWBH,

                                                            DWMC, ExamID, OrderID,//3
                                                            ExamAccessionID, ExamArrivalDateTime, ModalityID,

                                                            OrderProcedureName, ProcedureStepID, ProcedureStepName,//4
                                                            ExamType, RoomID, ReorderReason,

                                                            PreExamFrom, ExamSatus, status,//5
                                                            IsOver, IsNeedQueue, IsNeedVoice,
                                                            ArrayRoomID, ArrayProcedureStepName
                                                            );

                    //生成插入到JiaohaoExamInfo的语句
                    String sql_JiaohaoExamInfo = String.Format("insert into JiaohaoExamInfo " +
                                                               " (ExamID,OrderID,RoomID,CheckRoom," +
                                                               "ProcedureStepID,ProcedureStepName,ExamType,RfidName) VALUES " +
                                                               " ('{0}','{1}','{2}','{3}'," +
                                                               "'{4}','{5}','{6}','{7}')",
                                                               ExamID, OrderID, RoomID, ModalityID,
                                                               ProcedureStepID, ProcedureStepName, ExamType, this.ring_no);

                    //对于相同的RoomID,在JiaohaoTable中只能写入一次
                    if (reg_str_RoomID_registed_cluster.IndexOf(RoomID) >= 0)
                    {
                        //如果此Exam的RoomID已经登记了,则不再写入相同的JiaohaoTable记录
                        sql_JiaohaoTable = "";
                    }
                    else
                    {
                        //记录本次的RoomID到已完成房间串
                        reg_str_RoomID_registed_cluster += RoomID;
                    }
                    //保存SQL语句
                    reg_list_sql_JiaohaoTable.Add(sql_JiaohaoTable);
                    reg_list_sql_JiaohaoExamInfo.Add(sql_JiaohaoExamInfo);
                }//end for (int i = 0; i < register_table.Rows.Count; i++)

                //重置返回值
                str_ret_DJLSH = null;

                //逐条写入数据库
                int nCount = queue.getDB().update_use_Transaction(reg_list_sql_JiaohaoTable);
                if (nCount > 0)
                {
                    //不再插入检查到JiaohaoExamInfo
                    //int nCount2 = queue.getDB().update_use_Transaction(reg_list_sql_JiaohaoExamInfo);

                    str_ret_DJLSH = DJLSH;//设置返回值
                }
            }
            catch (Exception exp)
            {
                str_ret_DJLSH = null;
            }

            return(str_ret_DJLSH);
        }
コード例 #23
0
ファイル: MysqlOperator.cs プロジェクト: legoli/Diancan
        public String Call_StoreProcedure_demo(String roomID)
        {
            String strRet = "";

            roomID = CSTR.trim(roomID);
            if (roomID.Length <= 0)
            {
                return("");
            }

            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return("");
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "demo2";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //in - roomID
                MySqlParameter parameter_room_id = new MySqlParameter("?room_ID", MySqlDbType.VarChar, 20);
                parameter_room_id.Value = roomID;
                adapter.SelectCommand.Parameters.Add(parameter_room_id);

                //out - count(*)
                MySqlParameter parameter_exam_count = new MySqlParameter("?roomCount", MySqlDbType.VarChar, 20);
                parameter_exam_count.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_exam_count);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //查看是否有返回的表
                int nTableCount = ds.Tables.Count;
                if (nTableCount > 0)
                {
                    //即使存储过程中未返回表,Tables.Count也会为1,但为空表
                    DataTable tbl = ds.Tables[0];
                    if (CSTR.IsTableEmpty(tbl) == false)
                    {
                        foreach (DataRow row in tbl.Rows)
                        {
                            System.Windows.Forms.MessageBox.Show(CSTR.ObjectTrim(row[0]));
                        }
                    }
                }

                //取得Out参数
                strRet = CSTR.ObjectTrim(parameter_exam_count.Value);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.call_storeProcedure()] " + exp.Message);

                conn   = null;
                strRet = "";
            }

            return(strRet);
        }
コード例 #24
0
ファイル: DatabaseCache.cs プロジェクト: legoli/Diancan
        private static DB_AutoFetcher Auto_Fetcher_Thread = new DB_AutoFetcher();//Cache自动刷新线程

        //DB_AutoFetcher的线程回调函数
        public static void Worker_DB_Fetched(Dictionary <String, DataTable> tables)
        {
            lock (lock_obj)
            {
                if (null == tables)
                {
                    return;
                }
                if (tables.Count <= 0)
                {
                    return;
                }

                foreach (String key in tables.Keys)
                {
                    if (key.Equals("JiaohaoTable"))
                    {
                        //把JiaohaoTable中的QueueID全部加前导0到8位,为了数字排序转字符排序的一致性
                        DataTable tempTbl = tables[key];
                        if (CSTR.IsTableEmpty(tempTbl) == false)
                        {
                            foreach (DataRow row in tempTbl.Rows)
                            {
                                String strQueueID = CSTR.ObjectTrim(row["QueueID"]);
                                strQueueID     = strQueueID.PadLeft(10, '0');
                                row["QueueID"] = strQueueID;
                            }
                        }

                        tbl_JiaohaoTable  = tempTbl;
                        time_JiaohaoTable = DateTime.Now;

                        //如果是JiaohaoTable更新,则刷新界面
                        Worker_DB_Fetched_need_reflesh_UI = true;
                    }
                    else if (key.Equals("JiaohaoExamInfo"))
                    {
                        tbl_JiaohaoExamInfo  = tables[key];
                        time_JiaohaoExamInfo = DateTime.Now;
                    }
                    else if (key.Equals("JiaohaoRfid"))
                    {
                        tbl_JiaohaoRfid  = tables[key];
                        time_JiaohaoRfid = DateTime.Now;
                    }
                    else if (key.Equals("JiaohaoRoomInfo"))
                    {
                        tbl_JiaohaoRoomInfo  = tables[key];
                        time_JiaohaoRoomInfo = DateTime.Now;
                    }
                    else if (key.Equals("JiaohaoSpecialExam"))
                    {
                        tbl_JiaohaoSpecialExam  = tables[key];
                        time_JiaohaoSpecialExam = DateTime.Now;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }
コード例 #25
0
ファイル: MysqlOperator.cs プロジェクト: legoli/Diancan
        //语音叫号获取一条播报的信息
        public DataTable Call_SP_TTS_Get_One_Item_To_Speak()
        {
            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return(null);
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "TTS_Get_One_Item_To_Speak";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //in - parameter_Handler_Name
                //MySqlParameter parameter_in_index_id = new MySqlParameter("?in_index_id", MySqlDbType.Int32, 11);
                //parameter_in_index_id.Direction = ParameterDirection.Input;
                //parameter_in_index_id.Value = nIndexID;
                //adapter.SelectCommand.Parameters.Add(parameter_in_index_id);

                //out - out_result_flag
                MySqlParameter parameter_out_result_flag = new MySqlParameter("?out_result_flag", MySqlDbType.Int32, 11);
                parameter_out_result_flag.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_out_result_flag);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //取得Out参数
                int result_flag = CSTR.convertToInt(CSTR.ObjectTrim(parameter_out_result_flag.Value));

                //返回结果不为1,表示没有任何结果集
                if (1 != result_flag)
                {
                    return(null);
                }
                if (null == ds)
                {
                    return(null);
                }
                if (ds.Tables.Count <= 0)
                {
                    return(null);
                }

                //返回获取的一条记录
                return(ds.Tables[0]);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.Call_SP_TTS_Get_One_Item_To_Speak()] " + exp.Message);

                conn = null;
            }

            return(null);
        }
コード例 #26
0
        /// <summary>
        /// check_us_exam_status()
        /// 用于查找超声系统中,指定的DJLSH的体检检查的完成状态
        /// </summary>
        /// <param name="lstDJLSH">需要查询的DJLSH列表</param>
        /// <returns>map('DJLSH',true/false) true表示已经完成,false表示不存在或未完成</returns>
        private Dictionary <String, bool> check_us_exam_status()
        {
            try
            {
                //获取[超声科]房间的未完成检查列表
                List <String> lstDJLSH = getUltrasoundExamList();
                if (CSTR.IsListEmpty(lstDJLSH))
                {
                    return(null);
                }

                //生成检查状态sql语句
                String sql = generateQueryString(lstDJLSH);
                if (CSTR.isEmpty(sql))
                {
                    return(null);
                }

                //执行查询
                SqlServerOperator us_db = new SqlServerOperator(true);
                DataTable         tbl   = us_db.query(sql);
                if (CSTR.IsTableEmpty(tbl))
                {
                    return(null);
                }

                //构建返回map
                Dictionary <String, bool> map = new Dictionary <string, bool>();
                foreach (DataRow row in tbl.Rows)
                {
                    //获取DJLSH
                    String DJLSH   = CSTR.ObjectTrim(row["patient_his_id"]);
                    bool   is_over = CSTR.ObjectTrim(row["study_state"]).Equals("已登记") ? false : true;
                    if (CSTR.isEmpty(DJLSH))
                    {
                        continue;
                    }

                    //在map.key中查找是否存在,如果没有则添加
                    bool is_key_exist = false;
                    foreach (String key in map.Keys)
                    {
                        if (DJLSH.Equals(key))
                        {
                            is_key_exist = true;
                        }
                    }

                    if (is_key_exist)
                    {
                        //多个相同DJLSH只要有一个已完成就OK
                        bool is_over_exist = map[DJLSH];
                        if (false == is_over_exist && true == is_over)
                        {
                            map[DJLSH] = true;
                        }
                    }
                    else
                    {
                        //new,加入到map
                        map[DJLSH] = is_over;
                    }
                }

                return(map);
            }
            catch (Exception exp)
            {
                System.Console.WriteLine(exp.Message);
            }

            //出错返回null值
            return(null);
        }
コード例 #27
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        /// <summary>
        /// 对同一个EXAM的多个房间,选择返回一个(活动房间)(未完成检查数最少的房间)
        /// </summary>
        /// <param name="listRound_2"></param>
        /// <returns></returns>
        private List <String> parse_4_Round_Recommanded_Room_Handle(List <String> listRound_2)
        {
            //[RoomID]:register_table.CheckRoom

            //逐一处理每个检查的房间串,并处理返回结果
            List <String> roomList = new List <string>();

            int nCount = register_table.Rows.Count;

            for (int i = 0; i < nCount; i++)
            {
                //注: 由于Round_1_2保证了数据的完整性,在Round3无需进行CSTR.isEmpty的处理了
                String rooms_id_origin  = "";
                String rooms_id_round_2 = "";

                try
                {
                    rooms_id_origin  = CSTR.ObjectTrim(register_table.Rows[i]["CheckRoom"]);
                    rooms_id_round_2 = listRound_2[i];

                    //如果只有一个房间,直接写回原串
                    String[] rooms_arr_round_2 = CSTR.splitRooms(rooms_id_round_2);
                    if (rooms_arr_round_2.Length <= 1)
                    {
                        roomList.Add(rooms_id_round_2);
                        continue;
                    }

                    //[规则] 同一EXAM的多个房间,需要根据排队的未完成检查数来选择其中一个数目较少的
                    int    min_count   = 9999;
                    String min_room_id = rooms_arr_round_2[0];
                    foreach (String roomID in rooms_arr_round_2)
                    {
                        if (CSTR.isEmpty(roomID))
                        {
                            continue;
                        }

                        int queue_count = DatabaseCache.Queue_Length_Count_Specified_Room_Ignore_QueueActive(roomID);
                        if (queue_count < min_count)
                        {
                            //更新min_count到本房间
                            min_count   = queue_count;
                            min_room_id = roomID;
                        }
                    }
                    //如果选择失败,则不予登记
                    if (CSTR.isEmpty(min_room_id))
                    {
                        min_room_id = VALID_ROOM_ID;
                    }

                    roomList.Add(min_room_id);
                }
                catch
                {
                    //如果还出错,直接写回Round1的串
                    String strSel = rooms_id_round_2;
                    if (CSTR.isEmpty(rooms_id_round_2))
                    {
                        strSel = rooms_id_origin;
                    }

                    //如果多个房间,简单选择第一个
                    String[] room_arr = CSTR.splitRooms(strSel);
                    if (null == room_arr || room_arr.Length <= 0)
                    {
                        strSel = VALID_ROOM_ID;
                    }
                    else
                    {
                        strSel = room_arr[0];
                    }

                    roomList.Add(strSel);
                }
            }//end for

            return(roomList);
        }
コード例 #28
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        /// <summary>
        /// 保证所有检查的房间都是active
        /// </summary>
        /// <param name="listRound_2">上一轮返回的房间串</param>
        /// <returns></returns>
        private List <String> parse_3_Round_Active_Room_Handle(List <String> listRound_2)
        {
            //[RoomID]:register_table.CheckRoom

            //逐一处理每个检查的房间串,并处理返回结果
            List <String> roomList = new List <string>();

            int nCount = register_table.Rows.Count;

            for (int i = 0; i < nCount; i++)
            {
                //注: 由于Round_1_2保证了数据的完整性,在Round3无需进行CSTR.isEmpty的处理了
                String rooms_id_origin  = "";
                String rooms_id_round_2 = "";

                try
                {
                    rooms_id_origin  = CSTR.ObjectTrim(register_table.Rows[i]["CheckRoom"]);
                    rooms_id_round_2 = listRound_2[i];

                    //如果round_2中有active的房间,直接作为返回结果
                    if (get_active_RoomID_Cluster(rooms_id_round_2).Length > 0)
                    {
                        roomList.Add(get_active_RoomID_Cluster(rooms_id_round_2));
                        continue;
                    }

                    //如果Round_2中的房间为disactive,则选择第一个,并判断房间类型,返回同类房间中激活的那一个
                    String[] rooms_arr_round_2 = CSTR.splitRooms(rooms_id_round_2);
                    if (null == rooms_arr_round_2 || rooms_arr_round_2.Length <= 0)
                    {
                        //不予登记
                        roomList.Add(VALID_ROOM_ID);
                        continue;
                    }

                    String first_room_id = rooms_arr_round_2[0];//取第一个做房间类型判断条件

                    //获取各类总检房间的开启情况
                    String active_endingRoomCluster_full     = get_active_RoomID_Cluster(endingRoomCluster_full);
                    String active_endingRoomCluster_normal   = get_active_RoomID_Cluster(endingRoomCluster_normal);
                    String active_endingRoomCluster_vocation = get_active_RoomID_Cluster(endingRoomCluster_vocation);

                    String strSel = first_room_id;
                    if (endingRoomCluster_normal.IndexOf(first_room_id) >= 0 ||
                        "[315]".Equals(first_room_id) ||
                        "[317]".Equals(first_room_id))//[规则]315,317房间关闭时,自动到普通总检
                    {
                        //属于普通总检房间
                        if (active_endingRoomCluster_normal.Length > 0)
                        {
                            strSel = active_endingRoomCluster_normal;
                        }
                        else if (active_endingRoomCluster_full.Length > 0)
                        {
                            strSel = active_endingRoomCluster_full;
                        }
                    }
                    else if (endingRoomCluster_vocation.IndexOf(first_room_id) >= 0)
                    {
                        //属于职检总检房间
                        if (active_endingRoomCluster_vocation.Length > 0)
                        {
                            strSel = active_endingRoomCluster_vocation;
                        }
                        else if (active_endingRoomCluster_full.Length > 0)
                        {
                            strSel = active_endingRoomCluster_full;
                        }
                    }
                    else if ("[302][303][304][305][405]".IndexOf(first_room_id) >= 0)
                    {
                        String tempRoomID = get_active_RoomID_Cluster("[302][303][304][305][405]");
                        if (tempRoomID.Length > 0)
                        {
                            strSel = tempRoomID;
                        }
                    }
                    else if ("[306][307][401][402][403][404]".IndexOf(first_room_id) >= 0)
                    {
                        String tempRoomID = get_active_RoomID_Cluster("[306][307][401][402][403][404]");
                        if (tempRoomID.Length > 0)
                        {
                            strSel = tempRoomID;
                        }
                        else
                        {
                            //[规则]当超声房间全部关闭时,自动选择超声科
                            strSel = "[超声科]";
                        }
                    }
                    else if ("[324][325][326]".IndexOf(first_room_id) >= 0)
                    {
                        String tempRoomID = get_active_RoomID_Cluster("[324][325][326]");
                        if (tempRoomID.Length > 0)
                        {
                            strSel = tempRoomID;
                        }
                    }

                    roomList.Add(strSel);
                }
                catch
                {
                    //如果还出错,对此Exam不登记
                    roomList.Add(VALID_ROOM_ID);
                }
            }//end for

            return(roomList);
        }
コード例 #29
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        /// <summary>
        /// 处理[306][307]职检->[307](取消职检到[307])) : [309][311]女->[311]
        /// 此轮的返回结果可以作为多个房间的备选(保存到JiaohaoTable.OptionRooms字段)
        /// </summary>
        /// <param name="listRound_1">第一轮的处理结果</param>
        /// <returns></returns>
        private List <String> parse_2_Round_Other_Room_Handle(List <String> listRound_1)
        {
            //[RoomID]:register_table.CheckRoom

            //逐一处理每个检查的房间串,并处理返回结果
            List <String> roomList = new List <string>();

            int nCount = register_table.Rows.Count;

            for (int i = 0; i < nCount; i++)
            {
                //注: 由于Round_1保证了数据的完整性,在Round2无需进行CSTR.isEmpty的处理了
                String rooms_id_origin  = "";
                String rooms_id_round_1 = "";

                try
                {
                    rooms_id_origin  = CSTR.ObjectTrim(register_table.Rows[i]["CheckRoom"]);
                    rooms_id_round_1 = listRound_1[i];

                    //0:女 1:男 %:未知
                    String PatientGender = CSTR.ObjectTrim(register_table.Rows[i]["XB"]);
                    if (PatientGender.Equals("0"))
                    {
                        PatientGender = "女";
                    }
                    else
                    {
                        PatientGender = "男";
                    }

                    //获取round_1的房间类型
                    String[] rooms_arr_round_1 = CSTR.splitRooms(rooms_id_round_1);
                    bool     has_UltraSound    = false;
                    bool     has_309           = false;
                    bool     has_311           = false;
                    foreach (String roomID in rooms_arr_round_1)
                    {
                        if ("[306][307][401][402][403][404]".IndexOf(roomID) >= 0)
                        {
                            has_UltraSound = true;
                        }
                        if (roomID.Equals("[309]"))
                        {
                            has_309 = true;
                        }
                        if (roomID.Equals("[311]"))
                        {
                            has_311 = true;
                        }
                    }

                    //[规则] 对于[309][311]的房间,男的选[309],女的选[311]
                    if (has_309 && has_311)
                    {
                        String strSel = rooms_id_round_1;

                        if (PatientGender.Equals("女"))
                        {
                            strSel = "[311]";
                        }
                        else
                        {
                            strSel = strSel.Replace("[311]", "");//去掉[311]房间
                            //如果为空则恢复原有串
                            if (CSTR.isEmpty(strSel))
                            {
                                strSel = rooms_id_round_1;
                            }
                        }

                        roomList.Add(strSel);
                        continue;
                    }
                    else if (has_UltraSound)
                    {
                        //[规则] (取消)职检的B超检查默认选[307],,经阴道检查[403]
                        String strSel = rooms_id_round_1;

                        //解决心电错误分配到[307]的问题
                        //if (STUDY_is_vacation_exam)
                        //{
                        //    strSel = "[307]";
                        //}

                        roomList.Add(strSel);
                        continue;
                    }
                    else
                    {
                        //其他不无需处理的RoomID,直接写回原有的房间串
                        roomList.Add(rooms_id_round_1);
                    }
                }
                catch
                {
                    //如果还出错,直接写回Round1的串
                    String strSel = rooms_id_round_1;
                    if (CSTR.isEmpty(rooms_id_round_1))
                    {
                        strSel = rooms_id_origin;
                    }

                    roomList.Add(strSel);
                }
            }//end for

            return(roomList);
        }
コード例 #30
0
ファイル: RuleForRegister.cs プロジェクト: legoli/Diancan
        /// <summary>
        /// parse_1_Round_Ending_Room_Handle
        /// 处理[308]~[313]的房间
        /// 根据职检与否来更改房间指向
        /// 保证检查有效性和房间号不为空
        /// </summary>
        /// <returns>返回修改了相关总检房间的列表,如[309][311]保存为list[2]='[308][312][313]'</returns>
        private List <String> parse_1_Round_Ending_Room_Handle()
        {
            //[RoomID]:register_table.CheckRoom

            //获取各类总检房间的开启情况
            String active_endingRoomCluster_full     = get_active_RoomID_Cluster(endingRoomCluster_full);
            String active_endingRoomCluster_normal   = get_active_RoomID_Cluster(endingRoomCluster_normal);
            String active_endingRoomCluster_vocation = get_active_RoomID_Cluster(endingRoomCluster_vocation);

            bool is_all_room_closed          = CSTR.isEmpty(active_endingRoomCluster_full);
            bool is_all_normal_room_closed   = CSTR.isEmpty(active_endingRoomCluster_normal);
            bool is_all_vocation_room_closed = CSTR.isEmpty(active_endingRoomCluster_vocation);

            //逐一处理每个检查的房间串,并处理返回结果
            List <String> roomList = new List <string>();

            foreach (DataRow row in register_table.Rows)
            {
                //[规则]检查类型和项目编号等四个关键字段为空则不予登记
                String OrderProcedureName = CSTR.ObjectTrim(row["ExamTypeMC"]);
                String ProcedureStepID    = CSTR.ObjectTrim(row["TJXMBH"]);
                String ProcedureStepName  = CSTR.ObjectTrim(row["TJXMMC"]);
                String ExamType           = CSTR.ObjectTrim(row["ExamType"]);
                if (CSTR.isEmpty(ExamType) || CSTR.isEmpty(OrderProcedureName) ||
                    CSTR.isEmpty(ProcedureStepID) || CSTR.isEmpty(ProcedureStepName))
                {
                    roomList.Add(VALID_ROOM_ID);
                    continue;
                }

                //[规则]对于没有CheckRoom的记录,属于体检系统新增记录,房间并入[other]系列
                String   rooms_id = CSTR.ObjectTrim(row["CheckRoom"]);
                String[] room_arr = CSTR.splitRooms(rooms_id);
                if (null == room_arr || room_arr.Length <= 0)
                {
                    roomList.Add("[other]");
                    continue;
                }

                //判断此exam的房间串是否属于endingRoom中的一个
                bool is_belong_endingRoom          = false; //总检房(总)
                bool is_belong_normal_endingRoom   = false; //个检总检
                bool is_belong_vocation_endingRoom = false; //职检总检
                foreach (String roomID in room_arr)
                {
                    if (endingRoomCluster_full.IndexOf(roomID) >= 0)
                    {
                        is_belong_endingRoom = true;
                    }
                    if (endingRoomCluster_normal.IndexOf(roomID) >= 0)
                    {
                        is_belong_normal_endingRoom = true;
                    }
                    if (endingRoomCluster_vocation.IndexOf(roomID) >= 0)
                    {
                        is_belong_vocation_endingRoom = true;
                    }
                }

                //如果不属于总检房间类型,写回原房间串,直接处理下一个exam
                if (false == is_belong_endingRoom)
                {
                    roomList.Add(rooms_id);
                    continue;
                }

                //----------------------------总检房间类型的处理---------------------
                //[规则]全部总检房间都关闭时,个检选择[311],职检选择[313]
                if (is_all_room_closed)
                {
                    String strSel = "[311]";
                    if (STUDY_is_vacation_exam)
                    {
                        strSel = "[313]";
                    }

                    roomList.Add(strSel);
                    continue;
                }

                //[规则]如果有独立的[311]或[310]房间的总检房间,直接映射为[311](包括职检)
                if (STUDY_has_311_or_310_alone)
                {
                    //注意:本循环中的rooms_id并非一定为[310]或[311],甚至可能为[312][313]
                    if (DatabaseCache.RoomInfo_is_active("[311]"))
                    {
                        //如果311房间active,直接选择
                        roomList.Add("[311]");
                        continue;
                    }
                }

                //[规则]如果Study中有职检EndingRoom,或者存在职检的项目,直接映射到[308][312][313],否则映射到[309][311]
                if (STUDY_has_312_313_room || STUDY_is_vacation_exam)
                {
                    //如果当前exam的rooms_id属于[312][313]则直接写回原串,否则强制写入[312][313]
                    if (is_belong_vocation_endingRoom)
                    {
                        roomList.Add(rooms_id);
                        continue;
                    }
                    else
                    {
                        roomList.Add("[308][312][313]");
                        continue;
                    }
                }


                //其他的个检总检房间,写入原串中的active房间
                //(当前条件:1.非职检 2.职检与个检必有一个是有未关闭房间
                String strActive = get_active_RoomID_Cluster(rooms_id);
                String strSelect = strActive;
                if (CSTR.isEmpty(strActive))
                {
                    if (false == is_all_normal_room_closed)
                    {
                        strSelect = active_endingRoomCluster_normal;
                    }
                    else
                    {
                        strSelect = active_endingRoomCluster_vocation;
                    }
                }
                roomList.Add(strSelect);
            }//end foreach

            return(roomList);
        }