private void search() { if (form.cmbMDTList().getValue() == null) { engine.showMessage("Valid search criteria must be specified - Please select a List"); return; } form.getGlobalContext().Core.setCurrentMDTListShown(form.cmbMDTList().getValue()); MDTListAndDatesVo voMdtListFilter = new MDTListAndDatesVo(); MDTListAndDatesVoCollection mdtColl = null; voMdtListFilter.setCareContext(new CareContextVo()); voMdtListFilter.getCareContext().setContext(ContextType.INPATIENT); voMdtListFilter.setListPatientisOn(form.cmbMDTList().getValue()); if ((form.cmbMDTList().getValue() != null) && (form.cmbMDTList().getValue().equals(MDTListAorB.NOTONANYLISTYET))) mdtColl = domain.listCareContextsWithNoMDTList(voMdtListFilter); else if (form.cmbMDTList().getValue() != null) mdtColl = domain.listMDT(voMdtListFilter); populateListControl(mdtColl); }
/** * A list of MDT appointments */ public ims.clinical.vo.MDTListAndDatesVoCollection listMDT(ims.clinical.vo.MDTListAndDatesVo voMDTList) { DomainFactory factory = getDomainFactory(); List MDTList = factory.find(" from MDTListandDates mdtlist where mdtlist.careContext.endDateTime is null " + "and mdtlist.careContext.context = :context " + "and mdtlist.listPatientisOn = :listPatient", new String[]{"context", "listPatient"}, new Object[]{getDomLookup(voMDTList.getCareContext().getContext()), getDomLookup(voMDTList.getListPatientisOn())}); MDTListAndDatesVoCollection voMDTNoContactColl = new MDTListAndDatesVoCollection(); for (int x = 0; x < MDTList.size(); x++) { MDTListandDates domMDTListAndDates = (MDTListandDates) MDTList.get(x); MDTListAndDatesVo voMDTListAndDates = MDTListAndDatesVoAssembler.create(domMDTListAndDates); voMDTListAndDates.setPatient(PatientShortAssembler.create(domMDTListAndDates.getPatient())); Demographics impl = (Demographics) getDomainImpl(DemographicsImpl.class); voMDTListAndDates.getPatient().setHasAlerts(impl.hasAlerts(domMDTListAndDates.getPatient().getId())); voMDTListAndDates.getPatient().setHasAllergies(impl.hasAllergy(domMDTListAndDates.getPatient().getId())); voMDTNoContactColl.add(voMDTListAndDates); } return voMDTNoContactColl.sort(); }
/** * List of Clinical Contacts with no MDT list type */ public ims.clinical.vo.MDTListAndDatesVoCollection listCareContextsWithNoMDTList(ims.clinical.vo.MDTListAndDatesVo voMDTList) { DomainFactory factory = getDomainFactory(); List contextList = factory.find(" from CareContext r where r.endDateTime is null and r.context = :context and r.id not in " + "( select careContext.id from MDTListandDates)", new String[]{"context"}, new Object[]{getDomLookup(ContextType.INPATIENT)}); MDTListAndDatesVoCollection voMDTNoContactColl = new MDTListAndDatesVoCollection(); for (int x = 0; x < contextList.size(); x++) { CareContext domCareContext = (CareContext) contextList.get(x); CareContextShortVo voCareContext = CareContextShortVoAssembler.create(domCareContext); Demographics impl = (Demographics) getDomainImpl(DemographicsImpl.class); MDTListAndDatesVo mdt = new MDTListAndDatesVo(); mdt.setPatient(PatientShortAssembler.create(domCareContext.getEpisodeOfCare().getCareSpell().getPatient())); mdt.getPatient().setHasAlerts(impl.hasAlerts(mdt.getPatient().getID_Patient())); mdt.getPatient().setHasAllergies(impl.hasAllergy(mdt.getPatient().getID_Patient())); mdt.setCareContext(voCareContext); voMDTNoContactColl.add(mdt); } return voMDTNoContactColl.sort(); }
private void populateListControl(MDTListAndDatesVoCollection mdtColl) { form.grdPatients().getRows().clear(); if (mdtColl != null) { GenForm.grdPatientsRow row = null; MDTListAndDatesVo mdt = null; for (int i = 0; i < mdtColl.size(); i++) { mdt = mdtColl.get(i); row = form.grdPatients().getRows().newRow(); if (mdt.getPatientIsNotNull()) { if (mdt.getPatient().getNameIsNotNull()) { row.setcolForename(mdt.getPatient().getName().getForename()); row.setcolSurname(mdt.getPatient().getName().getSurname()); } PatientId voPatId = mdt.getPatient().getDisplayId(); if (voPatId != null) row.setcolHospnum(voPatId.getValue()); row.setcolDob(mdt.getPatient().getDobIsNotNull() ? mdt.getPatient().getDob().toString() : null); row.setColAge(mdt.getPatient().getDobIsNotNull() ? mdt.getPatient().calculateAge().toString() : null); if (mdt.getPatient().getSex() != null) row.setcolSex(mdt.getPatient().getSex().getText()); if (mdt.getPatient().getIsDead() != null && mdt.getPatient().getIsDead().booleanValue()) row.setBackColor(ConfigFlag.UI.RIP_COLOUR.getValue()); } row.setValue(mdt); } form.lblTotal().setValue("Total : " + new Integer(mdtColl.size()).toString()); if (mdtColl.size() == 0) engine.showMessage("No matching patients found."); } }