Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var hl7 = require('simple-hl7');
- var Client = require('scp2').Client;
- /*
- The message constructor creates the MSH segment. Each argument is a field.
- */
- var adt = new hl7.Message(
- "EPIC",
- "EPICADT",
- "SMS",
- "199912271408",
- "CHARRIS",
- ["ADT", "A04"] //This field has 2 components
- //Keep adding fields
- );
- /*
- .addSegment() takes similiar syntax as Message constructor.
- The first argument is segment name, and the rest of the arguments are added as fields.
- */
- adt.addSegment("PID",
- "", //Blank field
- ["0493575", "", "", "2", "", "ID 1"], //Multiple components
- "454721",
- "",
- ["DOE", "JOHN", "", "", "", ""],
- "19480203"
- //Keep adding arguments to add more fields
- );
- adt.addSegment("OBX",
- 1, //Blank field
- ["JHDL", "HDL Cholesterol (CAD)"], //Multiple components
- 1,
- 62,
- ["CD:289", "mg/dL"],
- [">40", "40"]
- );
- adt.addSegment("OBX",
- 1, //Blank field
- ["JTRIG", "Triglyceride (CAD)"], //Multiple components
- 1,
- 15,
- ["CD:289", "mg/dL"],
- ["35-150", "35", "150"]
- );
- var client = new Client({
- port: 22
- });
- client.defaults({
- port: 22,
- host: 'example.com',
- username: 'admin',
- privateKey: '....',
- // password: 'password', (accepts password also)
- });
- client.write({
- destination: '/home/admin/data/file.txt',
- content: adt.toString()
- }, callback)
Add Comment
Please, Sign In to add comment