private static void ImportReportingWorklistFilters(WorklistData data, ReportingWorklist worklist, IUpdateContext context) { ImportStaffFilter(worklist.InterpretedByStaffFilter, data.Filters.InterpretedByStaff, context); ImportStaffFilter(worklist.TranscribedByStaffFilter, data.Filters.TranscribedByStaff, context); ImportStaffFilter(worklist.VerifiedByStaffFilter, data.Filters.VerifiedByStaff, context); ImportStaffFilter(worklist.SupervisedByStaffFilter, data.Filters.SupervisedByStaff, context); }
private void ExportReportingWorklistFilters(WorklistData data, ReportingWorklist worklist) { ExportStaffFilter(worklist.InterpretedByStaffFilter, data.Filters.InterpretedByStaff); ExportStaffFilter(worklist.TranscribedByStaffFilter, data.Filters.TranscribedByStaff); ExportStaffFilter(worklist.VerifiedByStaffFilter, data.Filters.VerifiedByStaff); ExportStaffFilter(worklist.SupervisedByStaffFilter, data.Filters.SupervisedByStaff); }
protected override void Import(WorklistData data, IUpdateContext context) { var worklist = LoadOrCreateWorklist(data.Name, data.Class, context); worklist.Description = data.Description; if (data.StaffSubscribers != null) { foreach (var s in data.StaffSubscribers) { var criteria = new StaffSearchCriteria(); criteria.Id.EqualTo(s.StaffId); var staff = context.GetBroker <IStaffBroker>().Find(criteria); if (staff.Count == 1) { worklist.StaffSubscribers.Add(CollectionUtils.FirstElement(staff)); } } } if (data.GroupSubscribers != null) { foreach (var s in data.GroupSubscribers) { var criteria = new StaffGroupSearchCriteria(); criteria.Name.EqualTo(s.StaffGroupName); var groups = context.GetBroker <IStaffGroupBroker>().Find(criteria); if (groups.Count == 1) { worklist.GroupSubscribers.Add(CollectionUtils.FirstElement(groups)); } } } // proc type filter ImportFilter( worklist.ProcedureTypeFilter, data.Filters.ProcedureTypes, delegate(WorklistData.ProcedureTypeData s) { var criteria = new ProcedureTypeSearchCriteria(); criteria.Id.EqualTo(s.Id); var broker = context.GetBroker <IProcedureTypeBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // proc type group filter ImportFilter( worklist.ProcedureTypeGroupFilter, data.Filters.ProcedureTypeGroups, delegate(WorklistData.ProcedureTypeGroupData s) { var criteria = new ProcedureTypeGroupSearchCriteria(); criteria.Name.EqualTo(s.Name); var broker = context.GetBroker <IProcedureTypeGroupBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria, ProcedureTypeGroup.GetSubClass(s.Class, context)))); }); //Bug #2284: don't forget to set the IncludeWorkingFacility property // facility filter worklist.FacilityFilter.IncludeWorkingFacility = data.Filters.Facilities.IncludeWorkingFacility; ImportFilter( worklist.FacilityFilter, data.Filters.Facilities, delegate(WorklistData.EnumValueData s) { var criteria = new FacilitySearchCriteria(); criteria.Code.EqualTo(s.Code); var broker = context.GetBroker <IFacilityBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // department filter ImportFilter( worklist.DepartmentFilter, data.Filters.Departments, delegate(WorklistData.DepartmentData s) { var criteria = new DepartmentSearchCriteria(); criteria.Id.EqualTo(s.Id); var broker = context.GetBroker <IDepartmentBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // priority filter ImportFilter( worklist.OrderPriorityFilter, data.Filters.OrderPriorities, delegate(WorklistData.EnumValueData s) { var broker = context.GetBroker <IEnumBroker>(); return(broker.Find <OrderPriorityEnum>(s.Code)); }); // ordering prac filter ImportFilter( worklist.OrderingPractitionerFilter, data.Filters.OrderingPractitioners, delegate(WorklistData.PractitionerData s) { var criteria = new ExternalPractitionerSearchCriteria(); criteria.Name.FamilyName.EqualTo(s.FamilyName); criteria.Name.GivenName.EqualTo(s.GivenName); // these criteria may not be provided (the data may not existed when exported), // but if available, they help to ensure the correct practitioner is being mapped if (!string.IsNullOrEmpty(s.BillingNumber)) { criteria.BillingNumber.EqualTo(s.BillingNumber); } if (!string.IsNullOrEmpty(s.LicenseNumber)) { criteria.LicenseNumber.EqualTo(s.LicenseNumber); } var broker = context.GetBroker <IExternalPractitionerBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // patient class filter ImportFilter( worklist.PatientClassFilter, data.Filters.PatientClasses, delegate(WorklistData.EnumValueData s) { var broker = context.GetBroker <IEnumBroker>(); return(broker.Find <PatientClassEnum>(s.Code)); }); // patient location filter ImportFilter( worklist.PatientLocationFilter, data.Filters.PatientLocations, delegate(WorklistData.LocationData s) { var criteria = new LocationSearchCriteria(); criteria.Id.EqualTo(s.Id); var broker = context.GetBroker <ILocationBroker>(); return(CollectionUtils.FirstElement(broker.Find(criteria))); }); // portable filter worklist.PortableFilter.IsEnabled = data.Filters.Portable.Enabled; worklist.PortableFilter.Value = data.Filters.Portable.Value; //Bug #2429: don't forget to include the time filter // time filter worklist.TimeFilter.IsEnabled = data.Filters.TimeWindow.Enabled; worklist.TimeFilter.Value = data.Filters.TimeWindow == null || data.Filters.TimeWindow.Value == null ? null : data.Filters.TimeWindow.Value.CreateTimeRange(); // reporting filters if (Worklist.GetSupportsReportingStaffRoleFilter(worklist.GetClass())) { ImportReportingWorklistFilters(data, worklist.As <ReportingWorklist>(), context); } }
protected override WorklistData Export(Worklist worklist, IReadContext context) { var data = new WorklistData(); data.Class = worklist.GetClass().FullName; data.Name = worklist.Name; data.Description = worklist.Description; data.StaffSubscribers = CollectionUtils.Map( worklist.StaffSubscribers, (Staff staff) => new WorklistData.StaffSubscriberData { StaffId = staff.Id }); data.GroupSubscribers = CollectionUtils.Map( worklist.GroupSubscribers, (StaffGroup group) => new WorklistData.GroupSubscriberData { StaffGroupName = group.Name }); // proc type filter ExportFilter( worklist.ProcedureTypeFilter, data.Filters.ProcedureTypes, item => new WorklistData.ProcedureTypeData { Id = item.Id }); // proc type group filter ExportFilter( worklist.ProcedureTypeGroupFilter, data.Filters.ProcedureTypeGroups, group => new WorklistData.ProcedureTypeGroupData { Class = group.GetClass().FullName, Name = group.Name }); // facility filter data.Filters.Facilities.IncludeWorkingFacility = worklist.FacilityFilter.IncludeWorkingFacility; ExportFilter( worklist.FacilityFilter, data.Filters.Facilities, item => new WorklistData.EnumValueData(item.Code)); // department filter ExportFilter( worklist.DepartmentFilter, data.Filters.Departments, item => new WorklistData.DepartmentData(item.Id)); // priority filter ExportFilter(worklist.OrderPriorityFilter, data.Filters.OrderPriorities, item => new WorklistData.EnumValueData(item.Code)); // ordering prac filter ExportFilter(worklist.OrderingPractitionerFilter, data.Filters.OrderingPractitioners, item => new WorklistData.PractitionerData(item.Name.FamilyName, item.Name.GivenName, item.LicenseNumber, item.BillingNumber)); // patient class filter ExportFilter(worklist.PatientClassFilter, data.Filters.PatientClasses, item => new WorklistData.EnumValueData(item.Code)); // patient location filter ExportFilter(worklist.PatientLocationFilter, data.Filters.PatientLocations, item => new WorklistData.LocationData(item.Id)); // portable filter data.Filters.Portable.Enabled = worklist.PortableFilter.IsEnabled; data.Filters.Portable.Value = worklist.PortableFilter.Value; //Bug #2429: don't forget to include the time filter // time filter data.Filters.TimeWindow.Enabled = worklist.TimeFilter.IsEnabled; data.Filters.TimeWindow.Value = worklist.TimeFilter.Value == null ? null : new WorklistData.TimeRangeData(worklist.TimeFilter.Value); // reporting worklist filters if (Worklist.GetSupportsReportingStaffRoleFilter(worklist.GetClass())) { ExportReportingWorklistFilters(data, worklist.As <ReportingWorklist>()); } return(data); }