예제 #1
0
        //-------------从指定的房间串中返回active的房间过滤----------------------------------------
        private String get_active_RoomID_Cluster(String roomCluster)
        {
            if (CSTR.isEmpty(roomCluster))
            {
                return("");
            }
            String[] room_arr = CSTR.splitRooms(roomCluster);
            if (null == room_arr || room_arr.Length <= 0)
            {
                return("");
            }

            String retCluster = "";

            foreach (String roomID in room_arr)
            {
                bool is_active = DatabaseCache.RoomInfo_is_active(roomID);
                if (is_active)
                {
                    retCluster += roomID;
                }
            }

            return(retCluster);
        }
예제 #2
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);
        }
예제 #3
0
        //根据手环号码获取检查列表(不分状态,全部)--------------------------------------------------
        public static DataRow[] JiaohaoTable_Get_All_Exam_By_ringNo(String ringNo)
        {
            String    sql = String.Format("RfidName='{0}'", ringNo);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            return(tbl.Select(sql));
        }
예제 #4
0
        //根据手环号码获取检查列表(不分状态,全部)--------------------------------------------------
        public static DataRow[] JiaohaoTable_Get_All_Exam_By_DJLSH(String DJLSH)
        {
            String    sql = String.Format("DJLSH='{0}'", DJLSH);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            return(tbl.Select(sql));
        }
예제 #5
0
        //获取指定IndexID的JiaohaoTable一条记录(不分状态,全部)--------------------------------------------------
        public static DataRow[] JiaohaoTable_Get_One_Item_By_IndexID(String indexID)
        {
            String    sql = String.Format("IndexID='{0}'", indexID);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            return(tbl.Select(sql));
        }
예제 #6
0
        public static DataRow[] Exam_Get_Unfinished_Exams()
        {
            //取得本进程对应的ModalityID(room_id)
            String    strRoomID = CONFIG.system_param["room_id"];
            String    sql       = String.Format("RoomID='{0}' and IsOver='0'", strRoomID);
            DataTable tbl       = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            //order by QueueID
            return(tbl.Select(sql, "QueueID"));
        }
예제 #7
0
        public static DataRow[] Exam_Get_Doing()
        {
            //取得本进程对应的ModalityID(room_id)
            String    strRoomID = CONFIG.system_param["room_id"];
            String    sql       = String.Format("QueueActive='1' and status='1' and IsChecking='1' and IsOver='0' and RoomID='{0}'", strRoomID);
            DataTable tbl       = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            //order by QueueID
            return(tbl.Select(sql, "QueueID DESC"));
        }
예제 #8
0
        // 获取本房间的当前正在检查的信息(当前的,不呼叫,用于显示正在检查)(对于234室,返回结果可能为多条)
        public static DataRow[] Exam_Get_Doing_To_Show()
        {
            //取得本进程对应的ModalityID(room_id)
            String strRoomID = CONFIG.system_param["room_id"];
            //IsSaid初始为0,在显示完信息后设置为1
            String    sql = String.Format("RoomID='{0}' and status='1' and IsChecking='1'", strRoomID);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            //order by IsSaid
            return(tbl.Select(sql, "IsSaid"));
        }
예제 #9
0
        public void worker_Report(Object dataObj)
        {
            //时钟总控,用于同步主程序中的timer_stop()与timer_start()
            if (stop_fetch)
            {
                return;
            }

            if (null == dataObj)
            {
                return;
            }

            Dictionary <String, DataTable> map = dataObj as Dictionary <String, DataTable>;

            //更新Cache数据库
            DatabaseCache.Worker_DB_Fetched(map);
        }
예제 #10
0
        public static DataRow[] Exam_Get_Single_Exam_By_IndexID(String strIndexID)
        {
            String    sql = String.Format("IndexID='{0}'", strIndexID);
            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(sel_rows);
        }
예제 #11
0
        //获取指定房间的过号检查队列总数(过号)
        public static int Queue_Length_Count_Specified_Room_Passed_Exam(String roomID)
        {
            //包含状态字为 1000,1110的检查,即只要QueueActive=1,IsOver=0
            String    sql = String.Format("QueueActive='0' And status='1' And IsChecking='0' And IsOver='0' And RoomID='{0}'", roomID);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

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

            return(sel_rows.Length);
        }
예제 #12
0
        //获取指定房间当前已分配的未完成检查数

        #endregion DocBench专属查询---------------------------------------------End

        #region 队列数目查询----------------------------------------------------Start
        //获取指定房间的Pending的队列总数,忽略QueueActive状态(use case:在新到检时需要知道各个房间的总检查,而非活动检查)
        public static int Queue_Length_Count_Specified_Room_Ignore_QueueActive(String roomID)
        {
            //只要IsOver=0就属于未完成检查
            String    sql = String.Format("IsOver='0' And RoomID='{0}'", roomID);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

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

            return(sel_rows.Length);
        }
예제 #13
0
        public static DataRow[] TJ_Queue_Arrange_Get_Checking_or_Activated_Exam(String DJLSH)
        {
            DJLSH = CSTR.trim(DJLSH);
            if (DJLSH.Length <= 0)
            {
                return(null);
            }

            //包括状态串为 1000 与 1110 的检查
            String sql = String.Format("QueueActive='1' And DJLSH='{0}'", DJLSH);

            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            return(tbl.Select(sql));
        }
예제 #14
0
        /// 获取本房间的相同RFID的信息(不管状态)
        public static DataRow[] Exam_Get_All_Exam_Ingone_Status_SameRoom_SameRFID(String strRFID)
        {
            strRFID = CSTR.trim(strRFID);
            if (strRFID.Length <= 0)
            {
                return(null);
            }

            //取得本进程对应的room_id
            String    strRoomID = CONFIG.system_param["room_id"];
            String    sql       = String.Format("RoomID='{0}' AND Rfid='{1}'", strRoomID, strRFID);
            DataTable tbl       = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            return(tbl.Select(sql));
        }
예제 #15
0
        /**
         * 获取指定DJLSH的当前活动检查
         * 使用:
         * FinalCheckWnd.cs在显示检查列表时调用
         *
         * **/
        //获取指定DJLSH的当前活动检查
        public static DataRow[] TJ_Queue_Arrange_Get_Activated_Exam(String DJLSH)
        {
            DJLSH = CSTR.trim(DJLSH);
            if (DJLSH.Length <= 0)
            {
                return(null);
            }

            String sql = String.Format("QueueActive='1' And status='0' And IsChecking='0' And IsOver='0' " +
                                       "And DJLSH='{0}'", DJLSH);

            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            return(tbl.Select(sql));
        }
예제 #16
0
        public static DataRow Exam_Get_Pending_First_One()
        {
            //取得本进程对应的ModalityID(room_id)
            String    strRoomID = CONFIG.system_param["room_id"];
            String    sql       = String.Format("QueueActive='1' and RoomID='{0}' and status='0' and IsChecking='0' and IsOver='0'", strRoomID);
            DataTable tbl       = DatabaseCache.DB_Get_JiaohaoTable_table();

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

            //order by QueueID
            DataRow[] rows = tbl.Select(sql, "QueueID");
            if (CSTR.IsArrayEmpty(rows))
            {
                return(null);
            }

            return(rows[0]);
        }
예제 #17
0
        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"]));
        }
예제 #18
0
        /// <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);
        }
예제 #19
0
        //登记成功,返回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);
        }
예제 #20
0
        /// <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);
        }