private void removeComponentFromBreachedInvestigations(Integer invId) { if(invId == null) return; BreachedInvestigationsVoCollection breachedInvestigations = form.getLocalContext().getBreachedInvestigations(); if(breachedInvestigations == null || breachedInvestigations.size() == 0) return; for(int i = breachedInvestigations.size() - 1; i >= 0; i--) { if(breachedInvestigations.get(i) == null || breachedInvestigations.get(i).getInvestigationId() == null) continue; if(invId.equals(breachedInvestigations.get(i).getInvestigationId())) breachedInvestigations.remove(breachedInvestigations.get(i)); } }
private boolean isInvestigationInBreachedList(Investigation inv, BreachedInvestigationsVoCollection breachedInvestigations) // WDEV-16762 { if(inv == null || breachedInvestigations == null) return false; Iterator<BreachedInvestigationsVo> list = breachedInvestigations.iterator();// WDEV-16762 while(list.hasNext()) { BreachedInvestigationsVo item = list.next();// WDEV-16762 if(item == null || item.getInvestigationId() == null) continue; if(item.getInvestigationId().equals(inv.getId()))// WDEV-16762 return true; } return false; }
private ReOrderPeriodMessageVoCollection getDistinctListOfMessages(ReOrderPeriodMessageVoCollection voCollMessages) { ReOrderPeriodMessageVoCollection collMessages = new ReOrderPeriodMessageVoCollection(); HashMap<String, ReOrderPeriodMessageVo> map = new HashMap<String, ReOrderPeriodMessageVo>(); for(int i=0;i<voCollMessages.size();i++) { if(!map.containsKey(voCollMessages.get(i).getItemName())) map.put(voCollMessages.get(i).getItemName(), voCollMessages.get(i)); } for (ReOrderPeriodMessageVo element : map.values()) { collMessages.add(element); //WDEV-16624 if(form.getLocalContext().getBreachedInvestigations() == null) form.getLocalContext().setBreachedInvestigations(new BreachedInvestigationsVoCollection());//WDEV-16762 //WDEV-16762 BreachedInvestigationsVo breached = new BreachedInvestigationsVo(); breached.setInvestigationId(element.getInvestigationId()); breached.setParentId(element.getParentId()); form.getLocalContext().getBreachedInvestigations().add(breached);//WDEV-16624, WDEV-16762 } return collMessages; }
public ReOrderPeriodMessageVoCollection listOrderSetInvestigationsWithinMinReOrderPeriod(OrderSetRefVo orderSet, PatientShort patient, BreachedInvestigationsVoCollection breachedInvestigations) // WDEV-16762 { if(orderSet == null || patient == null) throw new CodingRuntimeException("orderSet or patient is null in method listOrderSetInvestigationsWithinMinReOrderPeriod"); boolean isFemale = patient.getSexIsNotNull() && patient.getSex().equals(Sex.FEMALE); DomainFactory factory = getDomainFactory(); OrderSet doOrderSet = (OrderSet) factory.getDomainObject(orderSet); if(doOrderSet == null || doOrderSet.getComponent() == null) return null; Iterator it = doOrderSet.getComponent().iterator(); ReOrderPeriodMessageVoCollection voCollMessages = new ReOrderPeriodMessageVoCollection(); while(it.hasNext()) { Object comp = it.next(); if(!(comp instanceof OrderSetComponent)) continue; Investigation doInv = ((OrderSetComponent) comp).getInvestigation(); ReOrderPeriodMessageVoCollection profOrderInvMessages = listMessages(doInv, patient, isFemale, breachedInvestigations, null);//WDEV-16762 if(profOrderInvMessages != null) { for(ReOrderPeriodMessageVo item : profOrderInvMessages) voCollMessages.add(item); } } return voCollMessages; }
private void removeRefusedComponentsFromSelectedComponents() { SelectedComponentFromSelectOrderVoCollection selectedComponents = form.getLocalContext().getSelectedComponents(); if(selectedComponents != null) { for(int i = selectedComponents.size() - 1; i >= 0; i--) { SelectedComponentFromSelectOrderVo selectedComponent = selectedComponents.get(i); if(selectedComponent == null || SelectAndOrderComponentType.ORDERSET.equals(selectedComponent.getComponentType()))// WDEV-16762 continue; if(componentIsInRefusedList(selectedComponent)) { selectedComponents.remove(selectedComponent); } } } form.getLocalContext().setSelectedComponents(selectedComponents); SelectedComponentFromSelectOrderVoCollection selectedLinkedComponents = form.getLocalContext().getLinkedComponents(); if(selectedLinkedComponents != null) { for(int i = selectedLinkedComponents.size() - 1; i >= 0; i--) { SelectedComponentFromSelectOrderVo selectedLinkedComponent = selectedLinkedComponents.get(i); if(selectedLinkedComponent == null || SelectAndOrderComponentType.ORDERSET.equals(selectedLinkedComponent.getComponentType()))// WDEV-16762 continue; if(componentIsInRefusedList(selectedLinkedComponent)) { selectedLinkedComponents.remove(selectedLinkedComponent); } } } form.getLocalContext().setLinkedComponents(selectedLinkedComponents); BreachedInvestigationsVoCollection breachedInvestigations = form.getLocalContext().getBreachedInvestigations(); if(breachedInvestigations != null) { for(int i = breachedInvestigations.size() - 1; i >= 0; i--) { if(breachedInvestigations.get(i) == null) continue; if(breachedInvestigationIsInRefusedList(breachedInvestigations.get(i))) { breachedInvestigations.remove(breachedInvestigations.get(i)); } } } form.getLocalContext().setBreachedInvestigations(breachedInvestigations); }
private ReOrderPeriodMessageVoCollection listMessages(Investigation doInv, PatientShort patient, boolean isFemale, BreachedInvestigationsVoCollection breachedInvestigations, Integer parentId) //WDEV-16762 { if(doInv == null) return null; if(Boolean.TRUE.equals(doInv.getInvestigationIndex().isIsProfile())) { if(doInv.getAssocInvestigations() != null) { Iterator it = doInv.getAssocInvestigations().iterator(); ReOrderPeriodMessageVoCollection messages = new ReOrderPeriodMessageVoCollection();//WDEV-16624 while(it.hasNext()) { Object comp = it.next(); if(!(comp instanceof Investigation)) continue; addMessagesCollection(messages, listMessages((Investigation)comp, patient, isFemale, breachedInvestigations, doInv.getId()));//WDEV-16624, WDEV-16762 } return messages;//WDEV-16624 } } else { if(isInvestigationInBreachedList(doInv, breachedInvestigations)) return null; } LookupInstance femaleUnit = doInv.getFemaleMinReorderPeriodUnit(); LookupInstance maleUnit = doInv.getMinReorderPeriodUnit(); MinReorderPeriod unit = null; if(isFemale && femaleUnit != null) unit = LookupHelper.getMinReorderPeriodInstance(getLookupService(), doInv.getFemaleMinReorderPeriodUnit().getId()); else if(!isFemale && maleUnit != null) unit = LookupHelper.getMinReorderPeriodInstance(getLookupService(), doInv.getMinReorderPeriodUnit().getId()); Integer dataValue = isFemale ? doInv.getFemaleMinReorderPeriodVal() : doInv.getMinReorderPeriodVal(); if(dataValue == null && unit == null) return null; DateTime[] dateTimes = calculateDateTimeRange(dataValue, unit); return listInvOrderedWithinMinReOrderPeriod(doInv.getId(),dateTimes[0] , dateTimes[1], patient, dataValue, unit, assembleCategory(doInv.getInvestigationIndex().getCategory()), parentId);//WDEV-16580, WDEV-16762 }