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"); } } } }
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")); } }