Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-4487 Save Vitals Data in Visit Patient scenario #71

Merged
merged 9 commits into from
Mar 4, 2025
Prev Previous commit
Next Next commit
changeed variable name
  • Loading branch information
Bawanthathilan committed Mar 4, 2025
commit c4c3217ee5cbc82b5ef2daa4ed37ffa1b6e90eef
Original file line number Diff line number Diff line change
@@ -363,12 +363,12 @@ public HttpRequestActionBuilder saveVitalsData(String patientUuid) {
ZonedDateTime now = ZonedDateTime.now();
String encounterDatetime = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));

Map<String, Object> vitals = new HashMap<>();
vitals.put("form", VITALS_FORM_UUID);
vitals.put("patient", patientUuid);
vitals.put("location", VITALS_LOCATION_UUID);
vitals.put("encounterType", VITALS_ENCOUNTER_TYPE_UUID);
vitals.put("encounterDatetime", encounterDatetime);
Map<String, Object> encounter = new HashMap<>();
encounter.put("form", VITALS_FORM_UUID);
encounter.put("patient", patientUuid);
encounter.put("location", VITALS_LOCATION_UUID);
encounter.put("encounterType", VITALS_ENCOUNTER_TYPE_UUID);
encounter.put("encounterDatetime", encounterDatetime);

List<Map<String, Object>> obs = new ArrayList<>();
obs.add(Map.of("concept", SYSTOLIC_BLOOD_PRESSURE, "value", 34));
@@ -381,10 +381,10 @@ public HttpRequestActionBuilder saveVitalsData(String patientUuid) {
obs.add(Map.of("concept", HEIGHT_CM, "value", 121));
obs.add(Map.of("concept", MID_UPPER_ARM_CIRCUMFERENCE, "value", 34));

vitals.put("obs", obs);
encounter.put("obs", obs);

try {
String body = new ObjectMapper().writeValueAsString(vitals); // Convert Map to JSON
String body = new ObjectMapper().writeValueAsString(encounter); // Convert Map to JSON
return http("Save Vitals").post("/openmrs/ws/rest/v1/encounter").body(StringBody(body));
}
catch (JsonProcessingException e) {