コード例 #1
0
  /**
   * Inserts a new record. This method always returns a non null result. The ID field holds the
   * Unique ID for the inserted record (when greater than zero) or the error number (when less than
   * zero). If the ID is zero, the record was inserted but the server did not returned the Unique
   * ID.
   */
  public ims.dto.Result insert() {
    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Insert");

    if (DataCollection.count() == 0)
      return new ims.dto.Result("No data to insert", "DTO.Client.Go_mdt_hcps.Insert");

    if (DataCollection.count() > 1)
      return new ims.dto.Result(
          "Multiple object insert not allowed", "DTO.Client.Go_mdt_hcps.Insert");

    ims.dto.Result result = Connection.insert(serviceName, encodeNASMessage());
    if (result != null) return result;

    int recordID = 0;

    try {
      recordID = new Integer(Connection.getValueAt(2)).intValue();
    } catch (NumberFormatException ex) {
      return new ims.dto.Result("Invalid record ID returned", "DTO.Client.Go_mdt_hcps.Insert");
    }

    return new ims.dto.Result(
        recordID,
        "No error. The ID of the new record is in the ID field",
        "DTO.Client.Go_mdt_hcps.Insert");
  }
コード例 #2
0
  /** Executes a specific action. This method always returns a non null result. */
  public ims.dto.Result executeAction(String action) {
    if (action.length() == 0)
      return new ims.dto.Result("Invalid action name", "DTO.Client.Go_mdt_hcps.ExecuteAction");

    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.ExecuteAction");

    if (DataCollection.count() == 0)
      return new ims.dto.Result("Data container is empty", "DTO.Client.Go_mdt_hcps.ExecuteAction");

    if (DataCollection.count() > 1)
      return new ims.dto.Result(
          "Multiple objects are not allowed", "DTO.Client.Go_mdt_hcps.ExecuteAction");

    ims.dto.Result result = Connection.executeAction(serviceName, encodeNASMessage(), action);
    if (result != null) return result;

    try {
      return new ims.dto.Result(
          new Integer(Connection.getValueAt(2)).intValue(),
          "No error",
          "DTO.Client.Go_mdt_hcps.ExecuteAction");
    } catch (NumberFormatException ex) {
      return new ims.dto.Result("Invalid server response", "DTO.Client.Go_mdt_hcps.ExecuteAction");
    }
  }
コード例 #3
0
ファイル: Logic.java プロジェクト: HobbesFNM/openMAXIMS
  private void LoadLookups() {
    // Appointment Status
    Lkup lookupDto = form.getLocalContext().getApptStatus();
    if (lookupDto == null) {
      try {
        lookupDto = domain.getLookupInstance("3449");
      } catch (DomainInterfaceException e) {
        engine.showMessage(e.getMessage());
        return;
      }

      form.getLocalContext().setApptStatus(lookupDto);
    }

    // load activity groups
    Sd_activity_grp activityGroups =
        form.getGlobalContext().CcoSched.ActivityView.getActivityGroups();
    if (activityGroups == null) {
      try {
        activityGroups = domain.listSd_activity_grp("Y");
      } catch (DomainInterfaceException e) {
        engine.showMessage(e.getMessage());
        return;
      }

      form.getGlobalContext().CcoSched.ActivityView.setActivityGroups(activityGroups);
    }

    boolean loadActivity = false;
    if (form.ActivityGroup().size() == 0) {
      form.ActivityGroup().clear();
      for (int i = 0; activityGroups != null && i < activityGroups.DataCollection.count(); ++i)
        form.ActivityGroup()
            .newRow(
                activityGroups.DataCollection.get(i).Grp_id,
                activityGroups.DataCollection.get(i).Grp_nm);

      loadActivity = true;
    }

    // load activities
    Sd_activity activities = form.getGlobalContext().CcoSched.ActivityView.getActivities();
    if (activities == null) {
      try {
        activities = domain.listSd_activity("Y", "Y");
      } catch (DomainInterfaceException e) {
        engine.showMessage(e.getMessage());
        return;
      }

      Result result = activities.list();
      if (result != null) {
        engine.showMessage(result.getMessage());
        return;
      }
      form.getGlobalContext().CcoSched.ActivityView.setActivities(activities);
    }

    if (form.ActivityGroup().getValue() != null && loadActivity) onActivityGroupValueChanged();
  }
コード例 #4
0
ファイル: Logic.java プロジェクト: HobbesFNM/openMAXIMS
  private void getAppointments(Date date) throws PresentationLogicException {
    form.AppointmentsGrid().getRows().clear();
    EnableArrivalControls(false);
    // Clear the arrival controls
    ClearArrivalControls();

    if (date == null) return;

    String pkey = getPkey();

    Sd_appt_dts appDetails;
    try {
      appDetails = domain.listAppointmentDetails(pkey, date.toString(DateFormat.ISO));
    } catch (DomainInterfaceException e) {
      engine.showMessage(e.getMessage());
      return;
    }

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

    for (int i = 0; i < appDetails.DataCollection.count(); ++i) {
      GenForm.AppointmentsGridRow row = form.AppointmentsGrid().getRows().newRow();

      if (appDetails.DataCollection.get(i).First_appt_id
          == appDetails.DataCollection.get(i).Appt_id)
        row.setBooking(form.getImages().CcoSched.First);
      else if (appDetails.DataCollection.get(i).Last_appt_id
          == appDetails.DataCollection.get(i).Appt_id)
        row.setBooking(form.getImages().CcoSched.Last);
      Time dt = getTimeFromString(appDetails.DataCollection.get(i).Stm);
      row.setAppointmentTime(dt == null ? "" : dt.toString());
      row.setClinicName(appDetails.DataCollection.get(i).Prfile_sess_idtxt);
      row.setConsultant(appDetails.DataCollection.get(i).Act_consulttxt);
      row.setStatus(appDetails.DataCollection.get(i).Appt_stattxt);

      row.setValue(appDetails.DataCollection.get(i));
    }

    int nCount = form.AppointmentsGrid().getRows().size();
    if (nCount == 0) engine.showMessage("No records.");

    // 05/06/2003 - Kevin's improvement - select the first record (or the previous selected one)
    if (nCount > 0) {
      form.AppointmentsGrid()
          .setValue(form.AppointmentsGrid().getRows().get(GetPrevSelIndex()).getValue());

      if (form.AppointmentsGrid().getSelectedRowIndex() >= 0) onAppointmentsGridSelectionChanged();

      // If only one record - disable
      if (nCount == 1) form.AllAppointments().setEnabled(false);
    }
  }
コード例 #5
0
  /** Updates a record. If the result returned is not null an error occured. */
  public ims.dto.Result update() {
    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Update");

    if (DataCollection.count() == 0)
      return new ims.dto.Result("No data to update", "DTO.Client.Go_mdt_hcps.Update");

    if (DataCollection.count() > 1)
      return new ims.dto.Result(
          "Multiple object update not allowed", "DTO.Client.Go_mdt_hcps.Update");

    return Connection.update(serviceName, encodeNASMessage());
  }
コード例 #6
0
  /**
   * Returns the number of records using the specified filter. This method always returns a non null
   * result. The ID field holds the count result (when greater or equal to zero) or the error number
   * (when less than zero).
   */
  public ims.dto.Result count() {
    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Count");

    int result = Connection.count(serviceName, encodeNASFilter());
    if (result >= 0)
      return new ims.dto.Result(
          result,
          "No error detected. The count result is held in the ID field",
          "DTO.Client.Go_mdt_hcps.Count");

    return Connection.getLastError();
  }
コード例 #7
0
  /**
   * Returns one record using the specified filter. If the result returned is not null an error
   * occured.
   */
  public ims.dto.Result getLast() {
    DataCollection.clear();

    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Get");

    ims.dto.Result result = Connection.getLast(serviceName, encodeNASFilter());
    if (result != null) return result;

    lastGetFilter = Filter.cloneObject();
    decodeNASMessageWithRepeatingGroups();

    return null;
  }
コード例 #8
0
  // wdev-13343
  public ims.dto.client.Patient getPatient(String pid, String identifier)
      throws DomainInterfaceException {
    ims.dto.client.Patient patient =
        (ims.dto.client.Patient) getDTOInstance(ims.dto.client.Patient.class);
    patient.Filter.clear();
    if (pid != null && pid.equals("-549")) patient.Filter.Nhsn = identifier;
    else patient.Filter.Hospnum = identifier;

    Result result = patient.get();

    if (result != null) {
      throw new DomainInterfaceException(result.getMessage());
    }

    return patient;
  }
コード例 #9
0
  /**
   * Performs data validation prior to update. If the result returned is not null an error occured.
   */
  public ims.dto.Result getForUpdate() {
    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.GetForUpdate");

    if (lastGetFilter == null)
      return new ims.dto.Result(
          "Last get method failed or not called", "DTO.Client.Go_mdt_hcps.GetForUpdate");

    ims.dto.Result result = Connection.getForUpdate(serviceName, encodeNASFilter(lastGetFilter));
    if (result != null) return result;

    if (Connection.countResponseItems(Connection.getValueAt(6)) == 0) return null;

    DataCollection.clear();
    decodeNASMessageWithRepeatingGroups();

    return new ims.dto.Result(
        "The data was changed by another user", "DTO.Client.Go_mdt_hcps.GetForUpdate");
  }
コード例 #10
0
  // wdev-13343
  public ims.dto.client.Patient getCCODTOPatient(String pkey) throws DomainInterfaceException {
    if (pkey == null) throw new DomainRuntimeException("Cannot get Patient for null pkey");

    ims.dto.client.Patient patient =
        (ims.dto.client.Patient) getDTOInstance(ims.dto.client.Patient.class);
    patient.Filter.clear();
    patient.Filter.Pkey = pkey;

    Result result = patient.get();
    if (result != null) {
      if (result.getId() == -2)
        throw new DomainInterfaceException("Error Getting Patient Details for pkey = " + pkey);

      throw new DomainInterfaceException(result.getMessage());
    }

    if (patient.DataCollection.count() != 1)
      throw new DomainInterfaceException("Failed to get patient record.");

    return patient;
  }
コード例 #11
0
  /** Transfers a record. If the result returned is not null an error occured. */
  public ims.dto.Result transferData(String action) {
    if (action.length() == 0)
      return new ims.dto.Result("Invalid action name", "DTO.Client.Go_mdt_hcps.TransferData");

    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.TransferData");

    if (DataCollection.count() == 0)
      return new ims.dto.Result("No data to transfer", "DTO.Client.Go_mdt_hcps.TransferData");

    if (DataCollection.count() > 1)
      return new ims.dto.Result(
          "Multiple objects not allowed", "DTO.Client.Go_mdt_hcps.TransferData");

    ims.dto.Result result =
        Connection.transferData(serviceName, encodeNASMessage(), action.toUpperCase());
    if (result != null) return result;

    DataCollection.clear();
    decodeNASMessageWithRepeatingGroups();

    return null;
  }
コード例 #12
0
  private ims.dto.Result list(boolean loadAllRecords, int maxRecords) {
    DataCollection.clear();

    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.List");

    listInProgress = true;
    ims.dto.Result result = Connection.list(serviceName, encodeNASFilter());
    if (result != null) {
      listInProgress = false;
      if (result.getId() == -2) // NAS list empty
      return null;
      return result;
    }

    if (decodeNASMessage() == 0) {
      listInProgress = false;
      return null;
    }

    ims.dto.Result execResult = null;
    while (execResult == null && canContinueToList(loadAllRecords, maxRecords))
      execResult = nextList();

    if (execResult != null) {
      if (execResult.getId() != -3) {
        listInProgress = false;
        return execResult;
      }
    } else // NAS next list empty
    {
      listInProgress = false;
      return null;
    }

    if (!loadAllRecords || !listInProgress) {
      listInProgress = false;
      return Connection.stopList(serviceName);
    }

    listInProgress = false;
    return null;
  }
コード例 #13
0
ファイル: Logic.java プロジェクト: HobbesFNM/openMAXIMS
  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());
      }
    }
  }
コード例 #14
0
ファイル: Logic.java プロジェクト: HobbesFNM/openMAXIMS
  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);
      }
    }
  }