Stream: implementers
Topic: why do you mark me wrong?
Luis EC (May 16 2019 at 21:26):
what am I doing wrong?
patient.setId(IdDt.newRandomUuid());
Observation observation = new Observation();
observation.setStatus(ObservationStatus.FINAL);
observation
.getCode()
.addCoding()
.setSystem("http://loinc.org")
.setCode("789-8")
.setDisplay("Erythrocytes [#/volume] in Blood by Automated count");
observation.setValue(
new Quantity()
.setValue(4.12)
.setUnit("10 trillion/L")
.setSystem("http://unitsofmeasure.org")
.setCode("10*12/L"));
observation.setSubject(new Reference(patient.getId()));
//reporte diagnostico
DiagnosticReport diagnosticom = new DiagnosticReport();
diagnosticom.setStatus(DiagnosticReportStatus.FINAL);
diagnosticom.getCode().addCoding().setSystem("s").setCode("78").setDisplay(":");
diagnosticom.getCode().setText("Some Diagnostic Report");
diagnosticom.addResult().setReference("Observation/1");
diagnosticom.addResult().setReference("Observation/2");
diagnosticom.addResult().setReference("Observation/3");
/*Narrative narrative = new Narrative();
myGen.generateNarrative(ctx, diagnosticom, narrative);
String output = narrative.getDiv().getValueAsString();
ourLog.info(output);
assertThat(output, StringContains.containsString(diagnosticom.getCode().getTextElement().getValue()));*/
diagnosticom.setSubject(new Reference(patient.getId()));
// Create a bundle that will be used as a transaction
Bundle bundle = new Bundle();
bundle.setType(BundleType.TRANSACTION);
bundle.addEntry()
.setFullUrl(patient.getId())
.setResource(patient)
.getRequest()
.setUrl("Patient")
.setIfNoneExist("identifier=http://acme.org/mrns|12345")
.setMethod(HTTPVerb.POST);
bundle.addEntry()
.setResource(observation)
.getRequest()
.setUrl("Observation")
.setMethod(HTTPVerb.POST);
bundle.addEntry()
.setResource(diagnosticom)
.getRequest()
.setUrl("diagnostico")
.setMethod(HTTPVerb.POST);
ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(bundle);
//System.out.println("uno: "+ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(bundle));
Bundle resp = client.transaction().withBundle(bundle).execute();
ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp);
Grahame Grieve (May 16 2019 at 22:34):
what's the error? Is this HAPI?
Luis EC (May 16 2019 at 23:22):
I mark error in these two lines but I can not understand why
Bundle resp = client.transaction().withBundle(bundle).execute();
ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp)
Lloyd McKenzie (May 16 2019 at 23:32):
You mean your developer environment is flagging those lines as being in error? What do the error messages say?
Last updated: Apr 12 2022 at 19:14 UTC