Article ID: 17239
Date:
9/26/2003
Published: 1/12/2004
Application: MRI
Source:
Meditech
Platform: MAGIC

Printing the Most Recent Visit Date on a MRI Report

Recently, we had a hospital inquire as to how to print the most recent visit date on a MRI report.  They wrote the report in the DPM MRI.PAT detail segment mri.patient.file.  The field that we are after, visit.date, resides in the child segment mri.pat.visits.

By placing it on the report once (and not as a multiple), the field loops through all the visit dates and displays the last one filed.  Since the segment mri.pat.visits stores the data with the most recent visit first followed by the next latest visit, and so on, technically the "last visit" would print.

For example, consider the following patient's visit dates:

06/10/03
04/09/92
12/29/91
05/19/80

By placing visit.date on the picture as a single field, 05/19/80 would print since that is the last visit date stored.  The segment does not store the visit dates in the reverse order with 04/09/92 as the last visit date.  So, we actually want to print the first or most recent date.

However, there is an additional problem.  When you look at your data definition list, you see that the field "visit.date" is actually a virtual field; it is not stored on the disk as say "visit.admit.urn" is stored on the disk.  In order to get the first or most recent visit date, we must reproduce the coding in the virtual field and use the @First syntax to get the first subscript for the segment mri.pat.visits.

To get the correct visit date, you will need to create the following computed field:

xx.visit.date
DAT=DATE
JFY=L
LEN=8
VAL=99999999-((@First(visit.subscript))#"0|"$8)<99999999

This will now print the most recent visit date.


17277