예제 #1
0
        public void ORMOutBound(ORMOutbound pAck)
        {
            if (pAck != null)
            {
                bool ret = false;
                PatientOrder order = null;
                StatusManagerParams parms = null;

                try
                {
                    switch (pAck.OrderStatus)
                    {
                        case "IP":
                        case "SC":
                            order = new PatientOrder();

                            ret = order.startOrder(pAck.OrderId, "", parms);
                            break;

                        case "CM":
                            order = new PatientOrder();

                            ret = order.completeOrder(pAck.OrderId, "", parms);
                            break;
                        case "DC":
                            order = new PatientOrder();

                            ret = order.discontinueOrder(pAck.OrderId, "", parms);
                            break;
                        case "CA":
                            order = new PatientOrder();
                            parms = new StatusManagerParams();
                            parms.comments = pAck.Comment;

                            ret = order.cancelOrder(pAck.OrderId, "", parms);
                            break;
                    }
                }
                catch (Exception ex)
                {
                    ret = false;

                    Log.createLog(pAck.MessageControlId, mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, ex.Message);


                    throw ex;
                }

                if (ret)
                {

                    if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AA, ""))
                    {
                        throw new ValidationException("Unable to create ADT08 message log");
                    }

                }
            }
        }
예제 #2
0
        public void ORUResult(RIS_OrderResult pAck)
        {
            if (pAck != null)
            {
                bool ret = false;
                PatientOrder order = null;
                StatusManagerParams parms = null;
                PatientRadiologyOrder radiologyOrder = null;

                try
                {
                    if (pAck.ResultStatus == "F" && pAck.ReportStatus == "GDT")
                    {
                        order = new PatientOrder();

                        ret = order.verifiedReportedOrder(pAck.OrderId, "", parms);
                    }

                    radiologyOrder = new PatientRadiologyOrder();

                    radiologyOrder.Id = pAck.OrderId;
                    radiologyOrder.ReportPath = pAck.ReportPath;
                    radiologyOrder.ResultStatus = pAck.ResultStatus;
                    radiologyOrder.RISLink = pAck.ImageUrl;

                    if (!radiologyOrder.updateResult(radiologyOrder).Result)
                    {
                        throw new ValidationException("Unable to update patient result");
                    }

                    ret = true;
                }
                catch (Exception ex)
                {
                    ret = false;

                    Log.createLog(pAck.MessageControlId, mzk_messagetype.ORU01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, ex.Message);

                    throw ex;
                }

                if (ret)
                {

                    if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORU01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AA))
                    {
                        throw new ValidationException("Unable to create ORU message log");
                    }

                }
            }
        }
예제 #3
0
        public string ORUResult(LIS_OrderResult pAck)
        {
            if (pAck != null)
            {
                bool                ret      = false;
                PatientOrder        order    = null;
                StatusManagerParams parms    = null;
                PatientLabOrder     labOrder = new PatientLabOrder();

                try
                {
                    PatientLabOrder labOrderDetails = labOrder.getPatientOrder(null, null, null, null, DateTime.MinValue, DateTime.MinValue, false, pAck.OrderId).Result.FirstOrDefault();

                    if (labOrderDetails != null)
                    {
                        if (pAck.ResultStatus == "F" && labOrderDetails.OrderStatus != ((int)mzk_orderstatus.VerifiedandReported).ToString())
                        {
                            order = new PatientOrder();

                            ret = order.verifiedReportedOrder(pAck.OrderId, "", parms);
                        }

                        labOrder = new PatientLabOrder();

                        labOrder.Id           = pAck.OrderId;
                        labOrder.ResultStatus = pAck.ResultStatus;
                        labOrder.LISLink      = Helper.decodeEscapeChar(pAck.ImageUrl);
                        labOrder.ReportPath   = pAck.ReportPath;

                        if (!labOrder.updateResult(labOrder).Result)
                        {
                            throw new ValidationException("Unable to update patient result");
                        }

                        if (!string.IsNullOrEmpty(pAck.AbnormalResult) && pAck.AbnormalResult.ToLower() == "panic")
                        {
                            string testName    = "";
                            string patientName = "";

                            testName = labOrderDetails.TestName;

                            Patient patient = new Patient().getPatientDetails(labOrderDetails.PatientId).Result;

                            if (patient != null)
                            {
                                patientName = patient.name;
                            }

                            if (!labOrder.sendPanicResult(labOrder.Id, string.Format("Panic result received for Patient {0} and Test {1} ", patientName, testName)))
                            {
                                throw new ValidationException("Unable to send panic result");
                            }
                        }

                        ret = true;
                    }
                    else
                    {
                        throw new ValidationException("Unable to find lab order");
                    }
                }
                catch (Exception ex)
                {
                    ret = false;

                    Log.createLog(pAck.MessageControlId, HMHL7MessageType.ORU01, pAck.OrderId, HMHL7MessageDirection.Inbound, "AE", ex.Message);

                    return(Helper.generateACK("R01", pAck.MessageControlId, "AE", ex.Message));
                }

                if (ret)
                {
                    if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORU01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AA))
                    {
                        throw new ValidationException("Unable to create ORU message log");
                    }

                    return(Helper.generateACK("R01", pAck.MessageControlId, "AA", ""));
                }
                else
                {
                    if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORU01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, "Unknown error in updating result"))
                    {
                        throw new ValidationException("Unable to create ORU message log");
                    }

                    return(Helper.generateACK("R01", pAck.MessageControlId, "AE", "Unknown error in updating result"));
                }
            }
            else
            {
                if (!Log.createLog("", mzk_messagetype.ORU01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, "Invalid message format"))
                {
                    throw new ValidationException("Unable to create ORU message log");
                }

                return(MazikCareService.Core.Models.HL7.Helper.generateACK("R01", "", "AE", "Invalid message format"));
            }
        }
예제 #4
0
        public string ORMOutBound(ORMOutbound pAck)
        {
            if (pAck != null)
            {
                bool                ret   = false;
                PatientOrder        order = null;
                StatusManagerParams parms = null;

                try
                {
                    switch (pAck.OrderStatus.ToLower().Trim())
                    {
                    case "sample collected":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (!string.IsNullOrEmpty(pAck.Location))
                        {
                            parms.location = pAck.Location;
                        }

                        ret = order.sampleCollected(pAck.OrderId, "", parms);
                        break;

                    case "sample received":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (!string.IsNullOrEmpty(pAck.Location))
                        {
                            parms.location = pAck.Location;
                        }

                        ret = order.sampleReceived(pAck.OrderId, "", parms);
                        break;

                    case "sample dispatched":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (!string.IsNullOrEmpty(pAck.Location))
                        {
                            parms.location = pAck.Location;
                        }

                        ret = order.sampleDispatched(pAck.OrderId, "", parms);
                        break;

                    case "sample in process":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        ret = order.sampleinProcess(pAck.OrderId, "", parms);
                        break;

                    case "quantity not sufficient":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        ret = order.quantityNotSufficient(pAck.OrderId, "", parms);
                        break;

                    case "sample sent out":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (!string.IsNullOrEmpty(pAck.Location))
                        {
                            parms.location = pAck.Location;
                        }

                        ret = order.sampleSentOut(pAck.OrderId, "", parms);
                        break;

                    case "need second sample":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (!string.IsNullOrEmpty(pAck.Location))
                        {
                            parms.location = pAck.Location;
                        }

                        ret = order.needSecondSample(pAck.OrderId, "", parms);
                        break;

                    case "ca":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (pAck.NTE != null)
                        {
                            parms.comments = pAck.NTE.CommentDescription;
                        }

                        ret = order.cancelOrder(pAck.OrderId, "", parms);
                        break;

                    case "dc":
                        order = new PatientOrder();
                        parms = new StatusManagerParams();

                        if (pAck.NTE != null)
                        {
                            parms.comments = pAck.NTE.CommentDescription;
                        }

                        ret = order.discontinueOrder(pAck.OrderId, "", parms);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    ret = false;

                    Log.createLog(pAck.MessageControlId, mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, ex.Message);

                    return(Helper.generateACK("O01", pAck.MessageControlId, "AE", ex.Message));
                }

                if (ret)
                {
                    if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AA))
                    {
                        throw new ValidationException("Unable to create ORM message log");
                    }

                    return(Helper.generateACK("O01", pAck.MessageControlId, "AA", ""));
                }
                else
                {
                    if (parms != null)
                    {
                        if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, "Unknown error in changing order status"))
                        {
                            throw new ValidationException("Unable to create ORM message log");
                        }

                        return(Helper.generateACK("O01", pAck.MessageControlId, "AE", "Unknown error in changing order status"));
                    }
                    else
                    {
                        if (!Log.createLog(pAck.MessageControlId, mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, "Unable to find any valid status for the order"))
                        {
                            throw new ValidationException("Unable to create ORM message log");
                        }

                        return(Helper.generateACK("O01", pAck.MessageControlId, "AE", "Unable to find any valid status for the order"));
                    }
                }
            }
            else
            {
                if (!Log.createLog("", mzk_messagetype.ORM01, pAck.OrderId, mzk_messagedirection.Inbound, mzk_acknowledgecode.AE, "Invalid message format"))
                {
                    throw new ValidationException("Unable to create ORM message log");
                }

                return(MazikCareService.Core.Models.HL7.Helper.generateACK("O01", "", "AE", "Invalid message format"));
            }
        }