I'd like to create a C# program that generate the HL7 messages foramt by rooping through the table in database.
I have two tables: Patient and lab result.
I am trying to looping through these tables and generate the HL7 messages. some fields are default and some fields are comming from the database.
Please see the comments
For example,
Here is the data in the tables:
PId lastname firstname
19191919 John Rick
Test Result name
URR 79 John, rick
HGB 11.2 John, rick
and the HL 7 message that generate by the program should look like:
MSH|^&\~|NAPPY|||4|20060705003913||DFT^P03|0|P|2.2
EVN|P03|20060705003913||OVR
PID|||19191919||John^Rick -- -----------> Patient Id 19191919 , and last and first name John^Rick comes from the dataabse
OBX||ST|URR^URR||11||||||R ------------>Lab value: 11 comes from the database
OBX||ST|HCT^HGB||79.2||||||R ----------------->Lab value:79.2 comes from the database
FT1||||20060601||C|ZZ^Load Lab Results^^N^N|||1|||A230||||||586.6 ----------------> A230 comes from the database
BTS|1 -------------------> count of message in file
FTS|1
what is the best way to do this? can you show me some examples?