public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String forward = ""; ActionUtils.setUpNavLink(mapping.getParameter(), request); NewsUtils.putAppropriateNewsForViewingInRequest(request); User user = LegacySpringUtils.getUserManager().getLoggedInUser(); if (user != null) { final String role = LegacySpringUtils.getUserManager().getCurrentSpecialtyRole(user); // Is user patient or admin? if ("patient".equalsIgnoreCase(role)) { request.setAttribute("isPatient", true); } if ((user.getLastlogon() != null)) { request.setAttribute("lastLogin", format.format(user.getLastlogon())); } user.setLastlogon(new Date()); LegacySpringUtils.getUserManager().save(user); if ("patient".equalsIgnoreCase(role)) { String nhsno = LegacySpringUtils.getUserManager().getUsersRealNhsNoBestGuess(user.getUsername()); if (nhsno != null && !nhsno.equals("")) { LogEntry log = LegacySpringUtils.getLogEntryManager() .getLatestLogEntry(nhsno, AddLog.PATIENT_DATA_FOLLOWUP); if (log != null) { request.setAttribute("lastDataDate", format.format(log.getDate().getTime())); // Get the unit from the unitcode String unitcode = log.getUnitcode(); if (unitcode != null) { Unit unit = LegacySpringUtils.getUnitManager().get(unitcode); if (null == unit) { request.setAttribute("lastDataFrom", "Unit with code: " + unitcode); } else { request.setAttribute("lastDataFrom", unit.getName()); } } } } forward = "patient"; } else { forward = "admin"; } } return LogonUtils.logonChecks(mapping, request, forward); }
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String unitcode = BeanUtils.getProperty(form, "unitcode"); unitcode = (unitcode == null) ? "" : unitcode; String nhsno = BeanUtils.getProperty(form, "nhsno"); nhsno = (nhsno == null) ? "" : nhsno; String name = BeanUtils.getProperty(form, "name"); name = (name == null) ? "" : name; boolean showgps = "true".equals(BeanUtils.getProperty(form, "showgps")); DatabaseDAO dao = getDao(request); if (!"".equals(unitcode)) { HibernateUtil.retrievePersistentObjectAndAddToRequestWithIdParameter( request, Unit.class, unitcode, "unit"); } UnitPatientsWithTreatmentDao patientDao = new UnitPatientsWithTreatmentDao(unitcode, nhsno, name, showgps); List patients = dao.retrieveList(patientDao); request.setAttribute("patients", patients); return LogonUtils.logonChecks(mapping, request); }