/// <summary> /// Create NACK /// </summary> internal static IMessage CreateNack(IMessage request, string responseCode, string errCode, string errDescription, ISystemConfigurationService config) { System.Diagnostics.Trace.TraceWarning(String.Format("NACK Condition : {0}", errDescription)); if (request.Version == "2.3.1") { NHapi.Model.V231.Message.ACK ack = new NHapi.Model.V231.Message.ACK(); Terser terser = new Terser(ack); terser.Set("/MSA-1", responseCode); terser.Set("/MSA-3", "Error occurred"); terser.Set("/MSA-6-1", errCode); terser.Set("/MSA-6-2", errDescription); MessageUtil.UpdateMSH(terser, request, config); return(ack); } else { NHapi.Model.V25.Message.ACK ack = new NHapi.Model.V25.Message.ACK(); Terser terser = new Terser(ack); terser.Set("/MSA-1", responseCode); MessageUtil.UpdateMSH(terser, request, config); terser.Set("/ERR-3-1", errCode); terser.Set("/ERR-3-2", errDescription); return(ack); } }
/// <summary> /// Send a pix audit /// </summary> public static void SendPIXAudit(NHapi.Model.V25.Message.ADT_A01 request, NHapi.Model.V231.Message.ACK response) { ActionType act = ActionType.Create; OutcomeIndicator outcome = OutcomeIndicator.Success; if (request.MSH.MessageType.TriggerEvent.Value == "A08") { act = ActionType.Update; } if (!response.MSA.AcknowledgementCode.Value.EndsWith("A")) { outcome = OutcomeIndicator.EpicFail; } var audit = CreateAudit(act, outcome, EventIdentifierType.PatientRecord, new CodeValue <string>("ITI-8", "IHE Transactions") { DisplayName = "Patient Identity Feed" }, request, ConfigurationManager.AppSettings["crEndpoint"]); audit.AuditableObjects = new List <AuditableObject>() { new AuditableObject() { Type = AuditableObjectType.Person, TypeSpecified = true, Role = AuditableObjectRole.Patient, RoleSpecified = true, LifecycleType = AuditableObjectLifecycle.Export, IDTypeCode = new CodeValue <AuditableObjectIdType>(AuditableObjectIdType.PatientNumber), ObjectId = string.Format("{0}^^^&{1}&ISO", request.PID.GetPatientIdentifierList(0).IDNumber.Value, request.PID.GetPatientIdentifierList(0).AssigningAuthority.UniversalID.Value), ObjectDetail = new List <ObjectDetailType>() { new ObjectDetailType() { Type = "MSH-10", Value = System.Text.Encoding.UTF8.GetBytes(request.MSH.MessageControlID.Value) } } } }; SendAudit(audit); }