NextGen Connect 3.10.1 Released!

NextGen (Mirth) Connect 3.10.1 is now available as an appliance update and on our GitHub page. This release contains bug fixes. See the release notes for the list of fixes.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

global function and database connection

  • Filter
  • Time
  • Show
Clear All
new posts

  • global function and database connection

    I have 2000 charge files need to be processed at 10:00 pm everyday. I am thinking to create function in the code template that other channels can use it. I will pass a P1 segment and extract fields from it, e.g. patient name, dob, address, sex...I want to do a database connection using

    var dbConn =
    DatabaseConnectionFactory.createDatabaseConnection ("org.postgresql.Driver",
    'jdbcostgresql://localhost:5432/mirthtraining', 'mirthtraining',
    var result = dbConn.executeCachedQuery('SELECT * FROM person');

    I will use the function call in the filter javascript. Do I need to do the database connection for each record being read? The function should do a database query that if the patient is found return the MRN. What is the most efficient way to do it? I am confused and your help is appreciated. (mirth 3.01.7051)