Java 类ims.core.vo.domain.MemberOfStaffShortVoAssembler 实例源码

项目:AvoinApotti    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMosForLocation(LocationRefVo voLocation)
{
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();


    String hql = " from MemberOfStaff mos join fetch mos.locations loc where loc.location.id = :Location and mos.isActive = 1 order by mos.name.upperSurname,mos.name.upperForename"; //WDEV-15662
    if (voLocation != null)
    {
        markers.add("Location");
        values.add(voLocation.getID_Location());
    }

    DomainFactory factory = getDomainFactory();
    List mosList = factory.find(hql, markers, values);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:AvoinApotti    文件:MosAdminImpl.java   
public MemberOfStaffShortVo deactivateMos(MemberOfStaffShortVo mosVo) throws StaleObjectException
{
    if (mosVo.getID_MemberOfStaff() == null)
    {
        throw new DomainRuntimeException("Cannot Activate/Deactivate an MOS with NULL id!");
    }
    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosBo = MemberOfStaffShortVoAssembler.extractMemberOfStaff(getDomainFactory(), mosVo);
    mosBo.setIsActive(!(Boolean.TRUE.equals(mosBo.isIsActive())));

    if (mosBo.getHcp() != null)
    {
        mosBo.getHcp().setIsActive(mosBo.isIsActive());
    }


    factory.save(mosBo);

    return MemberOfStaffShortVoAssembler.create(mosBo);
}
项目:AvoinApotti    文件:MosAdminImpl.java   
public MemberOfStaffVo getMemberOfStaff(MemberOfStaffShortVo mos)
{
    MemberOfStaffVo newMosVo = new MemberOfStaffVo();
    if (mos.getID_MemberOfStaff() == null)
    {
        MemberOfStaffShortVoAssembler.copy(newMosVo, mos);
        return newMosVo;
    }

    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosDo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff().intValue());
    MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(mosDo);
    if (mosVo.getHcpIsNotNull())
    {
        HcpFilter voFilter = new HcpFilter();
        voFilter.setID_Hcp(mosVo.getHcp().getID_Hcp());
        ims.core.vo.Hcp vohcp = getHcp(voFilter);
        mosVo.setHcp(vohcp);
    }
    return mosVo;
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMosForLocation(LocationRefVo voLocation)
{
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();


    String hql = " from MemberOfStaff mos join fetch mos.locations loc where loc.location.id = :Location and mos.isActive = 1 order by mos.name.upperSurname,mos.name.upperForename"; //WDEV-15662
    if (voLocation != null)
    {
        markers.add("Location");
        values.add(voLocation.getID_Location());
    }

    DomainFactory factory = getDomainFactory();
    List mosList = factory.find(hql, markers, values);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVo deactivateMos(MemberOfStaffShortVo mosVo) throws StaleObjectException
    {
        if (mosVo.getID_MemberOfStaff() == null)
        {
            throw new DomainRuntimeException("Cannot Activate/Deactivate an MOS with NULL id!");
        }
        DomainFactory factory = getDomainFactory();
        MemberOfStaff mosBo = MemberOfStaffShortVoAssembler.extractMemberOfStaff(getDomainFactory(), mosVo);
        mosBo.setIsActive(!(Boolean.TRUE.equals(mosBo.isIsActive())));

        if (mosBo.getHcp() != null)
        {
            mosBo.getHcp().setIsActive(mosBo.isIsActive());
        }


        factory.save(mosBo);

        //WDEV-19576 MOS Master File HL7 message
        MemberOfStaffVo assembledMos = MemberOfStaffVoAssembler.create(mosBo);
        triggerMOSMasterFileEvent(assembledMos);

        return assembledMos;

//      return MemberOfStaffShortVoAssembler.create(mosBo);
    }
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffVo getMemberOfStaff(MemberOfStaffShortVo mos)
{
    MemberOfStaffVo newMosVo = new MemberOfStaffVo();
    if (mos.getID_MemberOfStaff() == null)
    {
        MemberOfStaffShortVoAssembler.copy(newMosVo, mos);
        return newMosVo;
    }

    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosDo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff().intValue());
    MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(mosDo);
    if (mosVo.getHcpIsNotNull())
    {
        HcpFilter voFilter = new HcpFilter();
        voFilter.setID_Hcp(mosVo.getHcp().getID_Hcp());
        ims.core.vo.Hcp vohcp = getHcp(voFilter);
        mosVo.setHcp(vohcp);
    }
    return mosVo;
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMosForLocation(LocationRefVo voLocation)
{
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();


    String hql = " from MemberOfStaff mos join fetch mos.locations loc where loc.location.id = :Location and mos.isActive = 1 order by mos.name.upperSurname,mos.name.upperForename"; //WDEV-15662
    if (voLocation != null)
    {
        markers.add("Location");
        values.add(voLocation.getID_Location());
    }

    DomainFactory factory = getDomainFactory();
    List mosList = factory.find(hql, markers, values);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVo deactivateMos(MemberOfStaffShortVo mosVo) throws StaleObjectException
{
    if (mosVo.getID_MemberOfStaff() == null)
    {
        throw new DomainRuntimeException("Cannot Activate/Deactivate an MOS with NULL id!");
    }
    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosBo = MemberOfStaffShortVoAssembler.extractMemberOfStaff(getDomainFactory(), mosVo);
    mosBo.setIsActive(!(Boolean.TRUE.equals(mosBo.isIsActive())));

    if (mosBo.getHcp() != null)
    {
        mosBo.getHcp().setIsActive(mosBo.isIsActive());
    }


    factory.save(mosBo);

    return MemberOfStaffShortVoAssembler.create(mosBo);
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffVo getMemberOfStaff(MemberOfStaffShortVo mos)
{
    MemberOfStaffVo newMosVo = new MemberOfStaffVo();
    if (mos.getID_MemberOfStaff() == null)
    {
        MemberOfStaffShortVoAssembler.copy(newMosVo, mos);
        return newMosVo;
    }

    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosDo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff().intValue());
    MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(mosDo);
    if (mosVo.getHcpIsNotNull())
    {
        HcpFilter voFilter = new HcpFilter();
        voFilter.setID_Hcp(mosVo.getHcp().getID_Hcp());
        ims.core.vo.Hcp vohcp = getHcp(voFilter);
        mosVo.setHcp(vohcp);
    }
    return mosVo;
}
项目:openmaxims-linux    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMosForLocation(LocationRefVo voLocation)
{
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();


    String hql = " from MemberOfStaff mos join fetch mos.locations loc where loc.location.id = :Location and mos.isActive = 1 order by mos.name.upperSurname,mos.name.upperForename"; //WDEV-15662
    if (voLocation != null)
    {
        markers.add("Location");
        values.add(voLocation.getID_Location());
    }

    DomainFactory factory = getDomainFactory();
    List mosList = factory.find(hql, markers, values);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:openmaxims-linux    文件:MosAdminImpl.java   
public MemberOfStaffShortVo deactivateMos(MemberOfStaffShortVo mosVo) throws StaleObjectException
{
    if (mosVo.getID_MemberOfStaff() == null)
    {
        throw new DomainRuntimeException("Cannot Activate/Deactivate an MOS with NULL id!");
    }
    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosBo = MemberOfStaffShortVoAssembler.extractMemberOfStaff(getDomainFactory(), mosVo);
    mosBo.setIsActive(!(Boolean.TRUE.equals(mosBo.isIsActive())));

    if (mosBo.getHcp() != null)
    {
        mosBo.getHcp().setIsActive(mosBo.isIsActive());
    }


    factory.save(mosBo);

    return MemberOfStaffShortVoAssembler.create(mosBo);
}
项目:openmaxims-linux    文件:MosAdminImpl.java   
public MemberOfStaffVo getMemberOfStaff(MemberOfStaffShortVo mos)
{
    MemberOfStaffVo newMosVo = new MemberOfStaffVo();
    if (mos.getID_MemberOfStaff() == null)
    {
        MemberOfStaffShortVoAssembler.copy(newMosVo, mos);
        return newMosVo;
    }

    DomainFactory factory = getDomainFactory();
    MemberOfStaff mosDo = (MemberOfStaff)factory.getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff().intValue());
    MemberOfStaffVo mosVo = MemberOfStaffVoAssembler.create(mosDo);
    if (mosVo.getHcpIsNotNull())
    {
        HcpFilter voFilter = new HcpFilter();
        voFilter.setID_Hcp(mosVo.getHcp().getID_Hcp());
        ims.core.vo.Hcp vohcp = getHcp(voFilter);
        mosVo.setHcp(vohcp);
    }
    return mosVo;
}
项目:AvoinApotti    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listNCHDs()
{
    DomainFactory factory = getDomainFactory();
    List lstMedics =  factory.find("from Medic m where m.isActive = :bActive and m.grade != :medicGrade", new String[]{"medicGrade", "bActive"}, new Object[]{getDomLookup(MedicGrade.CONS), Boolean.TRUE});

    MemberOfStaffShortVoCollection voCollMos = new MemberOfStaffShortVoCollection();
    for (Iterator iter = lstMedics.iterator(); iter.hasNext();)
    {
        MemberOfStaff doMos = ((Medic) iter.next()).getMos();
        voCollMos.add(MemberOfStaffShortVoAssembler.create(doMos));
    }
    return voCollMos;       
}
项目:openMAXIMS    文件:CorrespondenceOutpatientListImpl.java   
public MemberOfStaffShortVo getMOS(MemberOfStaffRefVo mos)
{
    if (mos == null || mos.getID_MemberOfStaff() == null)
        return null;

    return MemberOfStaffShortVoAssembler.create((MemberOfStaff) getDomainFactory().getDomainObject(MemberOfStaff.class, mos.getID_MemberOfStaff()));
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listNCHDs()
{
    DomainFactory factory = getDomainFactory();
    List lstMedics =  factory.find("from Medic m where m.isActive = :bActive and m.grade != :medicGrade", new String[]{"medicGrade", "bActive"}, new Object[]{getDomLookup(MedicGrade.CONS), Boolean.TRUE});

    MemberOfStaffShortVoCollection voCollMos = new MemberOfStaffShortVoCollection();
    for (Iterator iter = lstMedics.iterator(); iter.hasNext();)
    {
        MemberOfStaff doMos = ((Medic) iter.next()).getMos();
        voCollMos.add(MemberOfStaffShortVoAssembler.create(doMos));
    }
    return voCollMos;       
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listNCHDs()
{
    DomainFactory factory = getDomainFactory();
    List lstMedics =  factory.find("from Medic m where m.isActive = :bActive and m.grade != :medicGrade", new String[]{"medicGrade", "bActive"}, new Object[]{getDomLookup(MedicGrade.CONS), Boolean.TRUE});

    MemberOfStaffShortVoCollection voCollMos = new MemberOfStaffShortVoCollection();
    for (Iterator iter = lstMedics.iterator(); iter.hasNext();)
    {
        MemberOfStaff doMos = ((Medic) iter.next()).getMos();
        voCollMos.add(MemberOfStaffShortVoAssembler.create(doMos));
    }
    return voCollMos;       
}
项目:openmaxims-linux    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listNCHDs()
{
    DomainFactory factory = getDomainFactory();
    List lstMedics =  factory.find("from Medic m where m.isActive = :bActive and m.grade != :medicGrade", new String[]{"medicGrade", "bActive"}, new Object[]{getDomLookup(MedicGrade.CONS), Boolean.TRUE});

    MemberOfStaffShortVoCollection voCollMos = new MemberOfStaffShortVoCollection();
    for (Iterator iter = lstMedics.iterator(); iter.hasNext();)
    {
        MemberOfStaff doMos = ((Medic) iter.next()).getMos();
        voCollMos.add(MemberOfStaffShortVoAssembler.create(doMos));
    }
    return voCollMos;       
}
项目:AvoinApotti    文件:ApplicationUsersImpl.java   
/**
 * WDEV-12720
 * Function used to search for Members of Staff not linked to Application Users
 * matching 'mosSurname' and 'mosForename' strings passed
 * Strings passed will be split into words by " " (space) separator and then each
 * of these words is required to be CONTAINED in surname or fore name 
 */
public MemberOfStaffShortVoCollection listMos(String mosSurname, String mosForename)
{
    DomainFactory factory = getDomainFactory();

    StringBuilder query = new StringBuilder();

    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();

    query.append("select m from  MemberOfStaff m where m.id not in ( select au.mos.id from AppUser au where au.mos is not null) ");
    query.append(" and m.isActive = 1");

    if (mosSurname != null && mosSurname.length() > 0)
    {
        String[] surnames = mosSurname.split("\\s+");

        for (int i = 0; i < surnames.length; i++)
        {
            surnames[i] = surnames[i].replaceAll("[^a-zA-Z]", "");

            if (surnames[i].length() > 0)
            {
                query.append(" and (m.name.upperSurname like :SURNAME").append(i).append(")");

                markers.add("SURNAME" + i);
                values.add("%" + surnames[i].toUpperCase() + "%");
            }
        }
    }

    if (mosForename != null && mosForename.length() > 0)
    {
        String[] forenames = mosForename.split("\\s+");

        for (int i = 0; i < forenames.length; i++)
        {
            forenames[i] = forenames[i].replaceAll("[^a-zA-Z]", "");

            if (forenames[i].length() > 0)
            {
                query.append(" and (m.name.upperForename like :FORENAME").append(i).append(")");

                markers.add("FORENAME" + i);
                values.add("%" + forenames[i].toUpperCase() + "%");
            }
        }
    }

    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(factory.find(query.toString(), markers, values)).sort();
}
项目:AvoinApotti    文件:MosSearchImpl.java   
/**
* Returns a MosList based on the search criteria in the passed in filter
*/
public MemberOfStaffShortVoCollection listMembersOfStaff(MemberOfStaffShortVo filter)
{
    List mosList = listDomMos(filter);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:AvoinApotti    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMedics()
{
    List lstMedics = listActiveMedics();
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(lstMedics);
}
项目:AvoinApotti    文件:ReferralAppointmentDetailsComponentImpl.java   
public void cancelTCI(PatientElectiveListRefVo patientWaitingListRef, TCIOutcomeForPatientElectiveListVo tciOutcome) throws StaleObjectException
{
    if (patientWaitingListRef == null)
        throw new CodingRuntimeException("Cannot save on null WaitingList ref");

    DomainFactory factory = getDomainFactory();

    PatientElectiveList domWaitingList = (PatientElectiveList) factory.getDomainObject(patientWaitingListRef);

    MemberOfStaff domainMOS = MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory,((MemberOfStaffShortVo) getMosUser()));
    MemberOfStaff domainMOSFromDialog = MemberOfStaffLiteVoAssembler.extractMemberOfStaff(factory,(MemberOfStaffLiteVo) tciOutcome.getChangeBy());

    ElectiveListStatus status = new ElectiveListStatus();
    status.setElectiveListStatus(getDomLookup(WaitingListStatus.REQUIRES_TCI));
    status.setAuthoringUser(domainMOS);
    status.setStatusDateTime(new Date());

    //wdev-18384
    if( domWaitingList.getElectiveListStatus() == null || domWaitingList.getElectiveListStatus().getElectiveListStatus() == null || !domWaitingList.getElectiveListStatus().getElectiveListStatus().equals(getDomLookup(WaitingListStatus.REMOVED)))
    {
        domWaitingList.setElectiveListStatus(status);
        //wdev-18419
        if( tciOutcome != null && Boolean.TRUE.equals(tciOutcome.getCancelledForNonMedicalReason()) && tciOutcome.getStatusDateTimeIsNotNull() && tciOutcome.getStatusDateTime().getDate().equals(new ims.framework.utils.Date()))
        {
            ims.framework.utils.Date dtnow = new ims.framework.utils.Date();
            dtnow.addDay(28);
            domWaitingList.setRequiresTCIBy(dtnow.getDate());
            domWaitingList.setTCICancelledByProvider(true);
            if( tciOutcome.getOutcomeIsNotNull())
            {
                tciOutcome.setOutcome(AdmissionOfferOutcome.ADMISSION_CANCELLED_BY_HOSPITAL_ON_DAY_7);

            }
        }
        //---------

        if(domWaitingList.getElectiveListStatusHistory() == null)
            domWaitingList.setElectiveListStatusHistory(new ArrayList());

        domWaitingList.getElectiveListStatusHistory().add(status);
    }

    TCIForPatientElectiveList doTCIDetails = domWaitingList.getTCIDetails();

    domWaitingList.setTCIDetails(null);

    TCIOutcomeForPatientElectiveList newOutcome = new TCIOutcomeForPatientElectiveList();

    newOutcome.setOutcome(getDomLookup(tciOutcome.getOutcome()));
    newOutcome.setChangeBy(domainMOSFromDialog);
    newOutcome.setStatusDateTime(tciOutcome.getStatusDateTime().getJavaDate());

    doTCIDetails.setCurrentOutcome(newOutcome);

    if(doTCIDetails.getOutcomeHistory() == null)
        doTCIDetails.setOutcomeHistory(new ArrayList());

    doTCIDetails.getOutcomeHistory().add(newOutcome);

    if(domWaitingList.getTCIHistory() == null)
        domWaitingList.setTCIHistory(new ArrayList());

    domWaitingList.getTCIHistory().add(doTCIDetails);

    factory.save(domWaitingList);
}
项目:openMAXIMS    文件:PatientCaseNotesImpl.java   
public void mergeVolumes(PatientCaseNoteRefVo caseNoteFrom, PatientCaseNoteRefVo caseNoteTo) throws StaleObjectException
{
    if (caseNoteFrom == null || caseNoteTo == null)
        return;

    DomainFactory factory = getDomainFactory();

    PatientCaseNote domCaseNoteFrom = (PatientCaseNote) factory.getDomainObject(PatientCaseNote.class, caseNoteFrom.getID_PatientCaseNote());
    PatientCaseNote domCaseNoteTo = (PatientCaseNote) factory.getDomainObject(PatientCaseNote.class, caseNoteTo.getID_PatientCaseNote());

    if (domCaseNoteFrom.getOpenRequests() != null && domCaseNoteFrom.getOpenRequests().size() > 0)
    {
        for (int i = 0; i < domCaseNoteFrom.getOpenRequests().size(); i++)
        {

            if (domCaseNoteTo.getOpenRequests() == null)
                domCaseNoteTo.setOpenRequests(new ArrayList());

            // update the request and add it to the CaseNote
            PatientCaseNoteRequest request = (PatientCaseNoteRequest) domCaseNoteFrom.getOpenRequests().get(i);
            request.setCaseNote(domCaseNoteTo);

            domCaseNoteTo.getOpenRequests().add(request);
        }
    }
    //WDEV-21606
    if (Arrays.asList(CaseNoteStatus.MARKED_AS_FOUND.getID(), CaseNoteStatus.REQUIRES_MERGING.getID()).contains(domCaseNoteTo.getStatus().getId()))
    {
        domCaseNoteTo.setStatus(getDomLookup(CaseNoteStatus.ACTIVE));
    }
    PatientCaseNoteCommentListVoCollection caseNoteComments = getCommentsForCaseNote(caseNoteFrom);

    if (caseNoteComments != null && caseNoteComments.size() > 0)
    {
        for (int a = 0; a < caseNoteComments.size(); a++)
        {
            if (caseNoteComments.get(a) == null)
                continue;

            PatientCaseNoteComment domComment = (PatientCaseNoteComment) factory.getDomainObject(PatientCaseNoteComment.class, caseNoteComments.get(a).getID_PatientCaseNoteComment());

            domComment.setCaseNote(domCaseNoteTo);

            factory.save(domComment);
        }
    }

    MemberOfStaff domainMOS = null;
    Object mosUser = getMosUser();

    if (mosUser instanceof MemberOfStaffShortVo)
    {
        domainMOS = MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory, ((MemberOfStaffShortVo) getMosUser()));
    }

    domCaseNoteFrom.setMergedBy(domainMOS);
    domCaseNoteFrom.setMergedDate(new Date());
    domCaseNoteFrom.setMergedFrom(domCaseNoteTo);
    domCaseNoteFrom.setStatus(getDomLookup(CaseNoteStatus.MERGED));

    factory.save(domCaseNoteTo);
    factory.save(domCaseNoteFrom);
}
项目:openMAXIMS    文件:TheatreSessionManagementImpl.java   
public void cancelTCIAndReferralEROD(CatsReferralRefVo catsReferral, Booking_AppointmentRefVo apptRef, CancelAppointmentReason cancellationReason, String cancellationComments, Boolean isProviderCancellation, Boolean isPatientCancellation, Boolean cancelledForNonmedicalReason) throws StaleObjectException
{
    if(catsReferral == null || catsReferral.getID_CatsReferral() == null)
        throw new CodingRuntimeException("catsReferral is null or id not provided in method cancelReferralEROD");

    if(apptRef == null || apptRef.getID_Booking_Appointment() == null)
        throw new CodingRuntimeException("apptRef is null or id not provided in method getTheatreAppointment");

    DomainFactory factory = getDomainFactory();
    MemberOfStaff domainMOS = null;

    Object mosUser = getMosUser();

    if(mosUser instanceof MemberOfStaffShortVo)
    {
        domainMOS = MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory,((MemberOfStaffShortVo) getMosUser()));
    }

    String patientElectiveListQuery = "select electiveList from PatientElectiveList as electiveList left join electiveList.referral as cats left join electiveList.electiveListStatus as currentStatus left join currentStatus.electiveListStatus as elStatus left join electiveList.tCIDetails as tci left join tci.appointment as appt where cats.id = :CatsId and appt.id = :appointmentID and elStatus.id <> :RemovedId and (electiveList.isRIE is null or electiveList.isRIE = 0)";
    PatientElectiveList patientElectiveListDO  = (PatientElectiveList) factory.findFirst(patientElectiveListQuery, new String[] {"CatsId", "appointmentID", "RemovedId"}, new Object[] {catsReferral.getID_CatsReferral(), apptRef.getID_Booking_Appointment(), WaitingListStatus.REMOVED.getID()});

    if (patientElectiveListDO == null)
        return;

    TCIForPatientElectiveList doTCIDetails = patientElectiveListDO.getTCIDetails();

    if (doTCIDetails != null)
    {   
        TCIOutcomeForPatientElectiveList newOutcome = new TCIOutcomeForPatientElectiveList();
        newOutcome.setChangeBy(domainMOS);
        newOutcome.setStatusDateTime(doTCIDetails.getTCIDate() != null && new Date().after(doTCIDetails.getTCIDate()) ? (doTCIDetails.getTCITime() != null ? new DateTime(new ims.framework.utils.Date(doTCIDetails.getTCIDate()), new Time(doTCIDetails.getTCITime())).getJavaDate() : doTCIDetails.getTCIDate()) : new Date());
        newOutcome.setOutcomeReason(getDomLookup(TCIStatusChangeReason.LINKEDTHEATREAPPTCANCELLED));
        newOutcome.setCancellationReason(cancellationReason != null ? getDomLookup(cancellationReason) : null);
        newOutcome.setReasonComments(cancellationComments);

        boolean cancelledForNonMedicalReason = Boolean.TRUE.equals(cancelledForNonmedicalReason);
        boolean providerCancellation =  Boolean.TRUE.equals(isProviderCancellation);
        boolean patientCancellation =   Boolean.TRUE.equals(isPatientCancellation);
        boolean cancellationOnTCIDateOrLater = (doTCIDetails.getTCIDate() != null && new ims.framework.utils.Date().isGreaterOrEqualThan(new ims.framework.utils.Date(doTCIDetails.getTCIDate())));

        if (providerCancellation)
        {   
            newOutcome.setOutcome(cancellationOnTCIDateOrLater ? getDomLookup(AdmissionOfferOutcome.ADMISSION_CANCELLED_BY_HOSPITAL_ON_DAY_7) : getDomLookup(AdmissionOfferOutcome.ADMISSION_CANCELLED_BY_HOSPITAL_BEFORE_6));
            newOutcome.setCancelledForNonMedicalReason(cancelledForNonMedicalReason);
        }
        else if (patientCancellation)
        {   
            newOutcome.setOutcome(getDomLookup(AdmissionOfferOutcome.ADMISSION_CANCELLED_BY_PATIENT_2));
        }
        //call cancel TCI to finish and commit changes
        cancelTCI(new PatientElectiveListRefVo(patientElectiveListDO.getId(), patientElectiveListDO.getVersion()), TCIOutcomeForPatientElectiveListVoAssembler.create(newOutcome), null);
    }
    else
     throw new  StaleObjectException(patientElectiveListDO, "The TCI has been cancelled by another user. The screen will be refreshed.");   
}
项目:openMAXIMS    文件:ApplicationUsersImpl.java   
/**
 * WDEV-12720
 * Function used to search for Members of Staff not linked to Application Users
 * matching 'mosSurname' and 'mosForename' strings passed
 * Strings passed will be split into words by " " (space) separator and then each
 * of these words is required to be CONTAINED in surname or fore name 
 */
public MemberOfStaffShortVoCollection listMos(String mosSurname, String mosForename)
{
    DomainFactory factory = getDomainFactory();

    StringBuilder query = new StringBuilder();

    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();

    query.append("select m from  MemberOfStaff m where m.id not in ( select au.mos.id from AppUser au where au.mos is not null) ");
    query.append(" and m.isActive = 1");

    if (mosSurname != null && mosSurname.length() > 0)
    {
        String[] surnames = mosSurname.split("\\s+");

        for (int i = 0; i < surnames.length; i++)
        {
            surnames[i] = surnames[i].replaceAll("[^a-zA-Z]", "");

            if (surnames[i].length() > 0)
            {
                query.append(" and (m.name.upperSurname like :SURNAME").append(i).append(")");

                markers.add("SURNAME" + i);
                values.add("%" + surnames[i].toUpperCase() + "%");
            }
        }
    }

    if (mosForename != null && mosForename.length() > 0)
    {
        String[] forenames = mosForename.split("\\s+");

        for (int i = 0; i < forenames.length; i++)
        {
            forenames[i] = forenames[i].replaceAll("[^a-zA-Z]", "");

            if (forenames[i].length() > 0)
            {
                query.append(" and (m.name.upperForename like :FORENAME").append(i).append(")");

                markers.add("FORENAME" + i);
                values.add("%" + forenames[i].toUpperCase() + "%");
            }
        }
    }

    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(factory.find(query.toString(), markers, values)).sort();
}
项目:openMAXIMS    文件:MosSearchImpl.java   
/**
* Returns a MosList based on the search criteria in the passed in filter
*/
public MemberOfStaffShortVoCollection listMembersOfStaff(MemberOfStaffShortVo filter)
{
    List mosList = listDomMos(filter);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMedics()
{
    List lstMedics = listActiveMedics();
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(lstMedics);
}
项目:openMAXIMS    文件:AdminEventImpl.java   
private void markAsRemovedFutureAppointments(CatsReferral catsReferral) throws StaleObjectException
{
    if(catsReferral == null)
        return;

    String query = "select fda from FutureAppointmentDetails as fda left join fda.referral as cats left join fda.currentStatus as fdacs left join fdacs.pendingStatus as ps where cats.id = :CatsId and ps.id = :StatusId";
    DomainFactory factory = getDomainFactory();

    List futureAppts = factory.find(query, new String[] {"CatsId", "StatusId"}, new Object[] {catsReferral.getId(), FutureAppointmentStatus.OPEN.getID()});

    if(futureAppts == null || futureAppts.size() == 0)
        return;

    Object mos = getMosUser();
    MemberOfStaffShortVo mosUser = null;

    if(mos instanceof MemberOfStaffShortVo)
    {
        mosUser  = (MemberOfStaffShortVo) mos;
    }

    for(int i = 0; i<futureAppts.size(); i++)
    {
        if(futureAppts.get(i) == null)
            continue;

        FutureAppointmentDetails futureAppt = (FutureAppointmentDetails) futureAppts.get(i);

        ims.scheduling.domain.objects.FutureAppointmentStatus status = new ims.scheduling.domain.objects.FutureAppointmentStatus();
        status.setPendingStatus(getDomLookup(FutureAppointmentStatus.REMOVED));
        status.setStatusDateTime(new java.util.Date());
        status.setAuthoringUser(MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory, (MemberOfStaffShortVo) mosUser));

        futureAppt.setCurrentStatus(status);

        if(futureAppt.getStatusHistory() == null)
        {
            futureAppt.setStatusHistory(new ArrayList());
        }

        futureAppt.getStatusHistory().add(status);

        factory.save(futureAppt);
    }
}
项目:openMAXIMS    文件:ReferralDetailsImpl.java   
private void markAsRemovedFutureAppointments(CatsReferral catsReferral) throws StaleObjectException
{
    if(catsReferral == null)
        return;

    String query = "select fda from FutureAppointmentDetails as fda left join fda.referral as cats left join fda.currentStatus as fdacs left join fdacs.pendingStatus as ps where cats.id = :CatsId and ps.id = :StatusId";
    DomainFactory factory = getDomainFactory();

    List futureAppts = factory.find(query, new String[] {"CatsId", "StatusId"}, new Object[] {catsReferral.getId(), FutureAppointmentStatus.OPEN.getID()});

    if(futureAppts == null || futureAppts.size() == 0)
        return;

    Object mos = getMosUser();
    MemberOfStaffShortVo mosUser = null;

    if(mos instanceof MemberOfStaffShortVo)
    {
        mosUser  = (MemberOfStaffShortVo) mos;
    }

    for(int i = 0; i<futureAppts.size(); i++)
    {
        if(futureAppts.get(i) == null)
            continue;

        FutureAppointmentDetails futureAppt = (FutureAppointmentDetails) futureAppts.get(i);

        ims.scheduling.domain.objects.FutureAppointmentStatus status = new ims.scheduling.domain.objects.FutureAppointmentStatus();
        status.setPendingStatus(getDomLookup(FutureAppointmentStatus.REMOVED));
        status.setStatusDateTime(new java.util.Date());
        status.setAuthoringUser(MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory, (MemberOfStaffShortVo) mosUser));

        futureAppt.setCurrentStatus(status);

        if(futureAppt.getStatusHistory() == null)
        {
            futureAppt.setStatusHistory(new ArrayList());
        }

        futureAppt.getStatusHistory().add(status);

        factory.save(futureAppt);
    }
}
项目:openMAXIMS    文件:ApplicationUsersImpl.java   
/**
 * WDEV-12720
 * Function used to search for Members of Staff not linked to Application Users
 * matching 'mosSurname' and 'mosForename' strings passed
 * Strings passed will be split into words by " " (space) separator and then each
 * of these words is required to be CONTAINED in surname or fore name 
 */
public MemberOfStaffShortVoCollection listMos(String mosSurname, String mosForename)
{
    DomainFactory factory = getDomainFactory();

    StringBuilder query = new StringBuilder();

    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();

    query.append("select m from  MemberOfStaff m where m.id not in ( select au.mos.id from AppUser au where au.mos is not null) ");
    query.append(" and m.isActive = 1");

    if (mosSurname != null && mosSurname.length() > 0)
    {
        String[] surnames = mosSurname.split("\\s+");

        for (int i = 0; i < surnames.length; i++)
        {
            surnames[i] = surnames[i].replaceAll("[^a-zA-Z]", "");

            if (surnames[i].length() > 0)
            {
                query.append(" and (m.name.upperSurname like :SURNAME").append(i).append(")");

                markers.add("SURNAME" + i);
                values.add("%" + surnames[i].toUpperCase() + "%");
            }
        }
    }

    if (mosForename != null && mosForename.length() > 0)
    {
        String[] forenames = mosForename.split("\\s+");

        for (int i = 0; i < forenames.length; i++)
        {
            forenames[i] = forenames[i].replaceAll("[^a-zA-Z]", "");

            if (forenames[i].length() > 0)
            {
                query.append(" and (m.name.upperForename like :FORENAME").append(i).append(")");

                markers.add("FORENAME" + i);
                values.add("%" + forenames[i].toUpperCase() + "%");
            }
        }
    }

    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(factory.find(query.toString(), markers, values)).sort();
}
项目:openMAXIMS    文件:MosSearchImpl.java   
/**
* Returns a MosList based on the search criteria in the passed in filter
*/
public MemberOfStaffShortVoCollection listMembersOfStaff(MemberOfStaffShortVo filter)
{
    List mosList = listDomMos(filter);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMedics()
{
    List lstMedics = listActiveMedics();
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(lstMedics);
}
项目:openMAXIMS    文件:ReferralAppointmentDetailsComponentImpl.java   
public void cancelTCI(PatientElectiveListRefVo patientWaitingListRef, TCIOutcomeForPatientElectiveListVo tciOutcome) throws StaleObjectException
{
    if (patientWaitingListRef == null)
        throw new CodingRuntimeException("Cannot save on null WaitingList ref");

    DomainFactory factory = getDomainFactory();

    PatientElectiveList domWaitingList = (PatientElectiveList) factory.getDomainObject(patientWaitingListRef);

    MemberOfStaff domainMOS = MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory,((MemberOfStaffShortVo) getMosUser()));
    MemberOfStaff domainMOSFromDialog = MemberOfStaffLiteVoAssembler.extractMemberOfStaff(factory,(MemberOfStaffLiteVo) tciOutcome.getChangeBy());

    ElectiveListStatus status = new ElectiveListStatus();
    status.setElectiveListStatus(getDomLookup(WaitingListStatus.REQUIRES_TCI));
    status.setAuthoringUser(domainMOS);
    status.setStatusDateTime(new Date());

    //wdev-18384
    if( domWaitingList.getElectiveListStatus() == null || domWaitingList.getElectiveListStatus().getElectiveListStatus() == null || !domWaitingList.getElectiveListStatus().getElectiveListStatus().equals(getDomLookup(WaitingListStatus.REMOVED)))
    {
        domWaitingList.setElectiveListStatus(status);
        //wdev-18419
        if( tciOutcome != null && Boolean.TRUE.equals(tciOutcome.getCancelledForNonMedicalReason()) && tciOutcome.getStatusDateTimeIsNotNull() && tciOutcome.getStatusDateTime().getDate().equals(new ims.framework.utils.Date()))
        {
            ims.framework.utils.Date dtnow = new ims.framework.utils.Date();
            dtnow.addDay(28);
            domWaitingList.setRequiresTCIBy(dtnow.getDate());
            domWaitingList.setTCICancelledByProvider(true);
            if( tciOutcome.getOutcomeIsNotNull())
            {
                tciOutcome.setOutcome(AdmissionOfferOutcome.ADMISSION_CANCELLED_BY_HOSPITAL_ON_DAY_7);

            }
        }
        //---------

        if(domWaitingList.getElectiveListStatusHistory() == null)
            domWaitingList.setElectiveListStatusHistory(new ArrayList());

        domWaitingList.getElectiveListStatusHistory().add(status);
    }

    TCIForPatientElectiveList doTCIDetails = domWaitingList.getTCIDetails();

    domWaitingList.setTCIDetails(null);

    TCIOutcomeForPatientElectiveList newOutcome = new TCIOutcomeForPatientElectiveList();

    newOutcome.setOutcome(getDomLookup(tciOutcome.getOutcome()));
    newOutcome.setChangeBy(domainMOSFromDialog);
    newOutcome.setStatusDateTime(tciOutcome.getStatusDateTime().getJavaDate());

    doTCIDetails.setCurrentOutcome(newOutcome);

    if(doTCIDetails.getOutcomeHistory() == null)
        doTCIDetails.setOutcomeHistory(new ArrayList());

    doTCIDetails.getOutcomeHistory().add(newOutcome);

    if(domWaitingList.getTCIHistory() == null)
        domWaitingList.setTCIHistory(new ArrayList());

    domWaitingList.getTCIHistory().add(doTCIDetails);

    factory.save(domWaitingList);
}
项目:openmaxims-linux    文件:ApplicationUsersImpl.java   
/**
 * WDEV-12720
 * Function used to search for Members of Staff not linked to Application Users
 * matching 'mosSurname' and 'mosForename' strings passed
 * Strings passed will be split into words by " " (space) separator and then each
 * of these words is required to be CONTAINED in surname or fore name 
 */
public MemberOfStaffShortVoCollection listMos(String mosSurname, String mosForename)
{
    DomainFactory factory = getDomainFactory();

    StringBuilder query = new StringBuilder();

    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();

    query.append("select m from  MemberOfStaff m where m.id not in ( select au.mos.id from AppUser au where au.mos is not null) ");
    query.append(" and m.isActive = 1");

    if (mosSurname != null && mosSurname.length() > 0)
    {
        String[] surnames = mosSurname.split("\\s+");

        for (int i = 0; i < surnames.length; i++)
        {
            surnames[i] = surnames[i].replaceAll("[^a-zA-Z]", "");

            if (surnames[i].length() > 0)
            {
                query.append(" and (m.name.upperSurname like :SURNAME").append(i).append(")");

                markers.add("SURNAME" + i);
                values.add("%" + surnames[i].toUpperCase() + "%");
            }
        }
    }

    if (mosForename != null && mosForename.length() > 0)
    {
        String[] forenames = mosForename.split("\\s+");

        for (int i = 0; i < forenames.length; i++)
        {
            forenames[i] = forenames[i].replaceAll("[^a-zA-Z]", "");

            if (forenames[i].length() > 0)
            {
                query.append(" and (m.name.upperForename like :FORENAME").append(i).append(")");

                markers.add("FORENAME" + i);
                values.add("%" + forenames[i].toUpperCase() + "%");
            }
        }
    }

    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(factory.find(query.toString(), markers, values)).sort();
}
项目:openmaxims-linux    文件:MosSearchImpl.java   
/**
* Returns a MosList based on the search criteria in the passed in filter
*/
public MemberOfStaffShortVoCollection listMembersOfStaff(MemberOfStaffShortVo filter)
{
    List mosList = listDomMos(filter);
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(mosList);
}
项目:openmaxims-linux    文件:MosAdminImpl.java   
public MemberOfStaffShortVoCollection listMedics()
{
    List lstMedics = listActiveMedics();
    return MemberOfStaffShortVoAssembler.createMemberOfStaffShortVoCollectionFromMemberOfStaff(lstMedics);
}
项目:openMAXIMS    文件:ElectiveListDetailsImpl.java   
public void dnaTCI(PatientElectiveListRefVo patientElectiveList, Booking_AppointmentRefVo theatreThatIsNotDNA) throws StaleObjectException
{
    if (patientElectiveList == null)
        throw new CodingRuntimeException("Cannot mark the TCI as DNA on null PatientElectiveList.");

    DomainFactory factory = getDomainFactory();

    MemberOfStaff domainMOS = MemberOfStaffShortVoAssembler.extractMemberOfStaff(factory,((MemberOfStaffShortVo) getMosUser()));

    PatientElectiveList domWaitingList = (PatientElectiveList) factory.getDomainObject(patientElectiveList);

    ElectiveListStatus status = new ElectiveListStatus();
    status.setElectiveListStatus(getDomLookup(WaitingListStatus.REQUIRES_TCI));
    status.setAuthoringUser(domainMOS);
    status.setStatusDateTime(new java.util.Date());

    domWaitingList.setElectiveListStatus(status);

    if(domWaitingList.getElectiveListStatusHistory() == null)
        domWaitingList.setElectiveListStatusHistory(new ArrayList());

    domWaitingList.getElectiveListStatusHistory().add(status);

    TCIForPatientElectiveList doTCIDetails = domWaitingList.getTCIDetails();
    domWaitingList.setTCIDetails(null);

    TCIOutcomeForPatientElectiveList newOutcome = new TCIOutcomeForPatientElectiveList();

    newOutcome.setOutcome(getDomLookup(AdmissionOfferOutcome.PATIENT_FAILED_TO_ARRIVE_4));
    newOutcome.setChangeBy(domainMOS);
    newOutcome.setStatusDateTime(new java.util.Date());

    doTCIDetails.setCurrentOutcome(newOutcome);

    if(doTCIDetails.getOutcomeHistory() == null)
        doTCIDetails.setOutcomeHistory(new ArrayList());

    doTCIDetails.getOutcomeHistory().add(newOutcome);

    if(domWaitingList.getTCIHistory() == null)
        domWaitingList.setTCIHistory(new ArrayList());

    domWaitingList.getTCIHistory().add(doTCIDetails);

    if(theatreThatIsNotDNA != null && theatreThatIsNotDNA.getID_Booking_Appointment() != null)
    {
        domWaitingList.setTheatreAppointment((Booking_Appointment) factory.getDomainObject(Booking_Appointment.class, theatreThatIsNotDNA.getID_Booking_Appointment()));
    }

    factory.save(domWaitingList);
}