Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

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

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

MDM with Assoc PDF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MDM with Assoc PDF

    OK, so it's been weeks getting pieces and parts to get this working as it is hard to find answers and documented information, but here it is, hopes it helps someone. I have 1 issue left (next post), here is the Source Transformer:

    // Mike Caldwell 08/13/2008
    // Not bad for an old VB programmer
    // Create folder for PDF if they dont exist as YearMonth (200808)
    // then Copy PDF to correct folder with UNC Link in updated MDM
    // Move MDM to the IN directory to be processed by GE Centricity LinkLogic
    // Delete PDF from SRC after copy is complete, Move Command? unheard of I guess in Java
    // Java/C programmers beware, ProperCase variables used, you might hurt yourself
    // True = true = -1 = Yes = On etc..

    // Set Year(Yr) and YearMonth(YrMnth) variables
    var YrMnth = DateUtil.getCurrentDate("yyyyMM");
    var Yr = DateUtil.getCurrentDate("yyyy");

    // Update the OBX.5[1] segment with UNC + TXA.16
    // TAKE OFF THE + "12" After the PDF Copy is included
    var unc = "\\\\VMDC\\LABS_PDF\" + Yr + "\" + YrMnth ;
    if (msg['OBX']['OBX.3'][1] = "IMAGE_REF")
    {
    msg['OBX']['OBX.5'][1] = unc + "\" + msg['TXA']['TXA.16']['TXA.16.1'].toString();
    }

    // Make needed directories for my PDF destination: YEARMONTH (200808)
    // This is done to prevent a single directory having around 80,000+ files
    // which isnt fun when you try to open the folder in Windows
    //
    var NewFolder = "C://Temp//CarisDx_Mishra//" + Yr + "//" + YrMnth;
    var jiofolder = new java.io.File(NewFolder);
    var Success = jiofolder.mkdirs();
    channelMap.put('NewDirLoc',NewFolder);
    channelMap.put('CreatedNewDir?',Success);

    // Success = True directories created Else False they existed
    if (Success)
    {
    // Click DASHBOARD, Double click CHANNEL (CHANNEL MESSAGES)
    // Select A ROW, Click on Mapper below to see the following
    // logger.info Messages
    logger.info("Directory Created : " + NewFolder );
    }
    else
    {
    // Success = False directories existed
    if(jiofolder.isDirectory())
    {
    // Click DASHBOARD then look a bottom at SERVER LOG
    // this is where logger.error writes to
    logger.error("logger.error - Directory Existed!");
    }
    }

    // Get Source and Dest Paths and PDF Filename from TXA.16
    var PDFSrcPath = "C://Temp//CarisDx_Mishra//IN//";
    var PDFDestPath = "C://Temp//CarisDx_Mishra//" + Yr + "//" + YrMnth + "//" ;
    var PDFName = msg['TXA']['TXA.16']['TXA.16.1'].toString();
    channelMap.put('PDFPDFSrcPath',PDFSrcPath);
    channelMap.put('PDFPDFDestPath',PDFDestPath);
    channelMap.put('PDFName',PDFName);

    // Does the PDF Exist?
    var jioFile = new java.io.File(PDFSrcPath + PDFName);
    // boolean exists() -- Tests whether the file or directory denoted by this abstract pathname exists.
    var FileExists = jioFile.exists();
    channelMap.put('PDFExistsStatus',FileExists);

    // EXAMPLE: FileUtil.write('filename', append(true/false), stringData);
    // Check to see if the PDF exists in PDFSrcPath
    if (FileExists)
    {
    channelMap.put('PDFCopied', 'PDF File Copied - ' + PDFSrcPath + PDFName + ' -to- ' + PDFDestPath + PDFName)
    // COPY THE PDF TO NEW LOCATION
    FileUtil.write(PDFDestPath + PDFName, false, FileUtil.read(PDFSrcPath + PDFName));

    // DELETE THE PDF
    //var DeleteThisFile = Packages.java.io.File(PDFSrcPath + PDFName);
    //DeleteThisFile['delete']();

    // boolean delete() Deletes the file or directory denoted by this abstract pathname.
    // ????? Not sure why this won't work ??????
    //var jioDeletePDF = new java.io.File(PDFSrcPath + PDFName);
    //var DeletePDF = jioDeletePDF.delete();
    //if (DeletePDF)...

    // DELETE THE PDF
    var DeleteThisFile = Packages.java.io.File(PDFSrcPath + PDFName);
    if (DeleteThisFile['delete']())
    {
    channelMap.put('PDFDeletedStatus', 'PDF DELETED - ' + PDFSrcPath + PDFName);
    }
    else
    {
    channelMap.put('PDFDeletedStatus', 'PDF NOT Deleted - ' + PDFSrcPath + PDFName);
    }
    }
    else
    {
    channelMap.put('PDFCopied', 'PDF COPY ABORTED (PDF Not Found) - ' + PDFSrcPath + PDFName)
    } MDM_UPDATE_WITH_PDF_COPY.xml (12573 bytes)
    Mike Caldwell
    Alliance HealthCare - GE VAR
    Rocklin, CA
    Centricity PM/EMR Support - Developer - Network Engineer

  • #2
    Re:MDM with Assoc PDF

    So why does this work??? The code is in this channel REMed out.

    // Does the PDF Exist?
    // THIS WORKS FINE
    // boolean exists() -- Tests whether the file or directory denoted by this abstract pathname exists.
    var jioFile = new java.io.File(PDFSrcPath + PDFName);
    var FileExists = jioFile.exists();
    if (FileExists)...
    {

    And this does not work?

    // ????? Not sure why this won't work ??????
    // boolean delete() Deletes the file or directory denoted by this abstract pathname.
    var jioDeletePDF = new java.io.File(PDFSrcPath + PDFName);
    var DeletePDF = jioDeletePDF.delete();
    if (DeletePDF)...

    or just using

    jioDeletePDF.delete();

    It gives me an eror on the '.' I looked this up and it says:
    // boolean delete() Deletes the file or directory denoted by this abstract pathname.

    I had to use...

    var DeleteThisFile = Packages.java.io.File(PDFSrcPath + PDFName);
    if (DeleteThisFile['delete']())

    Which honestly I don't even know how this works - DeleteThisFile['delete']? Seems redundant.

    Are there other parms DeleteThisFile['????????']???
    Mike Caldwell
    Alliance HealthCare - GE VAR
    Rocklin, CA
    Centricity PM/EMR Support - Developer - Network Engineer

    Comment

    Working...
    X