Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #569 from ehrbase/alter_ihe
Browse files Browse the repository at this point in the history
fixed mapping
  • Loading branch information
SevKohler authored Jun 21, 2022
2 parents 3986e0d + fbf581e commit 6486080
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.openehealth.ipf.commons.ihe.xds.core.metadata.Document;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntry;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.PatientInfo;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp;

import javax.activation.DataHandler;
Expand Down Expand Up @@ -100,9 +99,7 @@ private static void setEventCodeList(DocumentEntry documentEntry, DocumentRefere
}

private static void setSourcePatientId(DocumentEntry documentEntry, DocumentReference documentReference) {
PatientInfo patientInfo = new PatientInfo();
patientInfo.getIds().add(getPatientId(documentReference.getContext().getSourcePatientInfo()));
documentEntry.setSourcePatientInfo(patientInfo);
documentEntry.setSourcePatientId(getPatientId(documentReference.getContext().getSourcePatientInfo()));
}

private static void setEventCodes(DocumentEntry documentEntry, DocumentReference documentReference) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
import org.openehealth.ipf.commons.ihe.xds.core.metadata.Code;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.Person;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet;
import org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.Optional;

public class SubmissionSetConverter extends ITI41Converter{
public class SubmissionSetConverter extends ITI41Converter {

public static SubmissionSet convert(DocumentManifest documentManifest) {
SubmissionSet submissionSet = new SubmissionSet();
Expand All @@ -44,31 +43,45 @@ private static Author getAuthor(List<Reference> authors) {
for (Reference authorEntry : authors) {
Author author = new Author();
authorEntry.getResource();
author.setAuthorPerson(getPerson(authorEntry));
author.getAuthorRole().add(getRole(authorEntry));
return author;
}
throw new UnprocessableEntityException("no Author was defined in the MHD Bundle");
}

private static Person getPerson(Reference authorEntry) {
private static Identifiable getRole(Reference authorEntry) {
if (authorEntry.getResource().getClass().equals(PractitionerRole.class)) {
PractitionerRole practitionerRole = (PractitionerRole) authorEntry.getResource();
Optional<String> id = practitionerRole.getCode().stream().filter(CodeableConcept::hasCoding)
.flatMap(codeableConcept -> codeableConcept.getCoding().stream())
.map(Coding::getCode)
.findFirst();
return new Identifiable(id.get()); //always present
} else {
throw new UnprocessableEntityException("Only PractionerRole is currently supported for DocumentManifest Author");
}

}

/* private static Person getPerson(Reference authorEntry) {
if (authorEntry.getResource().getClass().equals(PractitionerRole.class)) {
PractitionerRole practitionerRole = (PractitionerRole) authorEntry.getResource();
Person person = new Person();
Optional<String> id = practitionerRole.getCode().stream().filter(CodeableConcept::hasCoding)
.flatMap(codeableConcept -> codeableConcept.getCoding().stream())
.map(Coding::getCode)
.findFirst();
/* Optional<String> name = practitionerRole.getCode().stream().filter(CodeableConcept::hasCoding)
*//* Optional<String> name = practitionerRole.getCode().stream().filter(CodeableConcept::hasCoding)
.flatMap(codeableConcept -> codeableConcept.getCoding().stream())
.map(Coding::getDisplay)
.findFirst();
person.setName(new Name(name.get()));*/
person.setName(new Name(name.get()));*//*
person.setId(new Identifiable(id.get())); //Always present
return person;
} else {
throw new UnprocessableEntityException("Only PractionerRole is currently supported for DocumentManifest Author");
}
}
}*/


}

0 comments on commit 6486080

Please sign in to comment.