private String buildReOrderMessage(ReOrderPeriodMessageVoCollection voCollMessages) { if(voCollMessages == null) return null; StringBuilder message = new StringBuilder(); for(ReOrderPeriodMessageVo item : voCollMessages) { message.append("The minimum re-order period for '").append(item.getItemName()).append("' is '").append(item.getAmount()); message.append(" ").append(item.getUnit().getText()).append("'").append("\rThis item was last ordered for this patient on "); message.append(item.getRequiredByDate() != null ? item.getRequiredByDate().getDate().toString() : item.getOrderedDateTime().getDate().toString()); message.append(" at ").append(item.getRequiredByDate() != null ? item.getRequiredByDate().getTime().toString() : item.getOrderedDateTime().getTime().toString()); message.append(".").append("\rDo you still wish to order this item?"); if(voCollMessages.size() > 1) message.append("\r\r"); } return message.toString(); }
private InvestigationRefVoCollection removeFromRefusedInvestigation() { ReOrderPeriodMessageVoCollection voCollMessages = form.getGlobalContext().OCRR.getYesNoDialogWithReasonMessage(); if(voCollMessages == null || voCollMessages.size() == 0) return null; InvestigationRefVoCollection invColl = form.getGlobalContext().OCRR.getRefusedInvestigation(); if(invColl == null) return null; for(ReOrderPeriodMessageVo item : voCollMessages) { if(item == null || item.getInvestigationId() == null) continue; removeComponentFromRefusedInvestigations(item.getInvestigationId()); } return invColl; }
private boolean itemIdIsInRefusedList(ReOrderPeriodMessageVo reOrderPeriodMessageVo) { if(reOrderPeriodMessageVo == null || reOrderPeriodMessageVo.getInvestigationId() == null) return false; InvestigationRefVoCollection refusedInv = form.getGlobalContext().OCRR.getRefusedInvestigation(); if(refusedInv == null || refusedInv.size() == 0) return false; for(InvestigationRefVo inv : refusedInv) { if(inv == null) continue; if(inv.getID_Investigation().equals(reOrderPeriodMessageVo.getInvestigationId()) || inv.getID_Investigation().equals(reOrderPeriodMessageVo.getParentId())) 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; }