Esempio n. 1
0
  private void populateSearchCriteriaFromData(EndoscopyVettingWorklistSearchCritVo searchCrit) {
    if (searchCrit == null) return;

    if (ElectiveAdmissionType.PLANNED_TYPE13.equals(searchCrit.getElectiveAdmissionType())) {
      form.GroupElectiveListType()
          .setValue(GroupElectiveListTypeEnumeration.rdoPlannedSurveillance);

    } else if (ElectiveAdmissionType.ELECTIVE_TYPE11.equals(
        searchCrit.getElectiveAdmissionType())) {
      form.GroupElectiveListType().setValue(GroupElectiveListTypeEnumeration.rdoWaitingBooked);
    } else form.GroupElectiveListType().setValue(GroupElectiveListTypeEnumeration.None);

    form.cmbUrgency().setValue(searchCrit.getUrgency());
    form.cmbProcedureType().setValue(searchCrit.getProcedureType());

    form.intRTTBreachDateIn().setValue(searchCrit.getRTTBreachDateIn());
    form.cmbRTTBreachDateIn().setValue(searchCrit.getRTTBReachDateUnits());
    form.chkIncludePatientsBreachedRTTDate().setValue(searchCrit.getIncludePatientsBreached());

    form.intPlannedDateIn().setValue(searchCrit.getPlannedDateInt());
    form.cmbPlannedDateIn().setValue(searchCrit.getPlaneDateUnits());
    form.chkIncludePastPlannedDates().setValue(searchCrit.getIncludePatientsBreached());

    if (YesNo.YES.equals(searchCrit.getGeneralAnaesthetic())) {
      form.chkGeneralAnaesthetic().setValue(Boolean.TRUE);
    } else {
      form.chkGeneralAnaesthetic().setValue(Boolean.FALSE);
    }
  }
Esempio n. 2
0
 @Override
 protected void onContextMenuItemClick(int menuItemID, Control sender)
     throws PresentationLogicException {
   switch (menuItemID) {
     case ims.RefMan.forms
         .endoscopyvettingworklist
         .GenForm
         .ContextMenus
         .RefManNamespace
         .EndoscopyVettingWorklist
         .VIEW_Endoscopy_Request:
       editWaitingElectiveListCardDialog();
       break;
     case ims.RefMan.forms
         .endoscopyvettingworklist
         .GenForm
         .ContextMenus
         .RefManNamespace
         .EndoscopyVettingWorklist
         .ADD_EDIT_COMMENTS: // WDEV-22488
       PatientElectiveListAddLaterVo tempVo =
           domain.getPatientElectiveList(
               (PatientElectiveListRefVo) form.dyngrdResults().getSelectedRow().getValue());
       form.getGlobalContext().RefMan.setCatsReferral(tempVo.getReferral());
       if (tempVo.getElectiveAdmissionTypeIsNotNull()
           && (ElectiveAdmissionType.ELECTIVE_TYPE11.equals(tempVo.getElectiveAdmissionType())
               || ElectiveAdmissionType.BOOKED_TYPE12.equals(tempVo.getElectiveAdmissionType()))) {
         engine.open(
             form.getForms().RefMan.ElectiveListAddLaterDialog,
             new Object[] {
               ims.admin.vo.enums.ElectiveListDetails.ADDTOWAITINGLIST,
               tempVo.getCreatingAppointment(),
               tempVo,
               ElectiveListAddLaterDlgOpenMode.READ_ONLY,
               true
             },
             "Waiting List Details");
       } else if (tempVo.getElectiveAdmissionTypeIsNotNull()
           && ElectiveAdmissionType.PLANNED_TYPE13.equals(tempVo.getElectiveAdmissionType())) {
         engine.open(
             form.getForms().RefMan.ElectiveListAddLaterDialog,
             new Object[] {
               ims.admin.vo.enums.ElectiveListDetails.ADDTOPLANNEDLIST,
               tempVo.getCreatingAppointment(),
               tempVo,
               ElectiveListAddLaterDlgOpenMode.READ_ONLY,
               true
             },
             "Planned List Details");
       }
       break;
   }
 }
Esempio n. 3
0
  private void editWaitingElectiveListCardDialog() {
    PatientElectiveListAddLaterVo tempVo =
        domain.getPatientElectiveList(
            (PatientElectiveListRefVo) form.dyngrdResults().getSelectedRow().getValue());
    if (tempVo != null) {
      HcpLiteVo tempUsrVo = (HcpLiteVo) domain.getHcpLiteUser();
      boolean isEndoscopist =
          tempUsrVo != null && Boolean.TRUE.equals(tempUsrVo.getIsHCPaEndoscopist());

      if (isEndoscopist) {
        form.getGlobalContext().RefMan.setCatsReferral(tempVo.getReferral());
        if (tempVo.getElectiveAdmissionTypeIsNotNull()
            && (ElectiveAdmissionType.ELECTIVE_TYPE11.equals(tempVo.getElectiveAdmissionType())
                || ElectiveAdmissionType.BOOKED_TYPE12.equals(tempVo.getElectiveAdmissionType()))) {
          engine.open(
              form.getForms().RefMan.ElectiveListAddLaterDialog,
              new Object[] {
                ims.admin.vo.enums.ElectiveListDetails.ADDTOWAITINGLIST,
                tempVo.getCreatingAppointment(),
                tempVo,
                ElectiveListAddLaterDlgOpenMode.EDIT
              },
              "Waiting List Details");
        } else if (tempVo.getElectiveAdmissionTypeIsNotNull()
            && ElectiveAdmissionType.PLANNED_TYPE13.equals(tempVo.getElectiveAdmissionType())) {
          engine.open(
              form.getForms().RefMan.ElectiveListAddLaterDialog,
              new Object[] {
                ims.admin.vo.enums.ElectiveListDetails.ADDTOPLANNEDLIST,
                tempVo.getCreatingAppointment(),
                tempVo,
                ElectiveListAddLaterDlgOpenMode.EDIT
              },
              "Planned List Details");
        }
      } else {
        form.getGlobalContext().RefMan.setCatsReferral(tempVo.getReferral());
        if (tempVo.getElectiveAdmissionTypeIsNotNull()
            && (ElectiveAdmissionType.ELECTIVE_TYPE11.equals(tempVo.getElectiveAdmissionType())
                || ElectiveAdmissionType.BOOKED_TYPE12.equals(tempVo.getElectiveAdmissionType()))) {
          engine.open(
              form.getForms().RefMan.ElectiveListAddLaterDialog,
              new Object[] {
                ims.admin.vo.enums.ElectiveListDetails.ADDTOWAITINGLIST,
                tempVo.getCreatingAppointment(),
                tempVo,
                ElectiveListAddLaterDlgOpenMode.READ_ONLY
              },
              "Waiting List Details");
        } else if (tempVo.getElectiveAdmissionTypeIsNotNull()
            && ElectiveAdmissionType.PLANNED_TYPE13.equals(tempVo.getElectiveAdmissionType())) {
          engine.open(
              form.getForms().RefMan.ElectiveListAddLaterDialog,
              new Object[] {
                ims.admin.vo.enums.ElectiveListDetails.ADDTOPLANNEDLIST,
                tempVo.getCreatingAppointment(),
                tempVo,
                ElectiveListAddLaterDlgOpenMode.READ_ONLY
              },
              "Planned List Details");
        }
      }
    }
  }
Esempio n. 4
0
  public PatientElectiveListForPreAssessmentWorklistVoCollection listPreAssessments(
      PreAssessmentWorklistSearchCriteriaVo searchCriteria) {
    DomainFactory factory = getDomainFactory();
    StringBuffer hqlConditions = new StringBuffer();
    StringBuffer hqlJoins = new StringBuffer();

    StringBuffer hql =
        new StringBuffer(
            " select patElective from PatientElectiveList as patElective left join patElective.electiveListStatus as elStatus  ");

    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();

    String andStr = "";

    hqlConditions.append(andStr);
    hqlConditions.append(
        " patElective.preAssessmentRequired = 1 and elStatus.electiveListStatus.id <> :Status and ( patElective.requiresVetting = 0 or patElective.requiresVetting is null ) "); // wdev-21152
    markers.add("Status");
    values.add(WaitingListStatus.REMOVED.getID());

    andStr = " and ";

    if (searchCriteria.getServiceIsNotNull()
        || (searchCriteria.getServices() != null && searchCriteria.getServices().size() > 0)) {
      hqlConditions.append(andStr);
      hqlJoins.append(" left join patElective.electiveList as electiveListConfig  ");
      hqlConditions.append(
          " (electiveListConfig.service.id in (" + getServicesIDs(searchCriteria) + "))");
      andStr = " and ";
    }

    if (searchCriteria.getProcedureIsNotNull()) {
      hqlConditions.append(andStr);
      hqlConditions.append(
          " (patElective.primaryProcedure.id = :procedureID OR patElective.secondaryProcedure.id  = :procedureID) ");
      markers.add("procedureID");
      values.add(searchCriteria.getProcedure().getID_Procedure());
      andStr = " and ";
    }

    if (searchCriteria.getAnaestheticTypeIsNotNull()) {
      hqlConditions.append(andStr);
      hqlConditions.append(" (patElective.anaestheticType.id = :anaestheticTypeID) ");
      markers.add("anaestheticTypeID");
      values.add(searchCriteria.getAnaestheticType().getID());
      andStr = " and ";
    }

    if (searchCriteria.getUrgencyIsNotNull()) {
      hqlConditions.append(andStr);
      hqlJoins.append(" left join patElective.priority as priority ");
      hqlConditions.append(" (priority.id = :Urgency) ");
      markers.add("Urgency");
      values.add(searchCriteria.getUrgency().getID());
      andStr = " and ";
    }
    // WDEV-22781
    if (searchCriteria.getPatientIdentifierIsNotNull()) {
      hqlConditions.append(andStr);
      hqlJoins.append(
          " left join patElective.patient as patient left join patient.identifiers as ids ");
      hqlConditions.append(" (ids.value = :idValue AND ids.type = :idType) ");
      markers.add("idValue");
      markers.add("idType");
      values.add(searchCriteria.getPatientIdentifier());
      values.add(getDomLookup(searchCriteria.getPatIdType()));
      andStr = " and ";
    }
    // WDEV-22781 ends here

    if (searchCriteria.getBreachDateFromIsNotNull()) {
      hqlConditions.append(andStr);
      hqlJoins.append(
          " left join patElective.referral as catsRef left join catsRef.referralDetails as refDetails ");
      hqlConditions.append(" (refDetails.end18WW >= :fromdate) ");
      markers.add("fromdate");
      values.add(
          new DateTime(searchCriteria.getBreachDateFrom(), new Time("00:00:00")).getJavaDate());
      andStr = " and ";
    }

    if (searchCriteria.getBreachDateToIsNotNull()) {
      hqlConditions.append(andStr);
      hqlJoins.append(
          " left join patElective.referral as catsRef left join catsRef.referralDetails as refDetails ");
      hqlConditions.append(" (refDetails.end18WW <= :todate) ");
      markers.add("todate");
      values.add(
          new DateTime(searchCriteria.getBreachDateTo(), new Time("23:59:00"))
              .getJavaDate()); // WDEV-21037
      andStr = " and ";
    }

    if (searchCriteria.getTheatreTypeIsNotNull()) {
      hqlConditions.append(andStr);
      hqlJoins.append(" left join patElective.preAssessmentOutcome as preAssessmentOutcome ");
      hqlConditions.append(
          "( ( preAssessmentOutcome is not null AND preAssessmentOutcome.theatreType.id = :theatreType) OR (preAssessmentOutcome is null AND patElective.requiredTheatreType.id = :theatreType)) ");
      markers.add("theatreType");
      values.add(searchCriteria.getTheatreType().getID());
      andStr = " and ";
    }

    StringBuffer hqlConditionsOR = new StringBuffer();
    String orStr = "";
    if (searchCriteria
        .getPreAssessmentRequired()) // those that does not have preAssessmentOutcome saved and no
                                     // PreAssessment Booked
    {
      hqlConditionsOR.append(orStr);
      hqlJoins.append(" left join patElective.preAssessmentOutcome as preAssessmentOutcome ");
      hqlConditionsOR.append(
          " (patElective.preAssessmentOutcome is null AND patElective.preAssessmentAppointment is null) "); // WDEV-21037
      orStr = " OR ";
    }

    if (searchCriteria.getNotFitForSurgery()) {
      hqlConditionsOR.append(orStr);
      hqlJoins.append(" left join patElective.preAssessmentOutcome as preAssessmentOutcome ");
      hqlConditionsOR.append(" (preAssessmentOutcome.fitToProceed = 0) ");
      orStr = " OR ";
    }

    if (searchCriteria.getFitForSurgery()) {
      hqlConditionsOR.append(orStr);
      hqlJoins.append(" left join patElective.preAssessmentOutcome as preAssessmentOutcome ");
      hqlConditionsOR.append(" (preAssessmentOutcome.fitToProceed = 1) ");
      orStr = " OR ";
    }

    if (searchCriteria.getPreAssessmentOutcomePending()) {
      if (searchCriteria.getWaitingForIsNotNull() && searchCriteria.getWaitingFor().size() > 0) {
        hqlConditionsOR.append(orStr);
        hqlJoins.append(
            " left join patElective.preAssessmentOutcome as preAssessmentOutcome left join preAssessmentOutcome.waitingForDetails as waitingForDet left join waitingForDet.informationToBeReceived as infoReceived");
        hqlConditionsOR.append(
            " (preAssessmentOutcome is not null AND preAssessmentOutcome.fitToProceed is null AND (infoReceived.id in ("
                + getWaitingForIDs(searchCriteria.getWaitingFor())
                + ") AND (waitingForDet.received is null OR waitingForDet.received = 0))) ");
        orStr = " OR ";
      } else {
        hqlConditionsOR.append(orStr);
        hqlJoins.append(" left join patElective.preAssessmentOutcome as preAssessmentOutcome  ");
        hqlConditionsOR.append(
            " (preAssessmentOutcome.detailsOutstanding=1 AND preAssessmentOutcome.fitToProceed is null)");
        orStr = " OR ";
      }
    }

    // WDEV-21037
    if (searchCriteria.getPastAppointment()) {
      hqlConditionsOR.append(orStr);
      hqlJoins.append(" left join patElective.preAssessmentAppointment as preAssessmentAppt ");
      hqlConditionsOR.append(
          " (patElective.preAssessmentOutcome is null AND preAssessmentAppt.appointmentDate < :ApptTodayDate ) ");
      markers.add("ApptTodayDate");
      values.add(new DateTime().getJavaDate());
      orStr = " OR ";
    }

    if (searchCriteria.getFutureAppointment()) {
      hqlConditionsOR.append(orStr);
      hqlJoins.append(" left join patElective.preAssessmentAppointment as preAssessmentAppt ");
      hqlConditionsOR.append(
          " (patElective.preAssessmentOutcome is null AND preAssessmentAppt.appointmentDate > :ApptTodayDate ) ");
      markers.add("ApptTodayDate");
      values.add(new DateTime().getJavaDate());
      orStr = " OR ";
    }

    if (hqlConditionsOR.length() > 0) {
      hqlConditions.append(andStr);
      hqlConditions.append(" ( " + hqlConditionsOR + " ) ");
    }

    // WDEV-21037

    StringBuffer hqlConditionsElectiveListTypeOR = new StringBuffer();
    orStr = "";
    if (searchCriteria.getWaitingList()) {
      hqlConditionsElectiveListTypeOR.append(orStr);
      hqlConditionsElectiveListTypeOR.append(
          " (patElective.electiveAdmissionType.id = :WaitingListType OR patElective.electiveAdmissionType.id = :BookedListType) ");
      markers.add("WaitingListType");
      values.add(ElectiveAdmissionType.ELECTIVE_TYPE11.getID());
      markers.add("BookedListType");
      values.add(ElectiveAdmissionType.BOOKED_TYPE12.getID());
      orStr = " OR ";
    }

    if (searchCriteria.getSurveillancePlannedList()) {
      hqlConditionsElectiveListTypeOR.append(orStr);
      hqlConditionsElectiveListTypeOR.append(
          " (patElective.electiveAdmissionType.id = :PlannedList   ");
      markers.add("PlannedList");
      values.add(ElectiveAdmissionType.PLANNED_TYPE13.getID());
      orStr = " OR ";

      if (searchCriteria.getPlannedFromIsNotNull()) {
        hqlConditionsElectiveListTypeOR.append(andStr);

        hqlConditionsElectiveListTypeOR.append(
            " (patElective.plannedDate >= :fromdate) "); // wdev-21440
        markers.add("fromdate");
        values.add(
            new DateTime(searchCriteria.getPlannedFrom(), new Time("00:00:00")).getJavaDate());
        andStr = " and ";
      }

      if (searchCriteria.getPlannedToIsNotNull()) {
        hqlConditionsElectiveListTypeOR.append(andStr);

        hqlConditionsElectiveListTypeOR.append(
            " (patElective.plannedDate <= :todate) "); // wdev-21440
        markers.add("todate");
        values.add(new DateTime(searchCriteria.getPlannedTo(), new Time("23:59:59")).getJavaDate());
        andStr = " and ";
      }

      hqlConditionsElectiveListTypeOR.append(" )");
    }

    if (hqlConditionsElectiveListTypeOR.length() > 0) {
      hqlConditions.append(andStr);
      hqlConditions.append(" ( " + hqlConditionsElectiveListTypeOR + " ) ");
    }

    /*if (searchCriteria.getPlannedFromIsNotNull())
    {
    	hqlConditions.append(andStr);

    	//hqlJoins.append(" left join patElective.tCIDetails as tciDet ");
    	//hqlConditions.append(" (tciDet.plannedTCIDate >= :fromdate) ");
    	hqlConditions.append(" (patElective.plannedDate >= :fromdate) ");		//wdev-21440
    	markers.add("fromdate");
    	values.add(new DateTime(searchCriteria.getPlannedFrom(), new Time("00:00:00")).getJavaDate());
    	andStr = " and ";

    }

    if (searchCriteria.getPlannedToIsNotNull())
    {
    	hqlConditions.append(andStr);
    	//hqlJoins.append(" left join patElective.tCIDetails as tciDet ");
    	//hqlConditions.append(" (tciDet.plannedTCIDate <= :todate) ");
    	hqlConditions.append(" (patElective.plannedDate <= :todate) ");			//wdev-21440
    	markers.add("todate");
    	values.add(new DateTime(searchCriteria.getPlannedTo(), new Time("23:59:59")).getJavaDate());
    	andStr = " and ";

    }*/

    if (searchCriteria.getAddedToday()) {
      hqlConditions.append(andStr);
      hqlConditions.append(
          " (patElective.dateOnList >= :Today1 AND patElective.dateOnList <= :Today2) ");
      markers.add("Today1");
      values.add(new DateTime(new Date(), new Time("00:00:00")).getJavaDate());
      markers.add("Today2");
      values.add(new DateTime(new Date(), new Time("23:59:00")).getJavaDate());
      andStr = " and ";
    }
    // WDEV-23462
    if (searchCriteria.getIncludeEndoscopy()) {
      hqlConditions.append(andStr);
      hqlConditions.append(" patElective.admissionType.id = :AdmissionType ");
      markers.add("AdmissionType");
      values.add(WaitingCardAdmissionType.ENDOSCOPY.getID());
      andStr = " and ";
    }

    if (hqlConditions.length() > 0) {
      hqlConditions.insert(0, " where (");
      hqlConditions.append(" ) ");
    }

    List<?> list =
        factory.find(
            (hql.toString() + hqlJoins.toString() + hqlConditions.toString() + "  ").toString(),
            markers,
            values,
            2000); // order by refDetails.end18WW asc

    if (list == null || list.size() == 0) return null;

    return PatientElectiveListForPreAssessmentWorklistVoAssembler
        .createPatientElectiveListForPreAssessmentWorklistVoCollectionFromPatientElectiveList(list);
  }