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

Multiple Benificiary visit-api modified for all visit category #78

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,33 +59,37 @@ public class ChildhoodAdolescenceController {
* @Objective Save child-adolescent-care data for nurse.
* @param requestObj
* @return success or failure response with visit code
* @throws Exception
*/
@CrossOrigin
@ApiOperation(value = "Save child adolescent care (CAC) nurse data", consumes = "application/json", produces = "application/json")
@RequestMapping(value = { "/save/nurseData" }, method = { RequestMethod.POST })
public String saveBenNurseDataCAC(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String Authorization) {
@RequestHeader(value = "Authorization") String Authorization) throws Exception {
OutputResponse response = new OutputResponse();
try {
logger.info("Request object for child-adolescent-care nurse data saving :" + requestObj);

if (null != requestObj) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
JsonObject jsnOBJ = jsnElmnt.getAsJsonObject();

if (jsnOBJ != null) {
String genOPDRes = adolescentAndChildCareService.saveNurseData(jsnOBJ, Authorization);
response.setResponse(genOPDRes);

} else {
response.setResponse("Invalid request");
jsnOBJ = jsnElmnt.getAsJsonObject();
try {
logger.info("Request object for child-adolescent-care nurse data saving :" + requestObj);

if (jsnOBJ != null) {
String genOPDRes = adolescentAndChildCareService.saveNurseData(jsnOBJ, Authorization);
response.setResponse(genOPDRes);

} else {
response.setResponse("Invalid request");
}
} catch (SQLException e) {
logger.error("Error in nurse data saving :" + e);
response.setError(5000, "Unable to save data : " + e.getLocalizedMessage());
} catch (Exception e) {
logger.error("Error in nurse data saving :" + e.getMessage());
adolescentAndChildCareService.deleteVisitDetails(jsnOBJ);
response.setError(5000, e.getMessage());
}
} catch (SQLException e) {
logger.error("Error in nurse data saving :" + e);
response.setError(5000, "Unable to save data : " + e.getLocalizedMessage());
} catch (Exception e) {
logger.error("Error in nurse data saving :" + e);
response.setError(5000, "Unable to save data : " + e.getLocalizedMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -113,8 +117,8 @@ public String saveDoctorDataCAC(@RequestBody String requestObj,
}

} catch (Exception e) {
logger.error("Error while saving doctor data:" + e);
response.setError(5000, "Unable to save data. " + e.getMessage());
logger.error("Error while saving doctor data:" + e.getMessage());
response.setError(5000, e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -424,8 +428,8 @@ public String updateCACDoctorData(@RequestBody String requestObj,

logger.info("Doctor data update response:" + response);
} catch (Exception e) {
response.setError(5000, "Unable to modify data. " + e.getLocalizedMessage());
logger.error("Error while updating CAC doctor data:" + e);
logger.error("Unable to modify data. " + e.getLocalizedMessage());
response.setError(5000, e.getMessage());
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,33 +66,38 @@ public class AntenatalCareController {
* @Objective Save ANC data for nurse.
* @param JSON requestObj
* @return success or failure response
* @throws Exception
*/

@CrossOrigin
@ApiOperation(value = "Save ANC nurse data", consumes = "application/json", produces = "application/json")
@RequestMapping(value = { "/save/nurseData" }, method = { RequestMethod.POST })
public String saveBenANCNurseData(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String Authorization) {
@RequestHeader(value = "Authorization") String Authorization) throws Exception {
OutputResponse response = new OutputResponse();
try {

logger.info("Request object for ANC nurse data saving :" + requestObj);

if (null != requestObj) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();

if (jsnOBJ != null) {
String ancRes = ancService.saveANCNurseData(jsnOBJ, Authorization);
response.setResponse(ancRes);
} else {
response.setError(5000, "Invalid request");
}
try {

} catch (Exception e) {
logger.error("Error while saving nurse data:" + e);
response.setError(5000, "Unable to save data");
logger.info("Request object for ANC nurse data saving :" + requestObj);

if (jsnOBJ != null) {
String ancRes = ancService.saveANCNurseData(jsnOBJ, Authorization);
response.setResponse(ancRes);
} else {
response.setError(5000, "Invalid request");
}

} catch (Exception e) {
logger.error("Error while saving nurse data:" + e.getMessage());
ancService.deleteVisitDetails(jsnOBJ);
response.setError(5000, e.getMessage());
}
}
return response.toString();
}
Expand Down Expand Up @@ -127,8 +132,8 @@ public String saveBenANCDoctorData(@RequestBody String requestObj,
}

} catch (Exception e) {
logger.error("Error while saving doctor data:" + e);
response.setError(5000, "Unable to save data. " + e.getMessage());
logger.error("Error while saving doctor data:" + e.getMessage());
response.setError(5000, e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -564,8 +569,8 @@ public String updateANCDoctorData(@RequestBody String requestObj,
}
logger.info("ANC doctor data update Response:" + response);
} catch (Exception e) {
response.setError(5000, "Unable to modify data. " + e.getMessage());
logger.error("Error while updating beneficiary doctor data :" + e);
logger.error("Unable to modify data. " + e.getMessage());
response.setError(5000, e.getMessage());
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,36 @@ public void setCancerScreeningServiceImpl(CSServiceImpl cSServiceImpl) {
* @Objective Save Cancer Screening data for nurse.
* @param JSON requestObj
* @return success or failure response
* @throws Exception
*/

@CrossOrigin
@ApiOperation(value = "Save cancer screening data collected by nurse", consumes = "application/json", produces = "application/json")
@RequestMapping(value = { "/save/nurseData" }, method = { RequestMethod.POST })
public String saveBenCancerScreeningNurseData(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String Authorization) {
@RequestHeader(value = "Authorization") String Authorization) throws Exception {
OutputResponse response = new OutputResponse();
try {
logger.info("Request object for CS nurse data saving :" + requestObj);

if (null != requestObj) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();

if (jsnOBJ != null) {
String nurseDataSaveSuccessFlag = cSServiceImpl.saveCancerScreeningNurseData(jsnOBJ, Authorization);
response.setResponse(nurseDataSaveSuccessFlag);
} else {
response.setError(5000, "Invalid request");
try {
logger.info("Request object for CS nurse data saving :" + requestObj);

if (jsnOBJ != null) {
String nurseDataSaveSuccessFlag = cSServiceImpl.saveCancerScreeningNurseData(jsnOBJ, Authorization);
response.setResponse(nurseDataSaveSuccessFlag);
} else {
response.setError(5000, "Invalid request");
}
} catch (Exception e) {
logger.error("Error while saving beneficiary nurse data :" + e.getMessage());
cSServiceImpl.deleteVisitDetails(jsnOBJ);
response.setError(5000, e.getMessage());
}
} catch (Exception e) {
logger.error("Error while saving beneficiary nurse data :" + e);
response.setError(5000, "Unable to save data");
}
return response.toString();
}
Expand Down Expand Up @@ -128,8 +133,8 @@ public String saveBenCancerScreeningDoctorData(@RequestBody String requestObj,
}

} catch (Exception e) {
logger.error("Error while saving beneficiary doctor data :" + e);
response.setError(5000, "Unable to save data");
logger.error("Error while saving beneficiary doctor data :" + e.getMessage());
response.setError(5000, e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -608,8 +613,8 @@ public String updateCancerScreeningDoctorData(@RequestBody String requestObj) {
}
logger.info("CS doctor data update Response:" + response);
} catch (Exception e) {
response.setError(5000, "Error while updating beneficiary data. " + e);
logger.error("Error while updating beneficiary doctor data :" + e);
logger.error("Error while updating beneficiary data. " + e.getMessage());
response.setError(5000, e.getMessage());
}
return response.toString();
}
Expand Down
36 changes: 20 additions & 16 deletions src/main/java/com/iemr/hwc/controller/covid19/CovidController.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,30 @@ public class CovidController {
@ApiOperation(value = "Save COVID nurse data", consumes = "application/json", produces = "application/json")
@RequestMapping(value = { "/save/nurseData" }, method = { RequestMethod.POST })
public String saveBenNCDCareNurseData(@RequestBody String requestObj,
@RequestHeader(value = "Authorization") String Authorization) {
@RequestHeader(value = "Authorization") String Authorization) throws Exception {
OutputResponse response = new OutputResponse();
try {
logger.info("Request object for COVID 19 nurse data saving :" + requestObj);

if (null != requestObj) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();

if (jsnOBJ != null) {
String ncdCareRes = covid19ServiceImpl.saveCovid19NurseData(jsnOBJ, Authorization);
response.setResponse(ncdCareRes);
} else {
response.setError(5000, "Invalid Request !!!");
}
try {
logger.info("Request object for COVID 19 nurse data saving :" + requestObj);

} catch (Exception e) {
logger.error("Error while saving Pandemic nurse data :" + e);
response.setError(5000, "Unable to save data");
if (jsnOBJ != null) {
String ncdCareRes = covid19ServiceImpl.saveCovid19NurseData(jsnOBJ, Authorization);
response.setResponse(ncdCareRes);
} else {
response.setError(5000, "Invalid Request !!!");
}

} catch (Exception e) {
logger.error("Error while saving Pandemic nurse data :" + e.getMessage());
covid19ServiceImpl.deleteVisitDetails(jsnOBJ);
response.setError(5000, e.getMessage());
}
}
return response.toString();
}
Expand Down Expand Up @@ -117,8 +121,8 @@ public String saveBenCovidDoctorData(@RequestBody String requestObj,
response.setResponse("Invalid request");
}
} catch (Exception e) {
logger.error("Error while saving Covid doctor data :" + e);
response.setError(5000, "Unable to save data. " + e.getMessage());
logger.error("Error while saving Covid doctor data :" + e.getMessage());
response.setError(5000, e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -364,8 +368,8 @@ public String updateCovid19DoctorData(@RequestBody String requestObj,
}
logger.info("Doctor data update Response:" + response);
} catch (Exception e) {
response.setError(500, "Unable to modify data. " + e.getMessage());
logger.error("Error while updating doctor data :" + e);
logger.error("Unable to modify data. " + e.getMessage());
response.setError(5000, e.getMessage());
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,31 @@ public String saveFamilyPlanningNuseData(@ApiParam(value = "{\r\n" + " \"visitD
+ " \"parkingPlaceID\": 246,\r\n" + " \"vanID\": 220,\r\n" + " \"serviceID\": \"4\",\r\n"
+ " \"createdBy\": \"testtm\",\r\n" + " \"tcRequest\": null,\r\n"
+ " \"beneficiaryRegID\": \"274661\",\r\n" + " \"providerServiceMapID\": \"1261\"\r\n" + "}\r\n"
+ "") @RequestBody String requestOBJ, @RequestHeader(value = "Authorization") String Authorization) {
+ "") @RequestBody String requestOBJ, @RequestHeader(value = "Authorization") String Authorization)
throws Exception {

OutputResponse response = new OutputResponse();
try {

if (null != requestOBJ) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestOBJ);
jsnOBJ = jsnElmnt.getAsJsonObject();

if (jsnOBJ != null) {
try {

String outcome = familyPlanningService.saveNurseDataFP(jsnOBJ, Authorization);
// set response once data save successfully
response.setResponse(outcome);
} else
throw new IEMRException("Invalid request object / NULL");
} catch (Exception e) {
logger.error("error in saving family-planning nurse data : " + e.getLocalizedMessage());
response.setError(5000, "error in saving family-planning nurse data : " + e.getLocalizedMessage());
if (jsnOBJ != null) {

String outcome = familyPlanningService.saveNurseDataFP(jsnOBJ, Authorization);
// set response once data save successfully
response.setResponse(outcome);
} else
throw new IEMRException("Invalid request object / NULL");
} catch (Exception e) {
logger.error("error in saving family-planning nurse data : " + e.getLocalizedMessage());
familyPlanningService.deleteVisitDetails(jsnOBJ);
response.setError(5000, e.getMessage());
}
}

return response.toString();
Expand Down Expand Up @@ -169,8 +174,8 @@ public String saveFamilyPlanningDoctorData(@RequestBody String requestObj,
}

} catch (Exception e) {
logger.error("Error while saving doctor data:" + e);
response.setError(5000, "Unable to save data. " + e.getMessage());
logger.error("Error while saving doctor data:" + e.getMessage());
response.setError(5000, e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -388,8 +393,8 @@ public String updateFamilyPlanningDoctorData(@RequestBody String requestObj,

logger.info("Doctor data update response:" + response);
} catch (Exception e) {
response.setError(5000, "Unable to modify data. " + e.getLocalizedMessage());
logger.error("Error while updating FamilyPlanning doctor data:" + e);
logger.error("Unable to modify data. " + e.getLocalizedMessage());
response.setError(5000, e.getMessage());
}

return response.toString();
Expand Down
Loading