Ejemplo n.º 1
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);
  }