/** * @param nonCodedAllergen the nonCodedAllergen to set */ public void setNonCodedAllergen(String nonCodedAllergen) { this.nonCodedAllergen = nonCodedAllergen; if (StringUtils.isNotBlank(nonCodedAllergen) && codedAllergen != null && !codedAllergen.getUuid().equals(getOtherNonCodedConceptUuid())) { codedAllergen = null; } }
/** * @param codedAllergen the codedAllergen to set */ public void setCodedAllergen(Concept codedAllergen) { this.codedAllergen = codedAllergen; if (codedAllergen != null && !codedAllergen.getUuid().equals(getOtherNonCodedConceptUuid())) { nonCodedAllergen = null; } }
public boolean isCoded(){ return codedAllergen != null && !codedAllergen.getUuid().equals(getOtherNonCodedConceptUuid()); }
private Concept createMockConcept(String uuid) { Concept concept = mock(Concept.class); when(concept.getUuid()).thenReturn(uuid != null ? uuid : "some uuid"); when(concept.getName()).thenReturn(new ConceptName()); return concept; }
private void mergeDateOfDeath(Patient preferred, Patient notPreferred, PersonMergeLogData mergedData) { mergedData.setPriorDateOfDeath(preferred.getDeathDate()); if (preferred.getDeathDate() == null) { preferred.setDeathDate(notPreferred.getDeathDate()); } if (preferred.getCauseOfDeath() != null) { mergedData.setPriorCauseOfDeath(preferred.getCauseOfDeath().getUuid()); } if (preferred.getCauseOfDeath() == null) { preferred.setCauseOfDeath(notPreferred.getCauseOfDeath()); } }
Allergies existingAllergies = patientService.getAllergies(allergy.getPatient()); if (existingAllergies.containsAllergen(allergy)) { String key = "ui.i18n.Concept.name." + allergen.getCodedAllergen().getUuid(); String name = Context.getMessageSourceService().getMessage(key); if (key.equals(name)) {
private void assertCoded() { Assert.assertNotEquals(allergen.getCodedAllergen().getUuid(), Allergen.getOtherNonCodedConceptUuid()); Assert.assertNull(allergen.getNonCodedAllergen()); Assert.assertTrue(allergen.isCoded()); }
/** * @see BaseOpenmrsObject#equals(Object) */ @Test public void equals_shouldReturnTrueIfGivenObjectIsInstanceOfSuperOrExtendingClass() { Concept concept = new Concept(5); Concept numeric = new ConceptNumeric(); numeric.setUuid(concept.getUuid()); Assert.assertTrue(numeric.equals(concept)); Assert.assertTrue(concept.equals(numeric)); }
protected void assertNoCycles(Concept delegate, Set<String> path) throws ConversionException { for (Concept member : delegate.getSetMembers()) { if (path.add(member.getUuid())) { assertNoCycles(member, path); } else { throw new ConversionException("Cycles in children are not supported. Concept with uuid " + delegate.getUuid() + " repeats in a set."); } path.remove(member.getUuid()); } }
@Override public String resolveConceptUuidFromConceptName(String conceptName) { List<Concept> conceptList = conceptService.getConceptsByName(conceptName); if (CollectionUtils.isNotEmpty(conceptList)) { return conceptList.get(0).getUuid(); } return null; }
this.setRetireReason(c.getRetireReason()); this.setVersion(c.getVersion()); this.setUuid(c.getUuid());
/** * @see PatientService#mergePatients(Patient,Patient) */ @Test public void mergePatients_shouldAuditPriorCauseOfDeath() throws Exception { //retrieve preferred patient and set a cause of death Patient preferred = patientService.getPatient(999); preferred.setCauseOfDeath(Context.getConceptService().getConcept(3)); preferred.setDeathDate(new Date()); preferred.setDead(true); preferred.addName(new PersonName("givenName", "middleName", "familyName")); patientService.savePatient(preferred); //merge with not preferred Patient notPreferred = patientService.getPatient(7); voidOrders(Collections.singleton(notPreferred)); PersonMergeLog audit = mergeAndRetrieveAudit(preferred, notPreferred); Assert.assertEquals("prior cause of death was not audited", Context.getConceptService().getConcept(3).getUuid(), audit.getPersonMergeLogData().getPriorCauseOfDeath()); }
mergedData.setPriorCauseOfDeath(preferred.getCauseOfDeath().getUuid());
/** * Constructor from Concept. * * @param c */ public ConceptComplex(Concept c) { this.setAnswers(c.getAnswers(true)); this.setChangedBy(c.getChangedBy()); this.setConceptClass(c.getConceptClass()); this.setConceptId(c.getConceptId()); this.setConceptSets(c.getConceptSets()); this.setCreator(c.getCreator()); this.setDatatype(c.getDatatype()); this.setDateChanged(c.getDateChanged()); this.setDateCreated(c.getDateCreated()); this.setSet(c.getSet()); this.setNames(c.getNames()); this.setDescriptions(c.getDescriptions()); this.setConceptMappings(c.getConceptMappings()); this.setRetired(c.getRetired()); this.setVersion(c.getVersion()); this.setUuid(c.getUuid()); this.handler = ""; }
@Override public void validateFullRepresentation() throws Exception { Concept concept = (Concept) getRepresentation().get("concept"); assertEquals("d102c80f-1yz9-4da3-bb88-8122ce8868dd", concept.getUuid()); }
/** * @see {@link HtmlFormEntryUtil#getConcept(String)} tests a uuid that is 36 characters long but * has no dashes */ @Test @Verifies(value = "should find a concept by its uuid", method = "getConcept(String)") public void getConcept_shouldFindAConceptWithNonStandardUuid() throws Exception { // concept from HtmlFormEntryTest-data.xml String id = "1000AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; Assert.assertEquals(id, HtmlFormEntryUtil.getConcept(id).getUuid()); }
@Test public void getSearchConfig_shouldReturnConcepyByReferenceTermUuid() throws Exception { MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("term", "SSTRM-WGT234"); SimpleObject result = deserialize(handle(req)); List<Object> hits = (List<Object>) result.get("results"); Assert.assertEquals(1, hits.size()); Assert.assertEquals(service.getConcept(5089).getUuid(), PropertyUtils.getProperty(hits.get(0), "uuid")); }
@Test public void asRepresentation_shouldReturnProperlyEncodedValues() throws Exception { Allergy allergy = getObject(); Concept concept = Context.getConceptService().getConceptByUuid("a09ab2c5-878e-4905-b25d-5784167d0216"); allergy.setAllergen(concept); SimpleObject rep = getResource().asRepresentation(getObject(), Representation.DEFAULT); Assert.assertTrue(rep.keySet().contains("allergen")); rep = (SimpleObject) rep.get("allergen"); Assert.assertEquals("allergen", concept.getUuid(), rep.get("uuid")); } }
@Test public void asRepresentation_shouldReturnProperlyEncodedValues() throws Exception { Problem problem = getObject(); Concept concept = Context.getConceptService().getConceptByUuid("a09ab2c5-878e-4905-b25d-5784167d0216"); problem.setProblem(concept); SimpleObject rep = getResource().asRepresentation(getObject(), Representation.DEFAULT); Assert.assertTrue(rep.keySet().contains("problem")); rep = (SimpleObject) rep.get("problem"); Assert.assertEquals("problem", concept.getUuid(), rep.get("uuid")); } }