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"; } }
private GetWorklistEditFormChoicesResponse GetWorklistEditFormChoices(GetWorklistEditFormChoicesRequest request) { var response = new GetWorklistEditFormChoicesResponse(); var assembler = new WorklistAdminAssembler(); response.WorklistClasses = CollectionUtils.Map <Type, WorklistClassSummary>( ListClassesHelper(null, null, false), assembler.CreateClassSummary); var staffAssembler = new StaffAssembler(); response.StaffChoices = CollectionUtils.Map <Staff, StaffSummary>( this.PersistenceContext.GetBroker <IStaffBroker>().FindAll(false), item => staffAssembler.CreateStaffSummary(item, PersistenceContext)); var staffGroupAssembler = new StaffGroupAssembler(); response.GroupSubscriberChoices = CollectionUtils.Map <StaffGroup, StaffGroupSummary>( this.PersistenceContext.GetBroker <IStaffGroupBroker>().FindAll(false), staffGroupAssembler.CreateSummary); var facilityAssembler = new FacilityAssembler(); response.FacilityChoices = CollectionUtils.Map <Facility, FacilitySummary>( this.PersistenceContext.GetBroker <IFacilityBroker>().FindAll(false), facilityAssembler.CreateFacilitySummary); var departmentAssembler = new DepartmentAssembler(); response.DepartmentChoices = CollectionUtils.Map( this.PersistenceContext.GetBroker <IDepartmentBroker>().FindAll(false), (Department item) => departmentAssembler.CreateSummary(item, PersistenceContext)); var locationAssembler = new LocationAssembler(); response.PatientLocationChoices = CollectionUtils.Map <Location, LocationSummary>( this.PersistenceContext.GetBroker <ILocationBroker>().FindAll(false), locationAssembler.CreateLocationSummary); response.OrderPriorityChoices = EnumUtils.GetEnumValueList <OrderPriorityEnum>(PersistenceContext); response.PatientClassChoices = EnumUtils.GetEnumValueList <PatientClassEnum>(PersistenceContext); response.CurrentServerConfigurationRequiresTimeFilter = Worklist.CurrentServerConfigurationRequiresTimeFilter(); response.CurrentServerConfigurationMaxSpanDays = Worklist.CurrentServerConfigurationMaxSpanDays(); // add extra data iff editing a user-defined worklist (bug #4871) if (request.UserDefinedWorklist) { response.OwnerGroupChoices = CollectionUtils.Map <StaffGroup, StaffGroupSummary>( this.CurrentUserStaff.ActiveGroups, // only current user's active staff groups should be choosable staffGroupAssembler.CreateSummary); } var proceduerTypesAssembler = new ProcedureTypeAssembler(); response.ProcedureTypeChoices = CollectionUtils.Map <ProcedureType, ProcedureTypeSummary>( this.PersistenceContext.GetBroker <IProcedureTypeBroker>().FindAll(false), proceduerTypesAssembler.CreateSummary); return(response); }