public virtual void SetOBR(OBR obr, Order order, Procedure procedure)
 {
     obr.PlacerOrderNumber.EntityIdentifier.Value    = procedure.Number;
     obr.UniversalServiceIdentifier.Identifier.Value = procedure.Type.Id;
     obr.UniversalServiceIdentifier.Text.Value       = procedure.Type.Name;
     SetPhysician(obr.GetOrderingProvider(0), order.OrderingPractitioner);
     obr.RequestedDateTime.Time.Value = ExtractHL7DateTime(procedure.ScheduledStartTime);
 }
示例#2
0
        protected virtual void HandleNewOrder(ORC orc, OBR obr)
        {
            string placerNumber = obr.PlacerOrderNumber.EntityIdentifier.Value;
            var    order        = _persistenceManager.GetOrderByPlacer(placerNumber);

            if (order != null)
            {
                throw new Exception("Cannot create order which already exists");
            }

            var accessionNumber   = PersistenceContext.GetBroker <IAccessionNumberBroker>().GetNext();
            var diagnosticService = FindDiagnosticService(obr.UniversalServiceIdentifier.Identifier.Value,
                                                          PersistenceContext);
            var requestedTime     = ParseNullableDateTimeFromDateField(obr.RequestedDateTime.Time.Value);
            var orderingPhysician = GetOrderingPhysician(obr.GetOrderingProvider(0));
            var orderingFacility  = FindFacility(orc.GetOrderingFacilityName(0).OrganizationName.Value,
                                                 PersistenceContext);
            var orderingStaff = FindStaff(orc.GetOrderingProvider(0).IDNumber.Value, PersistenceContext);
            var priority      = ParseOrderPriority(obr.PriorityOBR.Value);

            order = Order.NewOrder(
                new OrderCreationArgs(Platform.Time, orderingStaff, "HL7", accessionNumber,
                                      Patient, Visit, diagnosticService, obr.GetReasonForStudy(0).Text.Value,
                                      priority, orderingFacility, orderingFacility, requestedTime,
                                      orderingPhysician,
                                      new List <ResultRecipient>()),
                PersistenceContext.GetBroker <IProcedureNumberBroker>(),
                PersistenceContext.GetBroker <IDicomUidBroker>()
                );

            order.PlacerNumber = placerNumber;
            var familyPhysician = GetFamilyPhysicianRecipients(GetProfileForFacility(orderingFacility));

            if (familyPhysician != null)
            {
                order.ResultRecipients.Add(familyPhysician);
            }

            _persistenceManager.AddOrder(order);

            foreach (var procedure in order.Procedures)
            {
                procedure.CreateProcedureSteps();
                procedure.Schedule(requestedTime);
                procedure.PerformingDepartment = GetPerformingDepartment(procedure.PerformingFacility,
                                                                         obr.ProcedureCode.Identifier.Value);
            }
        }