Exemplo n.º 1
0
        public string EditOrder(DtoOrder dtoOrder)
        {
            var visit       = VisitMethods.Instance.GetVisitByBillingNumber(dtoOrder.Visit.BillingNumber);
            var uniqueOrder = OrderMethods.Instance.GetOrderByNumber(dtoOrder.Number);

            if (PatientMethods.Instance.GetPatientById(visit.Patient.Id).Dod == null)
            {
                if (uniqueOrder == null)
                {
                    var order = new Order()
                    {
                        Number = dtoOrder.Number,
                        Visit  = new Visit()
                        {
                            Id = visit.Id
                        },
                        ClinicalInfo = dtoOrder.ClinicalInfo
                    };
                    return(OrderMethods.Instance.InsertOrder(order));
                }
                else
                {
                    Order order = new Order()
                    {
                        Number       = dtoOrder.Number,
                        Id           = uniqueOrder.Id,
                        ClinicalInfo = dtoOrder.ClinicalInfo,
                        Visit        = new Visit()
                        {
                            Id = visit.Id
                        }
                    };
                    return(OrderMethods.Instance.UpdateOrder(order));
                }
            }
            else
            {
                return("d");
            }
        }
Exemplo n.º 2
0
 public DtoOrder[] FindOrders(DtoOrder dtoOrder)
 {
     Order[]    orders    = OrderMethods.Instance.GetOrders(dtoOrder.Number, dtoOrder.Visit.BillingNumber);
     DtoOrder[] dtoOrders = orders.Select(order => new DtoOrder()
     {
         Id     = order.Id,
         Number = order.Number,
         Visit  = new DtoVisit()
         {
             Id            = order.Visit.Id,
             BillingNumber = order.Visit.BillingNumber,
             Patient       = new DtoPatient()
             {
                 Id        = order.Visit.Patient.Id,
                 FirstName = order.Visit.Patient.FirstName,
                 LastName  = order.Visit.Patient.LastName
             }
         },
         ClinicalInfo = order.ClinicalInfo,
     }).ToArray();
     return(dtoOrders);
 }