Exemplo n.º 1
0
        /// <summary>
        /// Returns an instance of <see cref="OrderSummary"/> based on a <see cref="Order"/> object.
        /// </summary>
        /// <param name="order"></param>
        /// <param name="read"></param>
        /// <returns></returns>
        /// <remark>
        /// 
        /// </remark>
        static public OrderSummary CreateOrderSummary(IPersistenceContext read, Order order)
        {
            if (order == null)
            {
                return null;
            }

            var orderSummary = new OrderSummary
                {
                    TheRequestedProcedure = ProcedureCode.Load(order.RequestedProcedureCodeKey),
                    TheOrder = order,
                    ScheduledDate = order.ScheduledDateTime,
                    StudyInstanceUid = order.StudyInstanceUid,
                    AccessionNumber = order.AccessionNumber,
                    Room = order.Room,
                    OrderStatusEnum = order.OrderStatusEnum,
                    ReasonForStudy = order.ReasonForStudy,
                    Bed = order.Bed,
                    InsertedTime = order.InsertTime,
                    UpdatedTime = order.UpdatedTime,
                    Key = order.Key,
                    PatientClass = order.PatientClass,
                    PointOfCare = order.PointOfCare,
                    Priority = order.Priority,
					QCExpected = order.QCExpected
                };

            if (order.Priority.Equals("S"))
                orderSummary.Priority = SR.Priority_Stat;
            else if (order.Priority.Equals("A"))
                orderSummary.Priority = SR.Priority_Asap;
            else if (order.Priority.Equals("R"))
                orderSummary.Priority = SR.Priority_Routine;
            else if (order.Priority.Equals("P"))
                orderSummary.Priority = SR.Priority_PreOp;
            else if (order.Priority.Equals("C"))
                orderSummary.Priority = SR.Priority_Callback;
            else if (order.Priority.Equals("T"))
                orderSummary.Priority = SR.Priority_Timing;

            orderSummary.Key = order.GetKey();

            orderSummary.PatientId = order.PatientId;
            orderSummary.PatientsName = order.PatientsName;
            orderSummary.IssuerOfPatientId = order.IssuerOfPatientId;
            orderSummary.RequestedProcedure = orderSummary.TheRequestedProcedure.Text;

            var referStaff = Staff.Load(order.ReferringStaffKey);
            orderSummary.ReferringStaff = referStaff.Name;
            
            var enteredByStaff = Staff.Load(order.EnteredByStaffKey);
            orderSummary.EnteredByStaff = enteredByStaff.Name;
            
           
            orderSummary.ThePartition = ServerPartitionMonitor.Instance.FindPartition(order.ServerPartitionKey) ??
                                        ServerPartition.Load(read, order.ServerPartitionKey);

			// Count of related studies
	        var broker = read.GetBroker<IStudyEntityBroker>();
	        var studySelect = new StudySelectCriteria();
	        studySelect.ServerPartitionKey.EqualTo(order.ServerPartitionKey);
	        studySelect.OrderKey.EqualTo(order.Key);
	        orderSummary.RelatedStudies = broker.Count(studySelect);

            return orderSummary;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns an instance of <see cref="OrderSummary"/> based on a <see cref="Order"/> object.
        /// </summary>
        /// <param name="order"></param>
        /// <param name="read"></param>
        /// <returns></returns>
        /// <remark>
        ///
        /// </remark>
        static public OrderSummary CreateOrderSummary(IPersistenceContext read, Order order)
        {
            if (order == null)
            {
                return(null);
            }

            var orderSummary = new OrderSummary
            {
                TheRequestedProcedure = ProcedureCode.Load(order.RequestedProcedureCodeKey),
                TheOrder         = order,
                ScheduledDate    = order.ScheduledDateTime,
                StudyInstanceUid = order.StudyInstanceUid,
                AccessionNumber  = order.AccessionNumber,
                Room             = order.Room,
                OrderStatusEnum  = order.OrderStatusEnum,
                ReasonForStudy   = order.ReasonForStudy,
                Bed          = order.Bed,
                InsertedTime = order.InsertTime,
                UpdatedTime  = order.UpdatedTime,
                Key          = order.Key,
                PatientClass = order.PatientClass,
                PointOfCare  = order.PointOfCare,
                Priority     = order.Priority,
                QCExpected   = order.QCExpected
            };

            if (order.Priority.Equals("S"))
            {
                orderSummary.Priority = SR.Priority_Stat;
            }
            else if (order.Priority.Equals("A"))
            {
                orderSummary.Priority = SR.Priority_Asap;
            }
            else if (order.Priority.Equals("R"))
            {
                orderSummary.Priority = SR.Priority_Routine;
            }
            else if (order.Priority.Equals("P"))
            {
                orderSummary.Priority = SR.Priority_PreOp;
            }
            else if (order.Priority.Equals("C"))
            {
                orderSummary.Priority = SR.Priority_Callback;
            }
            else if (order.Priority.Equals("T"))
            {
                orderSummary.Priority = SR.Priority_Timing;
            }

            orderSummary.Key = order.GetKey();

            orderSummary.PatientId          = order.PatientId;
            orderSummary.PatientsName       = order.PatientsName;
            orderSummary.IssuerOfPatientId  = order.IssuerOfPatientId;
            orderSummary.RequestedProcedure = orderSummary.TheRequestedProcedure.Text;

            var referStaff = Staff.Load(order.ReferringStaffKey);

            orderSummary.ReferringStaff = referStaff.Name;

            var enteredByStaff = Staff.Load(order.EnteredByStaffKey);

            orderSummary.EnteredByStaff = enteredByStaff.Name;


            orderSummary.ThePartition = ServerPartitionMonitor.Instance.FindPartition(order.ServerPartitionKey) ??
                                        ServerPartition.Load(read, order.ServerPartitionKey);

            // Count of related studies
            var broker      = read.GetBroker <IStudyEntityBroker>();
            var studySelect = new StudySelectCriteria();

            studySelect.ServerPartitionKey.EqualTo(order.ServerPartitionKey);
            studySelect.OrderKey.EqualTo(order.Key);
            orderSummary.RelatedStudies = broker.Count(studySelect);

            return(orderSummary);
        }