Beispiel #1
0
        private static Order[] GetOrdesBySerialNo(OrderTable table, decimal[] serialNums)
        {
            if ((serialNums == null) || (serialNums.Length == 0))
            {
                return new Order[] { }
            }
            ;

            List <Order> orders = new List <Order>();
            Order        order;

            foreach (decimal serialNo in serialNums)
            {
                order = table.Orders[table.Orders.IndexOf(serialNo)];

                if (order != null)
                {
                    orders.Add(order);
                }
            }
            // 按照序号进行排序
            orders.Sort(CompareSerialNoOfOrder);
            Order[] result = new Order[orders.Count];
            orders.CopyTo(result);
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 根据传入的医嘱对象表创建医嘱对象集合
        /// </summary>
        /// <param name="table"></param>
        internal OrderCollection(OrderTable table)
        {
            _maxSerialNo = 0;
            m_Table      = table;

            _orderList = new List <Order>();
            Order        newOrder;
            List <Order> newOrders = new List <Order>();

            // 先处理其它状态的医嘱,将新医嘱插在医嘱表的最后
            foreach (DataRow row in m_Table.OrderDataTable.Rows)
            {
                if (m_Table.IsTempOrder)
                {
                    newOrder = new TempOrder(row);
                }
                else
                {
                    newOrder = new LongOrder(row);
                }
                if (newOrder.State != OrderState.New)
                {
                    _orderList.Add(newOrder);
                }
                else
                {
                    newOrders.Add(newOrder);
                }
            }
            foreach (Order tempOrde in newOrders)
            {
                _orderList.Add(tempOrde);
            }

            //// 先处理分组信息,然后再绑定事件
            //ResetOrderGroupInfo();

            foreach (Order temp in _orderList)
            {
                // 绑定创建输出内容的委托
                temp.Content.ProcessCreateOutputeInfo =
                    new OrderContent.GenerateOutputInfo(CustomDrawOperation.CreateOutputeInfo);
                if (temp.Content.Item != null)
                {
                    temp.BeginInit();
                    temp.Content.Item.ReInitializeProperties();
                    temp.Content.EndInit();
                    temp.EndInit();
                }
                temp.OrderChanged += new EventHandler <OrderChangedEventArgs>(m_Table.AfterOrderChanged);
            }

            ResetViewList();
        }
Beispiel #3
0
        private void SynchLongOrderExecResultToEmr(DataTable longOrderTable)
        {
            if ((longOrderTable != null) && (longOrderTable.Rows.Count > 0))
            {
                OrderTable currentTable = m_CoreLogic.GetCurrentOrderTable(false);
                if (currentTable.Orders.Count == 0)
                {
                    if (CoreBusinessLogic.BusinessLogic.UsedForAllPatient)
                    {
                        throw new ArgumentOutOfRangeException("传入的长期医嘱数据在电子病历系统中不存在");
                    }
                    else
                    {
                        return;
                    }
                }
                currentTable.OrderDataTable.Merge(longOrderTable);
                string    changedSerialNo = CombineSerialNo(longOrderTable, "cqyzxh");
                DataRow[] changedRows     = currentTable.OrderDataTable.Select("cqyzxh in (" + changedSerialNo + ")");
                Dictionary <decimal, DataRow> changedHerbSummaries = new Dictionary <decimal, DataRow>();

                foreach (DataRow row in changedRows)
                {
                    if (row["memo"].ToString().StartsWith(Order.HerbSummaryFlag))
                    {
                        changedHerbSummaries.Add(Convert.ToDecimal(row["memo"].ToString().Substring(Order.HerbSummaryFlag.Length - 1)), row);
                    }
                }
                // 同步关联的草药明细的状态
                if (changedHerbSummaries.Count > 0)
                {
                    decimal groupSerialNo;

                    foreach (DataRow row in currentTable.OrderDataTable.Rows)
                    {
                        groupSerialNo = Convert.ToDecimal(row["fzxh"]);
                        if (changedHerbSummaries.ContainsKey(groupSerialNo))
                        {
                            row["yzzt"]  = changedHerbSummaries[groupSerialNo]["yzzt"];
                            row["zxczy"] = changedHerbSummaries[groupSerialNo]["zxczy"];
                            row["zxrq"]  = changedHerbSummaries[groupSerialNo]["zxrq"];
                        }
                    }
                }

                DataTable changedTable = currentTable.OrderDataTable.GetChanges();
                m_SqlExecutor.UpdateTable(currentTable.OrderDataTable, CoreBusinessLogic.GetOrderTableName(currentTable.IsTempOrder), false);
                //currentTable.OrderDataTable.AcceptChanges();
                // 处理质量管理消息
                m_CoreLogic.HandleQcMessageAfterSynchExecute(changedTable, false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 根据传入的医嘱表数据创建临时或长期医嘱的OrderView对象
        /// </summary>
        /// <param name="orderTable">医嘱对象表</param>
        public OrderTableView(OrderTable orderTable)
        {
            if (orderTable == null)
            {
                throw new ArgumentNullException(ConstMessages.ExceptionNullOrderTable);
            }

            _table       = orderTable;
            _state       = OrderState.All;
            _allowNew    = true;
            _allowEdit   = true;
            _allowRemove = true;

            m_ExpandAllHerbDetail          = !CoreBusinessLogic.BusinessLogic.AutoHideHerbDetail;
            m_GroupSerialNoOfExpandedHerbs = new Collection <decimal>();

            Table.ListChanged += new ListChangedEventHandler(DoAfterOrderListChanged);
        }
Beispiel #5
0
        private void SynchTempOrderExecResultToEmr(DataTable tempOrderTable)
        {
            // 直接对数据集进行合并,然后保存到EMR数据库(这样会导致OrderTable中数据集内容和对象属性不一致)
            if ((tempOrderTable != null) && (tempOrderTable.Rows.Count > 0))
            {
                OrderTable currentTable = m_CoreLogic.GetCurrentOrderTable(true);
                if (currentTable.Orders.Count == 0)
                {
                    if (CoreBusinessLogic.BusinessLogic.UsedForAllPatient)
                    {
                        throw new ArgumentOutOfRangeException("传入的临时医嘱数据在电子病历系统中不存在");
                    }
                    else
                    {
                        return;
                    }
                }
                currentTable.OrderDataTable.Merge(tempOrderTable);

                string    changedSerialNo = CombineSerialNo(tempOrderTable, "lsyzxh");
                DataRow[] changedRows     = currentTable.OrderDataTable.Select("lsyzxh in (" + changedSerialNo + ")");

                Dictionary <decimal, DataRow> changedHerbSummaries = new Dictionary <decimal, DataRow>();
                StringBuilder reqSerialNos = new StringBuilder("0");
                foreach (DataRow row in changedRows)
                {
                    if ((row["sqdxh"].ToString() != "") && (Convert.ToDecimal(row["sqdxh"]) != 0))
                    {
                        reqSerialNos.Append("," + row["sqdxh"].ToString());
                    }
                    else if (row["memo"].ToString().StartsWith(Order.HerbSummaryFlag))
                    {
                        changedHerbSummaries.Add(Convert.ToDecimal(row["memo"].ToString().Substring(Order.HerbSummaryFlag.Length - 1)), row);
                    }
                }
                // 同步关联的草药明细的状态
                if (changedHerbSummaries.Count > 0)
                {
                    decimal groupSerialNo;
                    foreach (DataRow row in currentTable.OrderDataTable.Rows)
                    {
                        groupSerialNo = Convert.ToDecimal(row["fzxh"]);
                        if (changedHerbSummaries.ContainsKey(groupSerialNo))
                        {
                            row["yzzt"]  = changedHerbSummaries[groupSerialNo]["yzzt"];
                            row["zxczy"] = changedHerbSummaries[groupSerialNo]["zxczy"];
                            row["zxrq"]  = changedHerbSummaries[groupSerialNo]["zxrq"];
                        }
                    }
                }

                DataTable changedTable = currentTable.OrderDataTable.GetChanges();
                m_SqlExecutor.UpdateTable(currentTable.OrderDataTable, CoreBusinessLogic.GetOrderTableName(currentTable.IsTempOrder), false);
                //currentTable.OrderDataTable.AcceptChanges();
                // 将关联的申请单状态改成已执行
                if (reqSerialNos.Length > 1)
                {
                    m_SqlExecutor.ExecuteNoneQuery("update BL_SQDK set qrbz = 2 where xh in (" + reqSerialNos.ToString() + ")");
                }

                // 处理质量管理消息
                m_CoreLogic.HandleQcMessageAfterSynchExecute(changedTable, true);
            }
        }