Example #1
0
  private void DisplayArrivalDetails() {
    form.Comment().setValue(form.getGlobalContext().CcoSched.ClinicView.getBookingComment());

    // 10/06/2003 - Do a Get in Sd_appt_dtsDTO (instead of sd_appt)
    Sd_appt_dts appts = null;
    try {
      appts =
          domain.getArrivalDetails(
              form.getGlobalContext().CcoSched.ClinicView.getAppointmentHeaderID(),
              form.getGlobalContext().CcoSched.ClinicView.getAppointmentID());
    } catch (DomainInterfaceException e) {
      engine.showMessage(e.getMessage());
      return;
    }

    form.getLocalContext().setappt_dts(appts);

    EnableArrivalControls(true);
    // If Unarrival was pressed don't default the Time to now.
    boolean defaultTime =
        (form.getLocalContext().getUnArrival() != null
                && form.getLocalContext().getUnArrival() == Boolean.TRUE)
            ? false
            : true;

    if (appts.DataCollection.count() > 0) {
      Time arrivalTime = getTimeFromString(appts.DataCollection.get(0).Arr_tme);

      if (arrivalTime != null) form.Time().setEnabled(false);

      DateTime dateTime = domain.getDateTime();
      Time now =
          new Time(
              dateTime.getTime().getHour(),
              dateTime.getTime().getMinute(),
              dateTime.getTime().getSecond());
      if (defaultTime) form.Time().setValue(arrivalTime == null ? now : arrivalTime);
      else form.Time().setValue(null);

      this.setActionLookupValue(getIntFromString(appts.DataCollection.get(0).Att_stat));
    }

    form.getLocalContext().setUnArrival(Boolean.FALSE);
  }
Example #2
0
  protected void onUnArrivalClick() throws PresentationLogicException {
    // Apply to all appointments
    if (form.AllAppointments().getValue()) {
      for (int i = 0; i < form.AppointmentsGrid().getRows().size(); i++) {
        // Apply to arrived only
        if (form.AppointmentsGrid().getRows().get(i).getValue().Appt_stat.equals("-2196")) {
          // 10/06/2003 - Update the Sd_appt_dtsDTO
          Sd_appt_dts appts;
          try {
            appts =
                domain.getArrivalDetails(
                    form.AppointmentsGrid().getRows().get(i).getValue().Appt_head_id,
                    form.AppointmentsGrid().getRows().get(i).getValue().Appt_id);
          } catch (DomainInterfaceException e) {
            engine.showMessage(e.getMessage());
            return;
          }

          try {
            appts = domain.getForUpdateArrivalDetails(appts);
          } catch (StaleObjectException e) {
            engine.showMessage(e.getMessage());
            return;
          }

          appts.DataCollection.get(0).Arr_tme = "";
          appts.DataCollection.get(0).Att_stat = "";
          appts.DataCollection.get(0).Appt_stat = "-2189";
          // appts.Sd_appt_apdtsCollection[0].attHcp_booking1 = Context.UserID;
          // 20/01/2005 - Clear Inpatient value if Appt_stat = "-2189";
          appts.DataCollection.get(0).Appinpatstat = null;

          try {
            domain.updateArrivalDetails(appts);
          } catch (DomainInterfaceException e) {
            engine.showMessage(e.getMessage());
            return;
          }

          form.getLocalContext().setUnArrival(Boolean.TRUE);
        }
      }

      getAppointments(form.DateSelected().getValue());
      form.getLocalContext().setUnArrival(Boolean.FALSE);
    } else {
      // 10/06/2003 - Update the Sd_appt_dtsDTO
      if (form.getLocalContext().getappt_dts() != null) {
        Sd_appt_dts appts = form.getLocalContext().getappt_dts();

        Result result = appts.getForUpdate();
        if (result != null) {
          engine.showMessage(result.getMessage());
          return;
        }

        appts.DataCollection.get(0).Arr_tme = "";
        appts.DataCollection.get(0).Att_stat = "";
        appts.DataCollection.get(0).Appt_stat = "-2189";
        // appts.Sd_appt_apdtsCollection[0].attHcp_booking1 = Context.UserID;
        // 20/01/2005 - Clear Inapatient value if Appt_stat = "-2189";
        appts.DataCollection.get(0).Appinpatstat = null;

        result = appts.update();
        if (result != null) {
          engine.showMessage(result.getMessage());
          return;
        }

        form.getLocalContext().setUnArrival(Boolean.TRUE);
        // Refresh
        EnableButtons(false);
        getAppointments(form.DateSelected().getValue());
      }
    }
  }
Example #3
0
  protected void onArrivalClick() throws PresentationLogicException {
    if (form.Time().getValue() == null) {
      engine.showMessage("Please select a time.");
      return;
    }

    if (form.Action().getValue() == null) {
      engine.showMessage("Please select a Location.");
      return;
    }

    // Update all the records - apply to all appointments
    // except Cancelled reallocate, Cancel not Reallocate & Arrived
    if (form.AllAppointments().getValue()) {
      for (int i = 0; i < form.AppointmentsGrid().getRows().size(); i++) {
        // 12/06/2003 - Allow only
        if (form.AppointmentsGrid().getRows().get(i).getValue().Appt_stat.equals("-2189")
            || // Open
            form.AppointmentsGrid().getRows().get(i).getValue().Appt_stat.equals("-2194")
            || // Rebooked
            form.AppointmentsGrid().getRows().get(i).getValue().Appt_stat.equals("-2195")
            || // Moved
            form.AppointmentsGrid()
                .getRows()
                .get(i)
                .getValue()
                .Appt_stat
                .equals("-2197")) // Cancel Died
        {

          Sd_appt_dts appts = null;
          try {
            appts =
                domain.getArrivalDetails(
                    form.AppointmentsGrid().getRows().get(i).getValue().Appt_head_id,
                    form.AppointmentsGrid().getRows().get(i).getValue().Appt_id);
          } catch (DomainInterfaceException e) {
            engine.showMessage(e.getMessage());
            return;
          }

          try {
            appts = domain.getForUpdateArrivalDetails(appts);
          } catch (StaleObjectException e) {
            engine.showMessage(e.getMessage());
            return;
          }

          appts.DataCollection.get(0).Arr_tme = form.Time().getValue().toString(TimeFormat.FLAT6);
          appts.DataCollection.get(0).Att_stat =
              form.Action().getValue() != null
                  ? Integer.toString(form.Action().getValue().getID())
                  : "";
          // appts.Sd_appt_dtsCollection[0].attHcp_booking1 = Context.UserID;
          appts.DataCollection.get(0).Appt_stat = "-2196"; // Arrived
          // 19/01/2005 - Inpatient logic
          appts.DataCollection.get(0).Appinpatstat =
              isInpatient(appts.DataCollection.get(0).Ploc) ? "Y" : "N";
          // ----------------------------
          try {
            appts = domain.updateArrivalDetails(appts);
          } catch (DomainInterfaceException e) {
            engine.showMessage(e.getMessage());
            return;
          }
        }
      }

      getAppointments(form.DateSelected().getValue());
      form.getLocalContext().setUnArrival(Boolean.FALSE);
    } else {
      // 10/06/2003 - Update the Sd_appt_dtsDTO
      if (form.getLocalContext().getappt_dts() != null) {
        Sd_appt_dts appts = form.getLocalContext().getappt_dts();

        Result result = appts.getForUpdate();
        if (result != null) {
          engine.showMessage(result.getMessage());
          return;
        }

        appts.DataCollection.get(0).Arr_tme = form.Time().getValue().toString(TimeFormat.FLAT6);
        appts.DataCollection.get(0).Att_stat =
            form.Action().getValue() != null
                ? Integer.toString(form.Action().getValue().getID())
                : "";
        // appts.Sd_appt_dtsCollection[0].attHcp_booking1 = Context.UserID;
        appts.DataCollection.get(0).Appt_stat = "-2196"; // Arrived
        // 19/01/2005 - Inpatient logic
        appts.DataCollection.get(0).Appinpatstat =
            isInpatient(appts.DataCollection.get(0).Ploc) ? "Y" : "N";
        // ----------------------------
        result = appts.update();
        if (result != null) {
          engine.showMessage(result.getMessage());
          return;
        }

        getAppointments(form.DateSelected().getValue());
        form.getLocalContext().setUnArrival(Boolean.FALSE);
      }
    }
  }