PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierTypeByName( assigningAuthority); if (pit == null) {
s = s.substring(s.indexOf(":") + 1); String[] temp = s.split(","); PatientIdentifierType pit = ps.getPatientIdentifierTypeByName(temp[0]); String identifier = temp[1]; List<PatientIdentifier> pis = ps.getPatientIdentifiers(identifier, Collections.singletonList(pit), null,
PatientIdentifierType pit = ps.getPatientIdentifierTypeByName(identifierType); List<PatientIdentifier> found = ps.getPatientIdentifiers(identifier, Collections.singletonList(pit), null, null, null);
/** * @see PatientService#getPatientIdentifierTypeByName(String) */ @Test public void getPatientIdentifierTypeByName_shouldNotReturnPatientIdentifierTypeThatPartiallyMatchesGivenName() throws Exception { PatientIdentifierType identifierType = Context.getPatientService().getPatientIdentifierTypeByName("OpenMRS"); Assert.assertNull(identifierType); }
/** * @see PatientService#getPatientIdentifierTypeByName(String) */ @Test public void getPatientIdentifierTypeByName_shouldReturnNullWhenPatientIdentifierTypeWithGivenNameDoesNotExist() throws Exception { PatientIdentifierType identifierType = Context.getPatientService().getPatientIdentifierTypeByName( "Invalid Identifier Example"); Assert.assertNull(identifierType); }
/** * @see PatientService#getPatientIdentifierTypeByName(String) */ @Test public void getPatientIdentifierTypeByName_shouldFetchPatientIdentifierTypeThatExactlyMatchesGivenName() throws Exception { String identifierTypeName = "OpenMRS Identification Number"; PatientIdentifierType identifierType = Context.getPatientService() .getPatientIdentifierTypeByName(identifierTypeName); Assert.assertNotNull(identifierType); Assert.assertEquals(identifierType.getName(), identifierTypeName); Assert.assertTrue(identifierType.getClass().isAssignableFrom(PatientIdentifierType.class)); }
ValidateUtil.validateFieldLengths(errors, identifierType.getClass(), "name", "format", "formatDescription", "validator", "retireReason"); PatientIdentifierType exist = Context.getPatientService().getPatientIdentifierTypeByName( identifierType.getName()); if (exist != null && !exist.getRetired()
List<String> attributes = Arrays.asList("London", "Berlin", "Warsaw", "Paris", "Zurich", "Singapore"); PatientIdentifierType idType = patientService.getPatientIdentifierTypeByName("Old Identification Number");
PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierTypeByName( assigningAuthority); if (pit == null) {
PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierTypeByName( assigningAuthority); if (pit == null) {
PatientIdentifierType getPatientIdentifierType(IdentifierType identifierType) { return patientService.getPatientIdentifierTypeByName(identifierType.getName()); }
org.openmrs.Patient getOpenmrsPatientByMotechId(String motechId) { PatientIdentifierType motechIdType = patientService.getPatientIdentifierTypeByName(IdentifierType.IDENTIFIER_MOTECH_ID.getName()); List<PatientIdentifierType> idTypes = new ArrayList<>(); idTypes.add(motechIdType); List<org.openmrs.Patient> patients = patientService.getPatients(null, motechId, idTypes, true); return (CollectionUtils.isNotEmpty(patients)) ? patients.get(0) : null; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String) */ @Override public PatientIdentifierType getByUniqueId(String uniqueId) { PatientIdentifierType type = service().getPatientIdentifierTypeByUuid(uniqueId); if (type == null) type = service().getPatientIdentifierTypeByName(uniqueId); return type; }
List<OpenMRSPatient> patients = convert(patientService.getPatients(name, motechId, Arrays.asList(patientService.getPatientIdentifierTypeByName(IdentifierType.IDENTIFIER_MOTECH_ID.getName())), false), new Converter<Patient, OpenMRSPatient>() { @Override
/** * Sets the identifier type for a patient identifier. * * @param instance * @param identifierType * @throws org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException */ @PropertySetter("identifierType") public void setIdentifierType(PatientIdentifier instance, PatientIdentifierType identifierType) { String uuid = identifierType.getUuid(); String name = identifierType.getName(); boolean reset = false; if (!reset && !StringUtils.isEmpty(uuid)) { PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierTypeByUuid(uuid); if (pit != null) { instance.setIdentifierType(pit); reset = true; } } if (!reset && !StringUtils.isEmpty(name)) { PatientIdentifierType pit = Context.getPatientService().getPatientIdentifierTypeByName(name); if (pit != null) { instance.setIdentifierType(pit); reset = true; } } }
identifierType = Context.getPatientService().getPatientIdentifierTypeByName(id);
@Test public void shouldGetAPatientIdentifierTypeByName() throws Exception { final String name = "OpenMRS Identification Number"; MockHttpServletRequest req = request(RequestMethod.GET, getURI() + "/" + name); SimpleObject result = deserialize(handle(req)); PatientIdentifierType patientIdentifierType = service.getPatientIdentifierTypeByName(name); assertEquals(patientIdentifierType.getUuid(), PropertyUtils.getProperty(result, "uuid")); assertEquals(patientIdentifierType.getName(), PropertyUtils.getProperty(result, "name")); }