Exemplo n.º 1
0
  public ActionForward updateAppointmentReason(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HashMap<String, Object> hashMap = new HashMap<String, Object>();

    OscarAppointmentDao appointmentDao =
        (OscarAppointmentDao) SpringUtils.getBean("oscarAppointmentDao");

    Appointment appointment =
        appointmentDao.find(Integer.parseInt(request.getParameter("appointmentNo")));

    if (appointment != null) {
      appointment.setReason(request.getParameter("reason"));
      appointmentDao.merge(appointment);

      hashMap.put("success", true);
      hashMap.put("appointmentNo", appointment.getId());
    }

    JsonConfig config = new JsonConfig();
    config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor());

    JSONObject json = JSONObject.fromObject(hashMap, config);
    response.getOutputStream().write(json.toString().getBytes());

    return null;
  }
Exemplo n.º 2
0
  public ActionForward getBillingArgs(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HashMap<String, Object> hashMap = new HashMap<String, Object>();

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);

    DemographicDao demographicDao = (DemographicDao) SpringUtils.getBean("demographicDao");
    OscarAppointmentDao appointmentDao =
        (OscarAppointmentDao) SpringUtils.getBean("oscarAppointmentDao");

    Appointment appointment = null;
    try {
      appointment = appointmentDao.find(Integer.parseInt(request.getParameter("appointment_no")));
    } catch (Exception e) {
      // appointment_no is not a number, I guess
      appointment = null;
    }

    Demographic demographic = demographicDao.getDemographic(request.getParameter("demographic_no"));

    hashMap.put("ohip_version", "V03G");

    if (demographic != null) {
      Integer sex = null;
      if (demographic.getSex().equalsIgnoreCase("M")) sex = 1;
      else if (demographic.getSex().equalsIgnoreCase("F")) sex = 2;

      String dateOfBirth =
          StringUtils.join(
              new String[] {
                demographic.getYearOfBirth(),
                demographic.getMonthOfBirth(),
                demographic.getDateOfBirth()
              },
              "");

      hashMap.put("hin", demographic.getHin());
      hashMap.put("ver", demographic.getVer());
      hashMap.put("hc_type", demographic.getHcType());
      hashMap.put("sex", sex);
      hashMap.put("demographic_dob", dateOfBirth);
      hashMap.put("demographic_name", demographic.getLastName() + "," + demographic.getFirstName());
    }

    if (appointment != null) {
      hashMap.put("apptProvider_no", appointment.getProviderNo());
      hashMap.put("start_time", appointment.getStartTime().toString());
      hashMap.put("appointment_date", appointment.getAppointmentDate().getTime());
    }

    hashMap.put("current_provider_no", loggedInInfo.getLoggedInProviderNo());
    hashMap.put("demo_mrp_provider_no", demographic.getProviderNo());

    JsonConfig config = new JsonConfig();
    config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor());

    JSONObject json = JSONObject.fromObject(hashMap, config);
    response.getOutputStream().write(json.toString().getBytes());

    return null;
  }