public OutPatientListVoCollection listOutPatients(ClinicRefVo clinic, Date clinicDate) { DomainFactory factory = getDomainFactory(); String hql; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); hql = " from OutpatientAttendance op "; StringBuffer condStr = new StringBuffer(); String andStr = " and "; condStr.append(" op.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); if (clinic != null) { condStr.append(andStr + " op.clinic.id = :clinic"); markers.add("clinic"); values.add(clinic.getID_Clinic()); } if (clinicDate != null) { condStr.append(andStr + " op.appointmentDateTime >= :startdate"); condStr.append(andStr + " op.appointmentDateTime < :enddate"); markers.add("startdate"); markers.add("enddate"); values.add(clinicDate.getDate()); values.add(clinicDate.copy().addDay(1).getDate()); } hql += " where "; hql += condStr.toString(); List<?> ops = factory.find(hql, markers, values); return OutPatientListVoAssembler.createOutPatientListVoCollectionFromOutpatientAttendance(ops).sort(); }
private void search() { clearOutPatientList(); if (form.dteClinic().getValue() == null || (form.qmbClinic().getValue() == null && form.qmbConsultant().getValue() == null)) { engine.showMessage("Valid search criteria must be specified - Please enter a Clinic Date and a Clinic and/or Consultant"); return; } OutPatientListVoCollection outpatientAttendances = domain.listOutpatients(form.qmbClinic().getValue(), form.qmbConsultant().getValue(), form.cmbSpecialty().getValue(), form.dteClinic().getValue()); if (outpatientAttendances == null || outpatientAttendances.size() == 0) { engine.showMessage("No matching patients found."); clearOutPatientList(); return; } populateOutPatientList(outpatientAttendances); OutPatientListSearchCriteriaVo searchCriteria = form.getGlobalContext().Core.getOutPatientSearchCriteria(); if (searchCriteria != null && searchCriteria.getColumnSortOrder() != null) { setSortOrderForColumn(searchCriteria.getColumnSortOrder().getColumnId(), searchCriteria.getColumnSortOrder().getSortOrder()); } }
private void populateList(OutPatientListVoCollection voOutPatColl) { if (voOutPatColl != null) { if (voOutPatColl.size() == 0) { engine.showMessage("No matching patients found."); return; } grdListRow row = null; for (int i = 0; i < voOutPatColl.size(); i++) { OutPatientListVo voOutPatient = voOutPatColl.get(i); if (voOutPatient != null && voOutPatient.getPasEventIsNotNull() && voOutPatient.getPasEvent().getPatientIsNotNull()) { row = form.grdList().getRows().newRow(); if (voOutPatient.getPasEvent().getPatient().getNameIsNotNull()) { row.setcolForename(voOutPatient.getPasEvent().getPatient().getName().getForename()); row.setcolSurname(voOutPatient.getPasEvent().getPatient().getName().getSurname()); } ims.core.vo.PatientId voPatId = voOutPatient.getPasEvent().getPatient().getDisplayId(); if (voPatId != null) row.setcolHospnum(voPatId.getValue()); if (voOutPatient.getPasEvent().getPatient().getDobIsNotNull()) row.setcolDob(voOutPatient.getPasEvent().getPatient().getDob().toString()); if (voOutPatient.getPasEvent().getPatient().getAgeIsNotNull()) row.setColAge(voOutPatient.getPasEvent().getPatient().getAge().toString()); else row.setColAge(voOutPatient.getPasEvent().getPatient().calculateAge().toString()); if (voOutPatient.getPasEvent().getPatient().getSexIsNotNull()) row.setcolSex(voOutPatient.getPasEvent().getPatient().getSex().getText()); if (voOutPatient.getClinicIsNotNull()) row.setcolClinic(voOutPatient.getClinic().getClinicName()); if (voOutPatient.getPasEvent() != null && voOutPatient.getPasEvent().getSpecialty() != null) row.setcolSpecialty(voOutPatient.getPasEvent().getSpecialty().getText()); if (voOutPatient.getAppointmentDateTimeIsNotNull()) row.setcolClinicDate(voOutPatient.getAppointmentDateTime().toString()); if (voOutPatient.getPasEvent().getPatient().getIsDead() != null && voOutPatient.getPasEvent().getPatient().getIsDead().booleanValue()) row.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); row.setValue(voOutPatient.getPasEvent().getPatient()); } } } }
private void populateList(OutPatientListVoCollection voOutPatColl) { form.lyrLetterCreate().tabClinicList().grdPatient().getRows().clear(); if (voOutPatColl == null || voOutPatColl.size() == 0) { engine.showMessage("No results found for search criteria", "No records", MessageButtons.OK, MessageIcon.INFORMATION); //wdev-15816 return; } for (int i = 0; i < voOutPatColl.size(); i++) { OutPatientListVo voOutPatient = voOutPatColl.get(i); if (voOutPatient != null && voOutPatient.getPasEventIsNotNull() && voOutPatient.getPasEvent().getPatientIsNotNull()) { grdPatientRow row = form.lyrLetterCreate().tabClinicList().grdPatient().getRows().newRow(); if (voOutPatient.getPasEvent().getPatient().getNameIsNotNull()) { row.setcolForename(voOutPatient.getPasEvent().getPatient().getName().getForename()); row.setcolSurname(voOutPatient.getPasEvent().getPatient().getName().getSurname()); } ims.core.vo.PatientId voPatId = voOutPatient.getPasEvent().getPatient().getDisplayId(); if (voPatId != null) row.setcolHospnum(voPatId.getValue()); if (voOutPatient.getPasEvent().getPatient().getDobIsNotNull()) row.setcolDob(voOutPatient.getPasEvent().getPatient().getDob().toString()); if (voOutPatient.getClinicIsNotNull()) row.setcolClinic(voOutPatient.getClinic().getClinicName()); if (voOutPatient.getPasEvent() != null && voOutPatient.getPasEvent().getSpecialty() != null) row.setcolSpecialty(voOutPatient.getPasEvent().getSpecialty().getText()); if (voOutPatient.getAppointmentDateTimeIsNotNull()) row.setcolClinicDate(voOutPatient.getAppointmentDateTime().toString()); if (voOutPatient.getPasEvent().getPatient().getIsDead() != null && voOutPatient.getPasEvent().getPatient().getIsDead().booleanValue()) row.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); row.setcolDocCreate(true); row.setValue(voOutPatient); } } }
private void populateOutPatientList(OutPatientListVoCollection outpatientAttendances) { clearOutPatientList(); if (outpatientAttendances == null || outpatientAttendances.size() == 0) { engine.showMessage("No matching patients found."); return; } storeSearchCriteria(); GenForm.grdOutPatientRow row = null; for (OutPatientListVo outpatient : outpatientAttendances) { if (outpatient != null && outpatient.getPasEventIsNotNull() && outpatient.getPasEvent().getPatientIsNotNull()) { PatientShort patient = outpatient.getPasEvent().getPatient(); row = form.grdOutPatient().getRows().newRow(); if (patient.getNameIsNotNull()) { row.setcolForename(patient.getName().getForename()); row.setcolSurname(patient.getName().getSurname()); } ims.core.vo.PatientId voPatId = patient.getDisplayId(); if (voPatId != null) row.setcolHospnum(voPatId.getValue()); //WDEV-16710 StringBuffer patientIdentifiers = new StringBuffer(); PatientIdCollection identifiers = patient.getIdentifiers(); if (identifiers != null) { for (int a = 0; a < identifiers.size(); a++) { patientIdentifiers.append("<b>" + identifiers.get(a).getType().toString() + ":</b> " + identifiers.get(a).getValue() + "<br>"); } } row.setTooltipForcolHospnum(patientIdentifiers.toString()); if (patient.getDobIsNotNull()) row.setcolDob(patient.getDob().toString()); if (patient.getAgeIsNotNull()) row.setColAge(patient.getAge().toString()); else { //WDEV-12716 Integer age = patient.calculateAge(); if (age != null) row.setColAge(age.toString()); } if (patient.getSexIsNotNull()) row.setcolSex(patient.getSex().getText()); if (outpatient.getClinicIsNotNull()) row.setcolClinic(outpatient.getClinic().getClinicName()); if (outpatient.getPasEvent() != null && outpatient.getPasEvent().getSpecialty() != null) row.setcolSpecialty(outpatient.getPasEvent().getSpecialty().getText()); if (outpatient.getAppointmentDateTimeIsNotNull()) row.setcolClinicDate(outpatient.getAppointmentDateTime().toString()); if (patient.getIsDead() != null && patient.getIsDead().booleanValue()) row.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); row.setValue(outpatient); } } }
private void populateOutPatientList(OutPatientListVoCollection outpatientAttendances) { clearOutPatientList(); if (outpatientAttendances == null || outpatientAttendances.size() == 0) { return; } storeSearchCriteria(); GenForm.grdOutPatientRow row = null; for (OutPatientListVo outpatient : outpatientAttendances) { if (outpatient != null && outpatient.getPasEventIsNotNull() && outpatient.getPasEvent().getPatientIsNotNull()) { PatientShort patient = outpatient.getPasEvent().getPatient(); row = form.grdOutPatient().getRows().newRow(); if (patient.getNameIsNotNull()) { row.setcolForename(patient.getName().getForename()); row.setcolSurname(patient.getName().getSurname()); } ims.core.vo.PatientId voPatId = patient.getDisplayId(); if (voPatId != null) row.setcolHospnum(voPatId.getValue()); //WDEV-16710 StringBuffer patientIdentifiers = new StringBuffer(); PatientIdCollection identifiers = patient.getIdentifiers(); if (identifiers != null) { for (int a = 0; a < identifiers.size(); a++) { patientIdentifiers.append("<b>" + identifiers.get(a).getType().toString() + ":</b> " + identifiers.get(a).getValue() + "<br>"); } } row.setTooltipForcolHospnum(patientIdentifiers.toString()); if (patient.getDobIsNotNull()) row.setcolDob(patient.getDob().toString()); if (patient.getAgeIsNotNull()) row.setColAge(patient.getAge().toString()); else { //WDEV-12716 Integer age = patient.calculateAge(); if (age != null) row.setColAge(age.toString()); } if (patient.getSexIsNotNull()) row.setcolSex(patient.getSex().getText()); if (outpatient.getClinicIsNotNull()) row.setcolClinic(outpatient.getClinic().getClinicName()); if (outpatient.getPasEvent() != null && outpatient.getPasEvent().getSpecialty() != null) row.setcolSpecialty(outpatient.getPasEvent().getSpecialty().getText()); if (outpatient.getAppointmentDateTimeIsNotNull()) row.setcolClinicDate(outpatient.getAppointmentDateTime().toString()); if (patient.getIsDead() != null && patient.getIsDead().booleanValue()) row.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); row.setValue(outpatient); } } }
private void sortColumn(int column) { OutPatientListVoCollection values = form.grdOutPatient().getValues(); form.grdOutPatient().getRows().clear(); switch (column) { case IDENTIFIER_COLUMN: form.getLocalContext().setSortOrderIdentifier(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderIdentifier()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new IdentifierComparator(form.getLocalContext().getSortOrderIdentifier())); addColumnSortToSearchCriteriaGC(IDENTIFIER_COLUMN, form.getLocalContext().getSortOrderIdentifier()); break; case SURNAME_COLUMN: form.getLocalContext().setSortOrderSurname(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderSurname()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new SurnameComparator(form.getLocalContext().getSortOrderSurname())); addColumnSortToSearchCriteriaGC(SURNAME_COLUMN, form.getLocalContext().getSortOrderSurname()); break; case FORENAME_COLUMN: form.getLocalContext().setSortOrderForename(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderForename()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new ForenameComparator(form.getLocalContext().getSortOrderForename())); addColumnSortToSearchCriteriaGC(FORENAME_COLUMN, form.getLocalContext().getSortOrderForename()); break; case SEX_COLUMN: form.getLocalContext().setSortOrderSex(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderSex()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new SexComparator(form.getLocalContext().getSortOrderSex())); addColumnSortToSearchCriteriaGC(SEX_COLUMN, form.getLocalContext().getSortOrderSex()); break; case DOB_COLUMN: form.getLocalContext().setSortOrderDOB(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderDOB()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new DOBComparator(form.getLocalContext().getSortOrderDOB())); addColumnSortToSearchCriteriaGC(DOB_COLUMN, form.getLocalContext().getSortOrderDOB()); break; case AGE_COLUMN: form.getLocalContext().setSortOrderAge(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderAge()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new AgeComparator(form.getLocalContext().getSortOrderAge())); addColumnSortToSearchCriteriaGC(AGE_COLUMN, form.getLocalContext().getSortOrderAge()); break; case CLINIC_COLUMN: form.getLocalContext().setSortOrderClinic(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderClinic()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new ClinicComparator(form.getLocalContext().getSortOrderClinic())); addColumnSortToSearchCriteriaGC(CLINIC_COLUMN, form.getLocalContext().getSortOrderClinic()); break; case SPECIALTY_COLUMN: form.getLocalContext().setSortOrderSpecialty(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderSpecialty()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new SpecialtyComparator(form.getLocalContext().getSortOrderSpecialty())); addColumnSortToSearchCriteriaGC(SPECIALTY_COLUMN, form.getLocalContext().getSortOrderSpecialty()); break; case CLINIC_DATE_COLUMN: form.getLocalContext().setSortOrderDate(SortOrder.ASCENDING.equals(form.getLocalContext().getSortOrderDate()) ? SortOrder.DESCENDING : SortOrder.ASCENDING); values.sort(new DateComparator(form.getLocalContext().getSortOrderDate())); addColumnSortToSearchCriteriaGC(CLINIC_DATE_COLUMN, form.getLocalContext().getSortOrderDate()); break; default: break; } populateOutPatientList(values); }