Guest User

Untitled

a guest
Nov 28th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. var hl7 = require('simple-hl7');
  2. var Client = require('scp2').Client;
  3.  
  4. /*
  5. The message constructor creates the MSH segment. Each argument is a field.
  6. */
  7.  
  8. var adt = new hl7.Message(
  9. "EPIC",
  10. "EPICADT",
  11. "SMS",
  12. "199912271408",
  13. "CHARRIS",
  14. ["ADT", "A04"] //This field has 2 components
  15. //Keep adding fields
  16. );
  17.  
  18. /*
  19. .addSegment() takes similiar syntax as Message constructor.
  20. The first argument is segment name, and the rest of the arguments are added as fields.
  21. */
  22.  
  23. adt.addSegment("PID",
  24. "", //Blank field
  25. ["0493575", "", "", "2", "", "ID 1"], //Multiple components
  26. "454721",
  27. "",
  28. ["DOE", "JOHN", "", "", "", ""],
  29. "19480203"
  30. //Keep adding arguments to add more fields
  31. );
  32.  
  33.  
  34. adt.addSegment("OBX",
  35. 1, //Blank field
  36. ["JHDL", "HDL Cholesterol (CAD)"], //Multiple components
  37. 1,
  38. 62,
  39. ["CD:289", "mg/dL"],
  40. [">40", "40"]
  41. );
  42.  
  43. adt.addSegment("OBX",
  44. 1, //Blank field
  45. ["JTRIG", "Triglyceride (CAD)"], //Multiple components
  46. 1,
  47. 15,
  48. ["CD:289", "mg/dL"],
  49. ["35-150", "35", "150"]
  50. );
  51.  
  52.  
  53. var client = new Client({
  54. port: 22
  55. });
  56.  
  57. client.defaults({
  58. port: 22,
  59. host: 'example.com',
  60. username: 'admin',
  61. privateKey: '....',
  62. // password: 'password', (accepts password also)
  63. });
  64.  
  65. client.write({
  66. destination: '/home/admin/data/file.txt',
  67. content: adt.toString()
  68. }, callback)
Add Comment
Please, Sign In to add comment