Java 类ims.core.vo.lookups.ReferralManagementContractType 实例源码

项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnAcceptClick() throws PresentationLogicException 
{
    if (form.getGlobalContext().RefMan.getReferralContractTypeForPatientIsNotNull() 
        && ! form.getGlobalContext().RefMan.getReferralContractTypeForPatient().equals(ReferralManagementContractType.REFERRALTRIAGE))
    {
        acceptReferral(null);
        open();
    }
    else
    {
        if (form.getLocalContext().getSelectedRecordIsNotNull()
            && form.getLocalContext().getSelectedRecord().getReferralDetailsIsNotNull()
            && form.getLocalContext().getSelectedRecord().getReferralDetails().getServiceIsNotNull())
            form.getLocalContext().setChangeServiceMessageBoxID(engine.showMessage("Do you need to change the Service from - '" + form.getLocalContext().getSelectedRecord().getReferralDetails().getService().getServiceName() + "' to some other Service ?", "Change Service", MessageButtons.YESNO));
    }
}
项目:AvoinApotti    文件:Logic.java   
@Override
protected void onBtnAcceptClick() throws PresentationLogicException 
{
    if (form.getGlobalContext().RefMan.getReferralContractTypeForPatientIsNotNull() 
        && ! form.getGlobalContext().RefMan.getReferralContractTypeForPatient().equals(ReferralManagementContractType.REFERRALTRIAGE))
        acceptReferral();
    else
    {
        if (form.getLocalContext().getSelectedRecordIsNotNull()
            && form.getLocalContext().getSelectedRecord().getReferralDetailsIsNotNull()
            && form.getLocalContext().getSelectedRecord().getReferralDetails().getServiceIsNotNull())
            form.getLocalContext().setChangeServiceMessageBoxID(engine.showMessage("Do you need to change the Service from - '" + form.getLocalContext().getSelectedRecord().getReferralDetails().getService().getServiceName() + "' to some other Service ?", "Change Service", MessageButtons.YESNO));
    }
}
项目:AvoinApotti    文件:Logic.java   
private void populateListControls(ContractConfigShortVoCollection records)
{
    clear();
    if (records == null || records.size()==0)
        return;
    for (int i = 0 ; i<records.size() ; i++)
    {
        ContractConfigShortVo record = records.get(i);
        if (record == null)
            continue;
        grdDetailsRow newRow = form.grdDetails().getRows().newRow();
        newRow.setColumnID(record.getContractId());
        newRow.setColumnName(record.getContractName());
        newRow.setColumnOrganisation(record.getContractOrganisationIsNotNull()?record.getContractOrganisation().getName():null);
        newRow.setColumnStatus(record.getStatus());
        newRow.setColumnRTT(record.getDaysToRTTBreachDate());
        //wdev-12676
        if(record.getContractTypeIsNotNull() && record.getContractType().equals(ReferralManagementContractType.DIAGNOSTIC))
            newRow.setColumnType(form.getImages().Clinical.PatientWithDiagnosticServices16);
        else if(record.getContractTypeIsNotNull() && record.getContractType().equals(ReferralManagementContractType.NONDIAGNOSTIC))
            newRow.setColumnType(form.getImages().Clinical.PatientSeenByConsultant16);
        else
            newRow.setColumnType(null);
        //-----------
        newRow.setValue(record);
    }
}
项目:AvoinApotti    文件:RefManHL7Helper.java   
public Boolean isReferralDiagnostic(Integer nBookingId)
{
    DomainFactory factory = getDomainFactory();
    List contractId = factory.find("select cont.contractType.id from CatsReferral as cats left join cats.appointments as bk left join cats.contract as cont where (bk.id = '" + nBookingId + "')");
    if (contractId.size() > 0&&ReferralManagementContractType.DIAGNOSTIC.getId()==((Integer)contractId.get(0)).intValue())
        return true;
    else
        return false;
}
项目:AvoinApotti    文件:BookAppointmentImpl.java   
private boolean isNonDiagnosticAppointment(CatsReferral catsReferral)
{
    if(catsReferral != null && catsReferral.getDOS() != null && catsReferral.getDOS().getContract() != null && catsReferral.getDOS().getContract().getContractType() != null)
    {
        if(ReferralManagementContractType.DIAGNOSTIC.getID() == catsReferral.getDOS().getContract().getContractType().getId())
            return false;
    }

    return true;
}
项目:AvoinApotti    文件:ReferralStatusListImpl.java   
public Boolean isThereAnyDiagnosticContractsForThisSite(OrganisationRefVo voOrg) 
{
    String hql = "from ContractConfig as cc where (cc.contractOrganisation.id = :orgID and cc.status = :actCC and cc.isRIE is null and cc.contractType = :DiagContra) ";
    List<?> dos = getDomainFactory().find(hql,new String[]{"orgID", "actCC", "DiagContra"},new Object[]{voOrg.getID_Organisation(), getDomLookup(PreActiveActiveInactiveStatus.ACTIVE), getDomLookup(ReferralManagementContractType.DIAGNOSTIC)});
    if (dos == null || dos.size() == 0)
        return Boolean.FALSE;
    else
        return Boolean.TRUE;
}
项目:AvoinApotti    文件:ExternalEventsImpl.java   
public void acceptReferralFromInvestigation(IfOrderInvestigationVo inv) throws DomainInterfaceException, StaleObjectException
{
    if (inv==null)
        throw new DomainInterfaceException("Cannot accept referral for NULL investigation");
    if(inv.getID_OrderInvestigation()==null)
        throw new DomainInterfaceException("Cannot accept referral investigation with NULL ID");

    DomainFactory factory = getDomainFactory();
    String hql="select c1_1 from CatsReferral as c1_1 left join c1_1.investigationOrders as o1_1 left join o1_1.investigations as o2_1 "+
    "where o2_1.id = :invID";
    List<Object> resultSet = factory.find(hql,new String[]{"invID"},new Object[]{inv.getID_OrderInvestigation()});
    for (Object result : resultSet) // There should only be one but lets do them all!
    {
        CatsReferral referral = (CatsReferral)result;
        //http://jira/browse/WDEV-12682
        if(referral.getContract()!=null&& referral.getContract().getContractType()!=null &&
                referral.getContract().getContractType().equals(getDomLookup(ReferralManagementContractType.DIAGNOSTIC)))
        {
            CATSReferralStatus status = new CATSReferralStatus();
            status.setStatusDateTime(new Date());
            status.setComment("Status updated from HL7 accept message");
            status.setReferralStatus(getDomLookup(ReferralApptStatus.REFERRAL_ACCEPTED));
            referral.setCurrentStatus(status);
            referral.getStatusHistory().add(status);
            factory.save(referral);
        }
    }

}
项目:openMAXIMS    文件:AppointmentOutcomeDialogImpl.java   
private boolean isNonDiagnosticAppointment(CatsReferralForRequestServiceVo record)
{
    if(record != null && record.getDOS() != null && record.getDOS().getContract() != null && record.getDOS().getContract().getContractType() != null)
    {
        if(ReferralManagementContractType.DIAGNOSTIC.getID() == record.getDOS().getContract().getContractType().getId())
            return false;
    }

    return true;
}
项目:openMAXIMS    文件:ReferralTriageImpl.java   
private boolean contactIsNotDiagnosticOrDiagnosticTriage(ContractConfigForReferralDetailsComponentVo value)
{
    if(value == null)
        return false;

    if(ReferralManagementContractType.DIAGNOSTIC.equals(value.getContractType()) || ReferralManagementContractType.DIAGNOSTICTRIAGE.equals(value.getContractType()))
        return false;

    return true;
}
项目:openMAXIMS    文件:Logic.java   
private void populateListControls(ContractConfigShortVoCollection records)
{
    clear();
    if (records == null || records.size()==0)
        return;
    for (int i = 0 ; i<records.size() ; i++)
    {
        ContractConfigShortVo record = records.get(i);
        if (record == null)
            continue;
        grdDetailsRow newRow = form.grdDetails().getRows().newRow();
        newRow.setColumnID(record.getContractId());
        newRow.setColumnName(record.getContractName());
        newRow.setColumnOrganisation(record.getContractOrganisationIsNotNull()?record.getContractOrganisation().getName():null);
        newRow.setColumnStatus(record.getStatus());
        newRow.setColumnRTT(record.getDaysToRTTBreachDate());
        //wdev-12676
        if(record.getContractTypeIsNotNull() && record.getContractType().equals(ReferralManagementContractType.DIAGNOSTIC))
            newRow.setColumnType(form.getImages().Clinical.PatientWithDiagnosticServices16);
        else if(record.getContractTypeIsNotNull() && record.getContractType().equals(ReferralManagementContractType.NONDIAGNOSTIC))
            newRow.setColumnType(form.getImages().Clinical.PatientSeenByConsultant16);
        else
            newRow.setColumnType(null);
        //-----------
        newRow.setValue(record);
    }
}
项目:openMAXIMS    文件:Logic.java   
private boolean contactIsNotDiagnosticOrDiagnosticTriage(ContractConfigForReferralDetailsComponentVo value)
{
    if(value == null)
        return false;

    if(ReferralManagementContractType.DIAGNOSTIC.equals(value.getContractType()) || ReferralManagementContractType.DIAGNOSTICTRIAGE.equals(value.getContractType()))
        return false;

    return true;
}
项目:openMAXIMS    文件:RefManHL7Helper.java   
public Boolean isReferralDiagnostic(Integer nBookingId)
{
    DomainFactory factory = getDomainFactory();
    List contractId = factory.find("select cont.contractType.id from CatsReferral as cats left join cats.appointments as bk left join cats.contract as cont where (bk.id = '" + nBookingId + "')");
    if (contractId.size() > 0&&ReferralManagementContractType.DIAGNOSTIC.getId()==((Integer)contractId.get(0)).intValue())
        return true;
    else
        return false;
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
private boolean isNonDiagnosticAppointment(CatsReferral catsReferral)
{
    if(catsReferral != null && catsReferral.getDOS() != null && catsReferral.getDOS().getContract() != null && catsReferral.getDOS().getContract().getContractType() != null)
    {
        if(ReferralManagementContractType.DIAGNOSTIC.getID() == catsReferral.getDOS().getContract().getContractType().getId())
            return false;
    }

    return true;
}
项目:openMAXIMS    文件:ReferralStatusListImpl.java   
public Boolean isThereAnyDiagnosticContractsForThisSite(OrganisationRefVo voOrg) 
{
    String hql = "from ContractConfig as cc where (cc.contractOrganisation.id = :orgID and cc.status = :actCC and cc.isRIE is null and cc.contractType = :DiagContra) ";
    List<?> dos = getDomainFactory().find(hql,new String[]{"orgID", "actCC", "DiagContra"},new Object[]{voOrg.getID_Organisation(), getDomLookup(PreActiveActiveInactiveStatus.ACTIVE), getDomLookup(ReferralManagementContractType.DIAGNOSTIC)});
    if (dos == null || dos.size() == 0)
        return Boolean.FALSE;
    else
        return Boolean.TRUE;
}
项目:openMAXIMS    文件:ReferralWizardImpl.java   
private boolean isNonDiagnosticAppointment(CatsReferralWizardVo record)
{
    if(record != null && record.getDOS() != null && record.getDOS().getContract() != null && record.getDOS().getContract().getContractType() != null)
    {
        if(ReferralManagementContractType.DIAGNOSTIC.getID() == record.getDOS().getContract().getContractType().getId())
            return false;
    }

    return true;
}
项目:openMAXIMS    文件:ExternalEventsImpl.java   
public void acceptReferralFromInvestigation(IfOrderInvestigationVo inv) throws DomainInterfaceException, StaleObjectException
{
    if (inv==null)
        throw new DomainInterfaceException("Cannot accept referral for NULL investigation");
    if(inv.getID_OrderInvestigation()==null)
        throw new DomainInterfaceException("Cannot accept referral investigation with NULL ID");

    DomainFactory factory = getDomainFactory();
    String hql="select c1_1 from CatsReferral as c1_1 left join c1_1.investigationOrders as o1_1 left join o1_1.investigations as o2_1 "+
    "where o2_1.id = :invID";
    List<Object> resultSet = factory.find(hql,new String[]{"invID"},new Object[]{inv.getID_OrderInvestigation()});
    for (Object result : resultSet) // There should only be one but lets do them all!
    {
        CatsReferral referral = (CatsReferral)result;
        //http://jira/browse/WDEV-12682
        if(referral.getContract()!=null&& referral.getContract().getContractType()!=null &&
                referral.getContract().getContractType().equals(getDomLookup(ReferralManagementContractType.DIAGNOSTIC)))
        {
            CATSReferralStatus status = new CATSReferralStatus();
            status.setStatusDateTime(new Date());
            status.setComment("Status updated from HL7 accept message");
            status.setReferralStatus(getDomLookup(ReferralApptStatus.REFERRAL_ACCEPTED));
            referral.setCurrentStatus(status);
            referral.getStatusHistory().add(status);
            factory.save(referral);
        }
    }

}
项目:openMAXIMS    文件:Logic.java   
@Override
protected void onBtnAcceptClick() throws PresentationLogicException 
{
    if (form.getGlobalContext().RefMan.getReferralContractTypeForPatientIsNotNull() 
        && ! form.getGlobalContext().RefMan.getReferralContractTypeForPatient().equals(ReferralManagementContractType.REFERRALTRIAGE))
        acceptReferral();
    else
    {
        if (form.getLocalContext().getSelectedRecordIsNotNull()
            && form.getLocalContext().getSelectedRecord().getReferralDetailsIsNotNull()
            && form.getLocalContext().getSelectedRecord().getReferralDetails().getServiceIsNotNull())
            form.getLocalContext().setChangeServiceMessageBoxID(engine.showMessage("Do you need to change the Service from - '" + form.getLocalContext().getSelectedRecord().getReferralDetails().getService().getServiceName() + "' to some other Service ?", "Change Service", MessageButtons.YESNO));
    }
}
项目:openMAXIMS    文件:Logic.java   
private void populateListControls(ContractConfigShortVoCollection records)
{
    clear();
    if (records == null || records.size()==0)
        return;
    for (int i = 0 ; i<records.size() ; i++)
    {
        ContractConfigShortVo record = records.get(i);
        if (record == null)
            continue;
        grdDetailsRow newRow = form.grdDetails().getRows().newRow();
        newRow.setColumnID(record.getContractId());
        newRow.setColumnName(record.getContractName());
        newRow.setColumnOrganisation(record.getContractOrganisationIsNotNull()?record.getContractOrganisation().getName():null);
        newRow.setColumnStatus(record.getStatus());
        newRow.setColumnRTT(record.getDaysToRTTBreachDate());
        //wdev-12676
        if(record.getContractTypeIsNotNull() && record.getContractType().equals(ReferralManagementContractType.DIAGNOSTIC))
            newRow.setColumnType(form.getImages().Clinical.PatientWithDiagnosticServices16);
        else if(record.getContractTypeIsNotNull() && record.getContractType().equals(ReferralManagementContractType.NONDIAGNOSTIC))
            newRow.setColumnType(form.getImages().Clinical.PatientSeenByConsultant16);
        else
            newRow.setColumnType(null);
        //-----------
        newRow.setValue(record);
    }
}
项目:openMAXIMS    文件:RefManHL7Helper.java   
public Boolean isReferralDiagnostic(Integer nBookingId)
{
    DomainFactory factory = getDomainFactory();
    List contractId = factory.find("select cont.contractType.id from CatsReferral as cats left join cats.appointments as bk left join cats.contract as cont where (bk.id = '" + nBookingId + "')");
    if (contractId.size() > 0&&ReferralManagementContractType.DIAGNOSTIC.getId()==((Integer)contractId.get(0)).intValue())
        return true;
    else
        return false;
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
private boolean isNonDiagnosticAppointment(CatsReferral catsReferral)
{
    if(catsReferral != null && catsReferral.getDOS() != null && catsReferral.getDOS().getContract() != null && catsReferral.getDOS().getContract().getContractType() != null)
    {
        if(ReferralManagementContractType.DIAGNOSTIC.getID() == catsReferral.getDOS().getContract().getContractType().getId())
            return false;
    }

    return true;
}
项目:openMAXIMS    文件:ReferralStatusListImpl.java   
public Boolean isThereAnyDiagnosticContractsForThisSite(OrganisationRefVo voOrg) 
{
    String hql = "from ContractConfig as cc where (cc.contractOrganisation.id = :orgID and cc.status = :actCC and cc.isRIE is null and cc.contractType = :DiagContra) ";
    List<?> dos = getDomainFactory().find(hql,new String[]{"orgID", "actCC", "DiagContra"},new Object[]{voOrg.getID_Organisation(), getDomLookup(PreActiveActiveInactiveStatus.ACTIVE), getDomLookup(ReferralManagementContractType.DIAGNOSTIC)});
    if (dos == null || dos.size() == 0)
        return Boolean.FALSE;
    else
        return Boolean.TRUE;
}
项目:openMAXIMS    文件:ExternalEventsImpl.java   
public void acceptReferralFromInvestigation(IfOrderInvestigationVo inv) throws DomainInterfaceException, StaleObjectException
{
    if (inv==null)
        throw new DomainInterfaceException("Cannot accept referral for NULL investigation");
    if(inv.getID_OrderInvestigation()==null)
        throw new DomainInterfaceException("Cannot accept referral investigation with NULL ID");

    DomainFactory factory = getDomainFactory();
    String hql="select c1_1 from CatsReferral as c1_1 left join c1_1.investigationOrders as o1_1 left join o1_1.investigations as o2_1 "+
    "where o2_1.id = :invID";
    List<Object> resultSet = factory.find(hql,new String[]{"invID"},new Object[]{inv.getID_OrderInvestigation()});
    for (Object result : resultSet) // There should only be one but lets do them all!
    {
        CatsReferral referral = (CatsReferral)result;
        //http://jira/browse/WDEV-12682
        if(referral.getContract()!=null&& referral.getContract().getContractType()!=null &&
                referral.getContract().getContractType().equals(getDomLookup(ReferralManagementContractType.DIAGNOSTIC)))
        {
            CATSReferralStatus status = new CATSReferralStatus();
            status.setStatusDateTime(new Date());
            status.setComment("Status updated from HL7 accept message");
            status.setReferralStatus(getDomLookup(ReferralApptStatus.REFERRAL_ACCEPTED));
            referral.setCurrentStatus(status);
            referral.getStatusHistory().add(status);
            factory.save(referral);
        }
    }

}
项目:AvoinApotti    文件:OCSExternalEventsImpl.java   
public void generateAppointmentCancelEvent(Booking_AppointmentRefVo appointment, OrderInvestigationRefVo investigation) throws StaleObjectException
{
    if (null == appointment)
        throw new DomainRuntimeException("Appointment Cannot be NULL");
    DomainFactory factory = getDomainFactory();
    ExternalSystemEvent event = new ExternalSystemEvent();

    // We need to deal with null investigations
    // when (not )sending the messages
    if (null != investigation) 
    {
        OrderInvestigation domInv = (OrderInvestigation) factory.getDomainObject(investigation);

        //WDEV-5912 For Investigations marked as NoInterface there are no interface calls
        if(domInv.getInvestigation() != null && domInv.getInvestigation().getInvestigationIndex() != null &&  domInv.getInvestigation().getInvestigationIndex().isNoInterface() != null && domInv.getInvestigation().getInvestigationIndex().isNoInterface())
            return;

        if (domInv.getInvestigation()!=null&&domInv.getInvestigation().getProviderService()!=null&&domInv.getInvestigation().getProviderService().getLocationService()!=null
                &&domInv.getInvestigation().getProviderService().getLocationService().getService()!=null
                &&!(ServiceCategory.RADIOLOGY_MODALITY.getID()==( domInv.getInvestigation().getProviderService().getLocationService().getService().getServiceCategory().getId())))

            return;

        event.setInvestigation(domInv);
        ProviderSystem providerSystem=domInv.getInvestigation().getProviderService().getProviderSystem();
        if(!isRebookApptWithCancelandFullXOSetForProviderSystem(providerSystem))
            return;

        event.setProviderSystem(providerSystem);
    }

    if (ReferralManagementContractType.DIAGNOSTIC.getId() == getContractTypeIdFromReferralContractForBookingId(appointment.getBoId()))
        return;

    Booking_Appointment domBookAppt = (Booking_Appointment) factory.getDomainObject(appointment);
    event.setAppointment(domBookAppt);
    event.setWasProcessed(Boolean.FALSE);
    event.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
    event.setEventType(getDomLookup(ExternalSystemEventTypes.CANCELAPPOINTMENT));
    if(domBookAppt!=null &&domBookAppt.getSession()!=null)
    {
        event.setCancelledAppointmentLocation(domBookAppt.getSession().getSchLocation());
    }
    factory.save(event);

}
项目:AvoinApotti    文件:Logic.java   
private void loadLocations()
{
    //      wdev-12682          
    if (form.cmbContract().getValue() != null
            && form.cmbContract().getValue().getContractTypeIsNotNull()
            && (form.cmbContract().getValue().getContractType().equals(ReferralManagementContractType.REFERRALTRIAGE)
                    || form.cmbContract().getValue().getContractType().equals(ReferralManagementContractType.NONDIAGNOSTIC)) )
    {
        form.lblLocation().setVisible(false);
        form.cmbLocation().setVisible(false);
        form.cmbLocation().setValue(null);
    }
    else if (form.getGlobalContext().RefMan.getDiagnosticReferralForApplicationIsNotNull()
            && form.getGlobalContext().RefMan.getDiagnosticReferralForApplication())
    {
        form.cmbLocation().clear();
        LocationLiteVoCollection voCollLocation = null;
        if (!ConfigFlag.UI.DISABLE_MULTI_SITE_CATS_FUNCTIONALITY.getValue())
        {
            if (form.cmbContract().getValue() != null)
                voCollLocation = domain.listLocationByOrganisation(form.cmbContract().getValue().getContractOrganisation(), "");
        }
        else
            voCollLocation = domain.listLocationLite();

        if (voCollLocation != null && voCollLocation.size() > 0)
        {
            for (LocationLiteVo voLoc : voCollLocation)
                form.cmbLocation().newRow(voLoc, voLoc.getName());
        }

        form.cmbLocation().setValue(form.getLocalContext().getreferralVoIsNotNull() && form.getLocalContext().getreferralVo().getID_ReferralLetterDetailsIsNotNull() ? form.getLocalContext().getreferralVo().getLocation() : null);

        if (form.cmbLocation().getValue() == null && form.getLocalContext().getreferralVo() == null)
            defaultLocation();

        form.lblLocation().setVisible(true);
        form.cmbLocation().setVisible(true);
    }
    else
    {
        form.lblLocation().setVisible(false);
        form.cmbLocation().setVisible(false);
        form.cmbLocation().setValue(null);
    }
}
项目:AvoinApotti    文件:Logic.java   
protected void onBtnSaveClick() throws PresentationLogicException
{
    ReferralLetterDetailsVo referralDetailsVo = getValue();
    CatsReferralWizardVo voCats = null;
    try
    {
        String[] errors = validateUILogic();
        errors = referralDetailsVo.validate(errors);
        if (errors != null)
        {
            engine.showErrors(errors);
            return;
        }

        voCats = domain.getCatsReferral(form.getGlobalContext().RefMan.getCatsReferral());
        // voCats.setIsAwaitingClinicalInfo(form.getGlobalContext().RefMan.getAwaitingClinicalInfoBoolean());
        // voCats.setAwaitingClinicalInfo(form.getLocalContext().getCurrentAwaitingClinicalInformationVo());

        //WDEV-11713 if (!ConfigFlag.UI.DISABLE_MULTI_SITE_CATS_FUNCTIONALITY.getValue())
        voCats.setContract(form.cmbContract().getValue());
        form.getGlobalContext().RefMan.setReferralContractTypeForPatient(form.cmbContract().getValue().getContractType());
        voCats.setReferralCategory(form.cmbCategory().getValue());//WDEV-12181
        voCats.setUrgency(form.cmbUrgency().getValue()); // WDEV-17930
        voCats.setConsUpgradeDate(form.dteConsUpgradeDate().getValue()); // WDEV-18452 

        voCats.setRTTClockImpact(form.chkActivityRTTClock().getValue());
        //WDEV-18432
        voCats.setReferralTransfer(form.getLocalContext().getTransferInfo());
        voCats.setPathwayID(form.getLocalContext().getTransferInfoIsNotNull() ? form.getLocalContext().getTransferInfo().getPathwayID() : null);

        //wdev-13647
        if(Boolean.TRUE.equals(ConfigFlag.UI.REFERRAL_DETAILS_DISPLAY_NEAREST_TREATMENT_CENTRE.getValue()))
        {
            voCats.setNearestTreatmentCentre(form.cmbNearestTreatmentCentreLocation().getValue());
        }
        //---

        errors = voCats.validate(errors);
        if (errors != null)
        {
            engine.showErrors(errors);
            return;
        }

        //          wdev-12682
        form.getLocalContext().setreferralVo(domain.save(referralDetailsVo, voCats, form.getGlobalContext().RefMan.getReferralContractTypeForPatientIsNotNull() && form.getGlobalContext().RefMan.getReferralContractTypeForPatient().equals(ReferralManagementContractType.DIAGNOSTIC)));

        //WDEV-11535 - update Global Context if specialty has changed
        if(form.getLocalContext().getreferralVoIsNotNull() && form.getLocalContext().getreferralVo().getEpisodeOfCareIsNotNull())
            form.getGlobalContext().Core.setEpisodeofCareShort(form.getLocalContext().getreferralVo().getEpisodeOfCare());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        form.getLocalContext().setreferralVo(domain.getReferral(referralDetailsVo.toReferralLetterDetailsRefVo()));
    }

    form.getLocalContext().setcomponentEvent(ReferralDetailsComponentButtonClicked.SAVE);
    if (referralDetailsVo.getDateReferralReceivedIsNotNull() && referralDetailsVo.getServiceIsNotNull() && form.getLocalContext().gethasCatsReferralReferralLetterIsNotNull() && form.getLocalContext().gethasCatsReferralReferralLetter())
        form.getLocalContext().setactiveDetailsButton(true);
    else
        form.getLocalContext().setactiveDetailsButton(false);

    form.setMode(FormMode.VIEW);
    //wdev-12256
    form.cmbContract().clear();

    // WDEV-12866
    // Use the new function to list active Contracts for a specific location
    // ContractConfigForReferralDetailsComponentVoCollection contracts = domain.listActiveContracts(domain.getOrganisationByLocation(engine.getCurrentLocation().getID()));
    ContractConfigForReferralDetailsComponentVoCollection contracts = domain.listActiveContractsForLocation((LocationRefVo) engine.getCurrentLocation());
    for (int i = 0; contracts != null && i < contracts.size(); i++)
    {
        form.cmbContract().newRow(contracts.get(i), contracts.get(i).getContractName());
    }
    //---end wdev-12256

    setValue(form.getLocalContext().getreferralVo(), domain.getCatsReferral(voCats));
}
项目:AvoinApotti    文件:Logic.java   
private void open() {
    loadReferralDetails();
    clearSearchCriteria();
    form.btnBook().setEnabled(false);
    form.btnCancel().setEnabled(false);
    form.bookingCalendarAppts().setEnabled(false);
    form.bookingCalendarAppts().setCurrentMonth(new Date());
    form.getLocalContext().setSch_Booking(new Sch_BookingVo());
    form.getLocalContext().setisLinkingOrderInv(false);
    clearBookingCalendar();

    form.cmbService().setEnabled(true);
    form.cmbActivity().setEnabled(true);
    form.qmbListOwner().setEnabled(true); // WDEV-18411
    form.imbClear().setEnabled(true);

    removeAllRadiologyServices();

    // WDEV-17903 - If Service in GC, default the value in
    if (form.getGlobalContext().Scheduling.getBookingServiceIsNotNull()) {
        form.cmbService().setValue(
                form.getGlobalContext().Scheduling.getBookingService());
        if (form.cmbService().getValue() == null
                && form.getGlobalContext().Scheduling.getBookingService() instanceof ServiceLiteVo) {
            form.cmbService().newRow(
                    form.getGlobalContext().Scheduling.getBookingService(),
                    ((ServiceLiteVo) form.getGlobalContext().Scheduling
                            .getBookingService()).getServiceName());
            form.cmbService().setValue(
                    form.getGlobalContext().Scheduling.getBookingService());
        }
    }

    // rebooking WDEV-5213
    repopulateScreen();

    // wdev-12682
    if (form.getGlobalContext().RefMan
            .getReferralContractTypeForPatientIsNotNull()
            && form.getGlobalContext().RefMan
                    .getReferralContractTypeForPatient().equals(
                            ReferralManagementContractType.DIAGNOSTIC)
            && form.getGlobalContext().Scheduling.getBookingAppointment() == null) {
        if (engine.getCurrentLocation() != null) {
            for (int i = 0; i < form.cmbLocation().getValues().size(); i++) {
                if (((LocationRefVo) form.cmbLocation().getValues().get(i))
                        .getID_Location().equals(
                                engine.getCurrentLocation().getID())) {
                    form.cmbLocation().setValue(
                            ((LocationRefVo) form.cmbLocation().getValues()
                                    .get(i)));
                    break;
                }
            }
        }
    }
}
项目:AvoinApotti    文件:BookAppointmentImpl.java   
/**
 * NB - This method is called from a web service and therefore should only
 * be modified with extreme caution (dlaffan)
 * 
 * WDEV-7448 - If PukkaJ interface is enabled this method will attempt to
 * send a cancel message to PukkaJ by creating an entry in OcsExternalEvent
 * 
 * @param doCatsReferral
 * @param voAppt
 * @throws StaleObjectException
 */
public void cancelAppointmentForPukkaJ(CatsReferralRefVo catsReferral, Booking_AppointmentRefVo appt) throws StaleObjectException
{
    if (appt == null || appt.getID_Booking_Appointment() == null)
        throw new CodingRuntimeException("appt is null or id not provided in method processAppointmentForPukkaJ");
    if (catsReferral == null || catsReferral.getID_CatsReferral() == null)
        throw new CodingRuntimeException("catsReferral is null or id not provided in method processAppointmentForPukkaJ");

    DomainFactory factory = getDomainFactory();
    CatsReferral doCatsReferral = (CatsReferral) factory.getDomainObject(catsReferral);

    if (doCatsReferral.getContract() != null
            && doCatsReferral.getContract().getContractType() != null
            && doCatsReferral.getContract().getContractType().getId() != ReferralManagementContractType.DIAGNOSTIC.getId())
            return;

    Booking_Appointment doAppt = (Booking_Appointment) factory.getDomainObject(appt);

    if (doCatsReferral.getAppointments().size() > 0)
    {
        Iterator it = doCatsReferral.getAppointments().iterator();

        if (doAppt.getApptStatus() != null && (doAppt.getApptStatus().equals(getDomLookup(Status_Reason.CANCELLED))))
        {
            if (countExistingReferralAppts(doCatsReferral, Status_Reason.BOOKED) == 0)
            {
                Iterator itOrdInvA = doCatsReferral.getOrderInvAppts().iterator();
                OrderInvAppt doOrdInvAppt = null;
                if(itOrdInvA.hasNext())
                    doOrdInvAppt = (OrderInvAppt) itOrdInvA.next();

                //WDEV-7448 - null pointer fix here - code was presuming that an ordInvAppt always exists
                if(doOrdInvAppt != null)
                {
                    doOrdInvAppt.getOrderInvestigation().setAppointmentDate(null);
                    factory.save(doOrdInvAppt.getOrderInvestigation());
                    doCatsReferral.getOrderInvAppts().remove(doOrdInvAppt);
                    try
                    {
                        factory.delete(doOrdInvAppt);
                    }
                    catch (ForeignKeyViolationException e)
                    {
                        throw new DomainRuntimeException(e.getMessage());
                    }
                    factory.save(doCatsReferral);


                    OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
                    impl.generateOrderUpdateEvent(new Booking_AppointmentRefVo(doAppt.getId(), doAppt.getVersion()), new OrderInvestigationRefVo(doOrdInvAppt.getOrderInvestigation().getId(), doOrdInvAppt.getOrderInvestigation().getVersion()));
                }
            }
        }
    }

}
项目:AvoinApotti    文件:ReferralStatusListImpl.java   
/**
 * WDEV-12875
 * Function used to analyse ContractConfiguration records for all Organisations on the branch (up form provided location)
 * @return <b>true</b> if at least one ContractConfiguration record active and of type Diagnostic, <b>false</b> otherwise
 */
public Boolean hasLocationDiagnosicContracts(LocationRefVo location)
{
    // If location is not provided
    if (location == null)
        return false;

    // Get root Location id
    Integer rootLocation = getRootLocationID(location.getID_Location());
    // Get the ID for all organisations on the branch up to root organisation
    ArrayList<Integer> organisations = listParentOrganisations(rootLocation);

    // If no organisations are found then return false
    if (organisations == null || organisations.size() == 0)
        return false;

    // Build query to retrieve first Active contract or type Diagnostic for the organisations on the branch
    StringBuilder query = new StringBuilder();

    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT contract FROM ContractConfig AS contract WHERE contract.status.id = :ACTIVE AND contract.contractType.id = :DIAG ");
    query.append("AND contract.isRIE is null AND contract.contractOrganisation.id IN (");

    paramNames.add("ACTIVE"); paramValues.add(PreActiveActiveInactiveStatus.ACTIVE.getID());
    paramNames.add("DIAG"); paramValues.add(ReferralManagementContractType.DIAGNOSTIC.getID());

    String separator = "";

    for (int i = 0; i < organisations.size(); i++)
    {
        query.append(separator);
        query.append(organisations.get(i));

        separator = ", ";
    }

    query.append(")");

    // Query the database for the first ContractConfig record (non RIE, Active, of type Diagnostic) for organisations on the branch of the provided location
    ContractConfigForReferralDetailsComponentVo contractConfig = ContractConfigForReferralDetailsComponentVoAssembler.create((ContractConfig) getDomainFactory().findFirst(query.toString(), paramNames, paramValues));

    // If at least one ContractConfig record is found then return true, otherwise return false
    if (contractConfig != null)
        return true;

    return false;
}
项目:openMAXIMS    文件:OCSExternalEventsImpl.java   
public void generateAppointmentCancelEvent(Booking_AppointmentRefVo appointment, OrderInvestigationRefVo investigation) throws StaleObjectException
{
    if (null == appointment)
        throw new DomainRuntimeException("Appointment Cannot be NULL");
    DomainFactory factory = getDomainFactory();
    ExternalSystemEvent event = new ExternalSystemEvent();

    // We need to deal with null investigations
    // when (not )sending the messages
    if (null != investigation) 
    {
        OrderInvestigation domInv = (OrderInvestigation) factory.getDomainObject(investigation);

        //WDEV-5912 For Investigations marked as NoInterface there are no interface calls
        if(domInv.getInvestigation() != null && domInv.getInvestigation().getInvestigationIndex() != null &&  domInv.getInvestigation().getInvestigationIndex().isNoInterface() != null && domInv.getInvestigation().getInvestigationIndex().isNoInterface())
            return;

        if (domInv.getInvestigation()!=null&&domInv.getInvestigation().getProviderService()!=null&&domInv.getInvestigation().getProviderService().getLocationService()!=null
                &&domInv.getInvestigation().getProviderService().getLocationService().getService()!=null
                &&!(ServiceCategory.RADIOLOGY_MODALITY.getID()==( domInv.getInvestigation().getProviderService().getLocationService().getService().getServiceCategory().getId())))

            return;

        event.setInvestigation(domInv);
        ProviderSystem providerSystem=domInv.getInvestigation().getProviderService().getProviderSystem();
        if(!isRebookApptWithCancelandFullXOSetForProviderSystem(providerSystem))
            return;

        event.setProviderSystem(providerSystem);
    }

    if (ReferralManagementContractType.DIAGNOSTIC.getId() == getContractTypeIdFromReferralContractForBookingId(appointment.getBoId()))
        return;

    Booking_Appointment domBookAppt = (Booking_Appointment) factory.getDomainObject(appointment);
    event.setAppointment(domBookAppt);
    event.setWasProcessed(Boolean.FALSE);
    event.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
    event.setEventType(getDomLookup(ExternalSystemEventTypes.CANCELAPPOINTMENT));
    if(domBookAppt!=null &&domBookAppt.getSession()!=null)
    {
        event.setCancelledAppointmentLocation(domBookAppt.getSession().getSchLocation());
    }
    factory.save(event);

}
项目:openMAXIMS    文件:Logic.java   
private void loadLocations()
{
    //      wdev-12682          
    if (form.cmbContract().getValue() != null
            && form.cmbContract().getValue().getContractTypeIsNotNull()
            && !form.cmbContract().getValue().getContractType().equals(ReferralManagementContractType.DIAGNOSTIC))
    {
        form.lblLocation().setVisible(false);
        form.cmbLocation().setVisible(false);
        form.cmbLocation().setValue(null);
    }
    else if (form.getGlobalContext().RefMan.getDiagnosticReferralForApplicationIsNotNull()
            && form.getGlobalContext().RefMan.getDiagnosticReferralForApplication())
    {
        form.cmbLocation().clear();

        /*if (!ConfigFlag.UI.DISABLE_MULTI_SITE_CATS_FUNCTIONALITY.getValue())
        {
            if (form.cmbContract().getValue() != null)
                voCollLocation = domain.listLocationByOrganisation(form.cmbContract().getValue().getContractOrganisation(), "");
        }
        else
            voCollLocation = domain.listLocationLite();*/

        LocationLiteVoCollection voCollLocation = domain.listLocationByContractAndService(form.cmbContract().getValue(), form.qmbService().getValue());

        if (voCollLocation != null && voCollLocation.size() > 0)
        {
            for (LocationLiteVo voLoc : voCollLocation)
                form.cmbLocation().newRow(voLoc, voLoc.getName());
        }

        form.cmbLocation().setValue(form.getLocalContext().getreferralVoIsNotNull() && form.getLocalContext().getreferralVo().getID_ReferralLetterDetailsIsNotNull() ? form.getLocalContext().getreferralVo().getLocation() : null);

        if (form.cmbLocation().getValue() == null && form.getLocalContext().getreferralVo() == null)
            defaultLocation();

        form.lblLocation().setVisible(true);
        form.cmbLocation().setVisible(true);
    }
    else
    {
        form.lblLocation().setVisible(false);
        form.cmbLocation().setVisible(false);
        form.cmbLocation().setValue(null);
    }
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
/**
 * NB - This method is called from a web service and therefore should only
 * be modified with extreme caution (dlaffan)
 * 
 * WDEV-7448 - If PukkaJ interface is enabled this method will attempt to
 * send a cancel message to PukkaJ by creating an entry in OcsExternalEvent
 * 
 * @param doCatsReferral
 * @param voAppt
 * @throws StaleObjectException
 */
public void cancelAppointmentForPukkaJ(CatsReferralRefVo catsReferral, Booking_AppointmentRefVo appt) throws StaleObjectException
{
    if (appt == null || appt.getID_Booking_Appointment() == null)
        throw new CodingRuntimeException("appt is null or id not provided in method processAppointmentForPukkaJ");
    if (catsReferral == null || catsReferral.getID_CatsReferral() == null)
        throw new CodingRuntimeException("catsReferral is null or id not provided in method processAppointmentForPukkaJ");

    DomainFactory factory = getDomainFactory();
    CatsReferral doCatsReferral = (CatsReferral) factory.getDomainObject(catsReferral);

    if (doCatsReferral.getContract() != null
            && doCatsReferral.getContract().getContractType() != null
            && doCatsReferral.getContract().getContractType().getId() != ReferralManagementContractType.DIAGNOSTIC.getId())
            return;

    Booking_Appointment doAppt = (Booking_Appointment) factory.getDomainObject(appt);

    if (doCatsReferral.getAppointments().size() > 0)
    {
        Iterator it = doCatsReferral.getAppointments().iterator();

        if (doAppt.getApptStatus() != null && (doAppt.getApptStatus().equals(getDomLookup(Status_Reason.CANCELLED))))
        {
            if (countExistingReferralAppts(doCatsReferral, Status_Reason.BOOKED) == 0)
            {
                Iterator itOrdInvA = doCatsReferral.getOrderInvAppts().iterator();
                OrderInvAppt doOrdInvAppt = null;
                if(itOrdInvA.hasNext())
                    doOrdInvAppt = (OrderInvAppt) itOrdInvA.next();

                //WDEV-7448 - null pointer fix here - code was presuming that an ordInvAppt always exists
                if(doOrdInvAppt != null)
                {
                    doOrdInvAppt.getOrderInvestigation().setAppointmentDate(null);
                    factory.save(doOrdInvAppt.getOrderInvestigation());
                    doCatsReferral.getOrderInvAppts().remove(doOrdInvAppt);
                    try
                    {
                        factory.delete(doOrdInvAppt);
                    }
                    catch (ForeignKeyViolationException e)
                    {
                        throw new DomainRuntimeException(e.getMessage());
                    }
                    factory.save(doCatsReferral);


                    OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
                    impl.generateOrderUpdateEvent(new Booking_AppointmentRefVo(doAppt.getId(), doAppt.getVersion()), new OrderInvestigationRefVo(doOrdInvAppt.getOrderInvestigation().getId(), doOrdInvAppt.getOrderInvestigation().getVersion()));
                }
            }
        }
    }

}
项目:openMAXIMS    文件:ReferralStatusListImpl.java   
/**
 * WDEV-12875
 * Function used to analyse ContractConfiguration records for all Organisations on the branch (up form provided location)
 * @return <b>true</b> if at least one ContractConfiguration record active and of type Diagnostic, <b>false</b> otherwise
 */
public Boolean hasLocationDiagnosicContracts(LocationRefVo location)
{
    // If location is not provided
    if (location == null)
        return false;

    // Get root Location id
    Integer rootLocation = getRootLocationID(location.getID_Location());
    // Get the ID for all organisations on the branch up to root organisation
    ArrayList<Integer> organisations = listParentOrganisations(rootLocation);

    // If no organisations are found then return false
    if (organisations == null || organisations.size() == 0)
        return false;

    // Build query to retrieve first Active contract or type Diagnostic for the organisations on the branch
    StringBuilder query = new StringBuilder();

    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT contract FROM ContractConfig AS contract WHERE contract.status.id = :ACTIVE AND contract.contractType.id = :DIAG ");
    query.append("AND contract.isRIE is null AND contract.contractOrganisation.id IN (");

    paramNames.add("ACTIVE"); paramValues.add(PreActiveActiveInactiveStatus.ACTIVE.getID());
    paramNames.add("DIAG"); paramValues.add(ReferralManagementContractType.DIAGNOSTIC.getID());

    String separator = "";

    for (int i = 0; i < organisations.size(); i++)
    {
        query.append(separator);
        query.append(organisations.get(i));

        separator = ", ";
    }

    query.append(")");

    // Query the database for the first ContractConfig record (non RIE, Active, of type Diagnostic) for organisations on the branch of the provided location
    ContractConfigForReferralDetailsComponentVo contractConfig = ContractConfigForReferralDetailsComponentVoAssembler.create((ContractConfig) getDomainFactory().findFirst(query.toString(), paramNames, paramValues));

    // If at least one ContractConfig record is found then return true, otherwise return false
    if (contractConfig != null)
        return true;

    return false;
}
项目:openMAXIMS    文件:OCSExternalEventsImpl.java   
public void generateAppointmentCancelEvent(Booking_AppointmentRefVo appointment, OrderInvestigationRefVo investigation) throws StaleObjectException
{
    if (null == appointment)
        throw new DomainRuntimeException("Appointment Cannot be NULL");
    DomainFactory factory = getDomainFactory();
    ExternalSystemEvent event = new ExternalSystemEvent();

    // We need to deal with null investigations
    // when (not )sending the messages
    if (null != investigation) 
    {
        OrderInvestigation domInv = (OrderInvestigation) factory.getDomainObject(investigation);

        //WDEV-5912 For Investigations marked as NoInterface there are no interface calls
        if(domInv.getInvestigation() != null && domInv.getInvestigation().getInvestigationIndex() != null &&  domInv.getInvestigation().getInvestigationIndex().isNoInterface() != null && domInv.getInvestigation().getInvestigationIndex().isNoInterface())
            return;

        if (domInv.getInvestigation()!=null&&domInv.getInvestigation().getProviderService()!=null&&domInv.getInvestigation().getProviderService().getLocationService()!=null
                &&domInv.getInvestigation().getProviderService().getLocationService().getService()!=null
                &&!(ServiceCategory.RADIOLOGY_MODALITY.getID()==( domInv.getInvestigation().getProviderService().getLocationService().getService().getServiceCategory().getId())))

            return;

        event.setInvestigation(domInv);
        ProviderSystem providerSystem=domInv.getInvestigation().getProviderService().getProviderSystem();
        if(!isRebookApptWithCancelandFullXOSetForProviderSystem(providerSystem))
            return;

        event.setProviderSystem(providerSystem);
    }

    if (ReferralManagementContractType.DIAGNOSTIC.getId() == getContractTypeIdFromReferralContractForBookingId(appointment.getBoId()))
        return;

    Booking_Appointment domBookAppt = (Booking_Appointment) factory.getDomainObject(appointment);
    event.setAppointment(domBookAppt);
    event.setWasProcessed(Boolean.FALSE);
    event.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
    event.setEventType(getDomLookup(ExternalSystemEventTypes.CANCELAPPOINTMENT));
    if(domBookAppt!=null &&domBookAppt.getSession()!=null)
    {
        event.setCancelledAppointmentLocation(domBookAppt.getSession().getSchLocation());
    }
    factory.save(event);

}
项目:openMAXIMS    文件:Logic.java   
private void loadLocations()
{
    //      wdev-12682          
    if (form.cmbContract().getValue() != null
            && form.cmbContract().getValue().getContractTypeIsNotNull()
            && (form.cmbContract().getValue().getContractType().equals(ReferralManagementContractType.REFERRALTRIAGE)
                    || form.cmbContract().getValue().getContractType().equals(ReferralManagementContractType.NONDIAGNOSTIC)) )
    {
        form.lblLocation().setVisible(false);
        form.cmbLocation().setVisible(false);
        form.cmbLocation().setValue(null);
    }
    else if (form.getGlobalContext().RefMan.getDiagnosticReferralForApplicationIsNotNull()
            && form.getGlobalContext().RefMan.getDiagnosticReferralForApplication())
    {
        form.cmbLocation().clear();
        LocationLiteVoCollection voCollLocation = null;
        if (!ConfigFlag.UI.DISABLE_MULTI_SITE_CATS_FUNCTIONALITY.getValue())
        {
            if (form.cmbContract().getValue() != null)
                voCollLocation = domain.listLocationByOrganisation(form.cmbContract().getValue().getContractOrganisation(), "");
        }
        else
            voCollLocation = domain.listLocationLite();

        if (voCollLocation != null && voCollLocation.size() > 0)
        {
            for (LocationLiteVo voLoc : voCollLocation)
                form.cmbLocation().newRow(voLoc, voLoc.getName());
        }

        form.cmbLocation().setValue(form.getLocalContext().getreferralVoIsNotNull() && form.getLocalContext().getreferralVo().getID_ReferralLetterDetailsIsNotNull() ? form.getLocalContext().getreferralVo().getLocation() : null);

        if (form.cmbLocation().getValue() == null && form.getLocalContext().getreferralVo() == null)
            defaultLocation();

        form.lblLocation().setVisible(true);
        form.cmbLocation().setVisible(true);
    }
    else
    {
        form.lblLocation().setVisible(false);
        form.cmbLocation().setVisible(false);
        form.cmbLocation().setValue(null);
    }
}
项目:openMAXIMS    文件:Logic.java   
protected void onBtnSaveClick() throws PresentationLogicException
{
    ReferralLetterDetailsVo referralDetailsVo = getValue();
    CatsReferralWizardVo voCats = null;
    try
    {
        String[] errors = validateUILogic();
        errors = referralDetailsVo.validate(errors);
        if (errors != null)
        {
            engine.showErrors(errors);
            return;
        }

        voCats = domain.getCatsReferral(form.getGlobalContext().RefMan.getCatsReferral());
        // voCats.setIsAwaitingClinicalInfo(form.getGlobalContext().RefMan.getAwaitingClinicalInfoBoolean());
        // voCats.setAwaitingClinicalInfo(form.getLocalContext().getCurrentAwaitingClinicalInformationVo());

        //WDEV-11713 if (!ConfigFlag.UI.DISABLE_MULTI_SITE_CATS_FUNCTIONALITY.getValue())
        voCats.setContract(form.cmbContract().getValue());
        form.getGlobalContext().RefMan.setReferralContractTypeForPatient(form.cmbContract().getValue().getContractType());
        voCats.setReferralCategory(form.cmbCategory().getValue());//WDEV-12181
        voCats.setUrgency(form.cmbUrgency().getValue()); // WDEV-17930
        voCats.setConsUpgradeDate(form.dteConsUpgradeDate().getValue()); // WDEV-18452 

        voCats.setRTTClockImpact(form.chkActivityRTTClock().getValue());
        //WDEV-18432
        voCats.setReferralTransfer(form.getLocalContext().getTransferInfo());
        voCats.setPathwayID(form.getLocalContext().getTransferInfoIsNotNull() ? form.getLocalContext().getTransferInfo().getPathwayID() : null);

        //wdev-13647
        if(Boolean.TRUE.equals(ConfigFlag.UI.REFERRAL_DETAILS_DISPLAY_NEAREST_TREATMENT_CENTRE.getValue()))
        {
            voCats.setNearestTreatmentCentre(form.cmbNearestTreatmentCentreLocation().getValue());
        }
        //---

        errors = voCats.validate(errors);
        if (errors != null)
        {
            engine.showErrors(errors);
            return;
        }

        //          wdev-12682
        form.getLocalContext().setreferralVo(domain.save(referralDetailsVo, voCats, form.getGlobalContext().RefMan.getReferralContractTypeForPatientIsNotNull() && form.getGlobalContext().RefMan.getReferralContractTypeForPatient().equals(ReferralManagementContractType.DIAGNOSTIC)));

        //WDEV-11535 - update Global Context if specialty has changed
        if(form.getLocalContext().getreferralVoIsNotNull() && form.getLocalContext().getreferralVo().getEpisodeOfCareIsNotNull())
            form.getGlobalContext().Core.setEpisodeofCareShort(form.getLocalContext().getreferralVo().getEpisodeOfCare());
    }
    catch (StaleObjectException e)
    {
        engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        form.getLocalContext().setreferralVo(domain.getReferral(referralDetailsVo.toReferralLetterDetailsRefVo()));
    }

    form.getLocalContext().setcomponentEvent(ReferralDetailsComponentButtonClicked.SAVE);
    if (referralDetailsVo.getDateReferralReceivedIsNotNull() && referralDetailsVo.getServiceIsNotNull() && form.getLocalContext().gethasCatsReferralReferralLetterIsNotNull() && form.getLocalContext().gethasCatsReferralReferralLetter())
        form.getLocalContext().setactiveDetailsButton(true);
    else
        form.getLocalContext().setactiveDetailsButton(false);

    form.setMode(FormMode.VIEW);
    //wdev-12256
    form.cmbContract().clear();

    // WDEV-12866
    // Use the new function to list active Contracts for a specific location
    // ContractConfigForReferralDetailsComponentVoCollection contracts = domain.listActiveContracts(domain.getOrganisationByLocation(engine.getCurrentLocation().getID()));
    ContractConfigForReferralDetailsComponentVoCollection contracts = domain.listActiveContractsForLocation((LocationRefVo) engine.getCurrentLocation());
    for (int i = 0; contracts != null && i < contracts.size(); i++)
    {
        form.cmbContract().newRow(contracts.get(i), contracts.get(i).getContractName());
    }
    //---end wdev-12256

    setValue(form.getLocalContext().getreferralVo(), domain.getCatsReferral(voCats));
}
项目:openMAXIMS    文件:Logic.java   
private void open() {
    loadReferralDetails();
    clearSearchCriteria();
    form.btnBook().setEnabled(false);
    form.btnCancel().setEnabled(false);
    form.bookingCalendarAppts().setEnabled(false);
    form.bookingCalendarAppts().setCurrentMonth(new Date());
    form.getLocalContext().setSch_Booking(new Sch_BookingVo());
    form.getLocalContext().setisLinkingOrderInv(false);
    clearBookingCalendar();

    form.cmbService().setEnabled(true);
    form.cmbActivity().setEnabled(true);
    form.qmbListOwner().setEnabled(true); // WDEV-18411
    form.imbClear().setEnabled(true);

    removeAllRadiologyServices();

    // WDEV-17903 - If Service in GC, default the value in
    if (form.getGlobalContext().Scheduling.getBookingServiceIsNotNull()) {
        form.cmbService().setValue(
                form.getGlobalContext().Scheduling.getBookingService());
        if (form.cmbService().getValue() == null
                && form.getGlobalContext().Scheduling.getBookingService() instanceof ServiceLiteVo) {
            form.cmbService().newRow(
                    form.getGlobalContext().Scheduling.getBookingService(),
                    ((ServiceLiteVo) form.getGlobalContext().Scheduling
                            .getBookingService()).getServiceName());
            form.cmbService().setValue(
                    form.getGlobalContext().Scheduling.getBookingService());
        }
    }

    // rebooking WDEV-5213
    repopulateScreen();

    // wdev-12682
    if (form.getGlobalContext().RefMan
            .getReferralContractTypeForPatientIsNotNull()
            && form.getGlobalContext().RefMan
                    .getReferralContractTypeForPatient().equals(
                            ReferralManagementContractType.DIAGNOSTIC)
            && form.getGlobalContext().Scheduling.getBookingAppointment() == null) {
        if (engine.getCurrentLocation() != null) {
            for (int i = 0; i < form.cmbLocation().getValues().size(); i++) {
                if (((LocationRefVo) form.cmbLocation().getValues().get(i))
                        .getID_Location().equals(
                                engine.getCurrentLocation().getID())) {
                    form.cmbLocation().setValue(
                            ((LocationRefVo) form.cmbLocation().getValues()
                                    .get(i)));
                    break;
                }
            }
        }
    }
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
/**
 * NB - This method is called from a web service and therefore should only
 * be modified with extreme caution (dlaffan)
 * 
 * WDEV-7448 - If PukkaJ interface is enabled this method will attempt to
 * send a cancel message to PukkaJ by creating an entry in OcsExternalEvent
 * 
 * @param doCatsReferral
 * @param voAppt
 * @throws StaleObjectException
 */
public void cancelAppointmentForPukkaJ(CatsReferralRefVo catsReferral, Booking_AppointmentRefVo appt) throws StaleObjectException
{
    if (appt == null || appt.getID_Booking_Appointment() == null)
        throw new CodingRuntimeException("appt is null or id not provided in method processAppointmentForPukkaJ");
    if (catsReferral == null || catsReferral.getID_CatsReferral() == null)
        throw new CodingRuntimeException("catsReferral is null or id not provided in method processAppointmentForPukkaJ");

    DomainFactory factory = getDomainFactory();
    CatsReferral doCatsReferral = (CatsReferral) factory.getDomainObject(catsReferral);

    if (doCatsReferral.getContract() != null
            && doCatsReferral.getContract().getContractType() != null
            && doCatsReferral.getContract().getContractType().getId() != ReferralManagementContractType.DIAGNOSTIC.getId())
            return;

    Booking_Appointment doAppt = (Booking_Appointment) factory.getDomainObject(appt);

    if (doCatsReferral.getAppointments().size() > 0)
    {
        Iterator it = doCatsReferral.getAppointments().iterator();

        if (doAppt.getApptStatus() != null && (doAppt.getApptStatus().equals(getDomLookup(Status_Reason.CANCELLED))))
        {
            if (countExistingReferralAppts(doCatsReferral, Status_Reason.BOOKED) == 0)
            {
                Iterator itOrdInvA = doCatsReferral.getOrderInvAppts().iterator();
                OrderInvAppt doOrdInvAppt = null;
                if(itOrdInvA.hasNext())
                    doOrdInvAppt = (OrderInvAppt) itOrdInvA.next();

                //WDEV-7448 - null pointer fix here - code was presuming that an ordInvAppt always exists
                if(doOrdInvAppt != null)
                {
                    doOrdInvAppt.getOrderInvestigation().setAppointmentDate(null);
                    factory.save(doOrdInvAppt.getOrderInvestigation());
                    doCatsReferral.getOrderInvAppts().remove(doOrdInvAppt);
                    try
                    {
                        factory.delete(doOrdInvAppt);
                    }
                    catch (ForeignKeyViolationException e)
                    {
                        throw new DomainRuntimeException(e.getMessage());
                    }
                    factory.save(doCatsReferral);


                    OCSExternalEvents impl = (OCSExternalEvents) getDomainImpl(OCSExternalEventsImpl.class);
                    impl.generateOrderUpdateEvent(new Booking_AppointmentRefVo(doAppt.getId(), doAppt.getVersion()), new OrderInvestigationRefVo(doOrdInvAppt.getOrderInvestigation().getId(), doOrdInvAppt.getOrderInvestigation().getVersion()));
                }
            }
        }
    }

}
项目:openMAXIMS    文件:ReferralStatusListImpl.java   
/**
 * WDEV-12875
 * Function used to analyse ContractConfiguration records for all Organisations on the branch (up form provided location)
 * @return <b>true</b> if at least one ContractConfiguration record active and of type Diagnostic, <b>false</b> otherwise
 */
public Boolean hasLocationDiagnosicContracts(LocationRefVo location)
{
    // If location is not provided
    if (location == null)
        return false;

    // Get root Location id
    Integer rootLocation = getRootLocationID(location.getID_Location());
    // Get the ID for all organisations on the branch up to root organisation
    ArrayList<Integer> organisations = listParentOrganisations(rootLocation);

    // If no organisations are found then return false
    if (organisations == null || organisations.size() == 0)
        return false;

    // Build query to retrieve first Active contract or type Diagnostic for the organisations on the branch
    StringBuilder query = new StringBuilder();

    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT contract FROM ContractConfig AS contract WHERE contract.status.id = :ACTIVE AND contract.contractType.id = :DIAG ");
    query.append("AND contract.isRIE is null AND contract.contractOrganisation.id IN (");

    paramNames.add("ACTIVE"); paramValues.add(PreActiveActiveInactiveStatus.ACTIVE.getID());
    paramNames.add("DIAG"); paramValues.add(ReferralManagementContractType.DIAGNOSTIC.getID());

    String separator = "";

    for (int i = 0; i < organisations.size(); i++)
    {
        query.append(separator);
        query.append(organisations.get(i));

        separator = ", ";
    }

    query.append(")");

    // Query the database for the first ContractConfig record (non RIE, Active, of type Diagnostic) for organisations on the branch of the provided location
    ContractConfigForReferralDetailsComponentVo contractConfig = ContractConfigForReferralDetailsComponentVoAssembler.create((ContractConfig) getDomainFactory().findFirst(query.toString(), paramNames, paramValues));

    // If at least one ContractConfig record is found then return true, otherwise return false
    if (contractConfig != null)
        return true;

    return false;
}
项目:openmaxims-linux    文件:OCSExternalEventsImpl.java   
public void generateAppointmentCancelEvent(Booking_AppointmentRefVo appointment, OrderInvestigationRefVo investigation) throws StaleObjectException
{
    if (null == appointment)
        throw new DomainRuntimeException("Appointment Cannot be NULL");
    DomainFactory factory = getDomainFactory();
    ExternalSystemEvent event = new ExternalSystemEvent();

    // We need to deal with null investigations
    // when (not )sending the messages
    if (null != investigation) 
    {
        OrderInvestigation domInv = (OrderInvestigation) factory.getDomainObject(investigation);

        //WDEV-5912 For Investigations marked as NoInterface there are no interface calls
        if(domInv.getInvestigation() != null && domInv.getInvestigation().getInvestigationIndex() != null &&  domInv.getInvestigation().getInvestigationIndex().isNoInterface() != null && domInv.getInvestigation().getInvestigationIndex().isNoInterface())
            return;

        if (domInv.getInvestigation()!=null&&domInv.getInvestigation().getProviderService()!=null&&domInv.getInvestigation().getProviderService().getLocationService()!=null
                &&domInv.getInvestigation().getProviderService().getLocationService().getService()!=null
                &&!(ServiceCategory.RADIOLOGY_MODALITY.getID()==( domInv.getInvestigation().getProviderService().getLocationService().getService().getServiceCategory().getId())))

            return;

        event.setInvestigation(domInv);
        ProviderSystem providerSystem=domInv.getInvestigation().getProviderService().getProviderSystem();
        if(!isRebookApptWithCancelandFullXOSetForProviderSystem(providerSystem))
            return;

        event.setProviderSystem(providerSystem);
    }

    if (ReferralManagementContractType.DIAGNOSTIC.getId() == getContractTypeIdFromReferralContractForBookingId(appointment.getBoId()))
        return;

    Booking_Appointment domBookAppt = (Booking_Appointment) factory.getDomainObject(appointment);
    event.setAppointment(domBookAppt);
    event.setWasProcessed(Boolean.FALSE);
    event.setMessageStatus(getDomLookup(OrderMessageStatus.CREATED));
    event.setEventType(getDomLookup(ExternalSystemEventTypes.CANCELAPPOINTMENT));
    if(domBookAppt!=null &&domBookAppt.getSession()!=null)
    {
        event.setCancelledAppointmentLocation(domBookAppt.getSession().getSchLocation());
    }
    factory.save(event);

}