Exemplo n.º 1
0
        private List <His2lis> BuildOrderRequest(PeticionEntrante ordersData)
        {
            RequestParser      messageParser      = new RequestParser();
            RequestBuilderUtil requestBuilderUtil = new RequestBuilderUtil();
            List <His2lis>     orderList          = new List <His2lis>();


            var           requestOrderMessage = ordersData;
            List <String> lastNames           = requestBuilderUtil.getLastNames(requestOrderMessage.Pid5_1_familyName);

            foreach (var orderDetail in requestOrderMessage.ListaORB)
            {
                var newOrder = new His2lis();
                newOrder.Orden          = requestBuilderUtil.compuseOrderId(requestOrderMessage.Orc4_placerGroupNumer);
                newOrder.Fsolicitud     = requestBuilderUtil.currentDateFormated();
                newOrder.Origen         = requestOrderMessage.Pv2_patientClass;
                newOrder.Servicio       = requestOrderMessage.Orc13_1_pointOfCare;
                newOrder.Doctor         = requestOrderMessage.Orc12_1_idNumber;
                newOrder.Libre          = "1";
                newOrder.Identificacion = requestOrderMessage.Pid3_1_idNumber;
                newOrder.Nombre         = requestOrderMessage.Pid5_2_givenName + " " + requestOrderMessage.Pid5_3_secondName;
                newOrder.Apell1         = lastNames[0];
                newOrder.Apell2         = lastNames[1];
                newOrder.Edad           = requestBuilderUtil.getAges(requestOrderMessage.Pid7_datetimeBirth);
                newOrder.Codigo         = orderDetail.Obr4_4_AlternateIdentifier;
                newOrder.Sexo           = requestBuilderUtil.getGender(requestOrderMessage.Pid8_AdministrativeSex);
                orderList.Add(newOrder);
            }

            return(orderList);
        }
Exemplo n.º 2
0
        private async Task <Boolean> saveTransaction(PeticionEntrante ordersData, string messageString)
        {
            RequestBuilderUtil utilData       = new RequestBuilderUtil();
            Transacciones      newTransaction = new Transacciones();
            string             orderID        = utilData.compuseOrderId(ordersData.Orc4_placerGroupNumer);

            newTransaction.Peticion  = messageString;
            newTransaction.Estado    = 0;
            newTransaction.Fecha     = DateTime.Now;
            newTransaction.Completas = 0;
            newTransaction.Pruebas   = ordersData.ListaORB.Count();
            newTransaction.Siapsid   = orderID;
            newTransaction.Ox        = ordersData.Orc1_orderControl;
            newTransaction.Orc       = int.Parse(ordersData.Orc2_placerOrderNumer);

            if (newTransaction.Ox == CoreConfiguration.ModificacionString)
            {
                _context.RemoveRange(_context.His2lis.Where(data => data.Orden == orderID));
                _context.RemoveRange(_context.Ohistidx.Where(data => data.Orden == orderID));
                _context.RemoveRange(_context.Oficha.Where(data => data.Custom == decimal.Parse(orderID)));
                _context.RemoveRange(_context.OtPerfil.Where(data => data.OtPerfilOrder == decimal.Parse(orderID)));
                _context.RemoveRange(_context.Ot.Where(data => data.TCustom == decimal.Parse(orderID)));
                var deleteCount    = _context.SaveChanges();
                var oldTransaction = _hl7Context.Transacciones.Where(data => data.Siapsid == ordersData.Orc4_placerGroupNumer);
                foreach (Transacciones tran in oldTransaction)
                {
                    tran.Estado = 8;
                }
                _hl7Context.Transacciones.UpdateRange(oldTransaction);
                _hl7Context.SaveChanges();
            }
            _hl7Context.Transacciones.Add(newTransaction);
            var result = await _hl7Context.SaveChangesAsync();

            return(result > 0);
        }