/** * Create a new appointment based on passed parameters * * @param timeSlot * @param patient * @param appointmentType * @return */ public boolean createAppointment(String timeSlot, String patient, String appointmentType) { String query = "appointmentscheduling/appointment"; try { String input = "{\"patient\": \"" + patient + "\", \"timeSlot\": \"" + timeSlot + "\", \"appointmentType\": \"" + appointmentType + "\", \"status\": \"SCHEDULED\"}"; logger.debug(input); System.out.println(input); StringEntity se = new StringEntity(input); se.setContentType("application/json"); if (RestCall.getRequestPost(query, se)) System.out.println("Success"); else System.out.println("Failure"); return true; } catch (Exception ex) { logger.info("Some Error occured inside createAppointment"); logger.error("\n ERROR Caused by\n", ex); ex.printStackTrace(); return false; } }
/** * Cancel appointment with specified uuid * * @param uuid * @return */ public boolean cancelAppointment(String uuid) { String query = "appointmentscheduling/appointment/" + uuid; try { String input = "{\"status\": \"CANCELLED\"}"; logger.debug(input); System.out.println(input); StringEntity se = new StringEntity(input); se.setContentType("application/json"); if (RestCall.getRequestPost(query, se)) System.out.println("Success"); else System.out.println("Failure"); return true; } catch (Exception ex) { logger.info("Some Error occured inside cancelAppointment"); logger.error("\n ERROR Caused by\n", ex); ex.printStackTrace(); return false; } }