Was able to save report as complex obs using this
@Override
@Transactional
public synchronized RadiologyReport saveRadiologyReport(RadiologyReport radiologyReport, String content) {
final Obs obs = new Obs();
final ConceptComplex concept = radiologyProperties.getConceptForReport();
obs.setConcept(concept);
obs.setPerson(radiologyReport.getRadiologyOrder()
.getPatient());
obs.setObsDatetime(new Date());
File tmpFile = null;
InputStream complexDataInputStream = null;
try {
tmpFile = File.createTempFile("report", ".html");
FileUtils.writeStringToFile(tmpFile, content);
complexDataInputStream = new FileInputStream(tmpFile);
}
catch (IOException e) {
throw new APIException(e.getMessage(), e);
}
final ComplexData complexData = new ComplexData(tmpFile.getName(), complexDataInputStream);
obs.setComplexData(complexData);
radiologyReport.setObs(obs);
Context.getObsService()
.saveObs(obs, "");
return saveRadiologyReport(radiologyReport);
}
But when I visit thepatient dashboard under the obs section I don’t see any obs created but in the database there is an obs associated with the patient.
Screenshot of saved report
Screenshot of patient dashboard
But when I visit the database, there is an obs associated with the patient and the complex value has the name of the report file
cc @teleivo