public LoadDepartmentEditorFormDataResponse LoadDepartmentEditorFormData(LoadDepartmentEditorFormDataRequest request)
		{
			var facilityAssembler = new FacilityAssembler();
			var facilities = PersistenceContext.GetBroker<IFacilityBroker>().FindAll(false);
			return new LoadDepartmentEditorFormDataResponse(
				CollectionUtils.Map(facilities, (Facility f) => facilityAssembler.CreateFacilitySummary(f)));
		}
Пример #2
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));
        }
Пример #3
0
        public LoadVisitEditorFormDataResponse LoadVisitEditorFormData(LoadVisitEditorFormDataRequest request)
        {
            // ignore request

            LoadVisitEditorFormDataResponse response = new LoadVisitEditorFormDataResponse();

            response.AdmissionTypeChoices = EnumUtils.GetEnumValueList<AdmissionTypeEnum>(PersistenceContext);
            response.AmbulatoryStatusChoices = EnumUtils.GetEnumValueList<AmbulatoryStatusEnum>(PersistenceContext);
            response.PatientClassChoices = EnumUtils.GetEnumValueList<PatientClassEnum>(PersistenceContext);
            response.PatientTypeChoices = EnumUtils.GetEnumValueList<PatientTypeEnum>(PersistenceContext);
            response.VisitLocationRoleChoices = EnumUtils.GetEnumValueList<VisitLocationRoleEnum>(PersistenceContext);
            response.VisitNumberAssigningAuthorityChoices = EnumUtils.GetEnumValueList<InformationAuthorityEnum>(PersistenceContext);

            response.VisitPractitionerRoleChoices = EnumUtils.GetEnumValueList<VisitPractitionerRoleEnum>(PersistenceContext);
            response.VisitStatusChoices = EnumUtils.GetEnumValueList<VisitStatusEnum>(PersistenceContext);

            FacilityAssembler facilityAssembler = new FacilityAssembler();
            response.FacilityChoices = CollectionUtils.Map<Facility, FacilitySummary, List<FacilitySummary>>(
				PersistenceContext.GetBroker<IFacilityBroker>().FindAll(false),
                delegate(Facility f)
                {
                    return facilityAssembler.CreateFacilitySummary(f);
                });

			LocationAssembler locationAssembler = new LocationAssembler();
			response.CurrentLocationChoices = CollectionUtils.Map<Location, LocationSummary>(
				PersistenceContext.GetBroker<ILocationBroker>().FindAll(false),
				delegate(Location f)
				{
					return locationAssembler.CreateLocationSummary(f);
				});

			return response;
        }
Пример #4
0
        public LoadDepartmentEditorFormDataResponse LoadDepartmentEditorFormData(LoadDepartmentEditorFormDataRequest request)
        {
            var facilityAssembler = new FacilityAssembler();
            var facilities        = PersistenceContext.GetBroker <IFacilityBroker>().FindAll(false);

            return(new LoadDepartmentEditorFormDataResponse(
                       CollectionUtils.Map(facilities, (Facility f) => facilityAssembler.CreateFacilitySummary(f))));
        }
Пример #5
0
		public GetWorkingFacilityChoicesResponse GetWorkingFacilityChoices(GetWorkingFacilityChoicesRequest request)
		{
			// load all facilities and sort by code
			var facilities = PersistenceContext.GetBroker<IFacilityBroker>().FindAll(false);
			facilities = facilities.OrderBy(x => x.Code).ToList();

			var facilityAssembler = new FacilityAssembler();
			return new GetWorkingFacilityChoicesResponse(
				CollectionUtils.Map(facilities,
					(Facility input) => facilityAssembler.CreateFacilitySummary(input)));
		}
Пример #6
0
 public GetLocationEditFormDataResponse GetLocationEditFormData(GetLocationEditFormDataRequest request)
 {
     FacilityAssembler assembler = new FacilityAssembler();
     return new GetLocationEditFormDataResponse(
         CollectionUtils.Map<Facility, FacilitySummary, List<FacilitySummary>>(
             PersistenceContext.GetBroker<IFacilityBroker>().FindAll(false),
             delegate(Facility f)
             {
                 return assembler.CreateFacilitySummary(f);
             }));
 }
Пример #7
0
        public UpdateFacilityResponse UpdateFacility(UpdateFacilityRequest request)
        {
            var facility = PersistenceContext.Load <Facility>(request.FacilityDetail.FacilityRef, EntityLoadFlags.CheckVersion);

            var assembler = new FacilityAssembler();

            assembler.UpdateFacility(request.FacilityDetail, facility, this.PersistenceContext);

            CheckMultipleInformationAuthoritiesUsed();

            return(new UpdateFacilityResponse(assembler.CreateFacilitySummary(facility)));
        }
Пример #8
0
        public GetLocationEditFormDataResponse GetLocationEditFormData(GetLocationEditFormDataRequest request)
        {
            FacilityAssembler assembler = new FacilityAssembler();

            return(new GetLocationEditFormDataResponse(
                       CollectionUtils.Map <Facility, FacilitySummary, List <FacilitySummary> >(
                           PersistenceContext.GetBroker <IFacilityBroker>().FindAll(false),
                           delegate(Facility f)
            {
                return assembler.CreateFacilitySummary(f);
            })));
        }
Пример #9
0
        public GetWorkingFacilityChoicesResponse GetWorkingFacilityChoices(GetWorkingFacilityChoicesRequest request)
        {
            // load all facilities and sort by code
            var facilities = PersistenceContext.GetBroker <IFacilityBroker>().FindAll(false);

            facilities = facilities.OrderBy(x => x.Code).ToList();

            var facilityAssembler = new FacilityAssembler();

            return(new GetWorkingFacilityChoicesResponse(
                       CollectionUtils.Map(facilities,
                                           (Facility input) => facilityAssembler.CreateFacilitySummary(input))));
        }
Пример #10
0
		public AddFacilityResponse AddFacility(AddFacilityRequest request)
		{
			var facility = new Facility();
			var assembler = new FacilityAssembler();
			assembler.UpdateFacility(request.FacilityDetail, facility, this.PersistenceContext);

			PersistenceContext.Lock(facility, DirtyState.New);

			CheckMultipleInformationAuthoritiesUsed();

			// ensure the new facility is assigned an OID before using it in the return value
			PersistenceContext.SynchState();

			return new AddFacilityResponse(assembler.CreateFacilitySummary(facility));
		}
Пример #11
0
        private static void UpdateListItem(VisitListItem data, Visit visit, IPersistenceContext context)
        {
            var facilityAssembler = new FacilityAssembler();

            data.VisitRef       = visit.GetRef();
            data.VisitNumber    = new CompositeIdentifierDetail(visit.VisitNumber.Id, EnumUtils.GetEnumValueInfo(visit.VisitNumber.AssigningAuthority));
            data.PatientClass   = EnumUtils.GetEnumValueInfo(visit.PatientClass);
            data.PatientType    = EnumUtils.GetEnumValueInfo(visit.PatientType);
            data.AdmissionType  = EnumUtils.GetEnumValueInfo(visit.AdmissionType);
            data.VisitStatus    = EnumUtils.GetEnumValueInfo(visit.Status, context);
            data.AdmitTime      = visit.AdmitTime;
            data.DischargeTime  = visit.DischargeTime;
            data.VisitFacility  = facilityAssembler.CreateFacilitySummary(visit.Facility);
            data.PreadmitNumber = visit.PreadmitNumber;
        }
Пример #12
0
		private static void UpdateListItem(VisitListItem data, Visit visit, IPersistenceContext context)
		{
			var facilityAssembler = new FacilityAssembler();

			data.VisitRef = visit.GetRef();
			data.VisitNumber = new CompositeIdentifierDetail(visit.VisitNumber.Id, EnumUtils.GetEnumValueInfo(visit.VisitNumber.AssigningAuthority));
			data.PatientClass = EnumUtils.GetEnumValueInfo(visit.PatientClass);
			data.PatientType = EnumUtils.GetEnumValueInfo(visit.PatientType);
			data.AdmissionType = EnumUtils.GetEnumValueInfo(visit.AdmissionType);
			data.VisitStatus = EnumUtils.GetEnumValueInfo(visit.Status, context);
			data.AdmitTime = visit.AdmitTime;
			data.DischargeTime = visit.DischargeTime;
			data.VisitFacility = facilityAssembler.CreateFacilitySummary(visit.Facility);
			data.PreadmitNumber = visit.PreadmitNumber;
		}
Пример #13
0
        public AddFacilityResponse AddFacility(AddFacilityRequest request)
        {
            var facility  = new Facility();
            var assembler = new FacilityAssembler();

            assembler.UpdateFacility(request.FacilityDetail, facility, this.PersistenceContext);

            PersistenceContext.Lock(facility, DirtyState.New);

            CheckMultipleInformationAuthoritiesUsed();

            // ensure the new facility is assigned an OID before using it in the return value
            PersistenceContext.SynchState();

            return(new AddFacilityResponse(assembler.CreateFacilitySummary(facility)));
        }
Пример #14
0
        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)
                       ));
        }
Пример #15
0
		public OrderRequisition CreateOrderRequisition(Order order, IPersistenceContext context)
		{
			var patientProfileAssembler = new PatientProfileAssembler();
			var visitAssembler = new VisitAssembler();
			var pracAssembler = new ExternalPractitionerAssembler();
			var facilityAssembler = new FacilityAssembler();
			var dsAssembler = new DiagnosticServiceAssembler();
			var attachmentAssembler = new OrderAttachmentAssembler();
			var noteAssembler = new OrderNoteAssembler();
			var resultRecipientAssembler = new ResultRecipientAssembler();

			var requisition = new OrderRequisition
								{
									OrderRef = order.GetRef(),
									Patient =
										patientProfileAssembler.CreatePatientProfileSummary(
											CollectionUtils.FirstElement(order.Procedures).PatientProfile, context),
									Visit = visitAssembler.CreateVisitSummary(order.Visit, context),
									DiagnosticService = dsAssembler.CreateSummary(order.DiagnosticService),
									SchedulingRequestTime = order.SchedulingRequestTime,
									OrderingPractitioner =
										pracAssembler.CreateExternalPractitionerSummary(order.OrderingPractitioner, context),
									OrderingFacility = facilityAssembler.CreateFacilitySummary(order.OrderingFacility),
									ReasonForStudy = order.ReasonForStudy,
									Priority = EnumUtils.GetEnumValueInfo(order.Priority, context),
									ResultRecipients = CollectionUtils.Map<ResultRecipient, ResultRecipientDetail>(
										order.ResultRecipients,
										r => resultRecipientAssembler.CreateResultRecipientDetail(r, context)),
									Procedures = CollectionUtils.Map<Procedure, ProcedureRequisition>(
										order.Procedures,
										procedure => CreateProcedureRequisition(procedure, context)),
									Attachments = CollectionUtils.Map<OrderAttachment, AttachmentSummary>(
										order.Attachments,
										attachment => attachmentAssembler.CreateOrderAttachmentSummary(attachment, context)),
									Notes = CollectionUtils.Map<OrderNote, OrderNoteDetail>(
										OrderNote.GetNotesForOrder(order),
										note => noteAssembler.CreateOrderNoteDetail(note, context)),
									ExtendedProperties = ExtendedPropertyUtils.Copy(order.ExtendedProperties),
									CanModify = !order.IsTerminated
								};

			return requisition;
		}
Пример #16
0
        public OrderRequisition CreateOrderRequisition(Order order, IPersistenceContext context)
        {
            var patientProfileAssembler  = new PatientProfileAssembler();
            var visitAssembler           = new VisitAssembler();
            var pracAssembler            = new ExternalPractitionerAssembler();
            var facilityAssembler        = new FacilityAssembler();
            var dsAssembler              = new DiagnosticServiceAssembler();
            var attachmentAssembler      = new OrderAttachmentAssembler();
            var noteAssembler            = new OrderNoteAssembler();
            var resultRecipientAssembler = new ResultRecipientAssembler();

            var requisition = new OrderRequisition
            {
                OrderRef = order.GetRef(),
                Patient  =
                    patientProfileAssembler.CreatePatientProfileSummary(
                        CollectionUtils.FirstElement(order.Procedures).PatientProfile, context),
                Visit                 = visitAssembler.CreateVisitSummary(order.Visit, context),
                DiagnosticService     = dsAssembler.CreateSummary(order.DiagnosticService),
                SchedulingRequestTime = order.SchedulingRequestTime,
                OrderingPractitioner  =
                    pracAssembler.CreateExternalPractitionerSummary(order.OrderingPractitioner, context),
                OrderingFacility = facilityAssembler.CreateFacilitySummary(order.OrderingFacility),
                ReasonForStudy   = order.ReasonForStudy,
                Priority         = EnumUtils.GetEnumValueInfo(order.Priority, context),
                ResultRecipients = CollectionUtils.Map <ResultRecipient, ResultRecipientDetail>(
                    order.ResultRecipients,
                    r => resultRecipientAssembler.CreateResultRecipientDetail(r, context)),
                Procedures = CollectionUtils.Map <Procedure, ProcedureRequisition>(
                    order.Procedures,
                    procedure => CreateProcedureRequisition(procedure, context)),
                Attachments = CollectionUtils.Map <OrderAttachment, AttachmentSummary>(
                    order.Attachments,
                    attachment => attachmentAssembler.CreateOrderAttachmentSummary(attachment, context)),
                Notes = CollectionUtils.Map <OrderNote, OrderNoteDetail>(
                    OrderNote.GetNotesForOrder(order),
                    note => noteAssembler.CreateOrderNoteDetail(note, context)),
                ExtendedProperties = ExtendedPropertyUtils.Copy(order.ExtendedProperties),
                CanModify          = !order.IsTerminated
            };

            return(requisition);
        }
Пример #17
0
        private static void UpdateListItem(OrderListItem data, Order order, IPersistenceContext context)
        {
            var practitionerAssembler = new ExternalPractitionerAssembler();
            var dsAssembler           = new DiagnosticServiceAssembler();
            var facilityAssembler     = new FacilityAssembler();

            data.OrderRef              = order.GetRef();
            data.PlacerNumber          = order.PlacerNumber;
            data.AccessionNumber       = order.AccessionNumber;
            data.DiagnosticService     = dsAssembler.CreateSummary(order.DiagnosticService);
            data.EnteredTime           = order.EnteredTime;
            data.SchedulingRequestTime = order.SchedulingRequestTime;
            data.OrderingPractitioner  = practitionerAssembler.CreateExternalPractitionerSummary(order.OrderingPractitioner, context);
            data.OrderingFacility      = facilityAssembler.CreateFacilitySummary(order.OrderingFacility);
            data.ReasonForStudy        = order.ReasonForStudy;
            data.OrderPriority         = EnumUtils.GetEnumValueInfo(order.Priority, context);
            data.CancelReason          = order.CancelInfo != null && order.CancelInfo.Reason != null?EnumUtils.GetEnumValueInfo(order.CancelInfo.Reason) : null;

            data.OrderStatus             = EnumUtils.GetEnumValueInfo(order.Status, context);
            data.OrderScheduledStartTime = order.ScheduledStartTime;
        }
Пример #18
0
        public LoadVisitEditorFormDataResponse LoadVisitEditorFormData(LoadVisitEditorFormDataRequest request)
        {
            // ignore request

            LoadVisitEditorFormDataResponse response = new LoadVisitEditorFormDataResponse();

            response.AdmissionTypeChoices                 = EnumUtils.GetEnumValueList <AdmissionTypeEnum>(PersistenceContext);
            response.AmbulatoryStatusChoices              = EnumUtils.GetEnumValueList <AmbulatoryStatusEnum>(PersistenceContext);
            response.PatientClassChoices                  = EnumUtils.GetEnumValueList <PatientClassEnum>(PersistenceContext);
            response.PatientTypeChoices                   = EnumUtils.GetEnumValueList <PatientTypeEnum>(PersistenceContext);
            response.VisitLocationRoleChoices             = EnumUtils.GetEnumValueList <VisitLocationRoleEnum>(PersistenceContext);
            response.VisitNumberAssigningAuthorityChoices = EnumUtils.GetEnumValueList <InformationAuthorityEnum>(PersistenceContext);

            response.VisitPractitionerRoleChoices = EnumUtils.GetEnumValueList <VisitPractitionerRoleEnum>(PersistenceContext);
            response.VisitStatusChoices           = EnumUtils.GetEnumValueList <VisitStatusEnum>(PersistenceContext);

            FacilityAssembler facilityAssembler = new FacilityAssembler();

            response.FacilityChoices = CollectionUtils.Map <Facility, FacilitySummary, List <FacilitySummary> >(
                PersistenceContext.GetBroker <IFacilityBroker>().FindAll(false),
                delegate(Facility f)
            {
                return(facilityAssembler.CreateFacilitySummary(f));
            });

            LocationAssembler locationAssembler = new LocationAssembler();

            response.CurrentLocationChoices = CollectionUtils.Map <Location, LocationSummary>(
                PersistenceContext.GetBroker <ILocationBroker>().FindAll(false),
                delegate(Location f)
            {
                return(locationAssembler.CreateLocationSummary(f));
            });

            return(response);
        }
Пример #19
0
		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)
				);
		}
Пример #20
0
		private static void UpdateListItem(OrderListItem data, Order order, IPersistenceContext context)
		{
			var practitionerAssembler = new ExternalPractitionerAssembler();
			var dsAssembler = new DiagnosticServiceAssembler();
			var facilityAssembler = new FacilityAssembler();

			data.OrderRef = order.GetRef();
			data.PlacerNumber = order.PlacerNumber;
			data.AccessionNumber = order.AccessionNumber;
			data.DiagnosticService = dsAssembler.CreateSummary(order.DiagnosticService);
			data.EnteredTime = order.EnteredTime;
			data.SchedulingRequestTime = order.SchedulingRequestTime;
			data.OrderingPractitioner = practitionerAssembler.CreateExternalPractitionerSummary(order.OrderingPractitioner, context);
			data.OrderingFacility = facilityAssembler.CreateFacilitySummary(order.OrderingFacility);
			data.ReasonForStudy = order.ReasonForStudy;
			data.OrderPriority = EnumUtils.GetEnumValueInfo(order.Priority, context);
			data.CancelReason = order.CancelInfo != null && order.CancelInfo.Reason != null ? EnumUtils.GetEnumValueInfo(order.CancelInfo.Reason) : null;
			data.OrderStatus = EnumUtils.GetEnumValueInfo(order.Status, context);
			data.OrderScheduledStartTime = order.ScheduledStartTime;
		}
Пример #21
0
		public UpdateFacilityResponse UpdateFacility(UpdateFacilityRequest request)
		{
			var facility = PersistenceContext.Load<Facility>(request.FacilityDetail.FacilityRef, EntityLoadFlags.CheckVersion);

			var assembler = new FacilityAssembler();
			assembler.UpdateFacility(request.FacilityDetail, facility, this.PersistenceContext);

			CheckMultipleInformationAuthoritiesUsed();

			return new UpdateFacilityResponse(assembler.CreateFacilitySummary(facility));
		}
Пример #22
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);
		}
Пример #23
0
        /// <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);
        }