Exemplo n.º 1
0
  protected void onRebookingNotReqClick() {
    // Do a get in sd_appt
    Sd_appt_dts.Sd_appt_dtsRecord appt_dtsRecord = form.MainGrid().getValue();
    if (appt_dtsRecord != null && appt_dtsRecord.Appt_head_id.length() > 0) {
      Sd_appt apptDto = null;
      try {
        apptDto = domain.getAndGetForUpdateSd_appt(appt_dtsRecord.Appt_head_id);
      } catch (DomainInterfaceException e) {
        engine.showMessage(e.getMessage());
        return;
      }

      boolean bFound = false;
      // Loop throught the details to find the repeating that has the same Appt_id as the one
      // selected from the grid
      if (apptDto != null && apptDto.DataCollection.count() > 0)
        for (int x = 0; x < apptDto.DataCollection.get(0).Appt_idCollection.count(); x++)
          if (apptDto
              .DataCollection
              .get(0)
              .Appt_idCollection
              .get(x)
              .Appt_id
              .equals(appt_dtsRecord.Appt_id)) {
            // Update the appointment status to Cancelled Reallocation not  required
            apptDto.DataCollection.get(0).Appt_idCollection.get(x).Appt_stat = "-2193";
            // 11/02/2005 - if the record is incomplete then update the completed flag to "F"
            if (isIncomplete(appt_dtsRecord))
              apptDto.DataCollection.get(0).Appt_idCollection.get(x).Act_comp_flg = "F";
            bFound = true;
            break;
          }

      if (bFound) {
        try {
          domain.updateSd_appt(apptDto);
        } catch (DomainInterfaceException e) {
          engine.showMessage(e.getMessage());
          return;
        }

        // Repopulate the grid with the new status
        if (form.MainGrid().getValue() != null) {
          GenForm.MainGridRow row = form.MainGrid().getRowByValue(form.MainGrid().getValue());
          row.setAppointmentStatus(GetApptStatusText("-2193"));
          row.getValue().Appt_stat = "-2193";
          onMainGridSelectionChanged();
        }
      }
    }
  }
Exemplo n.º 2
0
  protected void onListPatientsClick() {
    clearPIDAndPatient();
    form.Rebook().setEnabled(false);
    form.RebookingNotReq().setEnabled(false);
    form.PatientDiary().setEnabled(false);

    form.getGlobalContext().CcoSched.TreatmentPlan.setActionID(null);
    form.getGlobalContext().CcoSched.TreatmentPlan.setTreatmentPlanDetails(null);
    form.getGlobalContext().CcoSched.ActionUpdate.setTreatmentPlanActions(null);
    form.getGlobalContext().CcoSched.CancelledAppointments.setRebookAppointmentDetail(null);

    Clean();
    if (form.ActivityGroup().getValue() == null || form.Activity().getValue() == null) {
      engine.showMessage("Please select activity group and activity.");
      return;
    }

    String grp_id = form.ActivityGroup().getValue();
    String activ_id = form.Activity().getValue();
    String prty =
        form.Priority().getValue() != null
            ? Integer.toString(form.Priority().getValue().getID())
            : null;

    // Cancelled requiring rebooking
    String appt_stat = null;
    String act_comp_flg = null;
    if (form.chkIncompleteAppts().getValue()) {
      appt_stat = "-2192"; // Attended
      act_comp_flg = INCOMPLETE;
    } else appt_stat = "-2190 || -2191"; // Open and Cancelled Reallocate

    Sd_appt_dts patients = null;
    try {
      patients = domain.listSd_appt_dts(grp_id, activ_id, prty, appt_stat, act_comp_flg);
    } catch (DomainInterfaceException e) {
      engine.showMessage(e.getMessage());
      return;
    }

    for (int i = 0; patients != null && i < patients.DataCollection.count(); ++i) {
      GenForm.MainGridRow row = form.MainGrid().getRows().newRow();

      row.setHospitalNumber(patients.DataCollection.get(i).Hospnum);
      String name = patients.DataCollection.get(i).Fnm1 + " " + patients.DataCollection.get(i).Snm;
      row.setName(name);
      row.setTooltipForName(name);
      row.setPriority(patients.DataCollection.get(i).Prtytxt);
      row.setTooltipForPriority(patients.DataCollection.get(i).Prtytxt);

      Date DtodAppDate = null;
      if (patients.DataCollection.get(i).Sess_dt.equals("") == false) {
        try {
          DtodAppDate = new Date(patients.DataCollection.get(i).Sess_dt, DateFormat.ISO);
        } catch (ParseException e) {
        }
      }
      if (DtodAppDate != null) row.setInitAppDate(DtodAppDate);

      row.setCategory(patients.DataCollection.get(i).Txcattypetxt);
      row.setTooltipForCategory(patients.DataCollection.get(i).Txcattypetxt);

      Time DtodAppTime = null;
      if (patients.DataCollection.get(i).Stm.equals("") == false) {
        try {
          DtodAppTime = new Time(patients.DataCollection.get(i).Stm, TimeFormat.FLAT6);
        } catch (RuntimeException e) {
        }
      }

      if (DtodAppTime != null) row.setApptTime(DtodAppTime.toString());
      row.setAppointmentStatus(patients.DataCollection.get(i).Appt_stattxt);
      row.setTooltipForAppointmentStatus(patients.DataCollection.get(i).Appt_stattxt);
      row.setValue(patients.DataCollection.get(i));
    }

    if (patients == null || patients.DataCollection.count() == 0) engine.showMessage("No records.");

    form.MainGrid().sort(3);
  }