Search in sources :

Example 16 with Patient

use of org.hl7.fhir.r4.model.Patient in project bunsen by cerner.

the class TestData method newPatient.

/**
 * Returns a FHIR Patient for testing purposes.
 */
public static Patient newPatient() {
    Patient patient = new Patient();
    patient.setId("test-patient");
    patient.setMultipleBirth(new IntegerType(1));
    return patient;
}
Also used : IntegerType(org.hl7.fhir.dstu3.model.IntegerType) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 17 with Patient

use of org.hl7.fhir.r4.model.Patient in project bunsen by cerner.

the class TestData method newCondition.

/**
 * Returns a FHIR Condition for testing purposes.
 */
public static Condition newCondition() {
    Condition condition = new Condition();
    // Condition based on example from FHIR:
    // https://www.hl7.org/fhir/condition-example.json.html
    condition.setId("Condition/example");
    condition.setLanguage("en_US");
    // Narrative text
    Narrative narrative = new Narrative();
    narrative.setStatusAsString("generated");
    narrative.setDivAsString("This data was generated for test purposes.");
    XhtmlNode node = new XhtmlNode();
    node.setNodeType(NodeType.Text);
    node.setValue("Severe burn of left ear (Date: 24-May 2012)");
    condition.setText(narrative);
    condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));
    condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);
    // Condition code
    CodeableConcept code = new CodeableConcept();
    code.addCoding().setSystem("http://snomed.info/sct").setCode("39065001").setDisplay("Severe");
    condition.setSeverity(code);
    // Severity code
    CodeableConcept severity = new CodeableConcept();
    severity.addCoding().setSystem("http://snomed.info/sct").setCode("24484000").setDisplay("Burn of ear").setUserSelected(true);
    condition.setSeverity(severity);
    // Onset date time
    DateTimeType onset = new DateTimeType();
    onset.setValueAsString("2012-05-24");
    condition.setOnset(onset);
    return condition;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Narrative(org.hl7.fhir.dstu3.model.Narrative) Reference(org.hl7.fhir.dstu3.model.Reference) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 18 with Patient

use of org.hl7.fhir.r4.model.Patient in project bunsen by cerner.

the class ValueSetUdfsTest method patient.

private static Patient patient(String id, String marritalStatus) {
    Patient patient = new Patient();
    patient.setId(id);
    patient.setMaritalStatus(codeable("http://hl7.org/fhir/v3/MaritalStatus", marritalStatus));
    return patient;
}
Also used : Patient(org.hl7.fhir.dstu3.model.Patient)

Example 19 with Patient

use of org.hl7.fhir.r4.model.Patient in project wildfly-camel by wildfly-extras.

the class FhirXmlIntegrationTest method createPatient.

private Patient createPatient() {
    Patient patient = new Patient();
    patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
    return patient;
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) Address(org.hl7.fhir.dstu3.model.Address) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 20 with Patient

use of org.hl7.fhir.r4.model.Patient in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method addResourcesToBundle.

/**
 * @param bundle a {@link Bundle} to add the list of {@link ExplanationOfBenefit} resources to.
 * @param resources a list of either {@link ExplanationOfBenefit}s, {@link Coverage}s, or {@link
 *     Patient}s, of which a portion will be added to the bundle based on the paging values
 * @return Returns a {@link Bundle} of {@link ExplanationOfBenefit}s, {@link Coverage}s, or {@link
 *     Patient}s, which may contain multiple matching resources, or may also be empty.
 */
public static Bundle addResourcesToBundle(Bundle bundle, List<IBaseResource> resources) {
    Set<String> beneIds = new HashSet<String>();
    for (IBaseResource res : resources) {
        BundleEntryComponent entry = bundle.addEntry();
        entry.setResource((Resource) res);
        if (entry.getResource().getResourceType() == ResourceType.ExplanationOfBenefit) {
            ExplanationOfBenefit eob = ((ExplanationOfBenefit) entry.getResource());
            if (eob != null && eob.getPatient() != null && !Strings.isNullOrEmpty(eob.getPatient().getReference())) {
                String reference = eob.getPatient().getReference().replace("Patient/", "");
                if (!Strings.isNullOrEmpty(reference)) {
                    beneIds.add(reference);
                }
            }
        } else if (entry.getResource().getResourceType() == ResourceType.Patient) {
            Patient patient = ((Patient) entry.getResource());
            if (patient != null && !Strings.isNullOrEmpty(patient.getId())) {
                beneIds.add(patient.getId());
            }
        } else if (entry.getResource().getResourceType() == ResourceType.Coverage) {
            Coverage coverage = ((Coverage) entry.getResource());
            if (coverage != null && coverage.getBeneficiary() != null && !Strings.isNullOrEmpty(coverage.getBeneficiary().getReference())) {
                String reference = coverage.getBeneficiary().getReference().replace("Patient/", "");
                if (!Strings.isNullOrEmpty(reference)) {
                    beneIds.add(reference);
                }
            }
        }
    }
    logBeneIdToMdc(beneIds);
    return bundle;
}
Also used : BundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent) Patient(org.hl7.fhir.dstu3.model.Patient) Coverage(org.hl7.fhir.dstu3.model.Coverage) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) HashSet(java.util.HashSet)

Aggregations

Test (org.junit.Test)576 Patient (org.hl7.fhir.r4.model.Patient)362 Test (org.junit.jupiter.api.Test)353 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)245 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)227 Patient (org.hl7.fhir.dstu3.model.Patient)199 Bundle (org.hl7.fhir.r4.model.Bundle)178 ArrayList (java.util.ArrayList)140 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)140 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)138 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)136 Date (java.util.Date)131 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)127 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)127 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)125 Reference (org.hl7.fhir.r4.model.Reference)106 Resource (org.hl7.fhir.r4.model.Resource)101 List (java.util.List)100 Bundle (org.hl7.fhir.dstu3.model.Bundle)96 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)93