public ProcessConsultationBean tearForm(HttpServletRequest request) { ProcessConsultationBean bean = new ProcessConsultationBean(); bean.setAction(request.getParameter("action")); bean.setDemographic_name(request.getParameter("demographic_name")); bean.setDemographic_no(request.getParameter("demographic_no")); bean.setId(request.getParameter("id")); bean.setMethod(request.getParameter("method")); return bean; }
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request); ProcessConsultationBean formBean = null; String path = request.getSession().getServletContext().getRealPath("/"); ConsultationConfiguration config = new ConsultationConfiguration(path + File.separator + "WEB-INF/consultation.xml"); ConsultationsConfigBean configBean = config.loadConfig(); String providerNo = (String) request.getSession().getAttribute("user"); if (request.getParameter("action") == null) { formBean = new ProcessConsultationBean(); formBean.setId("Process Consultation Request"); request.setAttribute("formHandler", formBean); return new ActionForward(getViewPath()); } // populate the bean - better way to do this??? formBean = tearForm(request); if (formBean.getDemographic_no() != null && formBean.getAction().equals("populate")) { List<ConsultationRequest> consultationRequests = consultationRequestDao.getConsults(Integer.parseInt(formBean.getDemographic_no())); request.setAttribute("consultations", consultationRequests); formBean.setAction(""); request.setAttribute("formBean", formBean); return new ActionForward(this.getViewPath()); } if (formBean.getAction().equals("generate")) { String requestId = request.getParameter("current_consultation"); ConsultationRequest consultation = consultationRequestDao.find(Integer.parseInt(requestId)); ProfessionalSpecialist spec = professionalSpecialistDao.find(consultation.getSpecialistId()); // Provider provider = providerMgr // create a tickler here Tickler tickler = new Tickler(); tickler.setCreator(providerNo); tickler.setDemographicNo(Integer.parseInt(formBean.getDemographic_no())); tickler.setServiceDate(new Date()); tickler.setTaskAssignedTo(configBean.getProcessrequest().getRecipient()); String contextName = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath().substring(0, request.getContextPath().indexOf("/", 1)); tickler.setMessage( "A consultation request has been made for <br/>" + formBean.getDemographic_name() + "<br/>to<br/>" + spec.getFirstName() + " " + spec.getLastName() + " <br/>ADDRESS:" + spec.getStreetAddress() + " <br/>PHONE:" + spec.getPhoneNumber() + " <br/>FAX:" + spec.getFaxNumber() + "<br/>Reason: " + consultation.getReasonForReferral() + "<br/><br/>" + "Please obtain an appointment, and enter the information into the consultation form, and update" + " the status to 'Nothing'." + "<br/>" + "<br/><a target=\"consultation\" href=\"" + contextName + "/oscarEncounter/ViewRequest.do?requestId=" + consultation.getId() + "\">Link to consultation</a>" + "<br/><a target=\"demographic\" href=\"" + contextName + "/demographic/demographiccontrol.jsp?displaymode=edit&demographic_no=" + formBean.getDemographic_no() + "&dboperation=search_detail\">Link to patient</a>"); ticklerMgr.addTickler(loggedInInfo, tickler); } return null; }