Package org.openmrs

Examples of org.openmrs.Obs


        Number numVal = Double.valueOf(numericAns);
        List<Obs> list = existingObs.get(question);
        if (list != null) {
            for (Iterator<Obs> iter = list.iterator(); iter.hasNext(); ) {
                Obs test = iter.next();
                if (test.getValueNumeric().equals(numVal)) {
                    iter.remove();
                    if (list.size() == 0) {
                        existingObs.remove(question);
                    }
                    return test;
View Full Code Here


     */
    public Obs removeExistingObs(Concept question, Boolean answer) {
        List<Obs> list = existingObs.get(question);
        if (list != null) {
            for (Iterator<Obs> iter = list.iterator(); iter.hasNext(); ) {
                Obs test = iter.next();
                if (test.getValueAsBoolean() == null) {
                  throw new RuntimeException("Invalid boolean value for concept " + question + "; possibly caused by TRUNK-3150");
                }
                if (answer == test.getValueAsBoolean()) {
                    iter.remove();
                    if (list.size() == 0)
                        existingObs.remove(question);
                    return test;
                }
View Full Code Here

        }
        return null;
    }

    public Obs getNextUnmatchedObsGroup(String path) {
        Obs ret = null;
      int unmatchedContenterCount = 0;
        for (Map.Entry<Obs, Set<Obs>> e : existingObsInGroups.entrySet() ) {
        if (path.equals(ObsGroupComponent.getObsGroupPath(e.getKey()))) {
          if (ret == null) ret = e.getKey();
          unmatchedContenterCount++;
View Full Code Here

            if (path.equals(ObsGroupComponent.getObsGroupPath(e.getKey())) ) {
                contenders.add(e.getKey());
            }
         }

        Obs ret = null;
       
        if (contenders.size() > 0){
            List<Obs> rankTable = new ArrayList<Obs>();
            int topRanking = 0;
           
View Full Code Here

        try {
            if (start) {
                if (existingGroup != null) {
                    session.getSubmissionActions().beginObsGroup(existingGroup);
                } else {
                    Obs obsGroup = new Obs();
                    obsGroup.setConcept(groupingConcept);
                    session.getSubmissionActions().beginObsGroup(obsGroup);
                }
            } else {
                session.getSubmissionActions().endObsGroup();
            }
View Full Code Here

     * @param extraCols
     * @param rowStarted
     * @return
     */
    private static StringBuffer appendObsToRow(ObsSubmissionElement ose, StringBuffer sb, List<String> extraCols, Locale locale){
            Obs o = ose.getExistingObs();      

            sb.append(DEFAULT_COLUMN_SEPARATOR);
            sb.append(DEFAULT_QUOTE);
            if (ose.getConcept() != null)
                sb.append((o != null) ? getObsValueAsString(Context.getLocale(), o):EMPTY);
            else
                sb.append((o != null) ? o.getConcept().getBestName(locale):EMPTY);
            sb.append(DEFAULT_QUOTE);
           
            sb.append(DEFAULT_COLUMN_SEPARATOR);
            sb.append(DEFAULT_QUOTE);    
            sb.append((o!=null)? Context.getDateFormat().format(o.getObsDatetime()):EMPTY);                                  
            sb.append(DEFAULT_QUOTE);
           
            sb.append(DEFAULT_COLUMN_SEPARATOR);
            sb.append(DEFAULT_QUOTE);    
            sb.append(getObsGroupPath(o));                                  
            sb.append(DEFAULT_QUOTE);
           
            if (extraCols != null){
                for (String st : extraCols){
                    if (st.equals("valueModifier")){
                        sb.append(DEFAULT_COLUMN_SEPARATOR);
                        sb.append(DEFAULT_QUOTE);       
                        sb.append((o != null && o.getValueModifier() != null) ? o.getValueModifier():EMPTY);                                  
                        sb.append(DEFAULT_QUOTE);
                    } else if (st.equals("accessionNumber")){
                        sb.append(DEFAULT_COLUMN_SEPARATOR);
                        sb.append(DEFAULT_QUOTE);       
                        sb.append((o != null && o.getAccessionNumber() != null) ? o.getAccessionNumber():EMPTY);                                  
                        sb.append(DEFAULT_QUOTE);
                    } else if (st.equals("comment")){
                        sb.append(DEFAULT_COLUMN_SEPARATOR);
                        sb.append(DEFAULT_QUOTE);       
                        sb.append((o != null && o.getComment() != null) ? o.getComment():EMPTY);                                  
                        sb.append(DEFAULT_QUOTE);
                    }
                }
            }
        return sb;
View Full Code Here

    ComplexData complexData=new ComplexData("test", null);
    Concept c=new Concept();
    ConceptDatatype cd=new ConceptDatatype();
    cd.setUuid(HtmlFormEntryConstants.COMPLEX_UUID);
    c.setDatatype(cd);
    Obs o=HtmlFormEntryUtil.createObs(c, complexData, null, null);
      Assert.assertEquals(o.getValueComplex(),complexData.getTitle());
   
  }
View Full Code Here

        answerConcept.addName(answer);

        Concept question = new Concept();
        question.setUuid(UUID.randomUUID().toString());
        question.setDatatype(Context.getConceptService().getConceptDatatypeByName("Coded"));
        Obs created = HtmlFormEntryUtil.createObs(question, answer, new Date(), "");
        assertThat(created.getValueCodedName(), is(answerConcept.getPreferredName(Context.getLocale())));
        assertThat(created.getValueCoded(), is(answerConcept));
    }
View Full Code Here

  @Override
  public Obs saveObs(Obs obs) {
    ComplexData c = obs.getComplexData();
    AnnotatedImage ai = (AnnotatedImage) c.getData();
    obs.setComplexData(new ComplexData(c.getTitle(), ai.getImage()));
    Obs o = super.saveObs(obs);
    for (ImageAnnotation annotation : ai.getAnnotations())
      saveAnnotation(o, annotation, annotation.getStatus() == Status.DELETE);
    log.info("drawing:saving complexObs:" + o);
   
    return o;
View Full Code Here

    questionConcept = HtmlFormEntryUtil.getConcept(questionConceptId);
    if (questionConcept == null)
      throw new IllegalArgumentException("Cannot find concept for value " + questionConceptId
              + " in conceptId attribute value. Parameters: " + parameters);
    Concept c = null;
    Obs o = context.removeExistingObs(questionConcept, c);
    if (o != null)
      existingObs = Context.getObsService().getComplexObs(o.getId(), "");
   
  }
View Full Code Here

TOP

Related Classes of org.openmrs.Obs

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.