Java Code Examples for org.hl7.fhir.dstu3.model.Meta#setLastUpdated()

The following examples show how to use org.hl7.fhir.dstu3.model.Meta#setLastUpdated() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PractitionerRoleToFHIRPractitionerRoleTransformer.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
public org.hl7.fhir.dstu3.model.PractitionerRole transform(final PractitionerRole roleEntity) {
    final org.hl7.fhir.dstu3.model.PractitionerRole practitionerRole = new org.hl7.fhir.dstu3.model.PractitionerRole();

    Meta meta = new Meta().addProfile(CareConnectProfile.PractitionerRole_1);

    if (roleEntity.getUpdated() != null) {
        meta.setLastUpdated(roleEntity.getUpdated());
    }
    else {
        if (roleEntity.getCreated() != null) {
            meta.setLastUpdated(roleEntity.getCreated());
        }
    }

    practitionerRole.setId(roleEntity.getId().toString());

    for(PractitionerRoleIdentifier identifier : roleEntity.getIdentifiers())
    {
        Identifier ident = practitionerRole.addIdentifier();
        ident = daoutils.getIdentifier(identifier, ident);
    }


    if (roleEntity.getOrganisation() != null) {
        practitionerRole.getOrganization()
                .setReference("Organization/"+roleEntity.getOrganisation().getId())
                .setDisplay(roleEntity.getOrganisation().getName());
    }
    if (roleEntity.getRole() != null) {
        CodeableConcept role = new CodeableConcept();
        role.addCoding()
                .setCode(roleEntity.getRole().getCode())
                .setDisplay(roleEntity.getRole().getDisplay())
                .setSystem(roleEntity.getRole().getSystem());
        practitionerRole.getCode().add(role);
    }
    if (roleEntity.getPractitioner() != null) {
        practitionerRole.getPractitioner()
                .setReference("Practitioner/"+roleEntity.getPractitioner().getId())
                .setDisplay(roleEntity.getPractitioner().getNames().get(0).getDisplayName());
    }
    for (PractitionerSpecialty specialty : roleEntity.getSpecialties()) {
        CodeableConcept concept = new CodeableConcept();
        concept.addCoding()
                .setCode(specialty.getSpecialty().getCode())
                .setDisplay(specialty.getSpecialty().getDisplay())
                .setSystem(specialty.getSpecialty().getSystem());
        practitionerRole.addSpecialty(concept);
    }



    return practitionerRole;

}
 
Example 2
Source File: EndpointEntityToFHIREndpointTransform.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
public Endpoint transform(EndpointEntity endpointEntity) {
    final Endpoint endpoint = new Endpoint();



    Meta meta = new Meta();

    if (endpointEntity.getUpdated() != null) {
        meta.setLastUpdated(endpointEntity.getUpdated());
    }
    else {
        if (endpointEntity.getCreated() != null) {
            meta.setLastUpdated(endpointEntity.getCreated());
        }
    }
    endpoint.setMeta(meta);


    if (endpointEntity.getStatus() != null) {
        endpoint.setStatus(endpointEntity.getStatus());
    }


    for(EndpointIdentifier identifier: endpointEntity.getIdentifiers())
    {
        Identifier ident = endpoint.addIdentifier();
        ident = daoutils.getIdentifier(identifier, ident);
    }

    endpoint.setId(endpointEntity.getId().toString());

    log.trace("endpoint tfm3");
    if (endpointEntity.getName() != null) {
        endpoint.setName(endpointEntity.getName());
    }

    if (endpointEntity.getManagingOrganisation() != null) {
        endpoint.setManagingOrganization(new Reference("Organization/"+endpointEntity.getManagingOrganisation().getId()));
        endpoint.getManagingOrganization().setDisplay(endpointEntity.getManagingOrganisation().getName());
    }
    log.trace("endpoint tfm4");
    if (endpointEntity.getConnectionType()!=null) {
        endpoint.getConnectionType()
                .setCode(endpointEntity.getConnectionType().getCode())
                .setDisplay(endpointEntity.getConnectionType().getDisplay())
                .setSystem(endpointEntity.getConnectionType().getSystem());
    }

    log.trace("endpoint tfm5");
    if (endpointEntity.getAddress() != null) {
        endpoint.setAddress(endpointEntity.getAddress());
    }

    log.trace("endpoint tfm6");

    for(EndpointPayloadType endpointPayloadType : endpointEntity.getPayloadTypes()) {
        endpoint.addPayloadType()
                .addCoding()
                .setSystem(endpointPayloadType.getPayloadType().getSystem())
                .setCode(endpointPayloadType.getPayloadType().getCode())
                .setDisplay(endpointPayloadType.getPayloadType().getDisplay());
    }
    for(EndpointPayloadMime endpointPayloadMime : endpointEntity.getPayloadMimes()) {
        endpoint.addPayloadMimeType(endpointPayloadMime.getMimeType().getCode());
    }

    return endpoint;
}
 
Example 3
Source File: DiagnosticReportEntityToFHIRDiagnosticReportTransformer.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
public DiagnosticReport transform(final DiagnosticReportEntity diagnosticReportEntity) {
    final DiagnosticReport diagnosticReport = new DiagnosticReport();

    Meta meta = new Meta();
            //.addProfile(CareConnectProfile.Condition_1);

    if (diagnosticReportEntity.getUpdated() != null) {
        meta.setLastUpdated(diagnosticReportEntity.getUpdated());
    }
    else {
        if (diagnosticReportEntity.getCreated() != null) {
            meta.setLastUpdated(diagnosticReportEntity.getCreated());
        }
    }
    diagnosticReport.setMeta(meta);

    diagnosticReport.setId(diagnosticReportEntity.getId().toString());



    if (diagnosticReportEntity.getStatus() != null) {
        diagnosticReport.setStatus(diagnosticReportEntity.getStatus());
    }

    if (diagnosticReportEntity.getPatient() != null) {
        diagnosticReport
                .setSubject(new Reference("Patient/"+diagnosticReportEntity.getPatient().getId())
                .setDisplay(diagnosticReportEntity.getPatient().getNames().get(0).getDisplayName()));
    }



    for (DiagnosticReportIdentifier identifier : diagnosticReportEntity.getIdentifiers()) {
        Identifier ident = diagnosticReport.addIdentifier();
        ident = daoutils.getIdentifier(identifier, ident);
    }

    for (DiagnosticReportResult reportResult : diagnosticReportEntity.getResults()) {
        diagnosticReport.addResult(new Reference("Observation/"+reportResult.getObservation().getId()));
    }

    return diagnosticReport;

}
 
Example 4
Source File: PractitionerEntityToFHIRPractitionerTransformer.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
public Practitioner transform(final PractitionerEntity practitionerEntity) {
    final Practitioner practitioner = new Practitioner();

    Meta meta = new Meta().addProfile(CareConnectProfile.Practitioner_1);

    if (practitionerEntity.getUpdated() != null) {
        meta.setLastUpdated(practitionerEntity.getUpdated());
    }
    else {
        if (practitionerEntity.getCreated() != null) {
            meta.setLastUpdated(practitionerEntity.getCreated());
        }
    }
    practitioner.setMeta(meta);
    if (practitionerEntity.getActive() != null) {
        practitioner.setActive(practitionerEntity.getActive());
    }

    for(PractitionerIdentifier identifier :practitionerEntity.getIdentifiers())
    {
        Identifier ident = practitioner.addIdentifier();
        ident = daoutils.getIdentifier(identifier, ident);
    }

    practitioner.setId(practitionerEntity.getId().toString());

    if (practitionerEntity.getNames().size() > 0) {

        practitioner.addName()
                .setFamily(practitionerEntity.getNames().get(0).getFamilyName())
                .addGiven(practitionerEntity.getNames().get(0).getGivenName())
                .addPrefix(practitionerEntity.getNames().get(0).getPrefix());
    }
    for(int f=0;f<practitionerEntity.getTelecoms().size();f++)
    {
        practitioner.addTelecom()
                .setSystem(practitionerEntity.getTelecoms().get(f).getSystem())
                .setValue(practitionerEntity.getTelecoms().get(f).getValue())
                .setUse(practitionerEntity.getTelecoms().get(f).getTelecomUse());
    }


    for (PractitionerAddress practitionerAddress : practitionerEntity.getAddresses()){
        Address address = addressTransformer.transform(practitionerAddress);
        practitioner.addAddress(address);
    }

    if (practitionerEntity.getGender() !=null)
    {
        practitioner.setGender(daoutils.getGender(practitionerEntity.getGender()));
    }

    return practitioner;

}
 
Example 5
Source File: SlotEntityToFHIRSlotTransformer.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
public Slot transform(final SlotEntity slotEntity) {

    final Slot slot = new Slot();

    Meta meta = new Meta(); //.addProfile(CareConnectProfile.Location_1);

    if (slotEntity.getUpdated() != null) {
        meta.setLastUpdated(slotEntity.getUpdated());
    }
    else {
        if (slotEntity.getCreated() != null) {
            meta.setLastUpdated(slotEntity.getCreated());
        }
    }
    slot.setMeta(meta);

    slot.setId(slotEntity.getId().toString());

    for(SlotIdentifier identifier : slotEntity.getIdentifiers())
    {
        Identifier ident = slot.addIdentifier();
        ident = daoutils.getIdentifier(identifier, ident);
    }

    if (slotEntity.getServiceCategory() != null) {
        slot.getServiceCategory()
                .addCoding()
                .setDisplay(slotEntity.getServiceCategory().getDisplay())
                .setSystem(slotEntity.getServiceCategory().getSystem())
                .setCode(slotEntity.getServiceCategory().getCode());
    }

    if (slotEntity.getAppointmentType() != null) {
        slot.getAppointmentType()
                .addCoding()
                .setDisplay(slotEntity.getAppointmentType().getDisplay())
                .setSystem(slotEntity.getAppointmentType().getSystem())
                .setCode(slotEntity.getAppointmentType().getCode());
    }

    if (slotEntity.getSchedule() != null) {
        slot.setSchedule(new Reference("Schedule/"+slotEntity.getSchedule().getId()));
    }

    if (slotEntity.getStatus() != null) {
        slot.setStatus(slotEntity.getStatus());
    }
    if (slotEntity.getStart() != null) {
        slot.setStart(slotEntity.getStart());
    }

    if (slotEntity.getEnd() != null) {
        slot.setEnd(slotEntity.getEnd());
    }

    return slot;

}
 
Example 6
Source File: HealthcareServiceEntityToFHIRHealthcareServiceTransformer.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
    public HealthcareService transform(final HealthcareServiceEntity serviceEntity) {
        final HealthcareService service = new HealthcareService();

        Meta meta = new Meta(); //.addProfile(CareConnectProfile.Location_1);

        if (serviceEntity.getUpdated() != null) {
            meta.setLastUpdated(serviceEntity.getUpdated());
        }
        else {
            if (serviceEntity.getCreated() != null) {
                meta.setLastUpdated(serviceEntity.getCreated());
            }
        }
        service.setMeta(meta);

        service.setId(serviceEntity.getId().toString());

        for(HealthcareServiceIdentifier identifier : serviceEntity.getIdentifiers())
        {
            Identifier ident = service.addIdentifier();
            ident = daoutils.getIdentifier(identifier, ident);
        }

        if (serviceEntity.getActive() != null) {
            service.setActive(serviceEntity.getActive());
        }
        if (serviceEntity.getName() != null) {
            service.setName(serviceEntity.getName());
        }

        if (serviceEntity.getComment() != null) {
            service.setComment(serviceEntity.getComment());
        }

        if (serviceEntity.getCategory() != null) {
            service.getCategory()
                    .addCoding()
                    .setDisplay(serviceEntity.getCategory().getDisplay())
                    .setSystem(serviceEntity.getCategory().getSystem())
                    .setCode(serviceEntity.getCategory().getCode());
        }

        System.out.println("Provided By: " + serviceEntity.getProvidedBy().getId());
        if (serviceEntity.getProvidedBy() != null) {
            service.setProvidedBy(new Reference("Organization/"+serviceEntity.getProvidedBy().getId()).setDisplay(serviceEntity.getProvidedBy().getName()));
        }
        for (HealthcareServiceSpecialty serviceSpecialty : serviceEntity.getSpecialties()) {
            service.addSpecialty()
                    .addCoding()
                        .setCode(serviceSpecialty.getSpecialty().getCode())
                        .setSystem(serviceSpecialty.getSpecialty().getSystem())
                        .setDisplay(serviceSpecialty.getSpecialty().getDisplay());
        }
        for (HealthcareServiceLocation serviceLocation : serviceEntity.getLocations()) {
            service.addLocation(new Reference("Location/"+serviceLocation.getLocation().getId()).setDisplay(serviceLocation.getLocation().getName()));
        }

        for (HealthcareServiceTelecom serviceTelecom : serviceEntity.getTelecoms()) {
            service.addTelecom()
                    .setSystem(serviceTelecom.getSystem())
                    .setValue(serviceTelecom.getValue())
                    .setUse(serviceTelecom.getTelecomUse());

        }
/*        for (HealthcareServiceType serviceType : serviceEntity.getTypes()) {
            service.addType()
                    .addCoding()
                    .setCode(serviceType.getType_().getCode())
                    .setSystem(serviceType.getType_().getSystem())
                    .setDisplay(serviceType.getType_().getDisplay());
        }*/


        return service;

    }
 
Example 7
Source File: ScheduleEntityToFHIRScheduleTransformer.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Override
public Schedule transform(final ScheduleEntity scheduleEntity) {

        final Schedule schedule = new Schedule();

        Meta meta = new Meta(); //.addProfile(CareConnectProfile.Location_1);

        if (scheduleEntity.getUpdated() != null) {
            meta.setLastUpdated(scheduleEntity.getUpdated());
        }
        else {
            if (scheduleEntity.getCreated() != null) {
                meta.setLastUpdated(scheduleEntity.getCreated());
            }
        }
        schedule.setMeta(meta);

        schedule.setId(scheduleEntity.getId().toString());

        for(ScheduleIdentifier identifier : scheduleEntity.getIdentifiers())
        {
            Identifier ident = schedule.addIdentifier();
            ident = daoutils.getIdentifier(identifier, ident);
        }

        if (scheduleEntity.getActive() != null) {
            schedule.setActive(scheduleEntity.getActive());
        }

        for(ScheduleActor actor : scheduleEntity.getActors()){
            if(actor.getPractitionerRole() != null){
                schedule.addActor().setReference("PractitonerRole/"+actor.getPractitionerRole().getId());
            }

            if(actor.getPractitionerEntity() != null){
                schedule.addActor().setReference("Practitoner/"+actor.getPractitionerEntity().getId());
            }

            if(actor.getHealthcareServiceEntity() != null){
                schedule.addActor().setReference("HealthcareService/"+actor.getHealthcareServiceEntity().getId());
            }

            if(actor.getLocationEntity() != null){
                schedule.addActor().setReference("Location/"+actor.getLocationEntity().getId());
            }

        }

        if (scheduleEntity.getComment() != null) {
            schedule.setComment(scheduleEntity.getComment());
        }


        if (scheduleEntity.getCategory() != null) {
            schedule.getServiceCategory()
                    .addCoding()
                    .setDisplay(scheduleEntity.getCategory().getDisplay())
                    .setSystem(scheduleEntity.getCategory().getSystem())
                    .setCode(scheduleEntity.getCategory().getCode());
        }

        return schedule;

}
 
Example 8
Source File: GoalEntityToFHIRGoalTransformer.java    From careconnect-reference-implementation with Apache License 2.0 2 votes vote down vote up
@Override
public Goal transform(final GoalEntity goalEntity) {
    final Goal goal = new Goal();

    Meta meta = new Meta();

    if (goalEntity.getUpdated() != null) {
        meta.setLastUpdated(goalEntity.getUpdated());
    }
    else {
        if (goalEntity.getCreated() != null) {
            meta.setLastUpdated(goalEntity.getCreated());
        }
    }
    goal.setMeta(meta);

    goal.setId(goalEntity.getId().toString());

    
    if (goalEntity.getPatient() != null) {
        goal
                .setSubject(new Reference("Patient/"+goalEntity.getPatient().getId())
                .setDisplay(goalEntity.getPatient().getNames().get(0).getDisplayName()));
    }

    if (goalEntity.getStatus() != null) {
        goal.setStatus(goalEntity.getStatus());
    }




    for (GoalIdentifier identifier : goalEntity.getIdentifiers()) {
        Identifier ident = goal.addIdentifier();
        ident = daoutils.getIdentifier(identifier, ident);
    }




    return goal;

}