MSH|^~\&|<%= hl7.sending_application %>|<%= hl7.sending_facility %>|<%= hl7.receiving_application %>|<%= hl7.receiving_facility %>|<%= hl7.message_datetime.to_hl7datetime() %>||<%= hl7.message_type %>^<%= hl7.trigger_event %>|<%= hl7.message_control_id %>|<%= hl7.processing_id %>|<%= hl7.version %> EVN|<%= hl7.trigger_event %>|<%= hl7.message_datetime.to_hl7datetime() %> PID|||<%= patient.medical_record_number.identifier %>||<%= patient.names[0].family_name %>^<%= patient.names[0].given_name %>^<%= patient.names[0].middle_name%>^||<%= patient.date_of_birth.to_hl7date %>|<%= patient.gender.code %>||<%= patient.races[0].code %>|<%= patient.addresses[0].address_line1 %>^<%= patient.addresses[0].address_line2 %>^<%= patient.addresses[0].city %>^<%= patient.addresses[0].state %>^<%= patient.addresses[0].postal_code %>||(<%= patient.home_phone.area_code %>)<%= patient.home_phone.exchange_code %>-<%= patient.home_phone.subscriber_number %>~(<%= patient.cell_phone.area_code %>)<%= patient.cell_phone.exchange_code %>-<%= patient.cell_phone.subscriber_number %>|(<%= patient.work_phone.area_code %>)<%= patient.work_phone.exchange_code %>-<%= patient.work_phone.subscriber_number %>|<%= patient.language.code %>^<%= patient.language.description %>^<%= patient.language.coding_system %>|<%= patient.marital_status.code %>^<%= patient.marital_status.description %>^<%= patient.marital_status.coding_system %>|<%= patient.religion.code %>^<%= patient.religion.description %>^<%= patient.religion.coding_system %>|<%= patient.account_number.identifier %>|<%= patient.ssn %> PV1||<%= visit.patient_class %>|<%= visit.location.point_of_care %>^<%= visit.location.room %>^<%= visit.location.bed %>^<%= visit.location.facility %>^<%= visit.location.status %>^<%= visit.location.type %>^<%= visit.location.building %>^<%= visit.location.floor %>^<%= visit.location.description %>|<%= visit.admission.type %>|||<%= visit.doctors.attending.identifier %>^<%= visit.doctors.attending.name.family_name %>^<%= visit.doctors.attending.name.given_name %>^<%= visit.doctors.attending.name.middle_name %>^<%= visit.doctors.attending.name.suffix %>^<%= visit.doctors.attending.name.prefix %>^<%= visit.doctors.attending.name.degree %>|<%= visit.doctors.referring.identifier %>^<%= visit.doctors.referring.name.family_name %>^<%= visit.doctors.referring.name.given_name %>^<%= visit.doctors.referring.name.middle_name %>^<%= visit.doctors.referring.name.suffix %>^<%= visit.doctors.referring.name.prefix %>^<%= visit.doctors.referring.name.degree %>|<%= visit.doctors.consulting.identifier %>^<%= visit.doctors.consulting.name.family_name %>^<%= visit.doctors.consulting.name.given_name %>^<%= visit.doctors.consulting.name.middle_name %>^<%= visit.doctors.consulting.name.suffix %>^<%= visit.doctors.consulting.name.prefix %>^<%= visit.doctors.consulting.name.degree %>|<%= visit.hospital_service %>|11|12|<%= visit.readmission_indicator %>|<%= visit.admission.source %>|15|16|<%= visit.doctors.admitting.identifier %>^<%= visit.doctors.admitting.name.family_name %>^<%= visit.doctors.admitting.name.given_name %>^<%= visit.doctors.admitting.name.middle_name %>^<%= visit.doctors.admitting.name.suffix %>^<%= visit.doctors.admitting.name.prefix %>^<%= visit.doctors.admitting.name.degree %>|<%= visit.patient_type %>|<%= visit.visit_number.identifier %>^^^^<%= visit.visit_number.identifier_type_code %>|||||||||||||||||<%= visit.discharge.disposition %>|<%= visit.discharge.location %>|38|39|40|41|42|43|<%= visit.admission.datetime.to_hl7datetime() %>|<%= visit.discharge.datetime.to_hl7datetime() %> PV2|||^<%= visit.admission.reason %>