BLOGS
EASY SUBSCRIBE


Report Writing

Interoperability and EHR Optimization

Privacy and Security

Getting Most Recent BAR Comment for Account (MAGIC, Client/Server, or 6.0)

Written by Joe Cocuzzo, Senior VP of Report Writing Services - iatricSystems

A BAR analyst from a C/S hospital posted a request to the "Meditech-L" mailing list, asking for help in including the last billing comment and last billing comment date on a BAR.PAT report.

MEDITECH had provided code to loop back through the transactions and get the last "c" type transaction and then get the date, but this would stop on system comments also. MEDITECH also tried to provide code to get the comment itself, but the logic provided was not quite correct.

There are two issues to overcome for this report:

  1. You need to loop backward to the most recent "c" type transaction, but also skip any system transactions.
  2. You need to get the transaction text from a child segment under the transaction, as MEDITECH stores billing comments in multiple lines.

Step one is to take a look in a billing system and see what system comments look like, so we can figure out which transactions to exclude from our logic that will "back up" to the most recent comment made by a human, vs. the comments from automatic stuff in B/AR.

Even those of us that write NPR reports all day don’t exactly recall what system vs. user comments look like, so we write a quick report at the transaction text level to see what things look like; we need to write our quick report here:

NPR Tip

NPR Tip

Our quick report just gets some accounts and shows us all the "c" type transactions:

NPR Tip

NPR Tip

NPR Tip

So, how do we write some computed fields or attributes or macro code to get the last "real" comment date, and the comment text from that comment?

First, the date, we go "backward" (@Prev goes from largest to smallest transaction urn) until we hit a "c" type transaction where the user is anybody but BKG DAEMON. Hang on to the txn urn in the variable FND, which also serves as a flag to stop our backward looping.

[MAGIC Users Please Note:

In MAGIC, it appears that comments from automatic processes have the user that happened to start the BAR background job, so you’d need to do some more sophisticated screening of system stuff than you need to do in C/S. Possibly looking at @txn.comment for "NSD" and other automatic comments would work.]

Note that at the end of this loop, FND holds the @txn.urn we want and txn.urn is one less than that transaction, because the @Prev happens one more time before we check FND and stop looping because it has a value (i.e. NOT FND no longer true).

NPR Tip

Now we need to write some code to show all the transaction text for the comment. We could build an MV array and load it with the transaction text, but then you either have to use a utility to keep the field number subscript dynamic and unbreakable (highly recommended) or hardcode a field number and take the risk that an edit could break your report. Instead, lets write one computed field for the first text line, and wrap a DO loop around a second computed field to handle the rest of the text lines.

The first comment line is a simple computed field that just uses the txn.urn from FND and has a hardcoded 1 to print the first line

NPR Tip

For the rest of the lines, we wrap a loop around a second "D" line as follows:

NPR Tip

The field to print line 2 through N is:

NPR Tip

So our report written at the "top" (main) level is now smart enough to go through the transactions in the child segment and find the last comment, then go through the text in the grandchild segment and print the lines out.

I have added a horizontal line between accounts to make output clearer:

NPR Tip

A sample report, in MAGIC and C/S BAR.PAT.zcus.is.last.comment.and.text has been placed in our report library.

Topics: BAR analyst, MEDITECH, C/S, 6.0, Client/Server, Most Recent BAR Comment, 6.x Conversion, Report Writing Tips and Tricks, BAR.PAT report

Subscribe to the Report Writing blog.

Receive the latest articles directly in your inbox.
Enter your email address and click SUBSCRIBE:

Comments

0 COMMENTS