Generating ID on Registration
SanteMPI can generate a unique identifier in any format you choose whenever a patient is registered. This generation can occur regardless of where the registration originated (FHIR, HL7v2, UI, etc.).
This generator will use the Business Rules Engine to generate a new ID each time a master record is created for the patient.
Create a new Business Rules File
Create a new JavaScript file in the rules/ folder of your applet / plugin for SanteMPI. The basic structure of this file should be:
Write Generator Function
Next, write your ID generator in JavaScript, for example, this generator will create a 10 digit random identifier from UUID, and appends a mod 97 check digit to the end:
Write Business Rule
Next, we'll write a small function which accepts a patient as a parameter and adds a new identifier if one has not already been assigned
Attach Business Rules to Triggers
Finally, attach the business rule functions to the SanteDB triggers. The example below will attach the append function to the BeforeInsert trigger on PatientMaster
Register the Identifier Generator
You can also have the UI made aware of the presence of this generator by registering an identifier generator.
Last updated
Was this helpful?