for (Iterator<ConceptSearchResult> i = results.iterator(); i.hasNext();) { ConceptSearchResult res = i.next(); String ds = res.getConcept().getDisplayString(); out.print("{ \"value\":\""); if (res.getConceptName().isPreferred() out.print(WebUtil.escapeQuotes(res.getConceptName().getName())); } else { out.print(WebUtil.escapeQuotes(res.getConcept().getDisplayString()));
if (!initialValues.isEmpty()) { for (int i = 0; i < initialValues.size(); i++) { toPrint = toPrint + initialValues.get(i).getDisplayString() + ";"; for (int i = 0; i < initialValues.size(); i++) { String spanid = "" + context.getFieldName(this) + "span_" + i; sb.append("<span id=\"" + spanid + "\"></br>" + initialValues.get(i).getDisplayString() + "<input id=\"" + spanid + "_hid" + "\" class=\"autoCompleteHidden\" type=\"hidden\" name=\"" + spanid + "_hid" + "\" value=\"" + initialValues.get(i).getConceptId() + "\"> <input id=\"" + spanid + "_button"
String toPrint = ""; if (initialValue != null) { toPrint = initialValue.getDisplayString(); return WidgetFactory.displayValue(toPrint); } else { sb.append(" value=\"" + initialValue.getDisplayString() + "\""); sb.append("/>");
+ (concept == null ? "" : JavaScriptUtils.javaScriptEscape(concept.getDisplayString())) + "\");\n"); sb.append("$j('#" + widgetFieldName + "_hid" + "').val(\"" + (concept == null ? "" : JavaScriptUtils.javaScriptEscape(concept.getId().toString())) + "\");\n"); sb.append("$j('#" + widgetFieldName + "').change();\n");
/** * @see OrderResource1_10#getDisplayString(org.openmrs.Order) */ @PropertyGetter("display") public static String getDisplay(DrugOrder delegate) { StringBuilder ret = new StringBuilder(); ret.append("(" + delegate.getAction() + ") "); if (delegate.getDrug() != null) { ret.append(delegate.getDrug().getName()); } else { ret.append(delegate.getConcept().getDisplayString()); } if (Order.Action.DISCONTINUE != delegate.getAction() && delegate.getDosingType() != null && delegate.getDosingInstructionsInstance() != null) { String dosingInstructionsAsString = delegate.getDosingInstructionsInstance().getDosingInstructionsAsString( Context.getLocale()); ret.append(": "); ret.append(dosingInstructionsAsString); } return ret.toString(); } }
@Test public void generateHtml_shouldRenderMultipleConceptProperlyInViewMode() { when(context.getMode()).thenReturn(FormEntryContext.Mode.VIEW); DynamicAutocompleteWidget dynamicAutocompleteWidget = new DynamicAutocompleteWidget(generateConceptList(), null); Concept initialValue1 = mock(Concept.class); when(initialValue1.getDisplayString()).thenReturn("concept1"); dynamicAutocompleteWidget.addInitialValue(initialValue1); Concept initialValue2 = mock(Concept.class); when(initialValue2.getDisplayString()).thenReturn("concept2"); dynamicAutocompleteWidget.addInitialValue(initialValue2); String html = dynamicAutocompleteWidget.generateHtml(context); TestUtil.assertFuzzyContains("concept1;concept2;", html); }
@Test public void generateHtml_shouldRenderSingleConceptProperlyInViewMode() { when(context.getMode()).thenReturn(FormEntryContext.Mode.VIEW); DynamicAutocompleteWidget dynamicAutocompleteWidget = new DynamicAutocompleteWidget(generateConceptList(), null); Concept initialValue = mock(Concept.class); when(initialValue.getDisplayString()).thenReturn("concept1"); dynamicAutocompleteWidget.setInitialValue(initialValue); String html = dynamicAutocompleteWidget.generateHtml(context); TestUtil.assertFuzzyContains("concept1", html); }
/** * Gets the display string for a person attribute. * * @param pa the person attribute. * @return attribute type + value (for concise display purposes) */ @PropertyGetter("display") public String getDisplayString(PersonAttribute pa) { if (pa.getAttributeType() == null) return ""; if (Concept.class.getName().equals(pa.getAttributeType().getFormat()) && pa.getValue() != null) { Concept concept = Context.getConceptService().getConcept(pa.getValue()); return concept == null ? null : concept.getDisplayString(); } return pa.getAttributeType().getName() + " = " + pa.getValue(); }
@Override public String getDisplayProperty() { return getObject().getState().getConcept().getDisplayString(); }
/** * @see VelocityFunctions@getConcept() * @verifies return concept id of a concept code or uuid */ @Test public void getConcept_shouldReturnConceptWithGivenId() throws Exception { VelocityFunctions functions = setupFunctionsForPatient(7); Concept concept = Context.getConceptService ().getConcept (5089); Assert.assertEquals(concept.getDisplayString (), functions.getConcept ("5089").getDisplayString ()); }
/** * Gets the display string for a person name. * * @param Allergy the allergy object. * @return the display string. */ @PropertyGetter("display") public String getDisplayString(Allergy allergy) { if (allergy.getAllergen().isCoded()) { return allergy.getAllergen().getCodedAllergen().getDisplayString(); } else { return allergy.getAllergen().getNonCodedAllergen(); } }
@Override public void testResults(SubmissionResults results) { results.assertNoErrors(); List<Obs> obsList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4200")); List<Obs> obsDeathList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4300")); Assert.assertEquals(obsList.size(),1); Assert.assertEquals(obsDeathList.size(),1); Assert.assertEquals("PATIENT DIED",obsList.get(0).getValueCoded().getDisplayString()); Assert.assertEquals(dateAsString(date),dateAsString(obsList.get(0).getObsDatetime())); Assert.assertEquals("OTHER NON-CODED",obsDeathList.get(0).getValueCoded().getDisplayString()); Assert.assertEquals("Died from cancer",obsDeathList.get(0).getValueText()); }
@Override public void testResults(SubmissionResults results) { results.assertNoErrors(); List<Obs> obsList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4200")); List<Obs> obsDeathList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4300")); Assert.assertEquals(obsList.size(),1); Assert.assertEquals(obsDeathList.size(),1); Assert.assertEquals("PATIENT DIED",obsList.get(0).getValueCoded().getDisplayString()); Assert.assertEquals(dateAsString(date),dateAsString(obsList.get(0).getObsDatetime())); Assert.assertEquals("STROKE",obsDeathList.get(0).getValueCoded().getDisplayString()); Assert.assertEquals(null,obsList.get(0).getValueText()); }
@Override public void testResults(SubmissionResults results) { results.assertNoErrors(); List<Obs> obsList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4200")); Assert.assertEquals(obsList.size(),1); Assert.assertEquals("RECOVERED",obsList.get(0).getValueCoded().getDisplayString()); Assert.assertEquals(dateAsString(date),dateAsString(obsList.get(0).getObsDatetime())); }
dateWidget.setInitialValue(obsList.get(0).getObsDatetime()); initialAnswer = obsList.get(0).getValueCoded(); reasonForExitWidget.setInitialValue(initialAnswer.getDisplayString()); for (ConceptAnswer conceptAnswer : reasonExitConcept.getAnswers()) { Concept answerConcept = conceptAnswer.getAnswerConcept(); Option answerOption = new Option(answerConcept.getDisplayString(), answerConcept.getId().toString(), answerConcept.equals(initialAnswer)); reasonForExitWidget.addOption(answerOption); causeOfDeathWidget.setInitialValue(initialCauseOfDeath.getDisplayString()); if (obsDeath.get(0).getValueText() != null) { otherReasonWidget.setInitialValue(obsDeath.get(0).getValueText()); for (ConceptAnswer conceptAnswer : causeOfDeathConcept.getAnswers()) { Concept answerConcept = conceptAnswer.getAnswerConcept(); Option answerOption = new Option(answerConcept.getDisplayString(), answerConcept.getId().toString(), answerConcept.equals(initialCauseOfDeath)); causeOfDeathWidget.addOption(answerOption);