Patient Letters Report Logic

Based on the entered parameters, this report finds all letters that meet the following criteria:

  1. The letter template name includes the exact string entered by the user for Letter Template Name.
  2. The letter's last revision is within the date range created by the entered Start Date and End Date. 
  3. If Include Unsigned is "Yes," the letter is signed by the patient. If Include Unsigned is "No," all letters that meet criteria #1 and #2 are included. 

After the above have been filtered, this report returns every distinct combination of patient and letter template, including some additional information about the patient and the last date any qualifying letter was revised (this field is Last Revision). 

For instance, if there is more than one letter template name that meets criteria #1 above, if a patient had letters from multiple qualifying templates on their chart, the patient will be shown for each letter template. The intention is that the results, once exported, can be filtered if desired to a single letter template name.