Пример #1
0
 /// <summary>
 /// Formats the specified Procedure (must be a JSML encoded <see cref="ProcedureSummary"/> or <see cref="ProcedureDetail"/> object).
 /// </summary>
 /// <param name="jsml"></param>
 /// <returns></returns>
 public string FormatProcedureName(string jsml)
 {
     try
     {
         var procedureSummary = JsmlSerializer.Deserialize <ProcedureSummary>(jsml);
         return(procedureSummary == null ? "" : ProcedureFormat.Format(procedureSummary));
     }
     catch (InvalidCastException)
     {
         var procedureDetail = JsmlSerializer.Deserialize <ProcedureDetail>(jsml);
         return(procedureDetail == null ? "" : ProcedureFormat.Format(procedureDetail));
     }
 }
Пример #2
0
        private void LoadWorklistItem(IProtocollingWorkflowService service)
        {
            if (_worklistItem == null)
            {
                return;
            }

            var protocolRequest  = new GetProcedureProtocolRequest(_worklistItem.ProcedureRef);
            var protocolResponse = service.GetProcedureProtocol(protocolRequest);

            _protocolDetail = protocolResponse.ProtocolDetail;

            var sb = new StringBuilder();

            foreach (var procedure in _protocolDetail.Procedures)
            {
                sb.Append(ProcedureFormat.Format(procedure) + ", ");
            }

            _proceduresText = sb.ToString().TrimEnd(", ".ToCharArray());

            // Load available protocol groups
            var request  = new ListProtocolGroupsForProcedureRequest(_worklistItem.ProcedureRef);
            var response = service.ListProtocolGroupsForProcedure(request);

            _protocolGroupChoices = response.ProtocolGroups;
            _protocolGroup        = GetInitialProtocolGroup();

            RefreshAvailableProtocolCodes(_protocolDetail.Codes, service);

            // fill out selected item codes
            _selectedProtocolCodes.Items.Clear();
            _selectedProtocolCodes.Items.AddRange(_protocolDetail.Codes);

            if (Thread.CurrentPrincipal.IsInRole(ClearCanvas.Ris.Application.Common.AuthorityTokens.Workflow.Protocol.SubmitForReview) &&
                _protocolDetail.Supervisor == null)
            {
                // if this user has a default supervisor, retreive it, otherwise leave supervisor as null
                if (_rememberSupervisor && !String.IsNullOrEmpty(ProtocollingSettings.Default.SupervisorID))
                {
                    _protocolDetail.Supervisor = GetStaffByID(ProtocollingSettings.Default.SupervisorID);
                }
            }

            NotifyPropertyChanged("ProtocolGroupChoices");
            NotifyPropertyChanged("ProtocolGroup");
            NotifyPropertyChanged("SetDefaultProtocolGroupEnabled");
            NotifyPropertyChanged("Urgency");
        }
        public ProtocolEditorProcedurePlanSummaryTable()
        {
            ITableColumn sortColumn = new TableColumn <ProtocolEditorProcedurePlanSummaryTableItem, string>(
                "Procedure Description",
                delegate(ProtocolEditorProcedurePlanSummaryTableItem item) { return(ProcedureFormat.Format(item.ProcedureDetail)); },
                0.5f);

            this.Columns.Add(sortColumn);

            this.Columns.Add(new TableColumn <ProtocolEditorProcedurePlanSummaryTableItem, string>(
                                 "Protocol Status",
                                 delegate(ProtocolEditorProcedurePlanSummaryTableItem item)
            {
                return(item.ProtocolDetail.Status.Value);
            },
                                 0.5f));

            this.Sort(new TableSortParams(sortColumn, true));
        }
Пример #4
0
 public CheckInOrderTable()
 {
     this.Columns.Add(
         new TableColumn <CheckInOrderTableEntry, bool>(SR.ColumnCheckIn,
                                                        delegate(CheckInOrderTableEntry entry) { return(entry.Checked); },
                                                        delegate(CheckInOrderTableEntry entry, bool value) { entry.Checked = value; }, 0.30f));
     this.Columns.Add(
         new TableColumn <CheckInOrderTableEntry, string>(SR.ColumnProcedures,
                                                          delegate(CheckInOrderTableEntry entry) { return(ProcedureFormat.Format(entry.Procedure)); }, 1.0f));
     this.Columns.Add(
         new DateTimeTableColumn <CheckInOrderTableEntry>(SR.ColumnTime,
                                                          delegate(CheckInOrderTableEntry entry) { return(entry.Procedure.ScheduledStartTime); }, 0.5f));
     this.Columns.Add(
         new TableColumn <CheckInOrderTableEntry, string>(SR.ColumnPerformingFacility,
                                                          delegate(CheckInOrderTableEntry entry) { return(entry.Procedure.PerformingFacility.Name); }, 0.5f));
 }
Пример #5
0
            public string FormatOrderListItemProcedureName(string jsml)
            {
                var orderListItem = JsmlSerializer.Deserialize <OrderListItem>(jsml);

                return(orderListItem == null ? "" : ProcedureFormat.Format(orderListItem));
            }
Пример #6
0
 private static string FormatDescription(TItem item)
 {
     // if there is no accession number, this item represents a patient only, not an order
     return(item.AccessionNumber == null ? null :
            string.Format("{0} {1}", AccessionFormat.Format(item.AccessionNumber), ProcedureFormat.Format(item)));
 }
Пример #7
0
        public PriorSummaryTable()
        {
            this.Columns.Add(new TableColumn <PriorProcedureSummary, string>("Accession Number",
                                                                             delegate(PriorProcedureSummary item) { return(AccessionFormat.Format(item.AccessionNumber)); }));
            this.Columns.Add(new TableColumn <PriorProcedureSummary, string>("Procedure",
                                                                             delegate(PriorProcedureSummary item) { return(ProcedureFormat.Format(item)); }));

            this.Columns.Add(new DateTableColumn <PriorProcedureSummary>("Performed Date",
                                                                         delegate(PriorProcedureSummary item) { return(item.PerformedDate.Value); }));
            this.Columns.Add(new TableColumn <PriorProcedureSummary, string>("Report Status",
                                                                             delegate(PriorProcedureSummary item) { return(item.ReportStatus.Value); }));
        }
Пример #8
0
        private ProcedurePlanSummaryTable(int cellRowCount)
            : base(cellRowCount)
        {
            this.Columns.Add(new TableColumn <Checkable <ProcedurePlanSummaryTableItem>, bool>(
                                 "X",
                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable) { return(checkable.IsChecked); },
                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable, bool isChecked)
            {
                checkable.IsChecked = isChecked;
                EventsHelper.Fire(_checkedRowsChanged, this, EventArgs.Empty);
            },
                                 0.1f));

            this.Columns.Add(new TableColumn <Checkable <ProcedurePlanSummaryTableItem>, string>(
                                 SR.ColumnStatus,
                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable)
            {
                return(FormatStatus(checkable.Item));
            },
                                 0.5f));

            this.Columns.Add(new TableColumn <Checkable <ProcedurePlanSummaryTableItem>, string>(
                                 SR.ColumnModality,
                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable) { return(checkable.Item.ModalityProcedureStep.Modality.Name); },
                                 0.5f));

            DateTimeTableColumn <Checkable <ProcedurePlanSummaryTableItem> > scheduledStartTimeColumn =
                new DateTimeTableColumn <Checkable <ProcedurePlanSummaryTableItem> >(
                    SR.ColumnScheduledTime,
                    delegate(Checkable <ProcedurePlanSummaryTableItem> checkable) { return(checkable.Item.ModalityProcedureStep.ScheduledStartTime); },
                    0.5f);

            this.Columns.Add(scheduledStartTimeColumn);

            this.Columns.Add(new DateTimeTableColumn <Checkable <ProcedurePlanSummaryTableItem> >(
                                 SR.ColumnCheckInTime,
                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable) { return(checkable.Item.Procedure.CheckInTime); },
                                 0.5f));

            this.Columns.Add(new DateTimeTableColumn <Checkable <ProcedurePlanSummaryTableItem> >(
                                 SR.ColumnStartTime,
                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable) { return(checkable.Item.ModalityProcedureStep.StartTime); },
                                 0.5f));


            this.Columns.Add(new TableColumn <Checkable <ProcedurePlanSummaryTableItem>, string>(SR.ColumnProcedureDescription,
                                                                                                 delegate(Checkable <ProcedurePlanSummaryTableItem> checkable)
            {
                // if MPS description is identical to procedure type name, don't put redundant text
                if (checkable.Item.ModalityProcedureStep.Description == checkable.Item.Procedure.Type.Name)
                {
                    return(ProcedureFormat.Format(checkable.Item.Procedure));
                }
                else
                {
                    // MPS desc is different, so append it
                    return(string.Format("{0} - {1}",
                                         ProcedureFormat.Format(checkable.Item.Procedure),
                                         checkable.Item.ModalityProcedureStep.Description));
                }
            },
                                                                                                 0.5f,
                                                                                                 ProcedureDescriptionRow));

            this.Sort(new TableSortParams(scheduledStartTimeColumn, true));
        }
Пример #9
0
        private bool Confirm(IEnumerable <CheckInOrderTableEntry> checkedEntries)
        {
            var warnProcedures  = new List <ProcedureSummary>();
            var errorProcedures = new List <ProcedureSummary>();

            // Get the list of Order EntityRef from the table
            foreach (var entry in checkedEntries)
            {
                string checkInValidationMessage;
                var    result = CheckInSettings.Validate(entry.Procedure.ScheduledStartTime, _checkInTime, out checkInValidationMessage);
                switch (result)
                {
                case CheckInSettings.ValidateResult.TooEarly:
                case CheckInSettings.ValidateResult.TooLate:
                    warnProcedures.Add(entry.Procedure);
                    break;

                case CheckInSettings.ValidateResult.NotScheduled:
                    errorProcedures.Add(entry.Procedure);
                    break;
                }
            }

            if (errorProcedures.Count > 0)
            {
                var messageBuilder = new StringBuilder();
                messageBuilder.Append(SR.MessageCheckInProceduresNotScheduled);
                messageBuilder.AppendLine();
                messageBuilder.AppendLine();
                CollectionUtils.ForEach(errorProcedures, procedure => messageBuilder.AppendLine(ProcedureFormat.Format(procedure)));

                this.Host.DesktopWindow.ShowMessageBox(messageBuilder.ToString(), MessageBoxActions.Ok);
                return(false);
            }

            if (warnProcedures.Count > 0)
            {
                var earlyThreshold = TimeSpan.FromMinutes(CheckInSettings.Default.EarlyCheckInWarningThreshold);
                var lateThreshold  = TimeSpan.FromMinutes(CheckInSettings.Default.LateCheckInWarningThreshold);

                var messageBuilder = new StringBuilder();
                messageBuilder.AppendFormat(SR.MessageCheckInProceduresTooLateOrTooEarly,
                                            TimeSpanFormat.FormatDescriptive(earlyThreshold),
                                            TimeSpanFormat.FormatDescriptive(lateThreshold));
                messageBuilder.AppendLine();
                messageBuilder.AppendLine();
                CollectionUtils.ForEach(warnProcedures, procedure => messageBuilder.AppendLine(ProcedureFormat.Format(procedure)));
                messageBuilder.AppendLine();
                messageBuilder.Append(SR.MessageConfirmCheckInProcedures);

                if (DialogBoxAction.No == this.Host.DesktopWindow.ShowMessageBox(messageBuilder.ToString(), MessageBoxActions.YesNo))
                {
                    return(false);
                }
            }
            return(true);
        }