Skip to content

Commit

Permalink
fix: Remove method FHIRSrv
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Mar 4, 2024
1 parent 195e622 commit 3913402
Showing 1 changed file with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class FhirSRV implements IFhirSRV {
@Override
public ResourceDTO createFhirResources(final String cda, String authorRole,final PublicationCreateReplaceMetadataDTO requestBody,
final Integer size, final String hash, String transformId, String engineId) {

final ResourceDTO output = new ResourceDTO();
final org.jsoup.nodes.Document docCDA = Jsoup.parse(cda);
final String encodedCDA = Base64.getEncoder().encodeToString(cda.getBytes());
Expand All @@ -72,7 +72,7 @@ public ResourceDTO createFhirResources(final String cda, String authorRole,final
output.setBundleJson(StringUtility.toJSON(resDTO.getJson()));

AuthorSlotDTO authorSlot = buildAuthorSlotDTO(authorRole,docCDA);

try {
final SubmissionSetEntryDTO submissionSetEntryDTO = createSubmissionSetEntry(docCDA, requestBody.getTipoAttivitaClinica().getCode(),
requestBody.getIdentificativoSottomissione(),authorSlot);
Expand Down Expand Up @@ -126,7 +126,7 @@ private FhirResourceDTO buildFhirResourceDTO(final DocumentReferenceDTO document
req.setEngineId(engineId);
return req;
}


private SubmissionSetEntryDTO createSubmissionSetEntry(final org.jsoup.nodes.Document docCDA,
final String contentTypeCode, final String identificativoSottomissione,
Expand Down Expand Up @@ -240,7 +240,7 @@ private DocumentEntryDTO createDocumentEntry(final org.jsoup.nodes.Document docC
}
return de;
}

private String buildPatient(final org.jsoup.nodes.Document docCDA) {
String out = "";
final Element patientIdElement = docCDA.select(PATH_PATIENT_ID).first();
Expand All @@ -249,20 +249,10 @@ private String buildPatient(final org.jsoup.nodes.Document docCDA) {
String root = patientIdElement.attr("root");
out = cf + "^^^&" + root + "&ISO";
}
return out;
}

public static void main(String[] args) {
byte[] cda = FileUtility.getFileFromInternalResources("cda.xml");
org.jsoup.nodes.Document cdaJsoup = Jsoup.parse(new String(cda, StandardCharsets.UTF_8));
AuthorSlotDTO author = buildAuthorSlotDTO("APR", cdaJsoup);
System.out.println(author.getAuthorRole());
System.out.println(author.getAuthor());
System.out.println(author.getAuthorInstitution());

return out;
}


private static AuthorSlotDTO buildAuthorSlotDTO(final String authorRole,final org.jsoup.nodes.Document docCDA) {
AuthorSlotDTO author = new AuthorSlotDTO();
author.setAuthorRole(authorRole);
Expand All @@ -277,14 +267,14 @@ private static AuthorSlotDTO buildAuthorSlotDTO(final String authorRole,final or
} else {
author.setAuthorInstitution("AUTHOR_INSTITUTION_NOT_PRESENT");
}

final Element authorElement = docCDA.select("ClinicalDocument > author > assignedAuthor > id").first();
if (authorElement != null) {
String cfAuthor = authorElement.attr(EXTENSION_ATTRIBUTE);
String rootAuthor = authorElement.attr("root");
author.setAuthor(cfAuthor +"^^^^^^^^&" + rootAuthor + "&ISO");
}

return author;
}

Expand Down

0 comments on commit 3913402

Please sign in to comment.