private ModelAndView add(String returnPage, HttpServletRequest request) { String phoneNum = request.getParameter("phoneNum"); String externalID = request.getParameter("externalId"); patientScheduler.saveMotechPatient(externalID, phoneNum); List<Patient> patientList = patientDataService.retrieveAll(); Map<String, Object> modelMap = new TreeMap<String, Object>(); modelMap.put("patients", patientList); // List of patients is for display purposes only return new ModelAndView(returnPage, modelMap); }
private ModelAndView remove(String returnPage, HttpServletRequest request) { String externalID = request.getParameter("externalId"); Patient patient = patientDataService.findByExternalId(externalID); if (patient != null) { patientDataService.delete(patient); } List<Patient> patientList = patientDataService.retrieveAll(); Map<String, Object> modelMap = new TreeMap<>(); modelMap.put("patients", patientList); // List of patients is for display purposes only return new ModelAndView(returnPage, modelMap); }