public void Launch()
        {
            try
            {
                WorklistSummaryComponent component;
                if (this.Context.SelectedFolder is FolderTreeNode.ContainerFolder)
                {
                    var worklistDetail = new WorklistAdminDetail(null, this.Context.SelectedFolder.Name, "Container folder", null);
                    component = new WorklistSummaryComponent(worklistDetail, false);
                }
                else
                {
                    var folder = (IWorklistFolder)this.Context.SelectedFolder;

                    if (folder.WorklistRef == null)
                    {
                        var description    = folder.Tooltip ?? SR.TitleStaticFolder;
                        var worklistDetail = new WorklistAdminDetail(null, folder.Name, description, null);
                        component = new WorklistSummaryComponent(worklistDetail, false);
                    }
                    else
                    {
                        WorklistAdminDetail worklistDetail = null;
                        Platform.GetService <IWorklistAdminService>(service =>
                        {
                            var response   = service.LoadWorklistForEdit(new LoadWorklistForEditRequest(folder.WorklistRef));
                            worklistDetail = response.Detail;
                        });

                        component = new WorklistSummaryComponent(worklistDetail, worklistDetail.IsUserWorklist == false);
                    }
                }

                ApplicationComponent.LaunchAsDialog(this.Context.DesktopWindow, component, "Worklist Properties");
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, this.Context.DesktopWindow);
            }
        }
Beispiel #2
0
        public override void Start()
        {
            Platform.GetService(
                delegate(IWorklistAdminService service)
            {
                var request = new GetWorklistEditFormDataRequest
                {
                    GetWorklistEditFormChoicesRequest = new GetWorklistEditFormChoicesRequest(!_adminMode)
                };
                _formDataResponse = service.GetWorklistEditFormData(request).GetWorklistEditFormChoicesResponse;

                // initialize _worklistDetail depending on add vs edit vs duplicate mode
                var procedureTypeGroups = new List <ProcedureTypeGroupSummary>();
                if (_mode == WorklistEditorMode.Add)
                {
                    _worklistDetail = new WorklistAdminDetail
                    {
                        FilterByWorkingFacility = true,
                        // establish initial class name
                        WorklistClass = CollectionUtils.SelectFirst(_formDataResponse.WorklistClasses, wc => wc.ClassName == _initialClassName)
                    };
                }
                else
                {
                    // load the existing worklist
                    var response = service.LoadWorklistForEdit(new LoadWorklistForEditRequest(_worklistRef));

                    _worklistDetail = response.Detail;
                    _worklistRef    = response.Detail.EntityRef;

                    // determine initial set of proc type groups, since worklist class already known
                    var groupsResponse  = service.ListProcedureTypeGroups(new ListProcedureTypeGroupsRequest(_worklistDetail.WorklistClass.ProcedureTypeGroupClassName));
                    procedureTypeGroups = groupsResponse.ProcedureTypeGroups;
                }

                // limit class choices if filter specified
                if (_worklistClassChoices != null)
                {
                    _formDataResponse.WorklistClasses =
                        CollectionUtils.Select(_formDataResponse.WorklistClasses, wc => _worklistClassChoices.Contains(wc.ClassName));
                }

                // sort worklist classes so they appear alphabetically in editor
                _formDataResponse.WorklistClasses = CollectionUtils.Sort(_formDataResponse.WorklistClasses, (x, y) => x.DisplayName.CompareTo(y.DisplayName));

                // determine which main page to show (multi or single)
                if (_mode == WorklistEditorMode.Add && _adminMode)
                {
                    _detailComponent = new WorklistMultiDetailEditorComponent(_formDataResponse.WorklistClasses,
                                                                              _formDataResponse.OwnerGroupChoices);
                }
                else
                {
                    _detailComponent = new WorklistDetailEditorComponent(
                        _worklistDetail,
                        _formDataResponse.WorklistClasses,
                        _formDataResponse.OwnerGroupChoices,
                        _mode,
                        _adminMode,
                        false);
                }
                _detailComponent.ProcedureTypeGroupClassChanged += ProcedureTypeGroupClassChangedEventHandler;
                _detailComponent.WorklistClassChanged           += OnWorklistClassChanged;
                _detailComponent.WorklistCategoryChanged        += OnWorklistCategoryChanged;

                // create all other pages
                _filterComponent = new WorklistFilterEditorComponent(_worklistDetail,
                                                                     _formDataResponse.FacilityChoices, _formDataResponse.OrderPriorityChoices,
                                                                     _formDataResponse.PatientClassChoices);

                _procedureTypeFilterComponent = new SelectorEditorComponent <ProcedureTypeSummary, ProcedureTypeTable>(
                    _formDataResponse.ProcedureTypeChoices, _worklistDetail.ProcedureTypes, s => s.ProcedureTypeRef);

                _procedureTypeGroupFilterComponent = new SelectorEditorComponent <ProcedureTypeGroupSummary, ProcedureTypeGroupTable>(
                    procedureTypeGroups, _worklistDetail.ProcedureTypeGroups, s => s.ProcedureTypeGroupRef);

                _departmentFilterComponent = new SelectorEditorComponent <DepartmentSummary, DepartmentTable>(
                    _formDataResponse.DepartmentChoices, _worklistDetail.Departments, s => s.DepartmentRef);

                _locationFilterComponent = new SelectorEditorComponent <LocationSummary, LocationTable>(
                    _formDataResponse.PatientLocationChoices, _worklistDetail.PatientLocations, s => s.LocationRef);

                var maxSpanDays      = _formDataResponse.CurrentServerConfigurationRequiresTimeFilter ? _formDataResponse.CurrentServerConfigurationMaxSpanDays : 0;
                _timeWindowComponent = new WorklistTimeWindowEditorComponent(
                    _worklistDetail,
                    _mode == WorklistEditorMode.Add && _formDataResponse.CurrentServerConfigurationRequiresTimeFilter,
                    maxSpanDays);

                _interpretedByFilterComponent = new StaffSelectorEditorComponent(
                    _formDataResponse.StaffChoices, _worklistDetail.InterpretedByStaff.Staff, _worklistDetail.InterpretedByStaff.IncludeCurrentUser);

                _transcribedByFilterComponent = new StaffSelectorEditorComponent(
                    _formDataResponse.StaffChoices, _worklistDetail.TranscribedByStaff.Staff, _worklistDetail.TranscribedByStaff.IncludeCurrentUser);

                _verifiedByFilterComponent = new StaffSelectorEditorComponent(
                    _formDataResponse.StaffChoices, _worklistDetail.VerifiedByStaff.Staff, _worklistDetail.VerifiedByStaff.IncludeCurrentUser);
                _supervisedByFilterComponent = new StaffSelectorEditorComponent(
                    _formDataResponse.StaffChoices, _worklistDetail.SupervisedByStaff.Staff, _worklistDetail.SupervisedByStaff.IncludeCurrentUser);

                if (ShowSubscriptionPages)
                {
                    _staffSubscribersComponent = new SelectorEditorComponent <StaffSummary, StaffSelectorTable>(
                        _formDataResponse.StaffChoices,
                        _worklistDetail.StaffSubscribers,
                        s => s.StaffRef,
                        SubscriptionPagesReadOnly);
                    _groupSubscribersComponent = new SelectorEditorComponent <StaffGroupSummary, StaffGroupTable>(
                        _formDataResponse.GroupSubscriberChoices,
                        _worklistDetail.GroupSubscribers,
                        s => s.StaffGroupRef,
                        SubscriptionPagesReadOnly);
                }
            });

            // add pages
            this.Pages.Add(new NavigatorPage("NodeWorklist", _detailComponent));
            this.Pages.Add(new NavigatorPage("NodeWorklist/NodeFilters", _filterComponent));
            this.Pages.Add(new NavigatorPage("NodeWorklist/NodeFilters/FilterProcedureType", _procedureTypeFilterComponent));
            this.Pages.Add(new NavigatorPage("NodeWorklist/NodeFilters/FilterProcedureTypeGroup", _procedureTypeGroupFilterComponent));

            if (new WorkflowConfigurationReader().EnableVisitWorkflow)
            {
                this.Pages.Add(new NavigatorPage("NodeWorklist/NodeFilters/FilterPatientLocation", _locationFilterComponent));
            }
            this.Pages.Add(_departmentComponentPage = new NavigatorPage("NodeWorklist/NodeFilters/FilterDepartment", _departmentFilterComponent));

            _procedureTypeFilterComponent.ItemsAdded      += OnProcedureTypeAdded;
            _procedureTypeGroupFilterComponent.ItemsAdded += OnProcedureTypeGroupAdded;

            _interpretedByFilterComponentPage = new NavigatorPage("NodeWorklist/NodeFilters/NodeStaff/FilterInterpretedBy", _interpretedByFilterComponent);

            if (WorklistEditorComponentSettings.Default.ShowTranscribedByPage)
            {
                _transcribedByFilterComponentPage = new NavigatorPage("NodeWorklist/NodeFilters/NodeStaff/FilterTranscribedBy", _transcribedByFilterComponent);
            }

            _verifiedByFilterComponentPage   = new NavigatorPage("NodeWorklist/NodeFilters/NodeStaff/FilterVerifiedBy", _verifiedByFilterComponent);
            _supervisedByFilterComponentPage = new NavigatorPage("NodeWorklist/NodeFilters/NodeStaff/FilterSupervisedBy", _supervisedByFilterComponent);

            _timeWindowComponentPage = new NavigatorPage("NodeWorklist/FilterTimeWindow", _timeWindowComponent);

            ShowWorklistCategoryDependantPages();

            if (ShowSubscriptionPages)
            {
                this.Pages.Add(new NavigatorPage("NodeWorklist/NodeSubscribers/NodeGroupSubscribers", _groupSubscribersComponent));
                this.Pages.Add(new NavigatorPage("NodeWorklist/NodeSubscribers/NodeStaffSubscribers", _staffSubscribersComponent));
            }
            this.Pages.Add(_summaryComponentPage = new NavigatorPage("NodeWorklist/NodeWorklistSummary", _summaryComponent = new WorklistSummaryComponent(_worklistDetail, _adminMode)));

            this.CurrentPageChanged += WorklistEditorComponent_CurrentPageChanged;

            this.ValidationStrategy = new AllComponentsValidationStrategy();

            base.Start();

            // Modify EntityRef and add the word "copy" to the worklist name.
            // This is done after the Start() call, so changing the worklist name will trigger a component modify changed.
            if (_mode == WorklistEditorMode.Duplicate)
            {
                _worklistDetail.EntityRef = null;
                ((WorklistDetailEditorComponent)_detailComponent).Name = _worklistDetail.Name + " copy";
            }
        }