Exemplo n.º 1
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";
            }
        }
Exemplo n.º 2
0
        public override void Start()
        {
            LoadStaffGroupEditorFormDataResponse formDataResponse = null;

            Platform.GetService <IStaffGroupAdminService>(service =>
            {
                formDataResponse = service.LoadStaffGroupEditorFormData(
                    new LoadStaffGroupEditorFormDataRequest());

                if (_staffGroupRef == null)
                {
                    _staffGroupDetail = new StaffGroupDetail();
                }
                else
                {
                    var response      = service.LoadStaffGroupForEdit(new LoadStaffGroupForEditRequest(_staffGroupRef));
                    _staffGroupRef    = response.StaffGroup.StaffGroupRef;
                    _staffGroupDetail = response.StaffGroup;
                }
            });

            _detailsEditor = new StaffGroupDetailsEditorComponent {
                StaffGroupDetail = _staffGroupDetail
            };

            _staffEditor = new SelectorEditorComponent <StaffSummary, StaffTable>(
                formDataResponse.AllStaff,
                _staffGroupDetail.Members,
                staff => staff.StaffRef);

            var isWorklistEditorReadOnly = Thread.CurrentPrincipal.IsInRole(Application.Common.AuthorityTokens.Admin.Data.Worklist) == false;

            _worklistEditor = new SelectorEditorComponent <WorklistSummary, WorklistTable>(
                formDataResponse.AllAdminWorklists,
                _staffGroupDetail.Worklists,
                worklist => worklist.WorklistRef,
                isWorklistEditorReadOnly);

            this.Pages.Add(new NavigatorPage("Staff Group", _detailsEditor));
            this.Pages.Add(new NavigatorPage("Staff Group/Members", _staffEditor));
            this.Pages.Add(new NavigatorPage(
                               isWorklistEditorReadOnly
                                        ? "Staff Group/Subscribed Worklists (read only)"
                                        : "Staff Group/Subscribed Worklists",
                               _worklistEditor));

            // instantiate all extension pages
            _extensionPages = new List <IStaffGroupEditorPage>();
            foreach (IStaffGroupEditorPageProvider pageProvider in new StaffGroupEditorPageProviderExtensionPoint().CreateExtensions())
            {
                _extensionPages.AddRange(pageProvider.GetPages(new EditorContext(this)));
            }

            // add extension pages to navigator
            // the navigator will start those components if the user goes to that page
            foreach (var page in _extensionPages)
            {
                this.Pages.Add(new NavigatorPage(page.Path, page.GetComponent()));
            }

            base.Start();
        }