JHipster with MDHT library

98 views Asked by At

I included MDHT in pom.xml

<dependency>
    <groupId>org.openehealth.ipf.oht.mdht</groupId>
    <artifactId>ipf-oht-mdht-uml-cda-ccd</artifactId>
    <version>1.2.0.201212201425</version>
</dependency>

And I have created a method in resource as below where I wanted to load patients profile information

@GetMapping("/patients/profile/{id}")
@Timed
public ResponseEntity<PatientProfileDTO> getPatientProfile(@PathVariable Long id) { 
try {
    PatientProfileDTO patientProfileDTO = new PatientProfileDTO();

    CDAUtil.loadPackages();
    ContinuityOfCareDocument ccDocument = (ContinuityOfCareDocument) CDAUtil.load(new FileInputStream("patient_ccd.xml"));

    //set patientProfileDTO here by reading patient_ccd.xml 

    return ResponseUtil.wrapOrNotFound(Optional.ofNullable(patientProfileDTO));
} catch (Exception e) {
    return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "Error", "An exception occured while reading patient profile")).body(null);
}
}

I get exception org.openhealthtools.mdht.uml.cda.impl.ClinicalDocumentImpl cannot be cast to org.openhealthtools.mdht.uml.cda.ccd.ContinuityOfCareDocument on line ContinuityOfCareDocument ccDocument = (ContinuityOfCareDocument) CDAUtil.load(new FileInputStream("patient_ccd.xml"));

Has anyone encountered such issue or can suggest any any solution? I had been struggling for two days...

0

There are 0 answers