public MedicationDoseUnitCollection getUnits(MedicationRefVo medication, DoseFormIndicator form, MedicationRoute route) { if (!medication.getID_MedicationIsNotNull()) throw new DomainRuntimeException("Medication with null as id"); String hql = "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes " + "left join routes.route as route left join forms.form as form where " + "(medication.id = :medId and form.id = :formId and route.id = :routeId) "; List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId","routeId"},new Object[]{medication.getID_Medication(),new Integer(form.getID()),new Integer(route.getID())}); if (dos == null || dos.size() == 0) return null; MedicationRouteVo routeVo = MedicationRouteVoAssembler.create((ims.core.clinical.domain.objects.MedicationRoute) dos.get(0)); if (routeVo==null || !routeVo.getRouteUnitsIsNotNull() ) return null; MedicationDoseUnitCollection result = new MedicationDoseUnitCollection(); for (int i = 0 ; i < routeVo.getRouteUnits().size() ; i++) { if( routeVo.getRouteUnits().get(i)!=null && routeVo.getRouteUnits().get(i).getDoseUnitIsNotNull()) result.add(routeVo.getRouteUnits().get(i).getDoseUnit()); } return result; }
private void rebindUnitRows(DynamicGridRow parent) { if (parent == null) return; DynamicGridRowCollection rows = parent.getRows(); MedicationDoseUnitCollection mRoutes = ims.core.vo.lookups.LookupHelper.getMedicationDoseUnit(this.domain.getLookupService()); for (int i = 0 ; i < rows.size() ; i++) { if (rows.get(i).getValue() instanceof MedicationUnitVo) { MedicationUnitVo x = (MedicationUnitVo) rows.get(i).getValue(); if (!x.getDoseUnitIsNotNull()) continue; mRoutes.remove(x.getDoseUnit()); } } for (int i = 0 ; i < rows.size() ; i++) { DynamicGridCell cell = rows.get(i).getCells().get(form.lyrDetails().tabFRU().dyngrdFRU().getColumns().getByIdentifier(COL_MAIN)); Object back = cell.getValue(); cell.getItems().clear(); if (back!=null) cell.getItems().newItem(back); for (int j = 0 ; j < mRoutes.size() ;j++) cell.getItems().newItem(mRoutes.get(j)); cell.setValue(back); } }
private void populateLocalContexts() { form.getLocalContext().setDosages(null); MedicationDoseUnitCollection medUnits = ims.core.vo.lookups.LookupHelper.getMedicationDoseUnit(domain.getLookupService()); form.getLocalContext().setDosages(medUnits); form.getLocalContext().setFrequency(null); MedicationFrequencyCollection frequencies = ims.core.vo.lookups.LookupHelper.getMedicationFrequency(domain.getLookupService()); form.getLocalContext().setFrequency(frequencies); }
private void populateCmbUnits(MedicationDoseUnitCollection units) { form.cmbDoseUnit().clear(); if (units == null) return; for (int i = 0 ; i < units.size() ; i++) { if (units.get(i)!=null) { form.cmbDoseUnit().newRow(units.get(i), units.get(i).getIItemText()); } } }