public static void fillFormValues(EctConsultationFormRequestForm thisForm, Integer requestId) { ConsultationRequestDao consultDao = (ConsultationRequestDao) SpringUtils.getBean("consultationRequestDao"); ConsultationRequest consult = consultDao.find(requestId); thisForm.setAllergies(consult.getAllergies()); thisForm.setReasonForConsultation(consult.getReasonForReferral()); thisForm.setClinicalInformation(consult.getClinicalInfo()); thisForm.setCurrentMedications(consult.getCurrentMeds()); Date date = consult.getReferralDate(); thisForm.setReferalDate(DateFormatUtils.ISO_DATE_FORMAT.format(date)); thisForm.setSendTo(consult.getSendTo()); thisForm.setService(consult.getServiceId().toString()); thisForm.setStatus(consult.getStatus()); setAppointmentDateTime(thisForm, consult); thisForm.setConcurrentProblems(consult.getConcurrentProblems()); thisForm.setAppointmentNotes(consult.getStatusText()); thisForm.setUrgency(consult.getUrgency()); thisForm.setPatientWillBook(String.valueOf(consult.isPatientWillBook())); date = consult.getFollowUpDate(); if (date != null) { thisForm.setFollowUpDate(DateFormatUtils.ISO_DATE_FORMAT.format(date)); } else { thisForm.setFollowUpDate(""); } DemographicDao demoDao = (DemographicDao) SpringUtils.getBean("demographicDao"); Demographic demo = demoDao.getDemographicById(consult.getDemographicId()); thisForm.setPatientAddress(demo.getAddress()); thisForm.setPatientDOB(demo.getFormattedDob()); thisForm.setPatientHealthNum(demo.getHin()); thisForm.setPatientHealthCardVersionCode(demo.getVer()); thisForm.setPatientHealthCardType(demo.getHcType()); thisForm.setPatientFirstName(demo.getFirstName()); thisForm.setPatientLastName(demo.getLastName()); thisForm.setPatientPhone(demo.getPhone()); thisForm.setPatientSex(demo.getSex()); thisForm.setPatientWPhone(demo.getPhone2()); thisForm.setPatientEmail(demo.getEmail()); thisForm.setPatientAge(demo.getAge()); ProviderDao provDao = (ProviderDao) SpringUtils.getBean("providerDao"); Provider prov = provDao.getProvider(consult.getProviderNo()); thisForm.setProviderName(prov.getFormattedName()); thisForm.seteReferral(false); }
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; }