public OrderInvestigationForStatusChangeVo getOrderInvestigation(OrderInvestigationRefVo investigation) { if (investigation == null) throw new CodingRuntimeException("Error - Investigation to amend must not be null"); return OrderInvestigationForStatusChangeVoAssembler.create((OrderInvestigation) getDomainFactory().getDomainObject(OrderInvestigation.class, investigation.getID_OrderInvestigation())); }
public OrderInvestigationLiteVo updateInvestigationStatus(OrderInvestigationForStatusChangeVo investigation) throws StaleObjectException { if (investigation == null) throw new CodingRuntimeException("Error - Can not update the status for a null investigation"); OrderInvestigation domInvestigation = OrderInvestigationForStatusChangeVoAssembler.extractOrderInvestigation(getDomainFactory(), investigation); getDomainFactory().save(domInvestigation); return OrderInvestigationLiteVoAssembler.create(domInvestigation); }
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 }