|
1 | 1 | package org.openmrs.performance.http;
|
2 | 2 |
|
| 3 | +import com.fasterxml.jackson.annotation.JsonInclude; |
3 | 4 | import com.fasterxml.jackson.core.JsonProcessingException;
|
4 | 5 | import com.fasterxml.jackson.databind.ObjectMapper;
|
5 | 6 | import io.gatling.javaapi.http.HttpRequestActionBuilder;
|
@@ -321,4 +322,29 @@ public HttpRequestActionBuilder saveVisitNote(String patientUuid, String current
|
321 | 322 | throw new RuntimeException("Error converting visitNote to JSON", e);
|
322 | 323 | }
|
323 | 324 | }
|
| 325 | + |
| 326 | + public HttpRequestActionBuilder saveDiagnosis(String patientUuid, String encounterUuid, String diagnosisUuid, |
| 327 | + String certainty, int rank) { |
| 328 | + Map<String, Object> patientDiagnosis = new HashMap<>(); |
| 329 | + patientDiagnosis.put("patient", patientUuid); |
| 330 | + patientDiagnosis.put("encounter", encounterUuid); |
| 331 | + patientDiagnosis.put("certainty", certainty); |
| 332 | + patientDiagnosis.put("rank", rank); |
| 333 | + patientDiagnosis.put("condition", null); |
| 334 | + |
| 335 | + Map<String, Object> diagnosis = new HashMap<>(); |
| 336 | + diagnosis.put("coded", diagnosisUuid); |
| 337 | + patientDiagnosis.put("diagnosis", diagnosis); |
| 338 | + |
| 339 | + try { |
| 340 | + String body = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.ALWAYS) |
| 341 | + .writeValueAsString(patientDiagnosis); |
| 342 | + |
| 343 | + return http("Save Patient Diagnosis").post("/openmrs/ws/rest/v1/patientdiagnoses").body(StringBody(body)); |
| 344 | + } |
| 345 | + catch (JsonProcessingException e) { |
| 346 | + throw new RuntimeException("Error converting patientDiagnosis to JSON", e); |
| 347 | + } |
| 348 | + } |
| 349 | + |
324 | 350 | }
|
0 commit comments