@Override
  protected void onQmbConsultantTextSubmited(String value) throws PresentationLogicException {
    form.qmbConsultant().clear();

    if (value != null) {
      MedicLiteVo med = null;
      MedicLiteVoCollection voMedicColl = domain.listActiveMedics(value);
      if (voMedicColl != null) {
        for (int i = 0; i < voMedicColl.size(); i++) {
          med = voMedicColl.get(i);
          form.qmbConsultant().newRow(med, med.toString());
        }
      }
      if (voMedicColl != null && voMedicColl.size() == 1)
        form.qmbConsultant().setValue(voMedicColl.get(0));
      else if (voMedicColl != null && voMedicColl.size() > 1) form.qmbConsultant().showOpened();

      Integer id = engine.getLoggedInUser().getHcpId();
      if (med != null && id != null && id.equals(med.getID_Hcp()))
        form.qmbConsultant().setValue(med);
    }
  }
Beispiel #2
0
  protected void onFormOpen(Object[] args)
      throws ims.framework.exceptions.PresentationLogicException {
    LocationLiteVo locVo = null;
    LocSiteLiteVo locSiteVo = null;
    initialize();
    if (domain.getCurrentLocation() instanceof LocationLiteVo) {
      locVo = (LocationLiteVo) domain.getCurrentLocation();
    } else if (domain.getCurrentLocation() instanceof LocSiteLiteVo) {
      locSiteVo = (LocSiteLiteVo) domain.getCurrentLocation();
    }

    // WDEV-15691
    if (form.getGlobalContext().Clinical.getSelectedHcpIsNotNull()
        && (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
            || form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.MEDICAL))) {
      MedicLiteVoCollection medicColl = null;

      if (locVo != null) {
        if (locVo.getTypeIsNotNull() && locVo.getType().equals(LocationType.HOSP)) {
          if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
              && MedicGrade.CONS.equals(form.getGlobalContext().Clinical.getSelectedHcpGrade()))
            medicColl =
                domain.getMedics(
                    locVo,
                    HcpDisType.MEDICAL,
                    form.getGlobalContext().Clinical.getSelectedHcp(),
                    MedicGrade.CONS);
          else if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
              && form.getGlobalContext().Clinical.getSelectedHcpGrade() == null)
            medicColl =
                domain.getMedics(
                    locVo,
                    HcpDisType.MEDICAL,
                    form.getGlobalContext().Clinical.getSelectedHcp(),
                    null);
          else if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.MEDICAL))
            medicColl = domain.getMedics(locVo, HcpDisType.MEDICAL, null, null);
        } else if (locVo.getTypeIsNotNull() && !locVo.getType().equals(LocationType.HOSP)) {
          locVo = domain.getLocationLite(locVo);
          if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
              && MedicGrade.CONS.equals(form.getGlobalContext().Clinical.getSelectedHcpGrade()))
            medicColl =
                domain.getMedics(
                    locVo,
                    HcpDisType.MEDICAL,
                    form.getGlobalContext().Clinical.getSelectedHcp(),
                    MedicGrade.CONS);
          else if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
              && form.getGlobalContext().Clinical.getSelectedHcpGrade() == null)
            medicColl =
                domain.getMedics(
                    locVo,
                    HcpDisType.MEDICAL,
                    form.getGlobalContext().Clinical.getSelectedHcp(),
                    null);
          else if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.MEDICAL))
            medicColl = domain.getMedics(locVo, HcpDisType.MEDICAL, null, null);
        }
      } else if (locSiteVo != null) {
        locVo = domain.getLocationLite(locSiteVo);
        if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
            && MedicGrade.CONS.equals(form.getGlobalContext().Clinical.getSelectedHcpGrade()))
          medicColl =
              domain.getMedics(
                  locVo,
                  HcpDisType.MEDICAL,
                  form.getGlobalContext().Clinical.getSelectedHcp(),
                  MedicGrade.CONS);
        else if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.ANAESTHETIST)
            && form.getGlobalContext().Clinical.getSelectedHcpGrade() == null)
          medicColl =
              domain.getMedics(
                  locVo,
                  HcpDisType.MEDICAL,
                  form.getGlobalContext().Clinical.getSelectedHcp(),
                  null);
        else if (form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.MEDICAL))
          medicColl = domain.getMedics(locVo, HcpDisType.MEDICAL, null, null);
      }

      if (medicColl != null) {
        if (form.getGlobalContext().Clinical.getMedicsSurgicalAuditIsNotNull()) {
          MedicLiteVoCollection tempColl =
              form.getGlobalContext().Clinical.getMedicsSurgicalAudit();
          for (int i = 0; tempColl != null && i < tempColl.size(); i++) {
            if (medicColl != null && medicColl.contains(tempColl.get(i)))
              medicColl.remove(tempColl.get(i));
          }
        }
        medicColl.sort(new MedicComparator(SortOrder.ASCENDING));
        for (int i = 0; i < medicColl.size(); i++) {
          grdListedTestsRow row = form.grdListedTests().getRows().newRow();
          row.setcolSelected(false);

          MedicLiteVo tempVo = medicColl.get(i);
          row.setcolName(
              tempVo != null && tempVo.getMosIsNotNull() && tempVo.getMos().getNameIsNotNull()
                  ? tempVo.getMos().getName().toString()
                  : "");
          row.setValue(tempVo);
        }
      }
    } else if (form.getGlobalContext().Clinical.getSelectedHcpIsNotNull()
        && form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.NURSING)) {
      NurseVoCollection nurseColl = null;
      if (locVo != null) {
        if (locVo.getTypeIsNotNull() && locVo.getType().equals(LocationType.HOSP)) {
          nurseColl = domain.getNurses(locVo, form.getGlobalContext().Clinical.getSelectedHcp());
        } else if (locVo.getTypeIsNotNull() && !locVo.getType().equals(LocationType.HOSP)) {
          locVo = domain.getLocationLite(locVo);
          nurseColl = domain.getNurses(locVo, form.getGlobalContext().Clinical.getSelectedHcp());
        }
      } else if (locSiteVo != null) {
        locVo = domain.getLocationLite(locSiteVo);
        nurseColl = domain.getNurses(locVo, form.getGlobalContext().Clinical.getSelectedHcp());
      }

      if (nurseColl != null) {
        if (form.getGlobalContext().Clinical.getNursessSurgicalAuditIsNotNull()) {
          NurseVoCollection tempnColl = form.getGlobalContext().Clinical.getNursessSurgicalAudit();

          for (int j = 0; tempnColl != null && j < tempnColl.size(); j++) {
            if (nurseColl.contains(tempnColl.get(j))) nurseColl.remove(tempnColl.get(j));
          }
        }
        nurseColl.sort(new NurseComparator(SortOrder.ASCENDING));
        for (int i = 0; i < nurseColl.size(); i++) {
          grdListedTestsRow row = form.grdListedTests().getRows().newRow();
          row.setcolSelected(false);

          NurseVo tempVo = nurseColl.get(i);
          row.setcolName(
              tempVo != null && tempVo.getMosIsNotNull() && tempVo.getMos().getNameIsNotNull()
                  ? tempVo.getMos().getName().toString()
                  : "");
          row.setValue(tempVo);
        }
      }
    }
    // WDEV-15691
    else if (form.getGlobalContext().Clinical.getSelectedHcpIsNotNull()
        && form.getGlobalContext().Clinical.getSelectedHcp().equals(HcpDisType.RADIOGRAPHER)) {
      HcpLiteVoCollection radiographerColl = null; // WDEV-15691
      if (locVo != null) {
        if (locVo.getTypeIsNotNull() && locVo.getType().equals(LocationType.HOSP)) {
          radiographerColl =
              domain.getOtheDisciplineHcp(locVo, form.getGlobalContext().Clinical.getSelectedHcp());
        } else if (locVo.getTypeIsNotNull() && !locVo.getType().equals(LocationType.HOSP)) {
          locVo = domain.getLocationLite(locVo);
          radiographerColl =
              domain.getOtheDisciplineHcp(locVo, form.getGlobalContext().Clinical.getSelectedHcp());
        }
      } else if (locSiteVo != null) {
        locVo = domain.getLocationLite(locSiteVo);
        radiographerColl =
            domain.getOtheDisciplineHcp(locVo, form.getGlobalContext().Clinical.getSelectedHcp());
      }

      if (radiographerColl != null) {
        if (form.getGlobalContext().Clinical.getRadiographerSurgAuditProcDetailsIsNotNull()) {
          HcpLiteVoCollection tempnColl =
              form.getGlobalContext().Clinical.getRadiographerSurgAuditProcDetails();

          for (int j = 0; tempnColl != null && j < tempnColl.size(); j++) {
            if (radiographerColl.contains(tempnColl.get(j)))
              radiographerColl.remove(tempnColl.get(j));
          }
        }

        for (int i = 0; i < radiographerColl.size(); i++) {
          grdListedTestsRow row = form.grdListedTests().getRows().newRow();
          row.setcolSelected(false);

          HcpLiteVo tempVo = radiographerColl.get(i);
          row.setcolName(
              tempVo != null && tempVo.getMosIsNotNull() && tempVo.getMos().getNameIsNotNull()
                  ? tempVo.getMos().getName().toString()
                  : "");
          row.setValue(tempVo);
        }
      }
    }
  }