Skip to content

Commit 05cdfbb

Browse files
vanitha1822vishwab1DurgaPrasad-54SauravBizbRolly
authored
Merge Release 3.8.0 (3.6.1) to Main (#197)
* Elasticsearch Implementation for Beneficiary Search (#182) * fix: implement elasticsearch functionality * fix: update the response code * fix: update pom.xml * fix: advance search functionality * fix: add env properties * fix: updated to advancedSearch * fix: update to advanced * Added the Signature for hwc (#184) * fix:prescription drug for hwc * fix:doctor signature * fix:doctor signature * Cherry-pick health and version API enhancements to release-3.6.1 (#192) * Add /health endpoint and update /version endpoint * Update HTTPRequests and fix issues in /health and /version * fix(security): validate authentication for /health details * feat: update version and health endpoints * fix(redis): fix redis timeout handling issue * fix(health): fix InterruptedException handling and add redis timeout with proper interrupt restore * refactor(health): simplify MySQL health check and remove sensitive details * fix(health): removed unused methods from healthservices * fix(health): remove unused imports * fix(health): scope PROCESSLIST lock-wait check to application DB user * fix(health): avoid permanent DEGRADED from historical deadloc * fix(health): handle executor rejection during shutdown in /health * refactor(health): centralize component names and fix InterruptedException handling * fix(health): resolve remaining reliability issues on new code * fix(health): isolate advanced checks in dedicated executor to avoid thread starvation * fix(health): cancel timed-out advanced MySQL checks to avoid orphaned tasks * fix(health): make advanced MySQL checks interruptible on timeout * fix(health): remove unsafe connection sharing from advanced MySQL checks * refactor(health): reduce cognitive complexity of advanced MySQL throttle logic * fix(health): cancel in-flight futures on generic failure * feat(health): add gpl license header * change release vserion in pom file (#194) --------- Co-authored-by: Vishwanath Balkur <118195001+vishwab1@users.noreply.github.com> Co-authored-by: KOPPIREDDY DURGA PRASAD <144464542+DurgaPrasad-54@users.noreply.github.com> Co-authored-by: Saurav Mishra <saurav.mishra@bizbrolly.com> Co-authored-by: Saurav Mishra <80103738+SauravBizbRolly@users.noreply.github.com>
1 parent 0c4f474 commit 05cdfbb

34 files changed

Lines changed: 1245 additions & 419 deletions

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.iemr.hwc</groupId>
88
<artifactId>hwc-api</artifactId>
9-
<version>3.6.0</version>
9+
<version>3.8.0</version>
1010
<packaging>war</packaging>
1111

1212
<name>HWC-API</name>
@@ -531,4 +531,4 @@
531531
</plugins>
532532
</build>
533533

534-
</project>
534+
</project>

src/main/environment/common_ci.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ registrarQuickSearchByIdUrl =@env.COMMON_API@beneficiary/searchUserByID
2020

2121
registrarQuickSearchByPhoneNoUrl =@env.COMMON_API@beneficiary/searchUserByPhone
2222

23+
registrarQuickSearchByESUrl =@env.COMMON_API@beneficiary/searchUser
24+
2325
getBenImageFromIdentity =@env.HWC_IDENTITY_API_BASE@id/benImageByBenRegID
2426

2527
##save covid Vaccine details coming from mobile app through fhir
@@ -31,6 +33,9 @@ beneficiaryEditUrl =@env.COMMON_API@beneficiary/update
3133
## Advance Search
3234
registrarAdvanceSearchUrl =@env.COMMON_API@beneficiary/searchBeneficiary
3335

36+
## Advance Search using ES
37+
registrarAdvanceSearchESUrl =@env.COMMON_API@beneficiary/searchBeneficiaryES
38+
3439
## Data Sync API
3540
dataSyncUploadUrl=@env.MMU_API@dataSync/van-to-server
3641

src/main/environment/common_docker.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ registrarQuickSearchByIdUrl =${COMMON_API}beneficiary/searchUserByID
2020

2121
registrarQuickSearchByPhoneNoUrl =${COMMON_API}beneficiary/searchUserByPhone
2222

23+
registrarQuickSearchByESUrl =${COMMON_API}beneficiary/searchUser
24+
2325
getBenImageFromIdentity =${HWC_IDENTITY_API_BASE}id/benImageByBenRegID
2426

2527
##save covid Vaccine details coming from mobile app through fhir
@@ -31,6 +33,9 @@ beneficiaryEditUrl =${COMMON_API}beneficiary/update
3133
## Advance Search
3234
registrarAdvanceSearchUrl =${COMMON_API}beneficiary/searchBeneficiary
3335

36+
## Advance Search using ES
37+
registrarAdvanceSearchESUrl =${COMMON_API}beneficiary/searchBeneficiaryES
38+
3439
## Data Sync API
3540
dataSyncUploadUrl=${MMU_API}dataSync/van-to-server
3641

src/main/environment/common_example.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ registrarQuickSearchByIdUrl =http://localhost:8083/beneficiary/searchUserByID
2121

2222
registrarQuickSearchByPhoneNoUrl =http://localhost:8083/beneficiary/searchUserByPhone
2323

24+
registrarQuickSearchByESUrl =http://localhost:8083/beneficiary/searchUser
25+
2426
getBenImageFromIdentity =http://localhost:8094/id/benImageByBenRegID
2527

2628
##save covid Vaccine details coming from mobile app through fhir
@@ -32,6 +34,9 @@ beneficiaryEditUrl =http://localhost:8083/beneficiary/update
3234
## Advance Search
3335
registrarAdvanceSearchUrl =http://localhost:8083/beneficiary/searchBeneficiary
3436

37+
## Advance Search using ES
38+
registrarAdvanceSearchESUrl =http://localhost:8083/beneficiary/searchBeneficiaryES
39+
3540
## Data Sync API
3641
dataSyncUploadUrl==http://localhost:8087/dataSync/van-to-server
3742

src/main/java/com/iemr/hwc/controller/anc/AntenatalCareController.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
*/
2222
package com.iemr.hwc.controller.anc;
2323

24+
import java.util.ArrayList;
25+
import java.util.HashMap;
26+
import java.util.List;
27+
import java.util.Map;
28+
2429
import org.json.JSONObject;
2530
import org.slf4j.Logger;
2631
import org.slf4j.LoggerFactory;
@@ -35,6 +40,7 @@
3540
import org.springframework.web.bind.annotation.RestController;
3641

3742
import com.google.gson.Gson;
43+
import com.google.gson.JsonArray;
3844
import com.google.gson.JsonElement;
3945
import com.google.gson.JsonObject;
4046
import com.google.gson.JsonParser;
@@ -118,7 +124,23 @@ public String saveBenANCDoctorData(@RequestBody String requestObj,
118124
if (jsnOBJ != null) {
119125
Long r = ancService.saveANCDoctorData(jsnOBJ, Authorization);
120126
if (r != null && r > 0) {
121-
response.setResponse("Data saved successfully");
127+
// Extract drug IDs from JsonObject
128+
List<Long> prescribedDrugIDs = new ArrayList<>();
129+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
130+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
131+
for (int j = 0; j < drugIDsArray.size(); j++) {
132+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
133+
}
134+
}
135+
136+
// Create response with message and IDs
137+
Map<String, Object> responseData = new HashMap<>();
138+
responseData.put("message", "Data saved successfully");
139+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
140+
141+
Gson gson = new Gson();
142+
String responseJson = gson.toJson(responseData);
143+
response.setResponse(responseJson);
122144
} else {
123145
response.setError(5000, "Unable to save data");
124146
}
@@ -540,7 +562,23 @@ public String updateANCDoctorData(@RequestBody String requestObj,
540562
try {
541563
Long result = ancService.updateANCDoctorData(jsnOBJ, Authorization);
542564
if (null != result && result > 0) {
543-
response.setResponse("Data updated successfully");
565+
// Extract drug IDs from JsonObject
566+
List<Long> prescribedDrugIDs = new ArrayList<>();
567+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
568+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
569+
for (int j = 0; j < drugIDsArray.size(); j++) {
570+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
571+
}
572+
}
573+
574+
// Create response with message and IDs
575+
Map<String, Object> responseData = new HashMap<>();
576+
responseData.put("message", "Data updated successfully");
577+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
578+
579+
Gson gson = new Gson();
580+
String responseJson = gson.toJson(responseData);
581+
response.setResponse(responseJson);
544582
} else {
545583
response.setError(500, "Unable to modify data");
546584
}

src/main/java/com/iemr/hwc/controller/cancerscreening/CancerScreeningController.java

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
*/
2222
package com.iemr.hwc.controller.cancerscreening;
2323

24+
import java.util.ArrayList;
25+
import java.util.HashMap;
26+
import java.util.List;
27+
import java.util.Map;
28+
2429
import org.json.JSONObject;
2530
import org.slf4j.Logger;
2631
import org.slf4j.LoggerFactory;
@@ -34,6 +39,8 @@
3439
import org.springframework.web.bind.annotation.RequestMapping;
3540
import org.springframework.web.bind.annotation.RestController;
3641

42+
import com.google.gson.Gson;
43+
import com.google.gson.JsonArray;
3744
import com.google.gson.JsonElement;
3845
import com.google.gson.JsonObject;
3946
import com.google.gson.JsonParser;
@@ -119,7 +126,23 @@ public String saveBenCancerScreeningDoctorData(@RequestBody String requestObj,
119126
if (jsnOBJ != null) {
120127
Long csDocDataSaveSuccessFlag = cSServiceImpl.saveCancerScreeningDoctorData(jsnOBJ, Authorization);
121128
if (csDocDataSaveSuccessFlag != null && csDocDataSaveSuccessFlag > 0) {
122-
response.setResponse("Data saved successfully");
129+
// Extract drug IDs from JsonObject
130+
List<Long> prescribedDrugIDs = new ArrayList<>();
131+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
132+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
133+
for (int j = 0; j < drugIDsArray.size(); j++) {
134+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
135+
}
136+
}
137+
138+
// Create response with message and IDs
139+
Map<String, Object> responseData = new HashMap<>();
140+
responseData.put("message", "Data saved successfully");
141+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
142+
143+
Gson gson = new Gson();
144+
String responseJson = gson.toJson(responseData);
145+
response.setResponse(responseJson);
123146
} else {
124147
response.setError(5000, "Unable to save data");
125148
}
@@ -574,7 +597,23 @@ public String updateCancerScreeningDoctorData(@RequestBody String requestObj) {
574597
try {
575598
int result = cSServiceImpl.updateCancerScreeningDoctorData(jsnOBJ);
576599
if (result > 0) {
577-
response.setResponse("Data updated successfully");
600+
// Extract drug IDs from JsonObject
601+
List<Long> prescribedDrugIDs = new ArrayList<>();
602+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
603+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
604+
for (int j = 0; j < drugIDsArray.size(); j++) {
605+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
606+
}
607+
}
608+
609+
// Create response with message and IDs
610+
Map<String, Object> responseData = new HashMap<>();
611+
responseData.put("message", "Data updated successfully");
612+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
613+
614+
Gson gson = new Gson();
615+
String responseJson = gson.toJson(responseData);
616+
response.setResponse(responseJson);
578617
} else {
579618
response.setError(500, "Unable to modify data");
580619
}

src/main/java/com/iemr/hwc/controller/covid19/CovidController.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
*/
2222
package com.iemr.hwc.controller.covid19;
2323

24+
import java.util.ArrayList;
2425
import java.util.HashMap;
26+
import java.util.List;
2527
import java.util.Map;
2628

2729
import org.json.JSONObject;
@@ -37,6 +39,8 @@
3739
import org.springframework.web.bind.annotation.RequestMapping;
3840
import org.springframework.web.bind.annotation.RestController;
3941

42+
import com.google.gson.Gson;
43+
import com.google.gson.JsonArray;
4044
import com.google.gson.JsonElement;
4145
import com.google.gson.JsonObject;
4246
import com.google.gson.JsonParser;
@@ -109,7 +113,24 @@ public String saveBenCovidDoctorData(@RequestBody String requestObj,
109113
if (jsnOBJ != null) {
110114
Long ncdCareRes = covid19ServiceImpl.saveDoctorData(jsnOBJ, Authorization);
111115
if (null != ncdCareRes && ncdCareRes > 0) {
112-
response.setResponse("Data saved successfully");
116+
// Extract drug IDs from JsonObject
117+
List<Long> prescribedDrugIDs = new ArrayList<>();
118+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
119+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
120+
for (int j = 0; j < drugIDsArray.size(); j++) {
121+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
122+
}
123+
}
124+
125+
// Create response with message and IDs
126+
Map<String, Object> responseData = new HashMap<>();
127+
responseData.put("message", "Data saved successfully");
128+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
129+
130+
Gson gson = new Gson();
131+
String responseJson = gson.toJson(responseData);
132+
response.setResponse(responseJson);
133+
113134
} else {
114135
response.setResponse("Unable to save data");
115136
}
@@ -348,7 +369,24 @@ public String updateCovid19DoctorData(@RequestBody String requestObj,
348369
try {
349370
Long result = covid19ServiceImpl.updateCovid19DoctorData(jsnOBJ, Authorization);
350371
if (null != result && result > 0) {
351-
response.setResponse("Data updated successfully");
372+
// Extract drug IDs from JsonObject
373+
List<Long> prescribedDrugIDs = new ArrayList<>();
374+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
375+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
376+
for (int j = 0; j < drugIDsArray.size(); j++) {
377+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
378+
}
379+
}
380+
381+
// Create response with message and IDs
382+
Map<String, Object> responseData = new HashMap<>();
383+
responseData.put("message", "Data updated successfully");
384+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
385+
386+
Gson gson = new Gson();
387+
String responseJson = gson.toJson(responseData);
388+
response.setResponse(responseJson);
389+
352390
} else {
353391
response.setError(500, "Unable to modify data");
354392
}

src/main/java/com/iemr/hwc/controller/generalOPD/GeneralOPDController.java

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
*/
2222
package com.iemr.hwc.controller.generalOPD;
2323

24+
import java.util.ArrayList;
25+
import java.util.HashMap;
26+
2427
import org.json.JSONObject;
2528
import org.slf4j.Logger;
2629
import org.slf4j.LoggerFactory;
@@ -35,12 +38,20 @@
3538
import org.springframework.web.bind.annotation.RequestMethod;
3639
import org.springframework.web.bind.annotation.RestController;
3740

41+
import com.google.gson.Gson;
3842
import com.google.gson.JsonElement;
3943
import com.google.gson.JsonObject;
4044
import com.google.gson.JsonParser;
4145
import com.iemr.hwc.service.generalOPD.GeneralOPDServiceImpl;
4246
import com.iemr.hwc.utils.response.OutputResponse;
4347

48+
import java.util.ArrayList;
49+
import java.util.HashMap;
50+
import java.util.List;
51+
import java.util.Map;
52+
import com.google.gson.Gson;
53+
import com.google.gson.JsonArray;
54+
4455
import io.swagger.v3.oas.annotations.Operation;
4556

4657
/***
@@ -118,7 +129,23 @@ public String saveBenGenOPDDoctorData(@RequestBody String requestObj,
118129
if (jsnOBJ != null) {
119130
Long genOPDRes = generalOPDServiceImpl.saveDoctorData(jsnOBJ, Authorization);
120131
if (null != genOPDRes && genOPDRes > 0) {
121-
response.setResponse("Data saved successfully");
132+
// Extract drug IDs from JsonObject
133+
List<Long> prescribedDrugIDs = new ArrayList<>();
134+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
135+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
136+
for (int j = 0; j < drugIDsArray.size(); j++) {
137+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
138+
}
139+
}
140+
141+
// Create response with message and IDs
142+
Map<String, Object> responseData = new HashMap<>();
143+
responseData.put("message", "Data saved successfully");
144+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
145+
146+
Gson gson = new Gson();
147+
String responseJson = gson.toJson(responseData);
148+
response.setResponse(responseJson);
122149
} else {
123150
response.setResponse("Unable to save data");
124151
}
@@ -422,7 +449,23 @@ public String updateGeneralOPDDoctorData(@RequestBody String requestObj,
422449
try {
423450
Long result = generalOPDServiceImpl.updateGeneralOPDDoctorData(jsnOBJ, Authorization);
424451
if (null != result && result > 0) {
425-
response.setResponse("Data updated successfully");
452+
// Extract drug IDs from JsonObject
453+
List<Long> prescribedDrugIDs = new ArrayList<>();
454+
if (jsnOBJ.has("savedDrugIDs") && !jsnOBJ.get("savedDrugIDs").isJsonNull()) {
455+
JsonArray drugIDsArray = jsnOBJ.getAsJsonArray("savedDrugIDs");
456+
for (int j = 0; j < drugIDsArray.size(); j++) {
457+
prescribedDrugIDs.add(drugIDsArray.get(j).getAsLong());
458+
}
459+
}
460+
461+
// Create response with message and IDs
462+
Map<String, Object> responseData = new HashMap<>();
463+
responseData.put("message", "Data updated successfully");
464+
responseData.put("prescribedDrugIDs", prescribedDrugIDs);
465+
466+
Gson gson = new Gson();
467+
String responseJson = gson.toJson(responseData);
468+
response.setResponse(responseJson);
426469
} else {
427470
response.setError(500, "Unable to modify data");
428471
}

src/main/java/com/iemr/hwc/controller/health/HealthController.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* AMRIT – Accessible Medical Records via Integrated Technology
3+
* Integrated EHR (Electronic Health Records) Solution
4+
*
5+
* Copyright (C) "Piramal Swasthya Management and Research Institute"
6+
*
7+
* This file is part of AMRIT.
8+
*
9+
* This program is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU General Public License as published by
11+
* the Free Software Foundation, either version 3 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU General Public License
20+
* along with this program. If not, see https://www.gnu.org/licenses/.
21+
*/
22+
123
package com.iemr.hwc.controller.health;
224

325
import java.time.Instant;

0 commit comments

Comments
 (0)