コード例 #1
0
 private List getLogEntries(String nhsno, Calendar startdate, Calendar enddate)
     throws HibernateException {
   List logEntries = new ArrayList();
   if (nhsno != null && !nhsno.equals("")) {
     Session session = HibernateUtil.currentSession();
     Transaction tx = session.beginTransaction();
     Criteria criteria = session.createCriteria(LogEntry.class);
     criteria.add(Expression.between("date", startdate, enddate));
     criteria.add(Expression.like("nhsno", "%" + nhsno + "%"));
     criteria.addOrder(Order.asc("id"));
     logEntries = criteria.list();
     tx.commit();
     HibernateUtil.closeSession();
   }
   return logEntries;
 }
コード例 #2
0
 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);
 }