Examples of ObsFieldAnswer


Examples of org.openmrs.module.htmlformentry.schema.ObsFieldAnswer

                //a little validation:
                if (strDiscAnswerLabels.length != discReasons.size())
                    throw new RuntimeException("discontinueReasonAnswers and discontinueReasonAnswerLabels must contain the same number of members.");
                for (int i = 0; i < strDiscAnswerLabels.length; i ++ ){
                    discOptions.add(new Option( strDiscAnswerLabels[i], discReasons.get(i).getConceptId().toString(),false));
                    dof.addDiscontinuedReasonAnswer(new ObsFieldAnswer(strDiscAnswerLabels[i].trim(), discReasons.get(i)));
                }
            } else {
                // use the listed discontinueReasons, and use their ConceptNames.
                for (Concept c: discReasons){
                    discOptions.add(new Option( c.getBestName(Context.getLocale()).getName(), c.getConceptId().toString(),false));
                    dof.addDiscontinuedReasonAnswer(new ObsFieldAnswer(c.getBestName(Context.getLocale()).getName(), c));
                }
            }
        } else {
            //just use the conceptAnswers
            for (ConceptAnswer ca : discontineReasonConcept.getAnswers()){
                discOptions.add(new Option( ca.getAnswerConcept().getBestName(Context.getLocale()).getName(), ca.getAnswerConcept().getConceptId().toString(),false));
                dof.addDiscontinuedReasonAnswer(new ObsFieldAnswer(ca.getAnswerConcept().getBestName(Context.getLocale()).getName(), ca.getAnswerConcept()));
            }
        }
        if (discOptions.size() == 1)
            throw new IllegalArgumentException("discontinue reason Concept doesn't have any ConceptAnswers");
View Full Code Here

Examples of org.openmrs.module.htmlformentry.schema.ObsFieldAnswer

       
        ObsField field = new ObsField();
        field.setName(valueLabel);
        //field.setQuestion(concept);
        if (answerConcept != null) {
            ObsFieldAnswer ans = new ObsFieldAnswer();
            ans.setDisplayName(getValueLabel());
            ans.setConcept(answerConcept);
            field.setAnswers(Arrays.asList(ans));
        }
        context.getSchema().addField(field);
    }
View Full Code Here

Examples of org.openmrs.module.htmlformentry.schema.ObsFieldAnswer

                //a little validation:
                if (strDiscAnswerLabels.length != discReasons.size())
                    throw new RuntimeException("discontinueReasonAnswers and discontinueReasonAnswerLabels must contain the same number of members.");
                for (int i = 0; i < strDiscAnswerLabels.length; i ++ ){
                    discOptions.add(new Option( strDiscAnswerLabels[i], discReasons.get(i).getConceptId().toString(),false))
                    srf.addDiscontinuedReasonAnswer(new ObsFieldAnswer(strDiscAnswerLabels[i].trim(), discReasons.get(i)));
                }
            } else {
                // use the listed discontinueReasons, and use their ConceptNames.
                for (Concept c: discReasons){
                    discOptions.add(new Option( c.getBestName(Context.getLocale()).getName(), c.getConceptId().toString(),false));
                    srf.addDiscontinuedReasonAnswer(new ObsFieldAnswer(c.getBestName(Context.getLocale()).getName(), c));
                }
            }
        } else {
            //just use the conceptAnswers
            for (ConceptAnswer ca : discontineReasonConcept.getAnswers()){
                discOptions.add(new Option( ca.getAnswerConcept().getBestName(Context.getLocale()).getName(), ca.getAnswerConcept().getConceptId().toString(),false));
                srf.addDiscontinuedReasonAnswer(new ObsFieldAnswer(ca.getAnswerConcept().getBestName(Context.getLocale()).getName(), ca.getAnswerConcept()));
            }
        }
        if (discOptions.size() == 1)
            throw new IllegalArgumentException("discontinue reason Concept doesn't have any ConceptAnswers");
       
View Full Code Here

Examples of org.openmrs.module.htmlformentry.schema.ObsFieldAnswer

    field.setName(valueLabel);
    if (concept != null) {
      field.setQuestion(concept);
    } else if (concepts != null && concepts.size() > 0) { //for concept selects
      for (int i = 0; i < concepts.size(); i++) {
        ObsFieldAnswer ans = new ObsFieldAnswer();
        ans.setConcept(concepts.get(i));
        if (i < conceptLabels.size()) {
          ans.setDisplayName(conceptLabels.get(i));
        }
        field.getQuestions().add(ans);
      }
    }
    if (answerConcept != null) {
      ObsFieldAnswer ans = new ObsFieldAnswer();
      ans.setDisplayName(getAnswerLabel());
      ans.setConcept(answerConcept);
      field.setAnswers(Arrays.asList(ans));
    } else if (conceptAnswers != null) {
      for (int i = 0; i < conceptAnswers.size(); i++) {
        ObsFieldAnswer ans = new ObsFieldAnswer();
        ans.setConcept(conceptAnswers.get(i));
        if (i < answerLabels.size()) {
          ans.setDisplayName(answerLabels.get(i));
        }
        field.getAnswers().add(ans);
      }
    }
    //conceptSelects should be excluded from obsGroup matching, because there's nothing to match on.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.