예제 #1
0
        private ListReportsResponse ListReports(ListReportsRequest request)
        {
            IList <Report> reports = new List <Report>();

            if (request.OrderRef != null)
            {
                // list only reports for this order
                var order = this.PersistenceContext.Load <Order>(request.OrderRef, EntityLoadFlags.Proxy);
                reports = this.PersistenceContext.GetBroker <IPatientHistoryBroker>().GetReportsForOrder(order);
            }
            else if (request.PatientRef != null)
            {
                var patient = this.PersistenceContext.Load <Patient>(request.PatientRef, EntityLoadFlags.Proxy);
                reports = this.PersistenceContext.GetBroker <IPatientHistoryBroker>().GetReportHistory(patient);
            }

            var assembler       = new BrowsePatientDataAssembler();
            var reportListItems = new List <ReportListItem>();

            foreach (var report in reports)
            {
                foreach (var procedure in report.Procedures)
                {
                    reportListItems.Add(assembler.CreateReportListItem(report, procedure, this.PersistenceContext));
                }
            }

            return(new ListReportsResponse(reportListItems));
        }
예제 #2
0
        private ListOrdersResponse ListOrders(ListOrdersRequest request)
        {
            var assembler = new BrowsePatientDataAssembler();
            var patient   = this.PersistenceContext.Load <Patient>(request.PatientRef, EntityLoadFlags.Proxy);

            switch (request.QueryDetailLevel)
            {
            case PatientOrdersQueryDetailLevel.Order:
                return(new ListOrdersResponse(
                           CollectionUtils.Map <Order, OrderListItem>(
                               this.PersistenceContext.GetBroker <IPatientHistoryBroker>().GetOrderHistory(patient),
                               order => assembler.CreateOrderListItem(order, this.PersistenceContext))));

            case PatientOrdersQueryDetailLevel.Procedure:
                return(new ListOrdersResponse(
                           CollectionUtils.Map <Procedure, OrderListItem>(
                               this.PersistenceContext.GetBroker <IPatientHistoryBroker>().GetProcedureHistory(patient),
                               rp => assembler.CreateOrderListItem(rp, this.PersistenceContext))));
            }

            return(new ListOrdersResponse(new List <OrderListItem>()));
        }
예제 #3
0
        private ListVisitsResponse ListVisits(ListVisitsRequest request)
        {
            // hide visits if "visit workflow" is disabled
            var workflowConfig = new WorkflowConfigurationReader();

            if (!workflowConfig.EnableVisitWorkflow)
            {
                return(null);
            }

            var browsePatientDataAssembler = new BrowsePatientDataAssembler();

            var patient = this.PersistenceContext.Load <Patient>(request.PatientRef, EntityLoadFlags.Proxy);

            var where = new VisitSearchCriteria();
            where.Patient.EqualTo(patient);

            var visits = this.PersistenceContext.GetBroker <IVisitBroker>().Find(where);

            return(new ListVisitsResponse(
                       CollectionUtils.Map <Visit, VisitListItem>(
                           visits,
                           v => browsePatientDataAssembler.CreateVisitListItem(v, this.PersistenceContext))));
        }
		private ListReportsResponse ListReports(ListReportsRequest request)
		{
			IList<Report> reports = new List<Report>();
			if (request.OrderRef != null)
			{
				// list only reports for this order
				var order = this.PersistenceContext.Load<Order>(request.OrderRef, EntityLoadFlags.Proxy);
				reports = this.PersistenceContext.GetBroker<IPatientHistoryBroker>().GetReportsForOrder(order);
			}
			else if (request.PatientRef != null)
			{
				var patient = this.PersistenceContext.Load<Patient>(request.PatientRef, EntityLoadFlags.Proxy);
				reports = this.PersistenceContext.GetBroker<IPatientHistoryBroker>().GetReportHistory(patient);
			}

			var assembler = new BrowsePatientDataAssembler();
			var reportListItems = new List<ReportListItem>();

			foreach (var report in reports)
			{
				foreach (var procedure in report.Procedures)
				{
					reportListItems.Add(assembler.CreateReportListItem(report, procedure, this.PersistenceContext));
				}
			}

			return new ListReportsResponse(reportListItems);
		}
		private ListOrdersResponse ListOrders(ListOrdersRequest request)
		{
			var assembler = new BrowsePatientDataAssembler();
			var patient = this.PersistenceContext.Load<Patient>(request.PatientRef, EntityLoadFlags.Proxy);

			switch (request.QueryDetailLevel)
			{
				case PatientOrdersQueryDetailLevel.Order:
					return new ListOrdersResponse(
						CollectionUtils.Map<Order, OrderListItem>(
							this.PersistenceContext.GetBroker<IPatientHistoryBroker>().GetOrderHistory(patient),
							order => assembler.CreateOrderListItem(order, this.PersistenceContext)));
				case PatientOrdersQueryDetailLevel.Procedure:
					return new ListOrdersResponse(
						CollectionUtils.Map<Procedure, OrderListItem>(
							this.PersistenceContext.GetBroker<IPatientHistoryBroker>().GetProcedureHistory(patient),
							rp => assembler.CreateOrderListItem(rp, this.PersistenceContext)));
			}

			return new ListOrdersResponse(new List<OrderListItem>());
		}
		private ListVisitsResponse ListVisits(ListVisitsRequest request)
		{
			// hide visits if "visit workflow" is disabled
			var workflowConfig = new WorkflowConfigurationReader();
			if(!workflowConfig.EnableVisitWorkflow)
				return null;

			var browsePatientDataAssembler = new BrowsePatientDataAssembler();

			var patient = this.PersistenceContext.Load<Patient>(request.PatientRef, EntityLoadFlags.Proxy);

			var where = new VisitSearchCriteria();
			where.Patient.EqualTo(patient);

			var visits = this.PersistenceContext.GetBroker<IVisitBroker>().Find(where);
			return new ListVisitsResponse(
				CollectionUtils.Map<Visit, VisitListItem>(
					visits,
					v => browsePatientDataAssembler.CreateVisitListItem(v, this.PersistenceContext)));
		}