Skip to content

Commit 95cecbc

Browse files
BAH-3773 | Add. return response
1 parent 801d7c2 commit 95cecbc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

omod/src/main/java/org/bahmni/module/hip/web/controller/PatientController.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ public ResponseEntity<?> checkHealthNumber(@PathVariable String patientUuid) {
109109

110110
@RequestMapping(method = RequestMethod.POST, value = "/existingPatients/update/{patientUuid}")
111111
public ResponseEntity<?> updatePatient(@PathVariable String patientUuid, @RequestBody PatientAbhaInfo patientAbhaInfo) {
112-
existingPatientService.checkAndAddPatientIdentifier(patientUuid,patientAbhaInfo);
113-
return ResponseEntity.ok().build();
112+
boolean isLinked = existingPatientService.checkAndAddPatientIdentifier(patientUuid,patientAbhaInfo);
113+
return ResponseEntity.ok()
114+
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
115+
.body(isLinked);
114116
}
115117

116118
}

omod/src/main/java/org/bahmni/module/hip/web/service/ExistingPatientService.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,17 @@ public String getHealthId(Patient patient) {
6363
return healthId;
6464
}
6565

66-
public void checkAndAddPatientIdentifier(String patientUuid, PatientAbhaInfo abhaInfo) {
66+
public boolean checkAndAddPatientIdentifier(String patientUuid, PatientAbhaInfo abhaInfo) {
6767
Patient patient = patientService.getPatientByUuid(patientUuid);
6868
try {
6969
if(patient.getPatientIdentifier(Config.ABHA_ADDRESS.getValue()) == null && patient.getPatientIdentifier(Config.ABHA_NUMBER.getValue()) == null) {
7070
setIdentifier(patient, abhaInfo.getAbhaAddress(), Config.ABHA_ADDRESS.getValue());
7171
setIdentifier(patient, abhaInfo.getAbhaNumber(), Config.ABHA_NUMBER.getValue());
72+
return true;
7273
}
7374
} catch (NullPointerException ignored) {
7475
}
76+
return false;
7577
}
7678

7779
private void setIdentifier(Patient patient, String identifierValue, String identifierType) {

0 commit comments

Comments
 (0)