Esempio n. 1
0
		public LoadModalityForEditResponse LoadModalityForEdit(LoadModalityForEditRequest request)
		{
			// note that the version of the ModalityRef is intentionally ignored here (default behaviour of ReadOperation)
			var m = PersistenceContext.Load<Modality>(request.ModalityRef);
			var assembler = new ModalityAssembler();
			return new LoadModalityForEditResponse(assembler.CreateModalityDetail(m));
		}
Esempio n. 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));
        }
Esempio n. 3
0
        public LoadModalityForEditResponse LoadModalityForEdit(LoadModalityForEditRequest request)
        {
            // note that the version of the ModalityRef is intentionally ignored here (default behaviour of ReadOperation)
            var m         = PersistenceContext.Load <Modality>(request.ModalityRef);
            var assembler = new ModalityAssembler();

            return(new LoadModalityForEditResponse(assembler.CreateModalityDetail(m)));
        }
Esempio n. 4
0
        public UpdateModalityResponse UpdateModality(UpdateModalityRequest request)
        {
            var modality  = PersistenceContext.Load <Modality>(request.ModalityDetail.ModalityRef, EntityLoadFlags.CheckVersion);
            var assembler = new ModalityAssembler();

            assembler.UpdateModality(request.ModalityDetail, modality, this.PersistenceContext);

            return(new UpdateModalityResponse(assembler.CreateModalitySummary(modality)));
        }
        public LoadProcedureTypeEditorFormDataResponse LoadProcedureTypeEditorFormData(LoadProcedureTypeEditorFormDataRequest request)
        {
            var where = new ModalitySearchCriteria();
            where.Name.SortAsc(0);
            where.Deactivated.EqualTo(false);

            var modalities = PersistenceContext.GetBroker <IModalityBroker>().Find(where);

            var assembler = new ModalityAssembler();

            return(new LoadProcedureTypeEditorFormDataResponse(modalities.Select(assembler.CreateModalitySummary).ToList()));
        }
Esempio n. 6
0
		public AddModalityResponse AddModality(AddModalityRequest request)
		{
			var modality = new Modality();
			var assembler = new ModalityAssembler();
			assembler.UpdateModality(request.ModalityDetail, modality, this.PersistenceContext);

			PersistenceContext.Lock(modality, DirtyState.New);

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

			return new AddModalityResponse(assembler.CreateModalitySummary(modality));
		}
Esempio n. 7
0
		public ListAllModalitiesResponse ListAllModalities(ListAllModalitiesRequest request)
		{
			var criteria = new ModalitySearchCriteria();
			criteria.Id.SortAsc(0);
			if (!request.IncludeDeactivated)
				criteria.Deactivated.EqualTo(false);

			var assembler = new ModalityAssembler();
			return new ListAllModalitiesResponse(
				CollectionUtils.Map<Modality, ModalitySummary, List<ModalitySummary>>(
					PersistenceContext.GetBroker<IModalityBroker>().Find(criteria, request.Page),
					assembler.CreateModalitySummary));
		}
Esempio n. 8
0
        public AddModalityResponse AddModality(AddModalityRequest request)
        {
            var modality  = new Modality();
            var assembler = new ModalityAssembler();

            assembler.UpdateModality(request.ModalityDetail, modality, this.PersistenceContext);

            PersistenceContext.Lock(modality, DirtyState.New);

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

            return(new AddModalityResponse(assembler.CreateModalitySummary(modality)));
        }
Esempio n. 9
0
        public ListAllModalitiesResponse ListAllModalities(ListAllModalitiesRequest request)
        {
            var criteria = new ModalitySearchCriteria();

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

            var assembler = new ModalityAssembler();

            return(new ListAllModalitiesResponse(
                       CollectionUtils.Map <Modality, ModalitySummary, List <ModalitySummary> >(
                           PersistenceContext.GetBroker <IModalityBroker>().Find(criteria, request.Page),
                           assembler.CreateModalitySummary)));
        }
Esempio n. 10
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)
                       ));
        }
		public LoadProcedureTypeEditorFormDataResponse LoadProcedureTypeEditorFormData(LoadProcedureTypeEditorFormDataRequest request)
		{
			var where = new ModalitySearchCriteria();
			where.Name.SortAsc(0);
			where.Deactivated.EqualTo(false);

			var modalities = PersistenceContext.GetBroker<IModalityBroker>().Find(where);

			var assembler = new ModalityAssembler();
			return new LoadProcedureTypeEditorFormDataResponse(modalities.Select(assembler.CreateModalitySummary).ToList());
		}
Esempio n. 12
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);
		}
Esempio n. 13
0
		public UpdateModalityResponse UpdateModality(UpdateModalityRequest request)
		{
			var modality = PersistenceContext.Load<Modality>(request.ModalityDetail.ModalityRef, EntityLoadFlags.CheckVersion);
			var assembler = new ModalityAssembler();
			assembler.UpdateModality(request.ModalityDetail, modality, this.PersistenceContext);

			return new UpdateModalityResponse(assembler.CreateModalitySummary(modality));
		}
Esempio n. 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)
				);
		}