static public Order Insert(IUpdateContext update, Order entity) { var broker = update.GetBroker<IOrderEntityBroker>(); var updateColumns = new OrderUpdateColumns(); updateColumns.ServerPartitionKey = entity.ServerPartitionKey; updateColumns.OrderStatusEnum = entity.OrderStatusEnum; updateColumns.InsertTime = entity.InsertTime; updateColumns.UpdatedTime = entity.UpdatedTime; updateColumns.PatientsName = entity.PatientsName; updateColumns.PatientId = entity.PatientId; updateColumns.AccessionNumber = entity.AccessionNumber; updateColumns.ScheduledDateTime = entity.ScheduledDateTime; updateColumns.RequestedProcedureCodeKey = entity.RequestedProcedureCodeKey; updateColumns.Priority = entity.Priority; updateColumns.QCExpected = entity.QCExpected; updateColumns.PatientClass = entity.PatientClass; updateColumns.ReasonForStudy = entity.ReasonForStudy; updateColumns.PointOfCare = entity.PointOfCare; updateColumns.Room = entity.Room; updateColumns.Bed = entity.Bed; updateColumns.StudyInstanceUid = entity.StudyInstanceUid; updateColumns.EnteredByStaffKey = entity.EnteredByStaffKey; updateColumns.ReferringStaffKey = entity.ReferringStaffKey; updateColumns.IssuerOfPatientId = entity.IssuerOfPatientId; Order newEntity = broker.Insert(updateColumns); return newEntity; }
public bool DeleteOrderItem(Order item) { return DeleteOrderItem(item.ServerPartitionKey, item.Key); }
static public Order Insert(Order entity) { using (var update = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { Order newEntity = Insert(update, entity); update.Commit(); return newEntity; } }
/// <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; }