Documentation ¶
Overview ¶
Package message_builder contains utilities to build messages easily. This is particularly useful for tests. To use: populate the Builder struct and call BuildMessage. Every invocation of BuildMessage creates a message with a different Message Control Id and a date newer than the previous invocation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // AdtA01 represents an Adt^A01 HL7 message. AdtA01 = &message.Type{MessageType: "ADT", TriggerEvent: "A01"} // AdtA03 represents an Adt^A03 HL7 message. AdtA03 = &message.Type{MessageType: "ADT", TriggerEvent: "A03"} // AdtA04 represents an Adt^A04 HL7 message. AdtA04 = &message.Type{MessageType: "ADT", TriggerEvent: "A04"} // AdtA05 represents an Adt^A05 HL7 message. AdtA05 = &message.Type{MessageType: "ADT", TriggerEvent: "A05"} // AdtA09 represents an Adt^A09 HL7 message. AdtA09 = &message.Type{MessageType: "ADT", TriggerEvent: "A09"} // AdtA10 represents an Adt^A10 HL7 message. AdtA10 = &message.Type{MessageType: "ADT", TriggerEvent: "A10"} // AdtA13 represents an Adt^A13 HL7 message. AdtA13 = &message.Type{MessageType: "ADT", TriggerEvent: "A13"} // AdtA17 represents an Adt^A17 HL7 message. AdtA17 = &message.Type{MessageType: "ADT", TriggerEvent: "A17"} // AdtA23 represents an Adt^A23 HL7 message. AdtA23 = &message.Type{MessageType: "ADT", TriggerEvent: "A23"} // AdtA31 represents an Adt^A31 HL7 message. AdtA31 = &message.Type{MessageType: "ADT", TriggerEvent: "A31"} // AdtA34 represents an Adt^A34 HL7 message. AdtA34 = &message.Type{MessageType: "ADT", TriggerEvent: "A34"} // AdtA40 represents an Adt^A40 HL7 message. AdtA40 = &message.Type{MessageType: "ADT", TriggerEvent: "A40"} // OrmO01 represents an ORM^O01 HL7 message. OrmO01 = &message.Type{MessageType: "ORM", TriggerEvent: "O01"} // OruR01 represents an ORU^R01 HL7 message. OruR01 = &message.Type{MessageType: "ORU", TriggerEvent: "R01"} // OruR03 represents an ORU^R03 HL7 message. OruR03 = &message.Type{MessageType: "ORU", TriggerEvent: "R03"} // OruR32 represents an ORU^R32 HL7 message. OruR32 = &message.Type{MessageType: "ORU", TriggerEvent: "R32"} // OrrO02 represents an ORR^O02 HL7 message. OrrO02 = &message.Type{MessageType: "ORR", TriggerEvent: "O02"} )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct { MessageType *message.Type HeaderInfo *message.HeaderInfo PatientInfo *ir.PatientInfo OtherPatientInfo *ir.PatientInfo UseOtherPatientInfo bool // Set to true if you want the data from the second, different, patient to be used. // Replace is a map of string to string replacements in the resulting message. Replace map[string]string // contains filtered or unexported fields }
func NewBuilderForTests ¶
func NewBuilderForTests() Builder
func NewBuilderWithTime ¶
func (*Builder) BuildMessage ¶
BuildMessage builds a HL7 message using the data contained in the Builder. It returns the HL7 message as a string, with segments separated by \r. Every invocation of BuildMessage generates a message with a different Message Control ID and a date after the previous generated message, so that every resulting message is treated as unique. BuildMessage fails if the message type cannot be identified or is not correct.
func (*Builder) CurrentTime ¶
CurrentTime populates the builder with the current time.