Ejemplo n.º 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));
        }
Ejemplo n.º 2
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;
        }
		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)));
		}
Ejemplo n.º 4
0
        public LoadFacilityForEditResponse LoadFacilityForEdit(LoadFacilityForEditRequest request)
        {
            // note that the version of the FacilityRef is intentionally ignored here (default behaviour of ReadOperation)
            var f         = PersistenceContext.Load <Facility>(request.FacilityRef);
            var assembler = new FacilityAssembler();

            return(new LoadFacilityForEditResponse(assembler.CreateFacilityDetail(f)));
        }
Ejemplo n.º 5
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))));
        }
Ejemplo n.º 6
0
		public LoadFacilityForEditResponse LoadFacilityForEdit(LoadFacilityForEditRequest request)
		{
			// note that the version of the FacilityRef is intentionally ignored here (default behaviour of ReadOperation)
			var f = PersistenceContext.Load<Facility>(request.FacilityRef);
			var assembler = new FacilityAssembler();

			return new LoadFacilityForEditResponse(assembler.CreateFacilityDetail(f));
		}
Ejemplo n.º 7
0
		public LoadModalityEditorFormDataResponse LoadModalityEditorFormData(LoadModalityEditorFormDataRequest request)
		{
			var facilityAssembler = new FacilityAssembler();
			return new LoadModalityEditorFormDataResponse
			{
				FacilityChoices = PersistenceContext.GetBroker<IFacilityBroker>().FindAll(false).Select(facilityAssembler.CreateFacilitySummary).ToList(),
				DicomModalityChoices = EnumUtils.GetEnumValueList<DicomModalityEnum>(this.PersistenceContext)
			};
		}
Ejemplo n.º 8
0
        public LoadModalityEditorFormDataResponse LoadModalityEditorFormData(LoadModalityEditorFormDataRequest request)
        {
            var facilityAssembler = new FacilityAssembler();

            return(new LoadModalityEditorFormDataResponse
            {
                FacilityChoices = PersistenceContext.GetBroker <IFacilityBroker>().FindAll(false).Select(facilityAssembler.CreateFacilitySummary).ToList(),
                DicomModalityChoices = EnumUtils.GetEnumValueList <DicomModalityEnum>(this.PersistenceContext)
            });
        }
Ejemplo n.º 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)));
		}
Ejemplo n.º 10
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);
             }));
 }
Ejemplo n.º 11
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);
            })));
        }
Ejemplo n.º 12
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)));
        }
Ejemplo n.º 13
0
		public ListAllFacilitiesResponse ListAllFacilities(ListAllFacilitiesRequest request)
		{
			var criteria = new FacilitySearchCriteria();
			criteria.Code.SortAsc(0);
			if (!request.IncludeDeactivated)
				criteria.Deactivated.EqualTo(false);

			var assembler = new FacilityAssembler();
			return new ListAllFacilitiesResponse(
				CollectionUtils.Map<Facility, FacilitySummary, List<FacilitySummary>>(
					PersistenceContext.GetBroker<IFacilityBroker>().Find(criteria, request.Page),
					assembler.CreateFacilitySummary));
		}
Ejemplo n.º 14
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))));
        }
Ejemplo n.º 15
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;
        }
Ejemplo n.º 16
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));
		}
Ejemplo n.º 17
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;
		}
Ejemplo n.º 18
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)));
        }
Ejemplo n.º 19
0
        public ListAllFacilitiesResponse ListAllFacilities(ListAllFacilitiesRequest request)
        {
            var criteria = new FacilitySearchCriteria();

            criteria.Code.SortAsc(0);
            if (!request.IncludeDeactivated)
            {
                criteria.Deactivated.EqualTo(false);
            }

            var assembler = new FacilityAssembler();

            return(new ListAllFacilitiesResponse(
                       CollectionUtils.Map <Facility, FacilitySummary, List <FacilitySummary> >(
                           PersistenceContext.GetBroker <IFacilityBroker>().Find(criteria, request.Page),
                           assembler.CreateFacilitySummary)));
        }
Ejemplo n.º 20
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)
                       ));
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
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;
		}
Ejemplo n.º 23
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;
		}
Ejemplo n.º 24
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;
        }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
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)
				);
		}
Ejemplo n.º 27
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);
		}
Ejemplo n.º 28
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);
        }
Ejemplo n.º 29
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));
		}
Ejemplo n.º 30
0
		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;
		}
Ejemplo n.º 31
0
        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);
        }