Subversion Repository Public Repository

emr_demo

Diff Revisions 5 vs 6 for /web_emr - Copy/src/main/java/com/bestray/security/service/FacilityMasterService.java

Diff revisions: vs.
  @@ -217,7 +217,7 @@
217 217 pharmacyRepository.save(pharmacy_new);
218 218 System.out.println("2@@@@@");
219 219 }else{
220 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is already avilable");
220 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
221 221 }
222 222 }
223 223 }
  @@ -231,7 +231,7 @@
231 231 pharmacy_new.setEnabled(false);
232 232 pharmacyRepository.save(pharmacy_new);
233 233 }else{
234 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not already avilable");
234 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
235 235
236 236 }
237 237 }
  @@ -244,7 +244,7 @@
244 244 String json = new ObjectMapper().writerWithDefaultPrettyPrinter()
245 245 .writeValueAsString(userExists);
246 246 if (userExists.isEmpty()) {
247 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not already avilable");
247 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
248 248
249 249 }else{
250 250
  @@ -286,7 +286,7 @@
286 286 labRepository.save(lab_new);
287 287 System.out.println("2@@@@@");
288 288 }else{
289 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is already avilable");
289 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
290 290 }
291 291 }
292 292 }
  @@ -300,7 +300,7 @@
300 300 lab_new.setEnabled(false);
301 301 labRepository.save(lab_new);
302 302 }else{
303 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not already avilable");
303 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
304 304
305 305 }
306 306 }
  @@ -313,7 +313,7 @@
313 313 String json = new ObjectMapper().writerWithDefaultPrettyPrinter()
314 314 .writeValueAsString(userExists);
315 315 if (userExists.isEmpty()) {
316 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not already avilable");
316 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
317 317
318 318 }else{
319 319
  @@ -350,7 +350,7 @@
350 350 expenditureRepository.save(expenditure_new);
351 351 System.out.println("2@@@@@");
352 352 }else{
353 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is already avilable");
353 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
354 354 }
355 355 }
356 356 }
  @@ -364,26 +364,42 @@
364 364 expenditure_new.setEnabled(false);
365 365 expenditureRepository.save(expenditure_new);
366 366 }else{
367 - throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not already avilable");
367 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
368 368
369 369 }
370 370 }
371 371 }
372 372
373 373 //searchExpenditure
374 - // public String searchExpenditure() throws ExceptionHandler_delete, JsonProcessingException {
375 - // List<ExpenditureMaster> userExists =expenditureRepository.findAll();
374 + public String searchExpenditure() throws ExceptionHandler_delete, JsonProcessingException {
375 + List<ExpenditureMaster> userExists =expenditureRepository.findAll();
376 + String json = new ObjectMapper().writerWithDefaultPrettyPrinter()
377 + .writeValueAsString(userExists);
378 + if (userExists.isEmpty()) {
379 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
380 +
381 + }else{
382 +
383 + System.out.println("############");
384 + }
385 + return json;
386 + }
387 +
388 + public ExpenditureMaster searchByNameExpenditure(String name) throws ExceptionHandler_delete, JsonProcessingException {
389 + ExpenditureMaster expenditureMaster =expenditureRepository.findByExpenditureType(name);
376 390 // String json = new ObjectMapper().writerWithDefaultPrettyPrinter()
377 391 // .writeValueAsString(userExists);
378 - // if (userExists.isEmpty()) {
379 - // throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not already avilable");
380 - //
381 - // }else{
382 - //
383 - // System.out.println("############");
384 - // }
385 - // return json;
386 - // }
392 + if (expenditureMaster!=null) {
393 +
394 + throw new ResponseStatusException(HttpStatus.NOT_FOUND, "given id is not avilable");
395 +
396 + }else{
397 +
398 + System.out.println("############");
399 +
400 + }
401 + return expenditureMaster;
402 + }
387 403
388 404
389 405 }