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 1 commit
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,12 +59,13 @@ 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);
Expand All @@ -85,7 +86,16 @@ public String saveBenNurseDataCAC(@RequestBody String requestObj,
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());
if (e.getMessage().equalsIgnoreCase("Error while booking slot.")) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();
adolescentAndChildCareService.deleteVisitDetails(jsnOBJ);
response.setError(5000, "Already booked slot, Please choose another slot");
} else {
response.setError(5000, "Unable to save data");
}
}
return response.toString();
}
Expand Down Expand Up @@ -114,7 +124,10 @@ 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());
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
response.setError(5000, "Unable to save data");
}
return response.toString();
}
Expand Down Expand Up @@ -425,7 +438,10 @@ 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);
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
logger.error("Error while updating CAC doctor data:" + e);
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ 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 {

Expand All @@ -92,7 +93,16 @@ public String saveBenANCNurseData(@RequestBody String requestObj,

} catch (Exception e) {
logger.error("Error while saving nurse data:" + e);
response.setError(5000, "Unable to save data");
if (e.getMessage().equalsIgnoreCase("Error while booking slot.")) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();
ancService.deleteVisitDetails(jsnOBJ);
response.setError(5000, "Already booked slot, Please choose another slot");
} else {
response.setError(5000, "Unable to save data");
}
}
return response.toString();
}
Expand Down Expand Up @@ -128,7 +138,10 @@ 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());
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
response.setError(5000, "Unable to save data");
}
return response.toString();
}
Expand Down Expand Up @@ -565,7 +578,10 @@ 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);
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
logger.error("Error while updating beneficiary doctor data :" + e);
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ 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);
Expand All @@ -91,7 +92,16 @@ public String saveBenCancerScreeningNurseData(@RequestBody String requestObj,
}
} catch (Exception e) {
logger.error("Error while saving beneficiary nurse data :" + e);
response.setError(5000, "Unable to save data");
if (e.getMessage().equalsIgnoreCase("Error while booking slot.")) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();
cSServiceImpl.deleteVisitDetails(jsnOBJ);
response.setError(5000, "Already booked slot, Please choose another slot");
} else {
response.setError(5000, "Unable to save data");
}
}
return response.toString();
}
Expand Down Expand Up @@ -129,7 +139,10 @@ 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");
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
response.setError(5000, "Unable to save data");
}
return response.toString();
}
Expand Down Expand Up @@ -609,7 +622,10 @@ 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);
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
logger.error("Error while updating beneficiary doctor data :" + e);
}
return response.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ 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 {
Expand All @@ -140,7 +140,16 @@ public String saveFamilyPlanningNuseData(@ApiParam(value = "{\r\n" + " \"visitD
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 (e.getMessage().equalsIgnoreCase("Error while booking slot.")) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestOBJ);
jsnOBJ = jsnElmnt.getAsJsonObject();
familyPlanningService.deleteVisitDetails(jsnOBJ);
response.setError(5000, "Already booked slot, Please choose another slot");
} else {
response.setError(5000, "error in saving family-planning nurse data : " + e.getLocalizedMessage());
}
}

return response.toString();
Expand Down Expand Up @@ -170,7 +179,10 @@ 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());
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
response.setError(5000, "Unable to save data. " + e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -389,7 +401,10 @@ 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);
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
logger.error("Error while updating FamilyPlanning doctor data:" + e);
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ public void setGeneralOPDServiceImpl(GeneralOPDServiceImpl generalOPDServiceImpl
* @Objective Save General OPD data for nurse.
* @param requestObj
* @return success or failure response
* @throws Exception
*/
@CrossOrigin
@ApiOperation(value = "Save general OPD data collected by nurse", consumes = "application/json", produces = "application/json")
@RequestMapping(value = { "/save/nurseData" }, method = { RequestMethod.POST })
public String saveBenGenOPDNurseData(@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 GeneralOPD nurse data saving :" + requestObj);
Expand All @@ -88,7 +89,16 @@ public String saveBenGenOPDNurseData(@RequestBody String requestObj,
}
} catch (Exception e) {
logger.error("Error in nurse data saving :" + e);
response.setError(5000, "Unable to save data");
if (e.getMessage().equalsIgnoreCase("Error while booking slot.")) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();
generalOPDServiceImpl.deleteVisitDetails(jsnOBJ);
response.setError(5000, "Already booked slot, Please choose another slot");
} else {
response.setError(5000, "Unable to save data");
}
}
return response.toString();
}
Expand Down Expand Up @@ -125,7 +135,10 @@ public String saveBenGenOPDDoctorData(@RequestBody String requestObj,
}
} catch (Exception e) {
logger.error("Error in doctor data saving :" + e);
response.setError(5000, "Unable to save data. " + e.getMessage());
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
response.setError(5000, "Unable to save data");
}
return response.toString();
}
Expand Down Expand Up @@ -438,7 +451,10 @@ public String updateGeneralOPDDoctorData(@RequestBody String requestObj,
logger.info("Doctor data update response:" + response);
} catch (Exception e) {
response.setError(5000, "Unable to modify data. " + e.getMessage());
logger.error("Error while updating General OPD doctor data:" + e);
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
logger.error("Error while updating General OPD doctor data:" + e);
}

return response.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ public void setNcdCareServiceImpl(NCDCareServiceImpl ncdCareServiceImpl) {
* @Objective Save NCD Care data for nurse.
* @param JSON requestObj
* @return success or failure response
* @throws Exception
*/
@CrossOrigin
@ApiOperation(value = "Save NCD care data collected by nurse", 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 NCD Care nurse data saving :" + requestObj);
Expand All @@ -90,7 +91,16 @@ public String saveBenNCDCareNurseData(@RequestBody String requestObj,

} catch (Exception e) {
logger.error("Error while saving NCD Care nurse data :" + e);
response.setError(5000, "Unable to save data");
if (e.getMessage().equalsIgnoreCase("Error while booking slot.")) {
JsonObject jsnOBJ = new JsonObject();
JsonParser jsnParser = new JsonParser();
JsonElement jsnElmnt = jsnParser.parse(requestObj);
jsnOBJ = jsnElmnt.getAsJsonObject();
ncdCareServiceImpl.deleteVisitDetails(jsnOBJ);
response.setError(5000, "Already booked slot, Please choose another slot");
} else {
response.setError(5000, "Unable to save data");
}
}
return response.toString();
}
Expand Down Expand Up @@ -127,7 +137,10 @@ public String saveBenNCDCareDoctorData(@RequestBody String requestObj,
}
} catch (Exception e) {
logger.error("Error while saving NCD Care doctor data :" + e);
response.setError(5000, "Unable to save data. " + e.getMessage());
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
response.setError(5000, "Unable to save data. " + e.getMessage());
}
return response.toString();
}
Expand Down Expand Up @@ -374,7 +387,10 @@ public String updateNCDCareDoctorData(@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);
if (e.getMessage().equalsIgnoreCase("Error while booking slot."))
response.setError(5000, "Already booked slot, Please choose another slot");
else
logger.error("Error while updating doctor data :" + e);
}

return response.toString();
Expand Down
Loading