public String execute(HttpServletRequest req) throws CommandException {
    Calendar calendar = Calendar.getInstance();
    String userId = req.getParameter("_userId");
    userId = Util.toString(userId);
    String type = req.getParameter("_type");
    String userName = req.getParameter("_userName");
    userName = Util.toString(userName);
    String searchDate = req.getParameter("_searchDate");
    searchDate = Util.toString(searchDate);

    if (searchDate == null || searchDate.equals("")) {
      searchDate = Integer.toString(calendar.get(Calendar.YEAR)) + "년 ";
      if (Integer.toString(calendar.get(Calendar.MONTH) + 1).length() < 2) {
        searchDate += "0" + Integer.toString(calendar.get(Calendar.MONTH) + 1) + "월 ";
      } else {
        searchDate += Integer.toString(calendar.get(Calendar.MONTH) + 1) + "월 ";
      }
      if (Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)).length() < 2) {
        searchDate += "0" + Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)) + "일 ";
      } else {
        searchDate += Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)) + "일 ";
      }

    } else {

      searchDate = searchDate.replace("년", "");
      searchDate = searchDate.replace("월", "");
      searchDate = searchDate.replace("일", "");
      searchDate = searchDate.trim();
    }
    req.setAttribute("userId", userId);
    req.setAttribute("userName", userName);
    req.setAttribute("searchDate", searchDate);
    if (type.equals(Define.USER_PHARMACIST)
        || type.equals(Define.USER_DOCTOR)
        || type.equals(Define.USER_INCHARGE)
        || type.equals(Define.USER_ADMIN)) {
      return "home/prescription/searchPrescription.jsp";
    } else if (type.equals(Define.USER_MANAGER)) {
      return "home/prescription/searchPrescription.jsp";
    } else {
      return "home/patient/searchPrescription.jsp";
    }
  }
Ejemplo n.º 2
0
 public String execute(HttpServletRequest req) throws CommandException {
   try {
     String key = Util.toString(req.getParameter("_key"));
     Hashtable<String, String> postHash = UserManager.getInstance().searchPost(key);
     req.setAttribute("postHash", postHash);
     return next;
   } catch (Exception ex) {
     Log.out.error(ex, ex);
     req.setAttribute("message", ex.getMessage());
     return "home/error.jsp";
   }
 }