private CodeableConcept readAsCodeableConcept(Element element) { CodeableConcept cc = new CodeableConcept(); List<Element> list = new ArrayList<Element>(); element.getNamedChildren("coding", list); for (Element item : list) cc.addCoding(readAsCoding(item)); cc.setText(element.getNamedChildValue("text")); return cc; }
private void extractTokensFromCodeableConcept(List<String> theSystems, List<String> theCodes, CodeableConcept theCodeableConcept, ResourceTable theEntity, Set<BaseResourceIndexedSearchParam> theListToPopulate, RuntimeSearchParam theParameterDef) { for (Coding nextCoding : theCodeableConcept.getCoding()) { extractTokensFromCoding(theSystems, theCodes, theEntity, theListToPopulate, theParameterDef, nextCoding); } }
public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); copyElement(src, tgt); for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); if (src.hasText()) tgt.setText(src.getText()); return tgt; }
private void checkCodeableConcept(List<ValidationMessage> errors, String path, Element focus, CodeableConcept fixed) { checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); List<Element> codings = new ArrayList<Element>(); focus.getNamedChildren("coding", codings); if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { for (int i = 0; i < codings.size(); i++) checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding", focus); } }
public CodeableConcept addProgramCode() { //3 CodeableConcept t = new CodeableConcept(); if (this.programCode == null) this.programCode = new ArrayList<CodeableConcept>(); this.programCode.add(t); return t; }
public static CodeableConcept createServiceCategory(String sc, String shortDx, String longDx) { CodeableConcept cpt = new CodeableConcept(); cpt.setText(longDx); Coding coding = new Coding(); coding.setCode(sc); coding.setDisplay(shortDx); cpt.getCoding().add(coding); return cpt; }
protected CodeableConcept codedValueTypeToCodeableConcept(CodedValueType cvt) { return cvt != null ? new CodeableConcept().addCoding(codedValueTypeToCoding(cvt)) : null; } }
CodeableConcept cc = new CodeableConcept(); Coding c = new Coding(); c.setCode(cda.getChild(l, "languageCode").getAttribute("code")); cc.getCoding().add(c); pat.addCommunication().setLanguage(cc); cc.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_LANG_PROF, convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); pat.setManagingOrganization(Factory.makeReference(makeOrganization(cda.getChild(pr, "providerOrganization"), "Provider")));
public static Encounter create(Patient patient, Date date, Location location, String sc) { Encounter encounter = new Encounter(); Reference pat = new Reference(patient); encounter.setSubject(pat); Period period = new Period(); period.setStart(date); encounter.setPeriod(period); Reference loc = new Reference(location); EncounterLocationComponent encloc = encounter.addLocation(); encloc.setPeriod(period); encloc.setLocation(loc); CodeableConcept type = encounter.addType(); CodeableConcept cat = getServiceCategory(sc); type.setText(cat.getText()); type.getCoding().addAll(cat.getCoding()); return encounter; }
public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept(); copyElement(src, tgt); for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) tgt.addCoding(convertCoding(t)); tgt.setText(src.getText()); return tgt; }
/** * {@inheritDoc} */ @Override public Basic createResource( final JCas jCas, final Segment section, final FhirPractitioner practitioner, final FhirNoteSpecs noteSpecs ) { final Basic basic = createAnnotationBasic( jCas, section, practitioner ); // The 'code' is the normalized section name PLUS section tag text. final CodeableConcept codeableConcept = FhirElementFactory.createSimpleCode( section ); codeableConcept.addCoding( new Coding( CODING_SECTION_NAME, section.getPreferredText(), null ) ); if ( !section.getPreferredText() .equals( section.getId() ) ) { codeableConcept.addCoding( new Coding( CODING_SECTION_ID, section.getId(), null ) ); } codeableConcept.setText( section.getTagText() ); basic.setCode( codeableConcept ); return basic; }
public static CodeableConcept newCodeableConcept(String code, String system, String display) { CodeableConcept cc = new CodeableConcept(); Coding c = new Coding(); c.setCode(code); c.setSystem(system); c.setDisplay(display); cc.getCoding().add(c); return cc; }
public static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws FHIRException { if (profile != null) throw new NotImplementedException("Not Implemented Yet"); if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) { return matches(c1.getText(), c2.getText(), null); } else { // in the absence of specific guidance, we just require that all codes match boolean ok = true; for (Coding c : c1.getCoding()) { ok = ok && inList(c2.getCoding(), c, null); } for (Coding c : c2.getCoding()) { ok = ok && inList(c1.getCoding(), c, null); } return ok; } }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); // Add an extension on the resource pat.addExtension() .setUrl("http://hl7.org/fhir/StructureDefinition/patient-importance") .setValue(new CodeableConcept().setText("Patient is a VIP")); // Add an extension on a primitive pat.getBirthDateElement().setValueAsString("1955-02-22"); pat.getBirthDateElement().addExtension() .setUrl("http://hl7.org/fhir/StructureDefinition/patient-birthTime") .setValue(new TimeType("23:30")); IParser parser = FhirContext.forDstu3().newJsonParser().setPrettyPrint(true); System.out.println(parser.encodeResourceToString(pat)); } }
obs.getCode().addCoding().setSystem("http://loinc.org").setCode("12345-6"); obs.setValue(new StringType("This is a value"));
try { CodeableConcept cc = readAsCodeableConcept(element); if (!cc.hasCoding()) { if (binding.getStrength() == BindingStrength.REQUIRED) rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); if (binding.getStrength() != BindingStrength.EXAMPLE) { boolean atLeastOneSystemIsSupported = false; for (Coding nextCoding : cc.getCoding()) { String nextSystem = nextCoding.getSystem(); if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { for (Coding nextCoding : cc.getCoding()) { String nextCode = nextCoding.getCode(); String nextSystem = nextCoding.getSystem();
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case -1355086998: return addCoding(); case 3556653: return getTextElement(); default: return super.makeProperty(hash, name); } }
private String summariseCodeableConcept(CodeableConcept value) { if (value.hasCoding()) return summariseCoding(value.getCodingFirstRep()); else return value.getText(); }
if (isNotBlank(nextValue.getType().getText())) { addStringParam(theEntity, retVal, nextSpDef, nextValue.getType().getText()); } else if (nextObject instanceof CodeableConcept) { CodeableConcept nextCC = (CodeableConcept) nextObject; if (!nextCC.getTextElement().isEmpty()) { addStringParam(theEntity, retVal, nextSpDef, nextCC.getTextElement().getValue());
public org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.instance.model.ClinicalImpression src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); copyDomainResource(src, tgt); tgt.setSubject(convertReference(src.getPatient())); tgt.setAssessor(convertReference(src.getAssessor())); tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); if (src.hasDate()) tgt.setDate(src.getDate()); tgt.setDescription(src.getDescription()); tgt.setPrevious(convertReference(src.getPrevious())); for (org.hl7.fhir.instance.model.Reference t : src.getProblem()) tgt.addProblem(convertReference(t)); // for (org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) // tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); tgt.addProtocol(src.getProtocol()); tgt.setSummary(src.getSummary()); for (org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) tgt.addFinding(convertClinicalImpressionFindingComponent(t)); if (src.hasPrognosis()) tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); // for (org.hl7.fhir.instance.model.Reference t : src.getPlan()) // tgt.addPlan(convertReference(t)); for (org.hl7.fhir.instance.model.Reference t : src.getAction()) tgt.addAction(convertReference(t)); return tgt; }