The current approach for handling patient identifier searches using admin-defined regular expressions is too slow. Regular expression (REGEXP) searches (at least in MySQL) do not use indexes and, therefore, unacceptably slow down the system.
A quick fix is to clear out the patient.identifierRegex global property.
A long-term fix would be to replace the regular expression search with the ability to define a list of search patterns. We need to be able to accommodate leading zeroes and identifier with or without a hyphen.
Add a patient.identifierSearchPattern global property that allows for @SEARCH@, @
SEARCH-1@ (search query without last character), and @CHECKDIGIT@ (last character) with commas separating multiple values.
For example, setting patient.identifierSearchPattern to "@SEARCH@,0@SEARCH@,@
SEARCH-1@ @CHECKDIGIT@,0@@CHECKDIGIT@" would turn a request for "4127" into a search for "in ('4127','04127','412-7','0412-7')". SEARCH-1@