private void populateGridFromData(OrderedInvestigationStatusVoCollection collStatus) { form.grdHistory().getRows().clear(); for(int i=0;i<collStatus.size();i++) { OrderedInvestigationStatusVo status = collStatus.get(i); GenForm.grdHistoryRow row = form.grdHistory().getRows().newRow(); if(status.getChangeDateTimeIsNotNull()) row.setColDateTime(status.getChangeDateTime().toString()); if(status.getProcessedDateTimeIsNotNull()) row.setprocessedDateTime(status.getProcessedDateTime().toString()); row.setColUser(status.getChangeUser()); row.setColStatus(getStatusText( status.getOrdInvStatus())); if(status.getOrdInvStatus().equals(OrderInvStatus.CANCEL_REQUEST)){ if(status.getStatusChangeReasonIsNotNull()) row.setColReason(status.getStatusChangeReason().toString()); } else row.setColReason(status.getStatusReason()); row.setTooltipForColReason(status.getStatusReason()); } }
private boolean isInvestigationCompletedOrResulted(OrderInvestigationListVo inv) { if (inv!=null&&inv.getOrdInvStatusHistoryIsNotNull()) { for (OrderedInvestigationStatusVo status : inv.getOrdInvStatusHistory()) { if(status.getOrdInvStatusIsNotNull() &&(OrderInvStatus.NEW_RESULT.equals(status.getOrdInvStatus()) ||OrderInvStatus.UPDATED_RESULT.equals(status.getOrdInvStatus()) ||OrderInvStatus.RESULTED.equals(status.getOrdInvStatus()) ||OrderInvStatus.COMPLETE.equals(status.getOrdInvStatus()))) { return true; } } } return false; }
private String generateStatusTooltip(OrderedInvestigationStatusVo ordInvCurrentStatus) { if (ordInvCurrentStatus != null && ordInvCurrentStatus.getOrdInvStatus() != null) { StringBuffer sb = new StringBuffer(); sb.append("<b>Current status: </b>" + ordInvCurrentStatus.getOrdInvStatus().getText()); if (ordInvCurrentStatus.getStatusReason() != null && ordInvCurrentStatus.getStatusReason().length() > 0 && ordInvCurrentStatus.getOrdInvStatus().equals(OrderInvStatus.CANCELLED)) sb.append("<br><b>Current status reason: </b>" + ordInvCurrentStatus.getStatusReason()); sb.append("<br><b>Date changed: </b>" + ordInvCurrentStatus.getChangeDateTime()); sb.append("<br><b>Changed by: </b>" + (ordInvCurrentStatus.getChangeUserIsNotNull() ? ordInvCurrentStatus.getChangeUser().toString() : "")); return sb.toString(); } return null; }
private String generateStatusTooltip(OrderedInvestigationStatusVo status) { if (status != null && status.getOrdInvStatus() != null) { StringBuffer sb = new StringBuffer(); sb.append("<b>Current status: </b>" + status.getOrdInvStatus().getText()); if (status.getStatusReason() != null && status.getStatusReason().length() > 0 && status.getOrdInvStatus().equals(OrderInvStatus.CANCELLED)) sb.append("<br><b>Current status reason: </b>" + status.getStatusReason()); sb.append("<br><b>Date changed: </b>" + status.getChangeDateTime()); sb.append("<br><b>Changed by: </b>" + (status.getChangeUserIsNotNull() ? status.getChangeUser().toString() : "")); return sb.toString(); } return 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 }
/** * Function used to cancel the appointment / or associate with the new investigation (or first investigation in order if multiple are selected for order) */ private void changeInvestigationAppointment(OcsOrderVo newOrder, OrderInvestigationLiteVo investigationToAmend) throws StaleObjectException { // Get appointment linked to order investigation if any OrderInvWithStatusApptVo orderInvAppointment = domain.getOrderInvestigationAppointment(investigationToAmend); // Check for OrderInvestigationAppointment record if (orderInvAppointment == null) return; // Get appointment Booking_AppointmentVo appointment = orderInvAppointment.getAppointment(); // Check for appointment record if (appointment == null) return; // Check if the modality was changed for the investigation to be amended if (hasModalityChanged(newOrder, investigationToAmend)) { // Check current status of the appointment - see if it was cancelled already // If the appointment wasn't cancelled - cancel it now if (!Status_Reason.CANCELLED.equals(appointment.getApptStatus())) { cancelAppointment(appointment); // OK to do this as this function should only be called in CARE UK project domain.updateCatsReferralCancelStatus(form.getGlobalContext().RefMan.getCatsReferral()); } } else { // Update investigation - with first investigation, else if (newOrder.getInvestigationsIsNotNull() && newOrder.getInvestigations().size() > 0) { OrderInvestigationBookingWithStatusVo orderInvestigationBooking = domain.getOrderInvestigationBooking(newOrder.getInvestigations().get(0)); orderInvestigationBooking.setAppointmentDate(new DateTime(appointment.getAppointmentDate(), appointment.getApptStartTime())); orderInvestigationBooking.setDisplayDateTime(new DateTime(appointment.getAppointmentDate(), appointment.getApptStartTime())); orderInvAppointment.setOrderInvestigation(orderInvestigationBooking); // Remove AppointmentDate and AppointmentTime from investigationToAmend investigationToAmend.setAppointmentDate(null); // Create status OrderedInvestigationStatusVo status = new OrderedInvestigationStatusVo(); status.setChangeDateTime(new DateTime()); status.setChangeUser(domain.getHcpLiteUser() != null ? ((HcpLiteVo) domain.getHcpLiteUser()).getIMosName() : null); status.setProcessedDateTime(new DateTime()); status.setOrdInvStatus(OrderInvStatus.ORDERED); orderInvestigationBooking.setOrdInvCurrentStatus(status); if (orderInvestigationBooking.getOrdInvStatusHistory() == null) orderInvestigationBooking.setOrdInvStatusHistory(new OrderedInvestigationStatusVoCollection()); orderInvestigationBooking.getOrdInvStatusHistory().add(status); } orderInvAppointment.validate(); domain.updateOrderInvestigationAppointment(orderInvAppointment, investigationToAmend); } }
/** * Function used to cancel the appointment / or associate with the new investigation (or first investigation in order if multiple are selected for order) * @throws DomainInterfaceException */ private void changeInvestigationAppointment(OcsOrderVo newOrder, OrderInvestigationLiteVo investigationToAmend) throws StaleObjectException, DomainInterfaceException { // Get appointment linked to order investigation if any OrderInvWithStatusApptVo orderInvAppointment = domain.getOrderInvestigationAppointment(investigationToAmend); // Check for OrderInvestigationAppointment record if (orderInvAppointment == null) return; // Get appointment Booking_AppointmentVo appointment = orderInvAppointment.getAppointment(); // Check for appointment record if (appointment == null) return; // Check if the modality was changed for the investigation to be amended if (hasModalityChanged(newOrder, investigationToAmend)) { // Check current status of the appointment - see if it was cancelled already // If the appointment wasn't cancelled - cancel it now if (!Status_Reason.CANCELLED.equals(appointment.getApptStatus())) { cancelAppointment(appointment); } } else { // Update investigation - with first investigation, else if (newOrder.getInvestigationsIsNotNull() && newOrder.getInvestigations().size() > 0) { OrderInvestigationBookingWithStatusVo orderInvestigationBooking = domain.getOrderInvestigationBooking(newOrder.getInvestigations().get(0)); orderInvestigationBooking.setAppointmentDate(new DateTime(appointment.getAppointmentDate(), appointment.getApptStartTime())); orderInvestigationBooking.setDisplayDateTime(new DateTime(appointment.getAppointmentDate(), appointment.getApptStartTime())); orderInvAppointment.setOrderInvestigation(orderInvestigationBooking); // Remove AppointmentDate and AppointmentTime from investigationToAmend investigationToAmend.setAppointmentDate(null); // Create status OrderedInvestigationStatusVo status = new OrderedInvestigationStatusVo(); status.setChangeDateTime(new DateTime()); status.setChangeUser(domain.getHcpLiteUser() != null ? ((HcpLiteVo) domain.getHcpLiteUser()).getIMosName() : null); status.setProcessedDateTime(new DateTime()); status.setOrdInvStatus(OrderInvStatus.ORDERED); orderInvestigationBooking.setOrdInvCurrentStatus(status); if (orderInvestigationBooking.getOrdInvStatusHistory() == null) orderInvestigationBooking.setOrdInvStatusHistory(new OrderedInvestigationStatusVoCollection()); orderInvestigationBooking.getOrdInvStatusHistory().add(status); } orderInvAppointment.validate(); domain.updateOrderInvestigationAppointment(orderInvAppointment, investigationToAmend); } }
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 }
/** * Function used to cancel the appointment / or associate with the new investigation (or first investigation in order if multiple are selected for order) */ private void changeInvestigationAppointment(OcsOrderVo newOrder, OrderInvestigationLiteVo investigationToAmend) throws StaleObjectException { // Get appointment linked to order investigation if any OrderInvWithStatusApptVo orderInvAppointment = domain.getOrderInvestigationAppointment(investigationToAmend); // Check for OrderInvestigationAppointment record if (orderInvAppointment == null) return; // Get appointment Booking_AppointmentVo appointment = orderInvAppointment.getAppointment(); // Check for appointment record if (appointment == null) return; // Check if the modality was changed for the investigation to be amended if (hasModalityChanged(newOrder, investigationToAmend)) { // Check current status of the appointment - see if it was cancelled already // If the appointment wasn't cancelled - cancel it now if (!Status_Reason.CANCELLED.equals(appointment.getApptStatus())) { cancelAppointment(appointment); // OK to do this as this function should only be called in CARE UK project domain.updateCatsReferralCancelStatus(form.getGlobalContext().CareUk.getCatsReferral()); } } else { // Update investigation - with first investigation, else if (newOrder.getInvestigationsIsNotNull() && newOrder.getInvestigations().size() > 0) { OrderInvestigationBookingWithStatusVo orderInvestigationBooking = domain.getOrderInvestigationBooking(newOrder.getInvestigations().get(0)); orderInvestigationBooking.setAppointmentDate(new DateTime(appointment.getAppointmentDate(), appointment.getApptStartTime())); orderInvestigationBooking.setDisplayDateTime(new DateTime(appointment.getAppointmentDate(), appointment.getApptStartTime())); orderInvAppointment.setOrderInvestigation(orderInvestigationBooking); // Remove AppointmentDate and AppointmentTime from investigationToAmend investigationToAmend.setAppointmentDate(null); // Create status OrderedInvestigationStatusVo status = new OrderedInvestigationStatusVo(); status.setChangeDateTime(new DateTime()); status.setChangeUser(domain.getHcpLiteUser() != null ? ((HcpLiteVo) domain.getHcpLiteUser()).getIMosName() : null); status.setProcessedDateTime(new DateTime()); status.setOrdInvStatus(OrderInvStatus.ORDERED); orderInvestigationBooking.setOrdInvCurrentStatus(status); if (orderInvestigationBooking.getOrdInvStatusHistory() == null) orderInvestigationBooking.setOrdInvStatusHistory(new OrderedInvestigationStatusVoCollection()); orderInvestigationBooking.getOrdInvStatusHistory().add(status); } orderInvAppointment.validate(); domain.updateOrderInvestigationAppointment(orderInvAppointment, investigationToAmend); } }