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

项目:openMAXIMS    文件:Logic.java   
private EpisodeOfCareAdmitVo createEpisodeOfCare(CareSpellAdmitVo careSpell, DateTime startDateTime, HcpRefVo responsibleHCP, Specialty specialty)
{
    EpisodeOfCareAdmitVo episodeOfCare = new EpisodeOfCareAdmitVo();

    episodeOfCare.setStartDate(startDateTime.getDate());
    episodeOfCare.setEndDate(null);

    episodeOfCare.setCareSpell(careSpell);
    episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);

    episodeOfCare.setSpecialty(specialty);
    episodeOfCare.setResponsibleHCP(responsibleHCP);        

    EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo();
    firstStatus.setStatus(EpisodeOfCareStatus.OPEN);
    firstStatus.setStatusDateTime(startDateTime);

    episodeOfCare.setCurrentStatus(firstStatus);
    episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection());
    episodeOfCare.getStatusHistory().add(firstStatus);

    if (careSpell.getEpisodes() == null) careSpell.setEpisodes(new EpisodeOfCareAdmitVoCollection());
    careSpell.getEpisodes().add(episodeOfCare);

    return episodeOfCare;
}
项目:openMAXIMS    文件:Logic.java   
private EpisodeOfCareRepatriationVo createEpisodeOfCare(PatientRefVo patient, CareSpellRefVo careSpell, PasEventRepatriationVo pasEvent, DateTime startDateTime, HcpLiteVo hcp, LocationRefVo location, ServiceLiteVo service, SourceOfReferral sourceOfReferral)
{
    EpisodeOfCareRepatriationVo episodeOfCare = new EpisodeOfCareRepatriationVo();

    episodeOfCare.setCareSpell(careSpell);
    episodeOfCare.setResponsibleHCP(hcp);       
    episodeOfCare.setSpecialty(service != null ? service.getSpecialty() : null);
    episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episodeOfCare.setStartDate(startDateTime.getDate());
    episodeOfCare.setEndDate(null);

    EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo();
    firstStatus.setStatus(EpisodeOfCareStatus.OPEN);
    firstStatus.setStatusDateTime(startDateTime);

    episodeOfCare.setCurrentStatus(firstStatus);
    episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection());
    episodeOfCare.getStatusHistory().add(firstStatus);

    episodeOfCare.setCareContexts(new CareContextRepatriationVoCollection());
    episodeOfCare.getCareContexts().add(createCareContext(patient, episodeOfCare, pasEvent, startDateTime, hcp, location, service, sourceOfReferral));

    return episodeOfCare;
}
项目:openMAXIMS    文件:Logic.java   
private EpisodeOfCareAdmitVo createEpisodeOfCare(CareSpellAdmitVo careSpell, DateTime startDateTime, HcpRefVo responsibleHCP, Specialty specialty)
{
    EpisodeOfCareAdmitVo episodeOfCare = new EpisodeOfCareAdmitVo();

    episodeOfCare.setStartDate(startDateTime.getDate());
    episodeOfCare.setEndDate(null);

    episodeOfCare.setCareSpell(careSpell);
    episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);

    episodeOfCare.setSpecialty(specialty);
    episodeOfCare.setResponsibleHCP(responsibleHCP);        

    EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo();
    firstStatus.setStatus(EpisodeOfCareStatus.OPEN);
    firstStatus.setStatusDateTime(startDateTime);

    episodeOfCare.setCurrentStatus(firstStatus);
    episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection());
    episodeOfCare.getStatusHistory().add(firstStatus);

    if (careSpell.getEpisodes() == null) careSpell.setEpisodes(new EpisodeOfCareAdmitVoCollection());
    careSpell.getEpisodes().add(episodeOfCare);

    return episodeOfCare;
}
项目:openMAXIMS    文件:Logic.java   
private EpisodeOfCareForRequestServiceShortVo createEpisodeOfCare(CareSpellForRequestServiceShortVo careSpell, DateTime startDateTime, HcpRefVo responsibleHCP, Specialty specialty)
{
    EpisodeOfCareForRequestServiceShortVo episodeOfCare = new EpisodeOfCareForRequestServiceShortVo();

    episodeOfCare.setStartDate(startDateTime.getDate());

    episodeOfCare.setCareSpell(careSpell);
    episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);

    episodeOfCare.setSpecialty(specialty);
    episodeOfCare.setResponsibleHCP(responsibleHCP);        

    EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo();
    firstStatus.setStatus(EpisodeOfCareStatus.OPEN);
    firstStatus.setStatusDateTime(startDateTime);

    episodeOfCare.setCurrentStatus(firstStatus);
    episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryRefVoCollection());
    episodeOfCare.getStatusHistory().add(firstStatus);

    if (careSpell.getEpisodes() == null) careSpell.setEpisodes(new EpisodeOfCareForRequestServiceShortVoCollection());
    careSpell.getEpisodes().add(episodeOfCare);

    return episodeOfCare;
}
项目:openMAXIMS    文件:Logic.java   
private EpisodeOfCareForRequestServiceShortVo createEpisodeOfCare(CareSpellForRequestServiceShortVo careSpell, DateTime startDateTime, HcpRefVo responsibleHCP, Specialty specialty)
{
    EpisodeOfCareForRequestServiceShortVo episodeOfCare = new EpisodeOfCareForRequestServiceShortVo();

    episodeOfCare.setStartDate(startDateTime.getDate());

    episodeOfCare.setCareSpell(careSpell);
    episodeOfCare.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);

    episodeOfCare.setSpecialty(specialty);
    episodeOfCare.setResponsibleHCP(responsibleHCP);        

    EpisodeOfCareStatusHistoryVo firstStatus = new EpisodeOfCareStatusHistoryVo();
    firstStatus.setStatus(EpisodeOfCareStatus.OPEN);
    firstStatus.setStatusDateTime(startDateTime);

    episodeOfCare.setCurrentStatus(firstStatus);
    episodeOfCare.setStatusHistory(new EpisodeOfCareStatusHistoryRefVoCollection());
    episodeOfCare.getStatusHistory().add(firstStatus);

    if (careSpell.getEpisodes() == null) careSpell.setEpisodes(new EpisodeOfCareForRequestServiceShortVoCollection());
    careSpell.getEpisodes().add(episodeOfCare);

    return episodeOfCare;
}
项目:AvoinApotti    文件:Logic.java   
private CareSpellVo createCareSpellEpisodeCareContext(PatientShort patient, AdmissionDetailVo  admission)
{
    HcpLiteVo hcp = domain.getHcpFromIMos(form.ccConsultant().getValue());
    BedSpaceStateLiteVo bedState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    CareSpellVo careSpell = new CareSpellVo();
    careSpell.setStartDate(new Date());
    careSpell.setEndDate(null);
    careSpell.setPatient(patient);

        EpisodeofCareVo episode = new EpisodeofCareVo();
        episode.setCareSpell(careSpell);
        episode.setResponsibleHCP(hcp);
        episode.setSpecialty(form.cmbSpecialty().getValue());
        episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
        episode.setStartDate(new Date());
        episode.setEndDate(null);

            CareContextVo careContext = new CareContextVo();
            careContext.setPasEvent(null);
            careContext.setContext(ContextType.EMERGENCY_UNSCHEDULED);
            careContext.setEpisodeOfCare(episode);
            careContext.setOrderingHospital(null);
            careContext.setEstimatedDischargeDate(form.dteEstDischarge().getValue());
            careContext.setStartDateTime(new DateTime());
            careContext.setEndDateTime(null);
            careContext.setLocationType(null);
            careContext.setResponsibleHCP(hcp);
            careContext.setBedNumber((bedState != null && bedState.getBedSpace() != null) ? bedState.getBedSpace().getBedNumber() : null);
            careContext.setDischargeReason(null);
            careContext.setCareContextHistory(null);

            CareContextStatusHistoryVo contextStatus = new CareContextStatusHistoryVo();
            contextStatus.setStatus(CareContextStatus.OPEN);
            contextStatus.setStatusDateTime(new DateTime());
            careContext.setCurrentStatus(contextStatus);
            careContext.setStatusHistory(new CareContextStatusHistoryVoCollection());
            careContext.getStatusHistory().add(contextStatus);

        episode.setCareContexts(new CareContextVoCollection());
        episode.getCareContexts().add(careContext);

        episode.setLinkedReferrals(null);
        episode.setLinkedReferralsHistory(null);
        episode.setCurrentReferral(null);
        episode.setEpisodeOfCareHistory(null);

        EpisodeOfCareStatusHistoryVo episodeStatus = new EpisodeOfCareStatusHistoryVo();
        episodeStatus.setStatus(EpisodeOfCareStatus.OPEN);
        episodeStatus.setStatusDateTime(new DateTime());
        episode.setCurrentStatus(episodeStatus);
        episode.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection());
        episode.getStatusHistory().add(episodeStatus);

        careSpell.setEpisodes(new EpisodeofCareVoCollection());
    careSpell.getEpisodes().add(episode);

    CareSpellStatusHistoryVo careSpellStatus = new CareSpellStatusHistoryVo();
    careSpellStatus.setStatus(ProblemGroupStatus.OPEN);
    careSpellStatus.setStatusDateTime(new DateTime());
    careSpell.setCurrentStatus(careSpellStatus);
    careSpell.setStatusHistory(new CareSpellStatusHistoryVoCollection());
    careSpell.getStatusHistory().add(careSpellStatus);

    return careSpell;
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
private void createOrSaveCareSpell(DomainFactory factory, AdmissionDetail doAdmissionDetail) throws StaleObjectException
{
    //WDEV-13001 //5) b) Use Selected Episode
    EpisodeOfCare doEpisode = new EpisodeOfCare();
    CareSpell doCareSpell = new CareSpell();
    if(ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {
        if(doAdmissionDetail.getAdmissionEpisode() != null)
            doEpisode = doAdmissionDetail.getAdmissionEpisode();

        if(doEpisode.getCareSpell() != null)
            doCareSpell = doEpisode.getCareSpell();
    }

    doCareSpell.setPatient(doAdmissionDetail.getPasEvent().getPatient());

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {   
        doCareSpell.setStartDate(doAdmissionDetail.getAdmissionDateTime());

        doEpisode.setCareSpell(doCareSpell);

        //wdev-14309
        doEpisode.setResponsibleHCP(doAdmissionDetail.getConsultant());

        doEpisode.setRelationship(getDomLookup(CareSpelltoEpisodeRelationship.PRIMARY));
        doEpisode.setSpecialty(doAdmissionDetail.getPasEvent().getSpecialty());
        doEpisode.setStartDate( doAdmissionDetail.getAdmissionDateTime());
        //wdev-14309
    }

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
        doCareSpell.getEpisodes().add(doEpisode);

    CareContext doCareContext = new CareContext();
    doCareContext.setEpisodeOfCare(doEpisode);
    doCareContext.setContext(getDomLookup(ContextType.INPATIENT));
    doCareContext.setStartDateTime(doAdmissionDetail.getAdmissionDateTime());
    doCareContext.setPasEvent(doAdmissionDetail.getPasEvent());
    doCareContext.setResponsibleHCP(doEpisode.getResponsibleHCP());
    doCareContext.setEstimatedDischargeDate(doAdmissionDetail.getEstDischargeDate()); //WDEV-11438

    doCareContext.setCurrentStatus(new CareContextStatusHistory());
    doCareContext.getCurrentStatus().setStatus(getDomLookup(CareContextStatus.OPEN));
    doCareContext.getCurrentStatus().setStatusDateTime(new java.util.Date());

    doEpisode.getCareContexts().add(doCareContext);
    factory.save(doCareSpell);
}
项目:AvoinApotti    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv)throws HL7Exception
{
    CareSpellVo careSpell=new CareSpellVo();
    if(pas!=null && pas.getEventDateTime()!=null)
        careSpell.setStartDate( pas.getEventDateTime().getDate());
    else
        throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

    careSpell.setPatient(pas.getPatient());
    EpisodeofCareVo episode=new EpisodeofCareVo();
    episode.setCareSpell(careSpell);
    episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

    // wdev-4883 Check for PAS code mapping if national consultant code not found
    if (!episode.getResponsibleHCPIsNotNull())
    {
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
    }

    episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episode.setSpecialty(pas.getSpecialty());
    episode.setStartDate( pas.getEventDateTime().getDate());
    EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
    episodes.add(episode);
    CareContextVo careContext=new CareContextVo();
    careContext.setEpisodeOfCare(episode);
    ContextType context=new ContextType();
    if (pv.getPatientClass().getValue().equals("I"))
    {
        context = ContextType.INPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("O"))
    {
        context = ContextType.OUTPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("P"))
    {
        context = ContextType.TCI;
        pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
    }
    else
    {
        context = ContextType.GHGSURGERY;
    }
    careContext.setContext(context);
    careContext.setStartDateTime(pas.getEventDateTime());
    careContext.setPasEvent(pas);
    careContext.setResponsibleHCP(episode.getResponsibleHCP());

    //WDEV-10231
    careContext.setCurrentStatus(new CareContextStatusHistoryVo());
    careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
    careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

    LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
    LocSiteRefVo orderingHospRef = new LocSiteRefVo();
    if (loc!=null)
    {
        orderingHospRef.setID_Location(loc.getBoId());
        careContext.setOrderingHospital(orderingHospRef);
    }


    CareContextVoCollection careContexts=new CareContextVoCollection();
    careContexts.add(careContext);
    episode.setCareContexts(careContexts);
    careSpell.setEpisodes(episodes);

    return careSpell;


}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
private void createOrSaveCareSpell(DomainFactory factory, AdmissionDetail doAdmissionDetail) throws StaleObjectException
{
    //WDEV-13001 //5) b) Use Selected Episode
    EpisodeOfCare doEpisode = new EpisodeOfCare();
    CareSpell doCareSpell = new CareSpell();
    if(ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {
        if(doAdmissionDetail.getAdmissionEpisode() != null)
            doEpisode = doAdmissionDetail.getAdmissionEpisode();

        if(doEpisode.getCareSpell() != null)
            doCareSpell = doEpisode.getCareSpell();
    }

    doCareSpell.setPatient(doAdmissionDetail.getPasEvent().getPatient());

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {   
        doCareSpell.setStartDate(doAdmissionDetail.getAdmissionDateTime());

        doEpisode.setCareSpell(doCareSpell);

        //wdev-14309
        doEpisode.setResponsibleHCP(doAdmissionDetail.getConsultant());

        doEpisode.setRelationship(getDomLookup(CareSpelltoEpisodeRelationship.PRIMARY));
        doEpisode.setSpecialty(doAdmissionDetail.getPasEvent().getSpecialty());
        doEpisode.setStartDate( doAdmissionDetail.getAdmissionDateTime());
        //wdev-14309
    }

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
        doCareSpell.getEpisodes().add(doEpisode);

    CareContext doCareContext = new CareContext();
    doCareContext.setEpisodeOfCare(doEpisode);
    doCareContext.setContext(getDomLookup(ContextType.INPATIENT));
    doCareContext.setStartDateTime(doAdmissionDetail.getAdmissionDateTime());
    doCareContext.setPasEvent(doAdmissionDetail.getPasEvent());
    doCareContext.setResponsibleHCP(doEpisode.getResponsibleHCP());
    doCareContext.setEstimatedDischargeDate(doAdmissionDetail.getEstDischargeDate()); //WDEV-11438

    doCareContext.setCurrentStatus(new CareContextStatusHistory());
    doCareContext.getCurrentStatus().setStatus(getDomLookup(CareContextStatus.OPEN));
    doCareContext.getCurrentStatus().setStatusDateTime(new java.util.Date());

    doEpisode.getCareContexts().add(doCareContext);
    factory.save(doCareSpell);
}
项目:openMAXIMS    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv, ProviderSystemVo providerSystem)throws HL7Exception //WDEV-20278
    {
        CareSpellVo careSpell=new CareSpellVo();
        if(pas!=null && pas.getEventDateTime()!=null)
            careSpell.setStartDate( pas.getEventDateTime().getDate());
        else
            throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

        careSpell.setPatient(pas.getPatient());
        EpisodeofCareVo episode=new EpisodeofCareVo();
        episode.setCareSpell(careSpell);
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

        // wdev-4883 Check for PAS code mapping if national consultant code not found
        if (!episode.getResponsibleHCPIsNotNull())
        {
            episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
        }

        episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
        episode.setSpecialty(pas.getSpecialty());
        episode.setStartDate( pas.getEventDateTime().getDate());
        EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
        episodes.add(episode);
        CareContextVo careContext=new CareContextVo();
        careContext.setEpisodeOfCare(episode);
        ContextType context=new ContextType();
        if (pv.getPatientClass().getValue().equals("I"))
        {
            context = ContextType.INPATIENT;
            pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
        }
        else if (pv.getPatientClass().getValue().equals("O"))
        {
            context = ContextType.OUTPATIENT;
            pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
        }
        else if (pv.getPatientClass().getValue().equals("P"))
        {
            context = ContextType.TCI;
            pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
        }
        else
        {
            context = ContextType.GHGSURGERY;
        }
        careContext.setContext(context);
        careContext.setStartDateTime(pas.getEventDateTime());
        careContext.setPasEvent(pas);
        careContext.setResponsibleHCP(episode.getResponsibleHCP());

        //WDEV-10231
        careContext.setCurrentStatus(new CareContextStatusHistoryVo());
        careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
        careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

        //WDEV-20278
//      LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
        LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), providerSystem.getCodeSystem()); //WDEV-20278
        LocSiteRefVo orderingHospRef = new LocSiteRefVo();
        if (loc!=null)
        {
            orderingHospRef.setID_Location(loc.getBoId());
            careContext.setOrderingHospital(orderingHospRef);
        }


        CareContextVoCollection careContexts=new CareContextVoCollection();
        careContexts.add(careContext);
        episode.setCareContexts(careContexts);
        careSpell.setEpisodes(episodes);

        return careSpell;

    }
项目:openMAXIMS    文件:Logic.java   
private CareSpellVo createCareSpellEpisodeCareContext(PatientShort patient, AdmissionDetailVo  admission)
{
    HcpLiteVo hcp = domain.getHcpFromIMos(form.ccConsultant().getValue());
    BedSpaceStateLiteVo bedState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    CareSpellVo careSpell = new CareSpellVo();
    careSpell.setStartDate(new Date());
    careSpell.setEndDate(null);
    careSpell.setPatient(patient);

        EpisodeofCareVo episode = new EpisodeofCareVo();
        episode.setCareSpell(careSpell);
        episode.setResponsibleHCP(hcp);
        episode.setSpecialty(form.cmbSpecialty().getValue());
        episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
        episode.setStartDate(new Date());
        episode.setEndDate(null);

            CareContextVo careContext = new CareContextVo();
            careContext.setPasEvent(null);
            careContext.setContext(ContextType.EMERGENCY_UNSCHEDULED);
            careContext.setEpisodeOfCare(episode);
            careContext.setOrderingHospital(null);
            careContext.setEstimatedDischargeDate(form.dteEstDischarge().getValue());
            careContext.setStartDateTime(new DateTime());
            careContext.setEndDateTime(null);
            careContext.setLocationType(null);
            careContext.setResponsibleHCP(hcp);
            careContext.setBedNumber((bedState != null && bedState.getBedSpace() != null) ? bedState.getBedSpace().getBedNumber() : null);
            careContext.setDischargeReason(null);
            careContext.setCareContextHistory(null);

            CareContextStatusHistoryVo contextStatus = new CareContextStatusHistoryVo();
            contextStatus.setStatus(CareContextStatus.OPEN);
            contextStatus.setStatusDateTime(new DateTime());
            careContext.setCurrentStatus(contextStatus);
            careContext.setStatusHistory(new CareContextStatusHistoryVoCollection());
            careContext.getStatusHistory().add(contextStatus);

        episode.setCareContexts(new CareContextVoCollection());
        episode.getCareContexts().add(careContext);

        episode.setLinkedReferrals(null);
        episode.setLinkedReferralsHistory(null);
        episode.setCurrentReferral(null);
        episode.setEpisodeOfCareHistory(null);

        EpisodeOfCareStatusHistoryVo episodeStatus = new EpisodeOfCareStatusHistoryVo();
        episodeStatus.setStatus(EpisodeOfCareStatus.OPEN);
        episodeStatus.setStatusDateTime(new DateTime());
        episode.setCurrentStatus(episodeStatus);
        episode.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection());
        episode.getStatusHistory().add(episodeStatus);

        careSpell.setEpisodes(new EpisodeofCareVoCollection());
    careSpell.getEpisodes().add(episode);

    CareSpellStatusHistoryVo careSpellStatus = new CareSpellStatusHistoryVo();
    careSpellStatus.setStatus(ProblemGroupStatus.OPEN);
    careSpellStatus.setStatusDateTime(new DateTime());
    careSpell.setCurrentStatus(careSpellStatus);
    careSpell.setStatusHistory(new CareSpellStatusHistoryVoCollection());
    careSpell.getStatusHistory().add(careSpellStatus);

    return careSpell;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
private void createOrSaveCareSpell(DomainFactory factory, AdmissionDetail doAdmissionDetail) throws StaleObjectException
{
    //WDEV-13001 //5) b) Use Selected Episode
    EpisodeOfCare doEpisode = new EpisodeOfCare();
    CareSpell doCareSpell = new CareSpell();
    if(ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {
        if(doAdmissionDetail.getAdmissionEpisode() != null)
            doEpisode = doAdmissionDetail.getAdmissionEpisode();

        if(doEpisode.getCareSpell() != null)
            doCareSpell = doEpisode.getCareSpell();
    }

    doCareSpell.setPatient(doAdmissionDetail.getPasEvent().getPatient());

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {   
        doCareSpell.setStartDate(doAdmissionDetail.getAdmissionDateTime());

        doEpisode.setCareSpell(doCareSpell);

        //wdev-14309
        doEpisode.setResponsibleHCP(doAdmissionDetail.getConsultant());

        doEpisode.setRelationship(getDomLookup(CareSpelltoEpisodeRelationship.PRIMARY));
        doEpisode.setSpecialty(doAdmissionDetail.getPasEvent().getSpecialty());
        doEpisode.setStartDate( doAdmissionDetail.getAdmissionDateTime());
        //wdev-14309
    }

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
        doCareSpell.getEpisodes().add(doEpisode);

    CareContext doCareContext = new CareContext();
    doCareContext.setEpisodeOfCare(doEpisode);
    doCareContext.setContext(getDomLookup(ContextType.INPATIENT));
    doCareContext.setStartDateTime(doAdmissionDetail.getAdmissionDateTime());
    doCareContext.setPasEvent(doAdmissionDetail.getPasEvent());
    doCareContext.setResponsibleHCP(doEpisode.getResponsibleHCP());
    doCareContext.setEstimatedDischargeDate(doAdmissionDetail.getEstDischargeDate()); //WDEV-11438

    doCareContext.setCurrentStatus(new CareContextStatusHistory());
    doCareContext.getCurrentStatus().setStatus(getDomLookup(CareContextStatus.OPEN));
    doCareContext.getCurrentStatus().setStatusDateTime(new java.util.Date());

    doEpisode.getCareContexts().add(doCareContext);
    factory.save(doCareSpell);
}
项目:openMAXIMS    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv)throws HL7Exception
{
    CareSpellVo careSpell=new CareSpellVo();
    if(pas!=null && pas.getEventDateTime()!=null)
        careSpell.setStartDate( pas.getEventDateTime().getDate());
    else
        throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

    careSpell.setPatient(pas.getPatient());
    EpisodeofCareVo episode=new EpisodeofCareVo();
    episode.setCareSpell(careSpell);
    episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

    // wdev-4883 Check for PAS code mapping if national consultant code not found
    if (!episode.getResponsibleHCPIsNotNull())
    {
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
    }

    episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episode.setSpecialty(pas.getSpecialty());
    episode.setStartDate( pas.getEventDateTime().getDate());
    EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
    episodes.add(episode);
    CareContextVo careContext=new CareContextVo();
    careContext.setEpisodeOfCare(episode);
    ContextType context=new ContextType();
    if (pv.getPatientClass().getValue().equals("I"))
    {
        context = ContextType.INPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("O"))
    {
        context = ContextType.OUTPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("P"))
    {
        context = ContextType.TCI;
        pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
    }
    else
    {
        context = ContextType.GHGSURGERY;
    }
    careContext.setContext(context);
    careContext.setStartDateTime(pas.getEventDateTime());
    careContext.setPasEvent(pas);
    careContext.setResponsibleHCP(episode.getResponsibleHCP());

    //WDEV-10231
    careContext.setCurrentStatus(new CareContextStatusHistoryVo());
    careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
    careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

    LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
    LocSiteRefVo orderingHospRef = new LocSiteRefVo();
    if (loc!=null)
    {
        orderingHospRef.setID_Location(loc.getBoId());
        careContext.setOrderingHospital(orderingHospRef);
    }


    CareContextVoCollection careContexts=new CareContextVoCollection();
    careContexts.add(careContext);
    episode.setCareContexts(careContexts);
    careSpell.setEpisodes(episodes);

    return careSpell;


}
项目:openmaxims-linux    文件:Logic.java   
private CareSpellVo createCareSpellEpisodeCareContext(PatientShort patient, AdmissionDetailVo  admission)
{
    HcpLiteVo hcp = domain.getHcpFromIMos(form.ccConsultant().getValue());
    BedSpaceStateLiteVo bedState = form.getGlobalContext().Core.getSelectedBedSpaceState();

    CareSpellVo careSpell = new CareSpellVo();
    careSpell.setStartDate(new Date());
    careSpell.setEndDate(null);
    careSpell.setPatient(patient);

        EpisodeofCareVo episode = new EpisodeofCareVo();
        episode.setCareSpell(careSpell);
        episode.setResponsibleHCP(hcp);
        episode.setSpecialty(form.cmbSpecialty().getValue());
        episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
        episode.setStartDate(new Date());
        episode.setEndDate(null);

            CareContextVo careContext = new CareContextVo();
            careContext.setPasEvent(null);
            careContext.setContext(ContextType.EMERGENCY_UNSCHEDULED);
            careContext.setEpisodeOfCare(episode);
            careContext.setOrderingHospital(null);
            careContext.setEstimatedDischargeDate(form.dteEstDischarge().getValue());
            careContext.setStartDateTime(new DateTime());
            careContext.setEndDateTime(null);
            careContext.setLocationType(null);
            careContext.setResponsibleHCP(hcp);
            careContext.setBedNumber((bedState != null && bedState.getBedSpace() != null) ? bedState.getBedSpace().getBedNumber() : null);
            careContext.setDischargeReason(null);
            careContext.setCareContextHistory(null);

            CareContextStatusHistoryVo contextStatus = new CareContextStatusHistoryVo();
            contextStatus.setStatus(CareContextStatus.OPEN);
            contextStatus.setStatusDateTime(new DateTime());
            careContext.setCurrentStatus(contextStatus);
            careContext.setStatusHistory(new CareContextStatusHistoryVoCollection());
            careContext.getStatusHistory().add(contextStatus);

        episode.setCareContexts(new CareContextVoCollection());
        episode.getCareContexts().add(careContext);

        episode.setLinkedReferrals(null);
        episode.setLinkedReferralsHistory(null);
        episode.setCurrentReferral(null);
        episode.setEpisodeOfCareHistory(null);

        EpisodeOfCareStatusHistoryVo episodeStatus = new EpisodeOfCareStatusHistoryVo();
        episodeStatus.setStatus(EpisodeOfCareStatus.OPEN);
        episodeStatus.setStatusDateTime(new DateTime());
        episode.setCurrentStatus(episodeStatus);
        episode.setStatusHistory(new EpisodeOfCareStatusHistoryVoCollection());
        episode.getStatusHistory().add(episodeStatus);

        careSpell.setEpisodes(new EpisodeofCareVoCollection());
    careSpell.getEpisodes().add(episode);

    CareSpellStatusHistoryVo careSpellStatus = new CareSpellStatusHistoryVo();
    careSpellStatus.setStatus(ProblemGroupStatus.OPEN);
    careSpellStatus.setStatusDateTime(new DateTime());
    careSpell.setCurrentStatus(careSpellStatus);
    careSpell.setStatusHistory(new CareSpellStatusHistoryVoCollection());
    careSpell.getStatusHistory().add(careSpellStatus);

    return careSpell;
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
private void createOrSaveCareSpell(DomainFactory factory, AdmissionDetail doAdmissionDetail) throws StaleObjectException
{
    //WDEV-13001 //5) b) Use Selected Episode
    EpisodeOfCare doEpisode = new EpisodeOfCare();
    CareSpell doCareSpell = new CareSpell();
    if(ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {
        if(doAdmissionDetail.getAdmissionEpisode() != null)
            doEpisode = doAdmissionDetail.getAdmissionEpisode();

        if(doEpisode.getCareSpell() != null)
            doCareSpell = doEpisode.getCareSpell();
    }

    doCareSpell.setPatient(doAdmissionDetail.getPasEvent().getPatient());

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
    {   
        doCareSpell.setStartDate(doAdmissionDetail.getAdmissionDateTime());

        doEpisode.setCareSpell(doCareSpell);

        //wdev-14309
        doEpisode.setResponsibleHCP(doAdmissionDetail.getConsultant());

        doEpisode.setRelationship(getDomLookup(CareSpelltoEpisodeRelationship.PRIMARY));
        doEpisode.setSpecialty(doAdmissionDetail.getPasEvent().getSpecialty());
        doEpisode.setStartDate( doAdmissionDetail.getAdmissionDateTime());
        //wdev-14309
    }

    //WDEV-13001
    if(!ConfigFlag.DOM.ADT_LINK_ADMISSION_TO_EPISODE.getValue())
        doCareSpell.getEpisodes().add(doEpisode);

    CareContext doCareContext = new CareContext();
    doCareContext.setEpisodeOfCare(doEpisode);
    doCareContext.setContext(getDomLookup(ContextType.INPATIENT));
    doCareContext.setStartDateTime(doAdmissionDetail.getAdmissionDateTime());
    doCareContext.setPasEvent(doAdmissionDetail.getPasEvent());
    doCareContext.setResponsibleHCP(doEpisode.getResponsibleHCP());
    doCareContext.setEstimatedDischargeDate(doAdmissionDetail.getEstDischargeDate()); //WDEV-11438

    doCareContext.setCurrentStatus(new CareContextStatusHistory());
    doCareContext.getCurrentStatus().setStatus(getDomLookup(CareContextStatus.OPEN));
    doCareContext.getCurrentStatus().setStatusDateTime(new java.util.Date());

    doEpisode.getCareContexts().add(doCareContext);
    factory.save(doCareSpell);
}
项目:openmaxims-linux    文件:VoMapper.java   
public CareSpellVo createCareSpellVo(PasEventVo pas, PV1 pv)throws HL7Exception
{
    CareSpellVo careSpell=new CareSpellVo();
    if(pas!=null && pas.getEventDateTime()!=null)
        careSpell.setStartDate( pas.getEventDateTime().getDate());
    else
        throw new HL7Exception("Validation of PasEvent failed. Set the Event Date Time in PV1-44");

    careSpell.setPatient(pas.getPatient());
    EpisodeofCareVo episode=new EpisodeofCareVo();
    episode.setCareSpell(careSpell);
    episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.NAT_CONS_CODE, pv.getConsultingDoctor(0).getIDNumber().getValue()));

    // wdev-4883 Check for PAS code mapping if national consultant code not found
    if (!episode.getResponsibleHCPIsNotNull())
    {
        episode.setResponsibleHCP(hcpAdmin.getHcpLiteByExternalCode(TaxonomyType.PAS, pv.getConsultingDoctor(1).getIDNumber().getValue()));
    }

    episode.setRelationship(CareSpelltoEpisodeRelationship.PRIMARY);
    episode.setSpecialty(pas.getSpecialty());
    episode.setStartDate( pas.getEventDateTime().getDate());
    EpisodeofCareVoCollection episodes=new EpisodeofCareVoCollection();
    episodes.add(episode);
    CareContextVo careContext=new CareContextVo();
    careContext.setEpisodeOfCare(episode);
    ContextType context=new ContextType();
    if (pv.getPatientClass().getValue().equals("I"))
    {
        context = ContextType.INPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.INPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("O"))
    {
        context = ContextType.OUTPATIENT;
        pas.setEventType(ims.core.vo.lookups.PasEventType.OUTPATIENT);
    }
    else if (pv.getPatientClass().getValue().equals("P"))
    {
        context = ContextType.TCI;
        pas.setEventType(ims.core.vo.lookups.PasEventType.TCI);
    }
    else
    {
        context = ContextType.GHGSURGERY;
    }
    careContext.setContext(context);
    careContext.setStartDateTime(pas.getEventDateTime());
    careContext.setPasEvent(pas);
    careContext.setResponsibleHCP(episode.getResponsibleHCP());

    //WDEV-10231
    careContext.setCurrentStatus(new CareContextStatusHistoryVo());
    careContext.getCurrentStatus().setStatus(CareContextStatus.OPEN);
    careContext.getCurrentStatus().setStatusDateTime(pas.getEventDateTime());

    LocSiteShortVo loc = orgLoc.getLocSiteShortByTaxonomyType(pv.getAssignedPatientLocation().getBuilding().getValue(), TaxonomyType.PAS);
    LocSiteRefVo orderingHospRef = new LocSiteRefVo();
    if (loc!=null)
    {
        orderingHospRef.setID_Location(loc.getBoId());
        careContext.setOrderingHospital(orderingHospRef);
    }


    CareContextVoCollection careContexts=new CareContextVoCollection();
    careContexts.add(careContext);
    episode.setCareContexts(careContexts);
    careSpell.setEpisodes(episodes);

    return careSpell;


}