The typical approach would be to define variable names for these things and then use a module setting (global property) to define the ID format – e.g. $YY$MM$DD$PID$N-$C, where you define variables like:
- $YYYY four digit year - $YY two digit year - $M non-padded month - $MM zero-padded month - $D non-padded day of month - $DD zero-padded day of month - $PID patient id - $N incrementing number for day - $C check digit (calculated from identifier) If you are using a mod10 algorithm for check digits, then you may want to consider the modified Luhn algorithm <https://wiki.openmrs.org/x/bxIz> that allows for letters as well as numbers in the identifier. Note that the next iteration of the order entry service will be generating an order number & will accommodate implementation-specific algorithms. I'm assuming that, since you're building a lab system, you're referring to generating the lab's accession number. -Burke On Mon, May 14, 2012 at 7:38 AM, Friedman, Roger (CDC/CGH/DGHA) (CTR) < r...@cdc.gov> wrote: > For the lab module on which I am working, I need to generate unique IDs > for lab orders, specimens and reports. These IDs should be in a > user-specified format containing some or all of the following elements: > patient ID, current year, current month, current day, sequential number, > check digit, string constant. I am trying to decide on how the user is to > specify this: a pattern stored in a global property, some sort of > interpretable scripting language, a groovy snippet, whatever. Does anybody > have any suggestions, patterns to follow, examples? > _________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to lists...@listserv.iupui.edu with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:lists...@listserv.iupui.edu?body=SIGNOFF%20openmrs-devel-l]