public void EditSelectedWorklist() { if (_selectedWorklist != null) { WorklistAdminDetail detail = new WorklistAdminDetail(); detail.Name = _selectedWorklist.Name; detail.Description = _selectedWorklist.Description; detail.WorklistClass = _selectedWorklist.Class; WorklistDetailEditorComponent editor = new WorklistDetailEditorComponent( detail, this.WorklistClasses, _ownerGroupChoices, WorklistEditorMode.Edit, true, true); if (ApplicationComponent.LaunchAsDialog(this.Host.DesktopWindow, editor, SR.TitleEditWorklist) == ApplicationComponentExitCode.Accepted) { _selectedWorklist.Name = detail.Name; _selectedWorklist.Description = detail.Description; _worklistTable.Items.NotifyItemUpdated(_selectedWorklist); } } }
private void UpdateWorklistHelper(WorklistAdminDetail detail, Worklist worklist) { var adminAssembler = new WorklistAdminAssembler(); adminAssembler.UpdateWorklist( worklist, detail, worklist.Owner.IsAdminOwner, // only update subscribers iff the worklist is admin owned this.PersistenceContext); }
/// <summary> /// Constructor /// </summary> public WorklistFilterEditorComponent(WorklistAdminDetail detail, List <FacilitySummary> facilityChoices, List <EnumValueInfo> priorityChoices, List <EnumValueInfo> patientClassChoices) { _worklistDetail = detail; _facilityChoices = new ArrayList(); _facilityChoices.Add(_workingFacilityItem); _facilityChoices.AddRange(facilityChoices); _selectedFacilities = new ArrayList(); _selectedPortabilities = new ArrayList(); _priorityChoices = priorityChoices; _patientClassChoices = patientClassChoices; }
/// <summary> /// Constructor /// </summary> public WorklistDetailEditorComponent(WorklistAdminDetail detail, List <WorklistClassSummary> worklistClasses, List <StaffGroupSummary> ownerGroupChoices, WorklistEditorMode editorMode, bool adminMode, bool dialogMode) : base(worklistClasses, GetDefaultWorklistClass(worklistClasses, detail)) { _worklistDetail = detail; _dialogMode = dialogMode; _editorMode = editorMode; _adminMode = adminMode; _groupChoices = ownerGroupChoices; if (_editorMode == WorklistEditorMode.Add) { // default to "personal" if user has authority _isPersonal = HasPersonalAdminAuthority; } else { // default to "personal" if not a user worklist (this could happen when duplicating from an admin worklist) _isPersonal = !_worklistDetail.IsUserWorklist || _worklistDetail.IsStaffOwned; } // update the class to the default (if this is a new worklist) _worklistDetail.WorklistClass = GetDefaultWorklistClass(worklistClasses, detail); this.Validation.Add( new ValidationRule("SelectedGroup", delegate { var success = _adminMode || this.IsPersonal || (this.IsGroup && this.SelectedGroup != null); return(new ValidationResult(success, SR.MessageValueRequired)); })); this.Validation.Add(new ValidationRule("IsPersonal", delegate { var showValidation = this.IsPersonalGroupSelectionEnabled && this.IsPersonal && _hasWorklistCountError; return(new ValidationResult(!showValidation, _worklistCountErrorMessage)); })); this.Validation.Add(new ValidationRule("SelectedGroup", delegate { var showValidation = this.IsPersonalGroupSelectionEnabled && this.IsGroup && _worklistDetail.OwnerGroup != null && _hasWorklistCountError; return(new ValidationResult(!showValidation, _worklistCountErrorMessage)); })); }
private WorklistOwner CreateOwner(WorklistAdminDetail detail, bool userWorklist) { // if not creating a user worklist, the owner is Admin if (!userWorklist) { return(WorklistOwner.Admin); } // if an owner group is specified, assign ownership to the group if (detail.IsGroupOwned) { var group = PersistenceContext.Load <StaffGroup>(detail.OwnerGroup.StaffGroupRef, EntityLoadFlags.Proxy); return(new WorklistOwner(group)); } // otherwise assign ownership to current user, regardless of whether a different owner staff specified return(new WorklistOwner(CurrentUserStaff)); }
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); } }
public WorklistSummaryComponent(WorklistAdminDetail worklist, bool isAdmin) { _context = new WorklistSummaryContext(worklist, isAdmin); }
public WorklistSummaryContext(WorklistAdminDetail worklist, bool isAdmin) { _worklist = worklist; _isAdmin = isAdmin; }
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"; } }
/// <summary> /// Constructor /// </summary> public WorklistTimeWindowEditorComponent(WorklistAdminDetail detail, bool setDefaultTimeWindows, int maxSpanDays) { _worklistDetail = detail; _setDefaultTimeWindows = setDefaultTimeWindows; _maxSpanDays = maxSpanDays; }
private static WorklistClassSummary GetDefaultWorklistClass(IEnumerable <WorklistClassSummary> worklistClasses, WorklistAdminDetail detail) { return(detail.WorklistClass ?? CollectionUtils.SelectFirst(worklistClasses, w => w.ClassName == WorklistEditorComponentSettings.Default.DefaultWorklistClass)); }
/// <summary> /// Create worklist detail. /// </summary> /// <param name="worklist"></param> /// <param name="context"></param> /// <returns></returns> public WorklistAdminDetail CreateWorklistDetail(Worklist worklist, IPersistenceContext context) { var detail = new WorklistAdminDetail(worklist.GetRef(), worklist.Name, worklist.Description, CreateClassSummary(worklist.GetClass())); var staffAssembler = new StaffAssembler(); var staffGroupAssembler = new StaffGroupAssembler(); detail.OwnerStaff = worklist.Owner.IsStaffOwner ? staffAssembler.CreateStaffSummary(worklist.Owner.Staff, context) : null; detail.OwnerGroup = worklist.Owner.IsGroupOwner ? staffGroupAssembler.CreateSummary(worklist.Owner.Group) : null; // proc types var ptAssembler = new ProcedureTypeAssembler(); detail.ProcedureTypes = GetFilterSummary(worklist.ProcedureTypeFilter, item => ptAssembler.CreateSummary(item)); // proc type groups var ptgAssembler = new ProcedureTypeGroupAssembler(); detail.ProcedureTypeGroups = GetFilterSummary(worklist.ProcedureTypeGroupFilter, item => ptgAssembler.GetProcedureTypeGroupSummary(item, context)); // facilities var facilityAssembler = new FacilityAssembler(); detail.Facilities = GetFilterSummary(worklist.FacilityFilter, item => facilityAssembler.CreateFacilitySummary(item)); detail.FilterByWorkingFacility = worklist.FacilityFilter.IsEnabled && worklist.FacilityFilter.IncludeWorkingFacility; // departments var departmentAssembler = new DepartmentAssembler(); detail.Departments = GetFilterSummary(worklist.DepartmentFilter, item => departmentAssembler.CreateSummary(item, context)); // patient class detail.PatientClasses = GetFilterSummary(worklist.PatientClassFilter, item => EnumUtils.GetEnumValueInfo(item)); // location var locationAssembler = new LocationAssembler(); detail.PatientLocations = GetFilterSummary(worklist.PatientLocationFilter, item => locationAssembler.CreateLocationSummary(item)); // order priority detail.OrderPriorities = GetFilterSummary(worklist.OrderPriorityFilter, item => EnumUtils.GetEnumValueInfo(item)); // ordering prac var practitionerAssembler = new ExternalPractitionerAssembler(); detail.OrderingPractitioners = GetFilterSummary(worklist.OrderingPractitionerFilter, item => practitionerAssembler.CreateExternalPractitionerSummary(item, context)); // portable if (worklist.PortableFilter.IsEnabled) { detail.Portabilities = new List <bool> { worklist.PortableFilter.Value }; } // time window if (worklist.TimeFilter.IsEnabled && worklist.TimeFilter.Value != null) { if (worklist.TimeFilter.Value.Start != null) { detail.StartTime = CreateTimePointContract(worklist.TimeFilter.Value.Start); } if (worklist.TimeFilter.Value.End != null) { detail.EndTime = CreateTimePointContract(worklist.TimeFilter.Value.End); } } detail.StaffSubscribers = CollectionUtils.Map(worklist.StaffSubscribers, (Staff staff) => staffAssembler.CreateStaffSummary(staff, context)); detail.GroupSubscribers = CollectionUtils.Map(worklist.GroupSubscribers, (StaffGroup group) => staffGroupAssembler.CreateSummary(group)); // Some ReportingWorklists can support staff role filters, if that is true for this worklist, // add those filters to the WorklistAdminDetail if (Worklist.GetSupportsReportingStaffRoleFilter(worklist.GetClass())) { var reportingWorklist = worklist.As <ReportingWorklist>(); detail.InterpretedByStaff = GetFilterSummary(reportingWorklist.InterpretedByStaffFilter, context); detail.TranscribedByStaff = GetFilterSummary(reportingWorklist.TranscribedByStaffFilter, context); detail.VerifiedByStaff = GetFilterSummary(reportingWorklist.VerifiedByStaffFilter, context); detail.SupervisedByStaff = GetFilterSummary(reportingWorklist.SupervisedByStaffFilter, context); } return(detail); }
/// <summary> /// Update specified worklist from detail. /// </summary> /// <param name="worklist"></param> /// <param name="detail"></param> /// <param name="updateSubscribers"></param> /// <param name="context"></param> public void UpdateWorklist(Worklist worklist, WorklistAdminDetail detail, bool updateSubscribers, IPersistenceContext context) { worklist.Name = detail.Name; worklist.Description = detail.Description; // do not update the worklist.Owner here!!! - once set, it should never be updated // procedure types UpdateFilter(worklist.ProcedureTypeFilter, detail.ProcedureTypes, summary => context.Load <ProcedureType>(summary.ProcedureTypeRef, EntityLoadFlags.Proxy)); // procedure groups UpdateFilter(worklist.ProcedureTypeGroupFilter, detail.ProcedureTypeGroups, summary => context.Load <ProcedureTypeGroup>(summary.ProcedureTypeGroupRef, EntityLoadFlags.Proxy)); // facilities UpdateFilter(worklist.FacilityFilter, detail.Facilities, summary => context.Load <Facility>(summary.FacilityRef, EntityLoadFlags.Proxy)); worklist.FacilityFilter.IncludeWorkingFacility = detail.FilterByWorkingFacility; worklist.FacilityFilter.IsEnabled = worklist.FacilityFilter.Values.Count > 0 || worklist.FacilityFilter.IncludeWorkingFacility; // departments UpdateFilter(worklist.DepartmentFilter, detail.Departments, summary => context.Load <Department>(summary.DepartmentRef, EntityLoadFlags.Proxy)); // patient classes UpdateFilter(worklist.PatientClassFilter, detail.PatientClasses, summary => EnumUtils.GetEnumValue <PatientClassEnum>(summary, context)); // patient locations UpdateFilter(worklist.PatientLocationFilter, detail.PatientLocations, summary => context.Load <Location>(summary.LocationRef, EntityLoadFlags.Proxy)); // order priorities UpdateFilter(worklist.OrderPriorityFilter, detail.OrderPriorities, summary => EnumUtils.GetEnumValue <OrderPriorityEnum>(summary, context)); // ordering practitioners UpdateFilter(worklist.OrderingPractitionerFilter, detail.OrderingPractitioners, summary => context.Load <ExternalPractitioner>(summary.PractitionerRef, EntityLoadFlags.Proxy)); // portable if (detail.Portabilities != null) { // put them into a set to guarantee uniqueness, in case the client sent a non-unique list var set = new HashedSet <bool>(detail.Portabilities); // it only makes sense to enable this filter if the set contains exactly one value (true or false, but not both) worklist.PortableFilter.IsEnabled = set.Count == 1; worklist.PortableFilter.Value = CollectionUtils.FirstElement(set, false); } var start = CreateTimePoint(detail.StartTime); var end = CreateTimePoint(detail.EndTime); if (start != null || end != null) { worklist.TimeFilter.Value = new WorklistTimeRange(start, end); worklist.TimeFilter.IsEnabled = true; } else { worklist.TimeFilter.IsEnabled = false; } // process subscriptions if (updateSubscribers) { worklist.StaffSubscribers.Clear(); worklist.StaffSubscribers.AddAll( CollectionUtils.Map(detail.StaffSubscribers, (StaffSummary summary) => context.Load <Staff>(summary.StaffRef, EntityLoadFlags.Proxy))); worklist.GroupSubscribers.Clear(); worklist.GroupSubscribers.AddAll( CollectionUtils.Map(detail.GroupSubscribers, (StaffGroupSummary summary) => context.Load <StaffGroup>(summary.StaffGroupRef, EntityLoadFlags.Proxy))); } // If the worklist supports staff role filters, process the filters provided. if (Worklist.GetSupportsReportingStaffRoleFilter(worklist.GetClass())) { var reportingWorklist = worklist.As <ReportingWorklist>(); UpdateFilter(reportingWorklist.InterpretedByStaffFilter, detail.InterpretedByStaff, context); UpdateFilter(reportingWorklist.TranscribedByStaffFilter, detail.TranscribedByStaff, context); UpdateFilter(reportingWorklist.VerifiedByStaffFilter, detail.VerifiedByStaff, context); UpdateFilter(reportingWorklist.SupervisedByStaffFilter, detail.SupervisedByStaff, context); } }