private void Form1_Load(object sender, EventArgs e) { ADT_A04 message = new ADT_A04(); message.MSH.FieldSeparator.Value = @"|"; message.MSH.EncodingCharacters.Value = @"^~\&"; message.MSH.SendingApplication.NamespaceID.Value = "REGADT"; message.MSH.SendingFacility.NamespaceID.Value = "MCM"; message.MSH.ReceivingApplication.NamespaceID.Value = "IFENG"; message.MSH.DateTimeOfMessage.TimeOfAnEvent.Value = "199901101501"; message.MSH.MessageType.MessageType.Value = "ADT"; message.MSH.MessageType.TriggerEvent.Value = "A04"; message.MSH.MessageControlID.Value = "00001"; message.MSH.ProcessingID.ProcessingID.Value = "P"; message.MSH.VersionID.VersionID.Value = "2.3.1"; message.EVN.EventTypeCode.Value = "A04"; message.EVN.RecordedDateTime.TimeOfAnEvent.Value = "199901101500"; message.EVN.DateTimePlannedEvent.TimeOfAnEvent.Value = "199901101400"; message.EVN.EventReasonCode.Value = "01"; message.EVN.EventOccurred.TimeOfAnEvent.Value = "199901101410"; message.PID.GetPatientIdentifierList(0).ID.Value = "191919"; message.PID.GetPatientIdentifierList(0).AssigningAuthority.NamespaceID.Value = "GENHOS"; message.PID.GetPatientIdentifierList(0).IdentifierTypeCode.Value = "MR"; message.PID.GetPatientIdentifierList(1).ID.Value = "371-66-9256"; message.PID.GetPatientIdentifierList(1).AssigningAuthority.NamespaceID.Value = "USSSA"; message.PID.GetPatientIdentifierList(1).IdentifierTypeCode.Value = "SS"; message.PID.GetAlternatePatientIDPID(0).ID.Value = "253763"; message.PID.GetPatientName(0).FamilyLastName.FamilyName.Value = "MASSIE"; message.PID.GetPatientName(0).GivenName.Value = "JAMES"; message.PID.GetPatientName(0).MiddleInitialOrName.Value = "A"; message.PID.DateTimeOfBirth.TimeOfAnEvent.Value = "19560129"; message.PID.Sex.Value = "M"; message.PID.GetPatientAddress(0).StreetAddress.Value = "171 ZOBERLEIN"; message.PID.GetPatientAddress(0).City.Value = "ISHPEMING"; message.PID.GetPatientAddress(0).StateOrProvince.Value = "MI"; message.PID.GetPatientAddress(0).ZipOrPostalCode.Value = "49849"; message.PID.GetPatientAddress(0).Country.Value = null; message.PID.GetPhoneNumberHome(0).Get9999999X99999CAnyText.Value = "(90 0)485-5344"; message.PID.GetPhoneNumberBusiness(0).Get9999999X99999CAnyText.Value = "(900)485-5344"; message.PID.MaritalStatus.Identifier.Value = "S"; message.PID.Religion.Identifier.Value = "C"; message.PID.PatientAccountNumber.ID.Value = "10199925"; message.PID.PatientAccountNumber.AssigningAuthority.NamespaceID.Value = "GENHOS"; message.PID.PatientAccountNumber.IdentifierTypeCode.Value = "AN"; message.PID.SSNNumberPatient.Value = "371-66-9256"; PipeParser parser = new PipeParser(); richTextBox1.Text = parser.Encode(message); }
/// <summary> /// Creates a HL Message out of an object model /// </summary> /// <param name="objToEncode"></param> /// <returns></returns> public String Encode(Patient objToEncode) { var patient = objToEncode; PipeParser parser = new PipeParser(); // HL7 Message Header Settings ADT_A04 qry = new ADT_A04(); qry.MSH.MessageType.MessageType.Value = "ADT"; qry.MSH.MessageType.TriggerEvent.Value = "A01"; qry.MSH.FieldSeparator.Value = "|"; qry.MSH.VersionID.Value = "2.3"; qry.MSH.SendingApplication.NamespaceID.Value = "CohieCentral"; qry.MSH.SendingFacility.NamespaceID.Value = "COHIE"; qry.MSH.ReceivingApplication.NamespaceID.Value = "Clinical Data Provider"; qry.MSH.EncodingCharacters.Value = @"^~\&"; qry.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now); qry.MSH.ProcessingID.ProcessingID.Value = "P"; qry.PID.SetIDPatientID.Value = "77291"; qry.PID.PatientIDExternalID.CheckDigit.Value = "9"; qry.PID.PatientIDExternalID.ID.Value = "PATID1234"; qry.PID.PatientIDExternalID.CodeIdentifyingTheCheckDigitSchemeEmployed.Value = "55A"; // Patient Name qry.PID.GetPatientName(0).GivenName.Value = patient.PersonName.GivenName; qry.PID.GetPatientName(0).FamilyName.Value = patient.PersonName.FamilyName; qry.PID.GetPatientName(0).SuffixEgJRorIII.Value = patient.PersonName.Suffix; qry.PID.Sex.Value = patient.PersonSex.ToString(); qry.PID.GetPhoneNumberHome(0).PhoneNumber.Value = patient.PersonNumber.HomeNumber; qry.PID.DateOfBirth.TimeOfAnEvent.Value = "19680219"; // Patient Address qry.PID.GetPatientAddress(0).StreetAddress.Value = patient.PersonAddress.StreetAddress; qry.PID.GetPatientAddress(0).City.Value = patient.PersonAddress.City; qry.PID.GetPatientAddress(0).StateOrProvince.Value = patient.PersonAddress.State; qry.PID.GetPatientAddress(0).ZipOrPostalCode.Value = patient.PersonAddress.ZipCode; // Kin Details qry.AddNK1(); NK1 objNextOfKin = qry.GetNK1(); Person objKin = patient.NextOfKin[0]; objNextOfKin.GetName(0).GivenName.Value = objKin.PersonName.GivenName; objNextOfKin.GetName(0).FamilyName.Value = objKin.PersonName.FamilyName; objNextOfKin.Relationship.Identifier.Value = objKin.Relationship; objNextOfKin.GetAddress(0).StreetAddress.Value = objKin.PersonAddress.StreetAddress; objNextOfKin.GetAddress(0).City.Value = objKin.PersonAddress.City; objNextOfKin.GetAddress(0).StateOrProvince.Value = objKin.PersonAddress.State; objNextOfKin.GetAddress(0).ZipOrPostalCode.Value = objKin.PersonAddress.ZipCode; objNextOfKin.GetPhoneNumber(0).PhoneNumber.Value = objKin.PersonNumber.HomeNumber; objNextOfKin.GetBusinessPhoneNumber(0).PhoneNumber.Value = objKin.PersonNumber.OfficeNumber; var message = parser.Encode(qry); return(message); }