Java 类ims.ocrr.vo.lookups.InvestigationStatusChangeReason 实例源码

项目:AvoinApotti    文件:OrderSummaryCatsImpl.java   
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
    super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);

    //send the message where relevant
    String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvAppts = getDomainFactory().find(hql);

    if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
    {
        Iterator<?> it = doOrdInvAppts.iterator();
        while(it.hasNext())
        {
            OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

            OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
            impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));   
        }
    }
}
项目:openMAXIMS    文件:OrderSummaryCatsImpl.java   
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
    super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);

    //send the message where relevant
    String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvAppts = getDomainFactory().find(hql);

    if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
    {
        Iterator<?> it = doOrdInvAppts.iterator();
        while(it.hasNext())
        {
            OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

            OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
            impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));   
        }
    }
}
项目:openMAXIMS    文件:OrderSummaryCatsImpl.java   
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
    super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);

    //send the message where relevant
    String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvAppts = getDomainFactory().find(hql);

    if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
    {
        Iterator<?> it = doOrdInvAppts.iterator();
        while(it.hasNext())
        {
            OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

            OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
            impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));   
        }
    }
}
项目:openmaxims-linux    文件:OrderSummaryCatsImpl.java   
/**
* cancelOrderInvestigations and generateOrderCanceEvent where applicable
*/
@Override
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason cancelReason, String cancelReasonComment) throws StaleObjectException, ForeignKeyViolationException
{
    super.cancelOrderInvestigations(patient, collOrderInvestigation, cancelReason, cancelReasonComment);

    //send the message where relevant
    String hql = "select ordInvAppt from OrderInvAppt as ordInvAppt where ordInvAppt.orderInvestigation.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvAppts = getDomainFactory().find(hql);

    if(doOrdInvAppts != null && doOrdInvAppts.size() > 0)
    {
        Iterator<?> it = doOrdInvAppts.iterator();
        while(it.hasNext())
        {
            OrderInvAppt doOrderInvAppt = (OrderInvAppt) it.next();

            OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
            impl.generateOrderCancelEvent(new Booking_AppointmentRefVo(doOrderInvAppt.getAppointment().getId(), doOrderInvAppt.getAppointment().getVersion()), new OrderInvestigationRefVo(doOrderInvAppt.getOrderInvestigation().getId(), doOrderInvAppt.getOrderInvestigation().getVersion()));   
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
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
}
项目:AvoinApotti    文件:OrderSummaryImpl.java   
/**
 * for each orderinv set the status to CANCEL_REQUEST and where it has
 * an orderinvappt record call generateOrderCancelEvent 
 */
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason changeReason, String comment) throws StaleObjectException, ForeignKeyViolationException
{
    if(collOrderInvestigation == null || collOrderInvestigation.size() == 0)
        throw new CodingRuntimeException("collOrderInvestigation is null or empty in method generateOrderCancelEvent");

    DomainFactory factory = getDomainFactory();
    String hql = "from OrderInvestigation ordInv where ordInv.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvs = factory.find(hql);

    // Hash map with containers to be modified
    HashMap<OrderSpecimenContainer, ArrayList<Container>> containersToBeModified = new HashMap<OrderSpecimenContainer, ArrayList<Container>>(); 

    if(doOrdInvs != null && doOrdInvs.size() > 0)
    {
        Iterator<?> it = doOrdInvs.iterator();
        while(it.hasNext())
        {
            //WDEV-5740
            OrderInvestigation doOrderInv = (OrderInvestigation) it.next();
            OrderedInvestigationStatus status = new OrderedInvestigationStatus();
            status.setOrdInvStatus(getDomLookup(OrderInvStatus.CANCEL_REQUEST));
            status.setChangeDateTime(new java.util.Date());
            status.setProcessedDateTime(new java.util.Date());
            status.setStatusReason("OrderInvestigation Cancelled from UI " + "Comment: " + comment);
            status.setChangeUser(getHcpLiteUser() != null ? ((HcpLiteVo)getHcpLiteUser()).getIMosName() : null );
            status.setStatusChangeReason(getDomLookup(changeReason));
            doOrderInv.setOrdInvCurrentStatus(status);
            doOrderInv.getOrdInvStatusHistory().add(status);

            //WDEV-13430
            setWasProcessed(doOrderInv);

            storeCancelledContainers(containersToBeModified, patient, doOrderInv);

            factory.save(doOrderInv);
        }
    }

    updateOrderSpecimenContainers(containersToBeModified);

    //WDEV-12898 for each order investigation get its specimen and then in turn any corresponding specimenworklistitem's and update the status to cancelled if all invs for that specimen are cancelled
    updateSpecimenWorkListItems(doOrdInvs);
    updateSpecimenWorkListItemsForDFT(doOrdInvs);
}
项目:openMAXIMS    文件:OrderSummaryImpl.java   
/**
 * for each orderinv set the status to CANCEL_REQUEST and where it has
 * an orderinvappt record call generateOrderCancelEvent 
 */
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason changeReason, String comment) throws StaleObjectException, ForeignKeyViolationException
{
    if(collOrderInvestigation == null || collOrderInvestigation.size() == 0)
        throw new CodingRuntimeException("collOrderInvestigation is null or empty in method generateOrderCancelEvent");

    DomainFactory factory = getDomainFactory();
    String hql = "from OrderInvestigation ordInv where ordInv.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvs = factory.find(hql);

    // Hash map with containers to be modified
    HashMap<OrderSpecimenContainer, ArrayList<Container>> containersToBeModified = new HashMap<OrderSpecimenContainer, ArrayList<Container>>(); 

    if(doOrdInvs != null && doOrdInvs.size() > 0)
    {
        Iterator<?> it = doOrdInvs.iterator();
        while(it.hasNext())
        {
            //WDEV-5740
            OrderInvestigation doOrderInv = (OrderInvestigation) it.next();
            OrderedInvestigationStatus status = new OrderedInvestigationStatus();
            status.setOrdInvStatus(getDomLookup(OrderInvStatus.CANCEL_REQUEST));
            status.setChangeDateTime(new java.util.Date());
            status.setProcessedDateTime(new java.util.Date());
            status.setStatusReason("OrderInvestigation Cancelled from UI " + "Comment: " + comment);
            status.setChangeUser(getHcpLiteUser() != null ? ((HcpLiteVo)getHcpLiteUser()).getIMosName() : null );
            status.setStatusChangeReason(getDomLookup(changeReason));
            doOrderInv.setOrdInvCurrentStatus(status);
            doOrderInv.getOrdInvStatusHistory().add(status);

            //WDEV-13430
            setWasProcessed(doOrderInv);

            storeCancelledContainers(containersToBeModified, patient, doOrderInv);

            factory.save(doOrderInv);
        }
    }

    updateOrderSpecimenContainers(containersToBeModified);

    //WDEV-12898 for each order investigation get its specimen and then in turn any corresponding specimenworklistitem's and update the status to cancelled if all invs for that specimen are cancelled
    updateSpecimenWorkListItems(doOrdInvs);
    updateSpecimenWorkListItemsForDFT(doOrdInvs);
}
项目:openMAXIMS    文件:Logic.java   
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
}
项目:openMAXIMS    文件:OrderSummaryImpl.java   
/**
 * for each orderinv set the status to CANCEL_REQUEST and where it has
 * an orderinvappt record call generateOrderCancelEvent 
 */
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason changeReason, String comment) throws StaleObjectException, ForeignKeyViolationException
{
    if(collOrderInvestigation == null || collOrderInvestigation.size() == 0)
        throw new CodingRuntimeException("collOrderInvestigation is null or empty in method generateOrderCancelEvent");

    DomainFactory factory = getDomainFactory();
    String hql = "from OrderInvestigation ordInv where ordInv.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvs = factory.find(hql);

    // Hash map with containers to be modified
    HashMap<OrderSpecimenContainer, ArrayList<Container>> containersToBeModified = new HashMap<OrderSpecimenContainer, ArrayList<Container>>(); 

    if(doOrdInvs != null && doOrdInvs.size() > 0)
    {
        Iterator<?> it = doOrdInvs.iterator();
        while(it.hasNext())
        {
            //WDEV-5740
            OrderInvestigation doOrderInv = (OrderInvestigation) it.next();
            OrderedInvestigationStatus status = new OrderedInvestigationStatus();
            status.setOrdInvStatus(getDomLookup(OrderInvStatus.CANCEL_REQUEST));
            status.setChangeDateTime(new java.util.Date());
            status.setProcessedDateTime(new java.util.Date());
            status.setStatusReason("OrderInvestigation Cancelled from UI " + "Comment: " + comment);
            status.setChangeUser(getHcpLiteUser() != null ? ((HcpLiteVo)getHcpLiteUser()).getIMosName() : null );
            status.setStatusChangeReason(getDomLookup(changeReason));
            doOrderInv.setOrdInvCurrentStatus(status);
            doOrderInv.getOrdInvStatusHistory().add(status);

            //WDEV-13430
            setWasProcessed(doOrderInv);

            storeCancelledContainers(containersToBeModified, patient, doOrderInv);

            factory.save(doOrderInv);
        }
    }

    updateOrderSpecimenContainers(containersToBeModified);

    //WDEV-12898 for each order investigation get its specimen and then in turn any corresponding specimenworklistitem's and update the status to cancelled if all invs for that specimen are cancelled
    updateSpecimenWorkListItems(doOrdInvs);
    updateSpecimenWorkListItemsForDFT(doOrdInvs);
}
项目:openmaxims-linux    文件:Logic.java   
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
}
项目:openmaxims-linux    文件:OrderSummaryImpl.java   
/**
 * for each orderinv set the status to CANCEL_REQUEST and where it has
 * an orderinvappt record call generateOrderCancelEvent 
 */
public void cancelOrderInvestigations(PatientShort patient, OrderInvestigationRefVoCollection collOrderInvestigation, InvestigationStatusChangeReason changeReason, String comment) throws StaleObjectException, ForeignKeyViolationException
{
    if(collOrderInvestigation == null || collOrderInvestigation.size() == 0)
        throw new CodingRuntimeException("collOrderInvestigation is null or empty in method generateOrderCancelEvent");

    DomainFactory factory = getDomainFactory();
    String hql = "from OrderInvestigation ordInv where ordInv.id in (" + getIdString(collOrderInvestigation) + ")";
    List<?> doOrdInvs = factory.find(hql);

    // Hash map with containers to be modified
    HashMap<OrderSpecimenContainer, ArrayList<Container>> containersToBeModified = new HashMap<OrderSpecimenContainer, ArrayList<Container>>(); 

    if(doOrdInvs != null && doOrdInvs.size() > 0)
    {
        Iterator<?> it = doOrdInvs.iterator();
        while(it.hasNext())
        {
            //WDEV-5740
            OrderInvestigation doOrderInv = (OrderInvestigation) it.next();
            OrderedInvestigationStatus status = new OrderedInvestigationStatus();
            status.setOrdInvStatus(getDomLookup(OrderInvStatus.CANCEL_REQUEST));
            status.setChangeDateTime(new java.util.Date());
            status.setProcessedDateTime(new java.util.Date());
            status.setStatusReason("OrderInvestigation Cancelled from UI " + "Comment: " + comment);
            status.setChangeUser(getHcpLiteUser() != null ? ((HcpLiteVo)getHcpLiteUser()).getIMosName() : null );
            status.setStatusChangeReason(getDomLookup(changeReason));
            doOrderInv.setOrdInvCurrentStatus(status);
            doOrderInv.getOrdInvStatusHistory().add(status);

            //WDEV-13430
            setWasProcessed(doOrderInv);

            storeCancelledContainers(containersToBeModified, patient, doOrderInv);

            factory.save(doOrderInv);
        }
    }

    updateOrderSpecimenContainers(containersToBeModified);

    //WDEV-12898 for each order investigation get its specimen and then in turn any corresponding specimenworklistitem's and update the status to cancelled if all invs for that specimen are cancelled
    updateSpecimenWorkListItems(doOrdInvs);
    updateSpecimenWorkListItemsForDFT(doOrdInvs);
}