Beispiel #1
0
        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));
        }
Beispiel #2
0
        private static void UpdateListItem(OrderListItem data, Procedure rp, IPersistenceContext context)
        {
            var rptAssembler = new ProcedureTypeAssembler();

            data.ProcedureRef  = rp.GetRef();
            data.ProcedureType = rptAssembler.CreateSummary(rp.Type);
            data.ProcedureScheduledStartTime = rp.ScheduledStartTime;
            data.ProcedureSchedulingCode     = EnumUtils.GetEnumValueInfo(rp.SchedulingCode);
            data.ProcedureCheckInTime        = rp.ProcedureCheckIn.CheckInTime;
            data.ProcedureCheckOutTime       = rp.ProcedureCheckIn.CheckOutTime;
            data.ProcedureStatus             = EnumUtils.GetEnumValueInfo(rp.Status, context);
            data.ProcedurePerformingFacility = new FacilityAssembler().CreateFacilitySummary(rp.PerformingFacility);
            data.ProcedurePortable           = rp.Portable;
            data.ProcedureLaterality         = EnumUtils.GetEnumValueInfo(rp.Laterality, context);
        }
        public UpdateProcedureTypeResponse UpdateProcedureType(UpdateProcedureTypeRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckMemberIsSet(request.ProcedureType, "request.ProcedureType");
            Platform.CheckMemberIsSet(request.ProcedureType.ProcedureTypeRef, "request.ProcedureType.ProcedureTypeRef");

            var item = PersistenceContext.Load <ProcedureType>(request.ProcedureType.ProcedureTypeRef);

            var assembler = new ProcedureTypeAssembler();

            assembler.UpdateProcedureType(item, request.ProcedureType, PersistenceContext);

            PersistenceContext.SynchState();

            return(new UpdateProcedureTypeResponse(assembler.CreateSummary(item)));
        }
        public AddProcedureTypeResponse AddProcedureType(AddProcedureTypeRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckMemberIsSet(request.ProcedureType, "request.ProcedureType");

            var item = new ProcedureType();

            var assembler = new ProcedureTypeAssembler();

            assembler.UpdateProcedureType(item, request.ProcedureType, PersistenceContext);

            PersistenceContext.Lock(item, DirtyState.New);
            PersistenceContext.SynchState();

            return(new AddProcedureTypeResponse(assembler.CreateSummary(item)));
        }
        public GetPriorsResponse GetPriors(GetPriorsRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            if (request.OrderRef == null && request.ReportRef == null)
            {
                throw new ArgumentException("Either OrderRef or ReportRef must be non-null");
            }

            var priorReports = new HashedSet <Prior>();
            var broker       = this.PersistenceContext.GetBroker <IPriorReportBroker>();

            // if an order was supplied, find relevant priors for the order
            if (request.OrderRef != null)
            {
                var order = this.PersistenceContext.Load <Order>(request.OrderRef, EntityLoadFlags.Proxy);
                priorReports.AddAll(broker.GetPriors(order, request.RelevantOnly));
            }
            // if a report was supplied, find relevent priors for the report
            else if (request.ReportRef != null)
            {
                var report = this.PersistenceContext.Load <Report>(request.ReportRef, EntityLoadFlags.Proxy);
                priorReports.AddAll(broker.GetPriors(report, request.RelevantOnly));
            }

            // assemble results
            var procedureTypeAssembler     = new ProcedureTypeAssembler();
            var diagnosticServiceAssembler = new DiagnosticServiceAssembler();

            // Note: we use the ProcedureCheckin.CheckOutTime as the PerformedDate
            // because it is the closest to the end of modality procedure step completion time.
            // However, if we change the definition of CheckOutTime in the future, this won't be accurate
            var priorSummaries = CollectionUtils.Map(priorReports,
                                                     (Prior prior) => new PriorProcedureSummary(
                                                         prior.Order.GetRef(),
                                                         prior.Procedure.GetRef(),
                                                         prior.Report.GetRef(),
                                                         prior.Order.AccessionNumber,
                                                         diagnosticServiceAssembler.CreateSummary(prior.Order.DiagnosticService),
                                                         procedureTypeAssembler.CreateSummary(prior.ProcedureType),
                                                         prior.Procedure.Portable,
                                                         EnumUtils.GetEnumValueInfo(prior.Procedure.Laterality, PersistenceContext),
                                                         EnumUtils.GetEnumValueInfo(prior.Report.Status, PersistenceContext),
                                                         prior.Procedure.ProcedureCheckIn.CheckOutTime));

            return(new GetPriorsResponse(priorSummaries));
        }
		public GetProcedureTypeGroupEditFormDataResponse GetProcedureTypeGroupEditFormData(
			GetProcedureTypeGroupEditFormDataRequest request)
		{
			var response = new GetProcedureTypeGroupEditFormDataResponse();
			var ptgAssembler = new ProcedureTypeGroupAssembler();
			var subClasses = ProcedureTypeGroup.ListSubClasses(PersistenceContext);

			// Category choices
			response.Categories = CollectionUtils.Map(subClasses, (Type t) => ptgAssembler.GetCategoryEnumValueInfo(t));

			// ProcedureType choices
			var assembler = new ProcedureTypeAssembler();
			response.ProcedureTypes = CollectionUtils.Map(
				PersistenceContext.GetBroker<IProcedureTypeBroker>().FindAll(request.IncludeDeactivated),
				(ProcedureType rpt) => assembler.CreateSummary(rpt));

			return response;
		}
        public GetProcedureTypeGroupEditFormDataResponse GetProcedureTypeGroupEditFormData(
            GetProcedureTypeGroupEditFormDataRequest request)
        {
            var response     = new GetProcedureTypeGroupEditFormDataResponse();
            var ptgAssembler = new ProcedureTypeGroupAssembler();
            var subClasses   = ProcedureTypeGroup.ListSubClasses(PersistenceContext);

            // Category choices
            response.Categories = CollectionUtils.Map(subClasses, (Type t) => ptgAssembler.GetCategoryEnumValueInfo(t));

            // ProcedureType choices
            var assembler = new ProcedureTypeAssembler();

            response.ProcedureTypes = CollectionUtils.Map(
                PersistenceContext.GetBroker <IProcedureTypeBroker>().FindAll(request.IncludeDeactivated),
                (ProcedureType rpt) => assembler.CreateSummary(rpt));

            return(response);
        }
		public AddProcedureTypeResponse AddProcedureType(AddProcedureTypeRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.ProcedureType, "request.ProcedureType");

			var item = new ProcedureType();

			var assembler = new ProcedureTypeAssembler();
			assembler.UpdateProcedureType(item, request.ProcedureType, PersistenceContext);

			PersistenceContext.Lock(item, DirtyState.New);
			PersistenceContext.SynchState();

			return new AddProcedureTypeResponse(assembler.CreateSummary(item));
		}
		private static void UpdateListItem(OrderListItem data, Procedure rp, IPersistenceContext context)
		{
			var rptAssembler = new ProcedureTypeAssembler();
			data.ProcedureRef = rp.GetRef();
			data.ProcedureType = rptAssembler.CreateSummary(rp.Type);
			data.ProcedureScheduledStartTime = rp.ScheduledStartTime;
			data.ProcedureSchedulingCode = EnumUtils.GetEnumValueInfo(rp.SchedulingCode);
			data.ProcedureCheckInTime = rp.ProcedureCheckIn.CheckInTime;
			data.ProcedureCheckOutTime = rp.ProcedureCheckIn.CheckOutTime;
			data.ProcedureStatus = EnumUtils.GetEnumValueInfo(rp.Status, context);
			data.ProcedurePerformingFacility = new FacilityAssembler().CreateFacilitySummary(rp.PerformingFacility);
			data.ProcedurePortable = rp.Portable;
			data.ProcedureLaterality = EnumUtils.GetEnumValueInfo(rp.Laterality, context);
		}
        public ListProcedureTypesResponse ListProcedureTypes(ListProcedureTypesRequest request)
        {
            Platform.CheckForNullReference(request, "request");

            var where = new ProcedureTypeSearchCriteria();
            where.Id.SortAsc(0);
            if (!string.IsNullOrEmpty(request.Id))
            {
                where.Id.StartsWith(request.Id);
            }
            if (!string.IsNullOrEmpty(request.Name))
            {
                where.Name.Like(string.Format("%{0}%", request.Name));
            }
            if (!request.IncludeDeactivated)
            {
                where.Deactivated.EqualTo(false);
            }

            var broker = PersistenceContext.GetBroker <IProcedureTypeBroker>();
            var items  = broker.Find(where, request.Page);

            var assembler = new ProcedureTypeAssembler();

            return(new ListProcedureTypesResponse(CollectionUtils.Map(items, (ProcedureType item) => assembler.CreateSummary(item))));
        }
		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);
		}
Beispiel #12
0
        public LoadDiagnosticServiceEditorFormDataResponse LoadDiagnosticServiceEditorFormData(LoadDiagnosticServiceEditorFormDataRequest request)
        {
            ProcedureTypeSearchCriteria where = new ProcedureTypeSearchCriteria();
            where.Id.SortAsc(0);
            where.Deactivated.EqualTo(false);

            IList <ProcedureType> procTypes = PersistenceContext.GetBroker <IProcedureTypeBroker>().Find(where);

            ProcedureTypeAssembler assembler = new ProcedureTypeAssembler();

            return(new LoadDiagnosticServiceEditorFormDataResponse(
                       CollectionUtils.Map <ProcedureType, ProcedureTypeSummary>(procTypes,
                                                                                 delegate(ProcedureType pt) { return assembler.CreateSummary(pt); })));
        }
Beispiel #13
0
		public GetPriorsResponse GetPriors(GetPriorsRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			if (request.OrderRef == null && request.ReportRef == null)
				throw new ArgumentException("Either OrderRef or ReportRef must be non-null");

			var priorReports = new HashedSet<Prior>();
			var broker = this.PersistenceContext.GetBroker<IPriorReportBroker>();

			// if an order was supplied, find relevant priors for the order
			if (request.OrderRef != null)
			{
				var order = this.PersistenceContext.Load<Order>(request.OrderRef, EntityLoadFlags.Proxy);
				priorReports.AddAll(broker.GetPriors(order, request.RelevantOnly));
			}
			// if a report was supplied, find relevent priors for the report
			else if (request.ReportRef != null)
			{
				var report = this.PersistenceContext.Load<Report>(request.ReportRef, EntityLoadFlags.Proxy);
				priorReports.AddAll(broker.GetPriors(report, request.RelevantOnly));
			}

			// assemble results
			var procedureTypeAssembler = new ProcedureTypeAssembler();
			var diagnosticServiceAssembler = new DiagnosticServiceAssembler();

			// Note: we use the ProcedureCheckin.CheckOutTime as the PerformedDate
			// because it is the closest to the end of modality procedure step completion time.
			// However, if we change the definition of CheckOutTime in the future, this won't be accurate
			var priorSummaries = CollectionUtils.Map(priorReports,
				(Prior prior) => new PriorProcedureSummary(
							prior.Order.GetRef(),
							prior.Procedure.GetRef(),
				         	prior.Report.GetRef(),
							prior.Order.AccessionNumber,
							diagnosticServiceAssembler.CreateSummary(prior.Order.DiagnosticService),
							procedureTypeAssembler.CreateSummary(prior.ProcedureType),
							prior.Procedure.Portable,
							EnumUtils.GetEnumValueInfo(prior.Procedure.Laterality, PersistenceContext),
							EnumUtils.GetEnumValueInfo(prior.Report.Status, PersistenceContext),
							prior.Procedure.ProcedureCheckIn.CheckOutTime));

			return new GetPriorsResponse(priorSummaries);
		}
        /// <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 UpdateProcedureTypeResponse UpdateProcedureType(UpdateProcedureTypeRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.ProcedureType, "request.ProcedureType");
			Platform.CheckMemberIsSet(request.ProcedureType.ProcedureTypeRef, "request.ProcedureType.ProcedureTypeRef");

			var item = PersistenceContext.Load<ProcedureType>(request.ProcedureType.ProcedureTypeRef);

			var assembler = new ProcedureTypeAssembler();
			assembler.UpdateProcedureType(item, request.ProcedureType, PersistenceContext);

			PersistenceContext.SynchState();

			return new UpdateProcedureTypeResponse(assembler.CreateSummary(item));
		}
		public ListProcedureTypesResponse ListProcedureTypes(ListProcedureTypesRequest request)
		{
			Platform.CheckForNullReference(request, "request");

			var where = new ProcedureTypeSearchCriteria();
			where.Id.SortAsc(0);
			if (!string.IsNullOrEmpty(request.Id))
				where.Id.StartsWith(request.Id);
			if (!string.IsNullOrEmpty(request.Name))
				where.Name.Like(string.Format("%{0}%", request.Name));
			if (!request.IncludeDeactivated)
				where.Deactivated.EqualTo(false);

			var broker = PersistenceContext.GetBroker<IProcedureTypeBroker>();
			var items = broker.Find(where, request.Page);

			var assembler = new ProcedureTypeAssembler();
			return new ListProcedureTypesResponse(CollectionUtils.Map(items, (ProcedureType item) => assembler.CreateSummary(item)));
		}
		public LoadDiagnosticServiceEditorFormDataResponse LoadDiagnosticServiceEditorFormData(LoadDiagnosticServiceEditorFormDataRequest request)
		{
			ProcedureTypeSearchCriteria where = new ProcedureTypeSearchCriteria();
			where.Id.SortAsc(0);
			where.Deactivated.EqualTo(false);

			IList<ProcedureType> procTypes = PersistenceContext.GetBroker<IProcedureTypeBroker>().Find(where);

			ProcedureTypeAssembler assembler = new ProcedureTypeAssembler();
			return new LoadDiagnosticServiceEditorFormDataResponse(
				CollectionUtils.Map<ProcedureType, ProcedureTypeSummary>(procTypes,
					delegate(ProcedureType pt) { return assembler.CreateSummary(pt); }));
		}