示例#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
        //获取多个房间中最少活动检查的队列人数
        public static int Queue_Length_Min_Count_MultiRoom_Active_Exam(String clusterRooms)
        {
            //1.分解房间串
            String[] arrRooms = CSTR.splitRooms(clusterRooms);
            if (null == arrRooms)
            {
                return(0);
            }
            if (arrRooms.Length <= 0)
            {
                return(0);
            }

            //遍历所有房间的队列长度,找到最小的那个
            int min_length = 9999;

            foreach (String strRoom in arrRooms)
            {
                int count = Queue_Length_Count_Specified_Room_Active_Exam(strRoom);
                if (count < min_length)
                {
                    min_length = count;
                }
            }

            return(min_length);
        }
示例#3
0
        //获取多个房间的活动检查队列总数
        public static int Queue_Length_Count_MultiRoom_Cluster_Active_Exam(String clusterRooms)
        {
            //1.分解房间串
            String[] arrRooms = CSTR.splitRooms(clusterRooms);
            if (null == arrRooms)
            {
                return(0);
            }
            if (arrRooms.Length <= 0)
            {
                return(0);
            }

            //累加所有房间的队列长度
            int total_length = 0;

            foreach (String strRoom in arrRooms)
            {
                total_length += Queue_Length_Count_Specified_Room_Active_Exam(strRoom);
            }

            return(total_length);
        }
示例#4
0
        /// <summary>
        /// 同类型房间重复出现时,只选择唯一的一个,避免重复
        /// </summary>
        /// <param name="listRound_3"></param>
        /// <returns></returns>
        private List <String> parse_5_Round_RoomType_Uniqueness_Handle(List <String> listRound_3)
        {
            //[RoomID]:register_table.CheckRoom

            //注: 不生成新的返回List,而是对listRound_3进行修改后返回

            //保证listRound_3中的每一项都不为空,而且只有一个房间
            for (int i = 0; i < listRound_3.Count; i++)
            {
                String   roomID   = listRound_3[i];
                String[] room_arr = CSTR.splitRooms(roomID);

                //确保不为空
                if (CSTR.isEmpty(roomID) || CSTR.splitRoomsCount(room_arr) <= 0)
                {
                    listRound_3[i] = VALID_ROOM_ID;
                    continue;
                }

                //确保只有一个房间
                if (room_arr.Length > 1)
                {
                    //超过一个房间,则取第一个
                    listRound_3[i] = room_arr[0];
                }
            }


            //同类房间如果有重复,需要从中选择唯一的一个房间
            List <String> listSameType_RoomCluster = new List <string>();

            listSameType_RoomCluster.Add("[302][303][304][305][405]");
            listSameType_RoomCluster.Add("[306][307][401][402][403][404]");
            listSameType_RoomCluster.Add("[309][311]");
            listSameType_RoomCluster.Add("[308][312][313]");
            listSameType_RoomCluster.Add("[324][325][326]");
            listSameType_RoomCluster.Add("[322][406]");
            //保存listRound_3中的同类房间
            List <String> listExistRooms = new List <string>();

            for (int i = 0; i < listSameType_RoomCluster.Count; i++)
            {
                listExistRooms.Add("");
            }

            //获取listRound_3中的同类房间串
            foreach (String roomID in listRound_3)
            {
                for (int i = 0; i < listSameType_RoomCluster.Count; i++)
                {
                    String room_cluster_full = listSameType_RoomCluster[i];
                    if (room_cluster_full.IndexOf(roomID) >= 0)
                    {
                        //读取目前保存的同类房间串
                        String room_exist = listExistRooms[i];
                        //先清除,再添加,不会重复出现同一个RoomID
                        room_exist  = room_exist.Replace(roomID, "");
                        room_exist += roomID;
                        //重新保存
                        listExistRooms[i] = room_exist;
                    }
                } //end for
            }     //end foreach

            //判断是否重复
            for (int i = 0; i < listExistRooms.Count; i++)
            {
                String   rooms_id = listExistRooms[i];
                String[] room_arr = CSTR.splitRooms(rooms_id);
                if (CSTR.splitRoomsCount(room_arr) <= 1)
                {
                    continue;
                }

                //两个或以上同类房间,出现重复
                String strSel = "";
                //获取未关闭的房间
                String   strActive  = get_active_RoomID_Cluster(rooms_id);
                String[] arr_active = CSTR.splitRooms(strActive);
                if (CSTR.isEmpty(strActive) || CSTR.splitRoomsCount(arr_active) <= 0)
                {
                    //如果重复房间都关闭,则直接选择第一个
                    strSel = room_arr[0];
                }
                else
                {
                    //选择已开启房间的第一个
                    strSel = arr_active[0];
                }

                //更新到listRound_3
                for (int i_round_3 = 0; i_round_3 < listRound_3.Count; i_round_3++)
                {
                    String room_round_3 = listRound_3[i_round_3];
                    if (rooms_id.IndexOf(room_round_3) >= 0)
                    {
                        if (false == CSTR.isEmpty(strSel))
                        {
                            //更新,去除多个重复同类房间,修改为唯一的一个
                            listRound_3[i_round_3] = strSel;
                        }
                    }
                }
            }//end for

            return(listRound_3);
        }
示例#5
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);
        }
示例#6
0
        /// <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);
        }
示例#7
0
        /// <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);
        }
示例#8
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);
        }