public ProcedureRequisition CreateProcedureRequisition(Procedure procedure, IPersistenceContext context) { var modality = procedure.ModalityProcedureSteps.Select(mps => mps.Modality).FirstOrDefault(); var procedureTypeAssembler = new ProcedureTypeAssembler(); var facilityAssembler = new FacilityAssembler(); var departmentAssembler = new DepartmentAssembler(); var modalityAssembler = new ModalityAssembler(); // create requisition return(new ProcedureRequisition( procedure.GetRef(), procedureTypeAssembler.CreateSummary(procedure.Type), procedure.Number, procedure.ScheduledStartTime, procedure.ScheduledDuration, modalityAssembler.CreateModalitySummary(modality), EnumUtils.GetEnumValueInfo(procedure.SchedulingCode), procedure.PerformingFacility == null ? null : facilityAssembler.CreateFacilitySummary(procedure.PerformingFacility), procedure.PerformingDepartment == null ? null : departmentAssembler.CreateSummary(procedure.PerformingDepartment, context), EnumUtils.GetEnumValueInfo(procedure.Laterality, context), procedure.Portable, procedure.IsPreCheckIn == false, EnumUtils.GetEnumValueInfo(procedure.Status, context), IsProcedureModifiable(procedure), procedure.Status == ProcedureStatus.CA || procedure.Status == ProcedureStatus.DC)); }
public LoadDepartmentForEditResponse LoadDepartmentForEdit(LoadDepartmentForEditRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.DepartmentRef, "request.DepartmentRef"); var item = PersistenceContext.Load<Department>(request.DepartmentRef); var assembler = new DepartmentAssembler(); return new LoadDepartmentForEditResponse(assembler.CreateDetail(item, PersistenceContext)); }
public LoadDepartmentForEditResponse LoadDepartmentForEdit(LoadDepartmentForEditRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.DepartmentRef, "request.DepartmentRef"); var item = PersistenceContext.Load <Department>(request.DepartmentRef); var assembler = new DepartmentAssembler(); return(new LoadDepartmentForEditResponse(assembler.CreateDetail(item, PersistenceContext))); }
public ListDepartmentsResponse ListDepartments(ListDepartmentsRequest request) { Platform.CheckForNullReference(request, "request"); var where = new DepartmentSearchCriteria(); where.Id.SortAsc(0); var broker = PersistenceContext.GetBroker<IDepartmentBroker>(); var items = broker.Find(where, request.Page); var assembler = new DepartmentAssembler(); return new ListDepartmentsResponse( CollectionUtils.Map(items,(Department item) => assembler.CreateSummary(item, PersistenceContext)) ); }
public AddDepartmentResponse AddDepartment(AddDepartmentRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.Department, "request.Department"); var item = new Department(); var assembler = new DepartmentAssembler(); assembler.UpdateDepartment(item, request.Department, PersistenceContext); PersistenceContext.Lock(item, DirtyState.New); PersistenceContext.SynchState(); return new AddDepartmentResponse(assembler.CreateSummary(item, PersistenceContext)); }
public UpdateDepartmentResponse UpdateDepartment(UpdateDepartmentRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.Department, "request.Department"); Platform.CheckMemberIsSet(request.Department.DepartmentRef, "request.Department.DepartmentRef"); var item = PersistenceContext.Load <Department>(request.Department.DepartmentRef); var assembler = new DepartmentAssembler(); assembler.UpdateDepartment(item, request.Department, PersistenceContext); PersistenceContext.SynchState(); return(new UpdateDepartmentResponse(assembler.CreateSummary(item, PersistenceContext))); }
public AddDepartmentResponse AddDepartment(AddDepartmentRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.Department, "request.Department"); var item = new Department(); var assembler = new DepartmentAssembler(); assembler.UpdateDepartment(item, request.Department, PersistenceContext); PersistenceContext.Lock(item, DirtyState.New); PersistenceContext.SynchState(); return(new AddDepartmentResponse(assembler.CreateSummary(item, PersistenceContext))); }
public ListDepartmentsResponse ListDepartments(ListDepartmentsRequest request) { Platform.CheckForNullReference(request, "request"); var where = new DepartmentSearchCriteria(); where.Id.SortAsc(0); var broker = PersistenceContext.GetBroker <IDepartmentBroker>(); var items = broker.Find(where, request.Page); var assembler = new DepartmentAssembler(); return(new ListDepartmentsResponse( CollectionUtils.Map(items, (Department item) => assembler.CreateSummary(item, PersistenceContext)) )); }
public GetOrderEntryFormDataResponse GetOrderEntryFormData(GetOrderEntryFormDataRequest request) { Platform.CheckForNullReference(request, "request"); // Sorted list of facility summaries for active facilities var facilityAssembler = new FacilityAssembler(); var facilitySearchCriteria = new FacilitySearchCriteria(); facilitySearchCriteria.Deactivated.EqualTo(false); facilitySearchCriteria.Name.SortAsc(0); var facilities = CollectionUtils.Map( this.PersistenceContext.GetBroker <IFacilityBroker>().Find(facilitySearchCriteria), (Facility f) => facilityAssembler.CreateFacilitySummary(f)); // Sorted list of department summaries for active departments var departmentAssembler = new DepartmentAssembler(); var departmentSearchCriteria = new DepartmentSearchCriteria(); departmentSearchCriteria.Deactivated.EqualTo(false); departmentSearchCriteria.Name.SortAsc(0); var departments = CollectionUtils.Map( this.PersistenceContext.GetBroker <IDepartmentBroker>().Find(departmentSearchCriteria), (Department d) => departmentAssembler.CreateSummary(d, this.PersistenceContext)); // Sorted list of department summaries for active departments var modalityAssembler = new ModalityAssembler(); var modalitySearchCriteria = new ModalitySearchCriteria(); modalitySearchCriteria.Deactivated.EqualTo(false); modalitySearchCriteria.Name.SortAsc(0); var modalities = CollectionUtils.Map( this.PersistenceContext.GetBroker <IModalityBroker>().Find(modalitySearchCriteria), (Modality d) => modalityAssembler.CreateModalitySummary(d)); return(new GetOrderEntryFormDataResponse( facilities, departments, modalities, EnumUtils.GetEnumValueList <OrderPriorityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList <OrderCancelReasonEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList <LateralityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList <SchedulingCodeEnum>(this.PersistenceContext) )); }
public ProcedureRequisition CreateProcedureRequisition(Procedure procedure, IPersistenceContext context) { var modality = procedure.ModalityProcedureSteps.Select(mps => mps.Modality).FirstOrDefault(); var procedureTypeAssembler = new ProcedureTypeAssembler(); var facilityAssembler = new FacilityAssembler(); var departmentAssembler = new DepartmentAssembler(); var modalityAssembler = new ModalityAssembler(); // create requisition return new ProcedureRequisition( procedure.GetRef(), procedureTypeAssembler.CreateSummary(procedure.Type), procedure.Number, procedure.ScheduledStartTime, procedure.ScheduledDuration, modalityAssembler.CreateModalitySummary(modality), EnumUtils.GetEnumValueInfo(procedure.SchedulingCode), procedure.PerformingFacility == null ? null : facilityAssembler.CreateFacilitySummary(procedure.PerformingFacility), procedure.PerformingDepartment == null ? null : departmentAssembler.CreateSummary(procedure.PerformingDepartment, context), EnumUtils.GetEnumValueInfo(procedure.Laterality, context), procedure.Portable, procedure.IsPreCheckIn == false, EnumUtils.GetEnumValueInfo(procedure.Status, context), IsProcedureModifiable(procedure), procedure.Status == ProcedureStatus.CA || procedure.Status == ProcedureStatus.DC); }
/// <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); }
public GetOrderEntryFormDataResponse GetOrderEntryFormData(GetOrderEntryFormDataRequest request) { Platform.CheckForNullReference(request, "request"); // Sorted list of facility summaries for active facilities var facilityAssembler = new FacilityAssembler(); var facilitySearchCriteria = new FacilitySearchCriteria(); facilitySearchCriteria.Deactivated.EqualTo(false); facilitySearchCriteria.Name.SortAsc(0); var facilities = CollectionUtils.Map( this.PersistenceContext.GetBroker<IFacilityBroker>().Find(facilitySearchCriteria), (Facility f) => facilityAssembler.CreateFacilitySummary(f)); // Sorted list of department summaries for active departments var departmentAssembler = new DepartmentAssembler(); var departmentSearchCriteria = new DepartmentSearchCriteria(); departmentSearchCriteria.Deactivated.EqualTo(false); departmentSearchCriteria.Name.SortAsc(0); var departments = CollectionUtils.Map( this.PersistenceContext.GetBroker<IDepartmentBroker>().Find(departmentSearchCriteria), (Department d) => departmentAssembler.CreateSummary(d, this.PersistenceContext)); // Sorted list of department summaries for active departments var modalityAssembler = new ModalityAssembler(); var modalitySearchCriteria = new ModalitySearchCriteria(); modalitySearchCriteria.Deactivated.EqualTo(false); modalitySearchCriteria.Name.SortAsc(0); var modalities = CollectionUtils.Map( this.PersistenceContext.GetBroker<IModalityBroker>().Find(modalitySearchCriteria), (Modality d) => modalityAssembler.CreateModalitySummary(d)); return new GetOrderEntryFormDataResponse( facilities, departments, modalities, EnumUtils.GetEnumValueList<OrderPriorityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList<OrderCancelReasonEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList<LateralityEnum>(this.PersistenceContext), EnumUtils.GetEnumValueList<SchedulingCodeEnum>(this.PersistenceContext) ); }
public UpdateDepartmentResponse UpdateDepartment(UpdateDepartmentRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.Department, "request.Department"); Platform.CheckMemberIsSet(request.Department.DepartmentRef, "request.Department.DepartmentRef"); var item = PersistenceContext.Load<Department>(request.Department.DepartmentRef); var assembler = new DepartmentAssembler(); assembler.UpdateDepartment(item, request.Department, PersistenceContext); PersistenceContext.SynchState(); return new UpdateDepartmentResponse(assembler.CreateSummary(item, PersistenceContext)); }
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); }
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; }