private SpecimenWorkListItemVoCollection saveWorkListItems(DomainFactory factory, SpecimenWorkListItemVoCollection workListitems, HashMap objMap, ORDERSTATE state) throws StaleObjectException { if (workListitems == null) throw new CodingRuntimeException("No workListitems to save - method saveWorkListItems()"); List items = SpecimenWorkListItemVoAssembler.extractSpecimenWorkListItemList(factory, workListitems, null, objMap); Iterator it = items.iterator(); while (it.hasNext()) { SpecimenWorkListItem item = (SpecimenWorkListItem) it.next(); if(state.equals(ORDERSTATE.REQUESTING_AUTHORISATION)) item.setCollectionStatus(getDomLookup(ims.ocrr.vo.lookups.SpecimenCollectionStatus.AWAITING_AUTHORISATION)); factory.save(item); } workListitems = SpecimenWorkListItemVoAssembler.createSpecimenWorkListItemVoCollectionFromSpecimenWorkListItem(items); return workListitems; }
/** * For SpecimenWorklist items created for DFT investigation remove the OrderSpecimen entry */ private void processSpecimenWorklistItems(OcsOrderVo order, SpecimenWorkListItemVoCollection specimenWorklistItems) { if (specimenWorklistItems != null) { for (SpecimenWorkListItemVo specimen : specimenWorklistItems) { if (specimen.getDFTOrderInvestigation() != null) specimen.setSpecimen(null); } } }
private void placeOrder() { ORDERSTATE state = getOcsOrderAuthorisingState(); OcsOrderVo voOcsOrder = form.getLocalContext().getOcsOrder(); populateOrderInstanceData(voOcsOrder); String[] arrErrors = voOcsOrder.validate(validateOcsOrder(voOcsOrder)); if (arrErrors != null) { engine.showErrors(arrErrors); form.getLocalContext().setClosedRounds(null); form.getLocalContext().setWorkListItems(null); return; } SpecimenWorkListItemVoCollection workListItems = form.getLocalContext().getWorkListItems(); try { voOcsOrder = domain.saveOcsOrder(voOcsOrder, workListItems, state, form.getGlobalContext().RefMan.getCatsReferral(), form.getGlobalContext().Rotherham.getAppointmentToLink()); // WDEV-13999 // CARE UK project functionality ONLY if (CARE_UK_UI_ORDER.equals(ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue()) && form.getGlobalContext().OCRR.getOrderInvestigationToAmendIsNotNull()) { // When amending an investigation the appointment linked to it might be: // - cancelled if the modality for the investigation was changed from the one in the investigation to amend // - or associated with the new investigation instead of the old one changeInvestigationAppointment(voOcsOrder, form.getGlobalContext().OCRR.getOrderInvestigationToAmend()); OrderInvestigationForStatusChangeVo investigationToAmendStatus = domain.getOrderInvestigation(form.getGlobalContext().OCRR.getOrderInvestigationToAmend()); // Create new status for investigation to amend OrderedInvestigationStatusVo newStatus = new OrderedInvestigationStatusVo(); newStatus.setOrdInvStatus(OrderInvStatus.AMENDED); newStatus.setChangeDateTime(new DateTime()); newStatus.setChangeUser(engine.getLoggedInUser().getUserRealName() != null ? engine.getLoggedInUser().getUserRealName() : engine.getLoggedInUser().getUsername()); newStatus.setStatusChangeReason(InvestigationStatusChangeReason.AMENDED); newStatus.setStatusReason(InvestigationStatusChangeReason.AMENDED.getText()); newStatus.setProcessedDateTime(new DateTime()); // Set status investigationToAmendStatus.setOrdInvCurrentStatus(newStatus); if (!investigationToAmendStatus.getOrdInvStatusHistoryIsNotNull()) { investigationToAmendStatus.setOrdInvStatusHistory(new OrderedInvestigationStatusVoCollection()); } investigationToAmendStatus.getOrdInvStatusHistory().add(newStatus); domain.updateInvestigationStatus(investigationToAmendStatus); } if ((ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue().equals("CARE_UK") || ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue().equals("UKSH")) && form.getGlobalContext().RefMan.getCatsReferralIsNotNull()) // WDEV-11881 { domain.updateCatsReferralAdditionalInvStatus(form.getGlobalContext().RefMan.getCatsReferral()); } } catch (StaleObjectException e) { if (form.getGlobalContext().RefMan.getCatsReferral() != null) form.getGlobalContext().RefMan.setCatsReferral(domain.getCatsReferralListVo(form.getGlobalContext().RefMan.getCatsReferral()));// wdev-12864 engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.CANCEL); return; } processOrder(state, engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS), engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS), voOcsOrder); if (form.getGlobalContext().RefMan.getCatsReferral() != null) form.getGlobalContext().RefMan.setCatsReferral(domain.getCatsReferralListVo(form.getGlobalContext().RefMan.getCatsReferral()));// wdev-12864 }
private void placeOrder() { ORDERSTATE state = getOcsOrderAuthorisingState(); OcsOrderVo voOcsOrder = form.getLocalContext().getOcsOrder(); populateOrderInstanceData(voOcsOrder); String[] arrErrors = voOcsOrder.validate(validateOcsOrder(voOcsOrder)); if (arrErrors != null) { engine.showErrors(arrErrors); form.getLocalContext().setClosedRounds(null); form.getLocalContext().setWorkListItems(null); return; } SpecimenWorkListItemVoCollection workListItems = form.getLocalContext().getWorkListItems(); try { voOcsOrder = domain.saveOcsOrder(voOcsOrder, workListItems, state, form.getGlobalContext().CareUk.getCatsReferral(), form.getGlobalContext().Rotherham.getAppointmentToLink()); // WDEV-13999 // CARE UK project functionality ONLY if (CARE_UK_UI_ORDER.equals(ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue()) && form.getGlobalContext().OCRR.getOrderInvestigationToAmendIsNotNull()) { // When amending an investigation the appointment linked to it might be: // - cancelled if the modality for the investigation was changed from the one in the investigation to amend // - or associated with the new investigation instead of the old one changeInvestigationAppointment(voOcsOrder, form.getGlobalContext().OCRR.getOrderInvestigationToAmend()); OrderInvestigationForStatusChangeVo investigationToAmendStatus = domain.getOrderInvestigation(form.getGlobalContext().OCRR.getOrderInvestigationToAmend()); // Create new status for investigation to amend OrderedInvestigationStatusVo newStatus = new OrderedInvestigationStatusVo(); newStatus.setOrdInvStatus(OrderInvStatus.AMENDED); newStatus.setChangeDateTime(new DateTime()); newStatus.setChangeUser(engine.getLoggedInUser().getUserRealName() != null ? engine.getLoggedInUser().getUserRealName() : engine.getLoggedInUser().getUsername()); newStatus.setStatusChangeReason(InvestigationStatusChangeReason.AMENDED); newStatus.setStatusReason(InvestigationStatusChangeReason.AMENDED.getText()); newStatus.setProcessedDateTime(new DateTime()); // Set status investigationToAmendStatus.setOrdInvCurrentStatus(newStatus); if (!investigationToAmendStatus.getOrdInvStatusHistoryIsNotNull()) { investigationToAmendStatus.setOrdInvStatusHistory(new OrderedInvestigationStatusVoCollection()); } investigationToAmendStatus.getOrdInvStatusHistory().add(newStatus); domain.updateInvestigationStatus(investigationToAmendStatus); } if ((ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue().equals("CARE_UK") || ConfigFlag.UI.ORDER_ENTRY_UI_TYPE.getValue().equals("UKSH")) && form.getGlobalContext().CareUk.getCatsReferralIsNotNull()) // WDEV-11881 { domain.updateCatsReferralAdditionalInvStatus(form.getGlobalContext().CareUk.getCatsReferral()); } } catch (StaleObjectException e) { if (form.getGlobalContext().CareUk.getCatsReferral() != null) form.getGlobalContext().CareUk.setCatsReferral(domain.getCatsReferralListVo(form.getGlobalContext().CareUk.getCatsReferral()));// wdev-12864 engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.CANCEL); return; } processOrder(state, engine.hasRight(AppRight.CAN_AUTHORIZE_CLINICAL_IMAGING_ORDERS), engine.hasRight(AppRight.CAN_AUTHORIZE_PATHOLOGY_ORDERS), voOcsOrder); if (form.getGlobalContext().CareUk.getCatsReferral() != null) form.getGlobalContext().CareUk.setCatsReferral(domain.getCatsReferralListVo(form.getGlobalContext().CareUk.getCatsReferral()));// wdev-12864 }