PatientIdentifierType and objects through the API. A Patient is a Person and inherits all attributes/objects from that object. A PatientIdentifier is a medical record number. A patient can have any number of medical record numbers. Each number has a certain type: PatientIdentifierType. An example of a type would be a "hospital X id" or "Country X National ID"
A Patient object represents the reason we write OpenMRS. It represents a human that medical data (Obs) can be collected on. A Patient has very little metadata itself because it inherits from Person.
Properties on a patient:
Inherited from Person:
// Gets patients with the given criteria. only one of name/identifier is required. if identifier is non-null, identifier types are matched against and matchIdentifierExactly is considered public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes, boolean matchIdentifierExactly) // Saves the given Patient object into the database. Saves are cascaded to all objects on the Patient object (Identifiers, PersonName, PersonAddress, etc) public void savePatient(Patient p); // Marks the given patient as invalid. All obs and encounters associated to this patient are left as-is. public void voidPatient(Patient p); // Gets all patient objects in the system. If a database has more than 10k patients, this will probably cause an [OOM|docs:Troubleshooting Memory Errors] public List<Patient> getAllPatients();
Patient pat = Context.getPatientService().getPatientByUuid("1234-56789-123"); pat.setGender("M"); pat.addName(new PersonName("Jim", "Bob", "Smith"); Context.getPatientService().savePatient(pat);
A Patient can be linked to a user via the Person. If User.getPerson() is the Person parent class, they are the same person. Note: A Patient can have multiple user accounts linked to it with this modeling.
The Patient class source code can be seen here.
Administrators define what types of identifiers they will collect. These range from National ID numbers, to driver's license numbers, to per-hospital medical record numbers.
Properties on PatientIdentifierType:
See LuhnIdentifierValidator class for the typical validator
A patient has any number of identifiers. The patient can be found using any of their identifiers. A number has to be unique across all PatientIdentifierTypes in the database.
Properties on PatientIdentifier: