Java 类ims.core.vo.AdmissionDetailVoCollection 实例源码

项目:AvoinApotti    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getLastAdmissionForPatient(PatientRefVo parRef)
{
    if( parRef == null )
        throw new CodingRuntimeException("PatientRefVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 left join p1_1.patient as p2_1 where (p2_1.id = :patientId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"patientId"},new Object[]{parRef.getID_Patient()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:AvoinApotti    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getAdmissionForSelectedCareContext(CareContextInterfaceVo careContext)
{
    if( careContext == null || careContext.getPasEvent() == null )
        throw new CodingRuntimeException("CareContextInterfaceVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1  from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where (p1_1.id = :pasEventId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"pasEventId"},new Object[]{careContext.getPasEvent().getID_PASEvent()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:openMAXIMS    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getLastAdmissionForPatient(PatientRefVo parRef)
{
    if( parRef == null )
        throw new CodingRuntimeException("PatientRefVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 left join p1_1.patient as p2_1 where (p2_1.id = :patientId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"patientId"},new Object[]{parRef.getID_Patient()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:openMAXIMS    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getAdmissionForSelectedCareContext(CareContextInterfaceVo careContext)
{
    if( careContext == null || careContext.getPasEvent() == null )
        throw new CodingRuntimeException("CareContextInterfaceVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1  from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where (p1_1.id = :pasEventId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"pasEventId"},new Object[]{careContext.getPasEvent().getID_PASEvent()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:openMAXIMS    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getLastAdmissionForPatient(PatientRefVo parRef)
{
    if( parRef == null )
        throw new CodingRuntimeException("PatientRefVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 left join p1_1.patient as p2_1 where (p2_1.id = :patientId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"patientId"},new Object[]{parRef.getID_Patient()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:openMAXIMS    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getAdmissionForSelectedCareContext(CareContextInterfaceVo careContext)
{
    if( careContext == null || careContext.getPasEvent() == null )
        throw new CodingRuntimeException("CareContextInterfaceVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1  from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where (p1_1.id = :pasEventId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"pasEventId"},new Object[]{careContext.getPasEvent().getID_PASEvent()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:openmaxims-linux    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getLastAdmissionForPatient(PatientRefVo parRef)
{
    if( parRef == null )
        throw new CodingRuntimeException("PatientRefVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 left join p1_1.patient as p2_1 where (p2_1.id = :patientId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"patientId"},new Object[]{parRef.getID_Patient()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:openmaxims-linux    文件:ADTDischargeDetailsComponentImpl.java   
public AdmissionDetailVo getAdmissionForSelectedCareContext(CareContextInterfaceVo careContext)
{
    if( careContext == null || careContext.getPasEvent() == null )
        throw new CodingRuntimeException("CareContextInterfaceVo is null");

    DomainFactory factory = getDomainFactory();

    String hql = " select a1_1  from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where (p1_1.id = :pasEventId) order by a1_1.admissionDateTime desc";
    List<?> lst = factory.find(hql,new String[]{"pasEventId"},new Object[]{careContext.getPasEvent().getID_PASEvent()});
    if (lst != null && lst.size() > 0)
    {
        AdmissionDetailVoCollection tempColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(lst) ;
        if(tempColl != null && tempColl.size() > 0)
        {
            return tempColl.get(0);
        }

    }
    return null;
}
项目:AvoinApotti    文件:ClinicalAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetail(Integer pasEventId) 
{
    if(pasEventId == null)
        return null;

    if(pasEventId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where  "); 
        String andStr = " ";

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

        hql.append(andStr + " p1_1.id = :pasEventId");
            markers.add("pasEventId");
        values.add(pasEventId);
        andStr = " and ";   

        List list = factory.find(hql.toString(), markers,values);
        if(list != null && list.size() > 0)
        { 
            AdmissionDetailVoCollection voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(list);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:AvoinApotti    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract)
{
    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patientShort);
    referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0));

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    String codeCCG = getCCGCode(patient);
    referral.setContract(contract);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setService(form.cmbService().getValue());
        referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        referralDetails.setDateReferralReceived(new Date());
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(calculateEnd18WW(contract));
        referralDetails.setPCT(codeCCG);
        referralDetails.setGPName(patient.getGp());
        referralDetails.setPractice(getPatientGpDefaultPractice(patient));

    referral.setReferralDetails(referralDetails);

    return referral;
}
项目:AvoinApotti    文件:EDischargePatientReadyToLeaveSTHKComponentImpl.java   
public DateTime getAdmissionDateTimeFromAdmissionDetail(CareContextRefVo ccRefVo, PatientRefVo voPatRefVo)
{
    DomainFactory factory = getDomainFactory();
    CareContextVo voCC = CareContextVoAssembler.create((CareContext)factory.getDomainObject(CareContext.class, ccRefVo.getID_CareContext()));

    if (voCC.getPasEvent() == null)
    {
        return null;
    }

    String hql = "from AdmissionDetail ad " + 
    " where ad.pasEvent.patient.id = :patId " + 
    " and ad.pasEvent.id = :eventId ";

    ArrayList<String> labels = new ArrayList<String>();
    labels.add("patId");
    labels.add("eventId");

    ArrayList<Object> values = new ArrayList<Object>();
    values.add(voPatRefVo.getID_Patient());
    values.add(voCC.getPasEvent().getID_PASEvent());

    List<?> l = factory.find(hql, labels, values);      
    if (l != null && l.size() > 0)
    {
        if (l.size() > 1)
            throw new DomainRuntimeException("Duplicate data found for Patient and PasEvent");

        AdmissionDetailVoCollection  voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(l);
        return voColl.get(0).getAdmissionDateTime();
    }
    return null;
}
项目:openMAXIMS    文件:ClinicalAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetail(Integer pasEventId) 
{
    if(pasEventId == null)
        return null;

    if(pasEventId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where  "); 
        String andStr = " ";

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

        hql.append(andStr + " p1_1.id = :pasEventId");
            markers.add("pasEventId");
        values.add(pasEventId);
        andStr = " and ";   

        List list = factory.find(hql.toString(), markers,values);
        if(list != null && list.size() > 0)
        { 
            AdmissionDetailVoCollection voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(list);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:openMAXIMS    文件:EDischargePatientReadyToLeaveSTHKComponentImpl.java   
public DateTime getAdmissionDateTimeFromAdmissionDetail(CareContextRefVo ccRefVo, PatientRefVo voPatRefVo)
{
    DomainFactory factory = getDomainFactory();
    CareContextVo voCC = CareContextVoAssembler.create((CareContext)factory.getDomainObject(CareContext.class, ccRefVo.getID_CareContext()));

    if (voCC.getPasEvent() == null)
    {
        return null;
    }

    String hql = "from AdmissionDetail ad " + 
    " where ad.pasEvent.patient.id = :patId " + 
    " and ad.pasEvent.id = :eventId ";

    ArrayList<String> labels = new ArrayList<String>();
    labels.add("patId");
    labels.add("eventId");

    ArrayList<Object> values = new ArrayList<Object>();
    values.add(voPatRefVo.getID_Patient());
    values.add(voCC.getPasEvent().getID_PASEvent());

    List<?> l = factory.find(hql, labels, values);      
    if (l != null && l.size() > 0)
    {
        if (l.size() > 1)
            throw new DomainRuntimeException("Duplicate data found for Patient and PasEvent");

        AdmissionDetailVoCollection  voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(l);
        return voColl.get(0).getAdmissionDateTime();
    }
    return null;
}
项目:openMAXIMS    文件:ClinicalAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetail(Integer pasEventId) 
{
    if(pasEventId == null)
        return null;

    if(pasEventId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where  "); 
        String andStr = " ";

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

        hql.append(andStr + " p1_1.id = :pasEventId");
            markers.add("pasEventId");
        values.add(pasEventId);
        andStr = " and ";   

        List list = factory.find(hql.toString(), markers,values);
        if(list != null && list.size() > 0)
        { 
            AdmissionDetailVoCollection voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(list);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:openMAXIMS    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract)
{
    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patientShort);
    referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0));

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    String codeCCG = getCCGCode(patient);
    referral.setContract(contract);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setService(form.cmbService().getValue());
        referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        referralDetails.setDateReferralReceived(new Date());
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(calculateEnd18WW(contract));
        referralDetails.setPCT(codeCCG);
        referralDetails.setGPName(patient.getGp());
        referralDetails.setPractice(getPatientGpDefaultPractice(patient));

    referral.setReferralDetails(referralDetails);

    return referral;
}
项目:openMAXIMS    文件:EDischargePatientReadyToLeaveSTHKComponentImpl.java   
public DateTime getAdmissionDateTimeFromAdmissionDetail(CareContextRefVo ccRefVo, PatientRefVo voPatRefVo)
{
    DomainFactory factory = getDomainFactory();
    CareContextVo voCC = CareContextVoAssembler.create((CareContext)factory.getDomainObject(CareContext.class, ccRefVo.getID_CareContext()));

    if (voCC.getPasEvent() == null)
    {
        return null;
    }

    String hql = "from AdmissionDetail ad " + 
    " where ad.pasEvent.patient.id = :patId " + 
    " and ad.pasEvent.id = :eventId ";

    ArrayList<String> labels = new ArrayList<String>();
    labels.add("patId");
    labels.add("eventId");

    ArrayList<Object> values = new ArrayList<Object>();
    values.add(voPatRefVo.getID_Patient());
    values.add(voCC.getPasEvent().getID_PASEvent());

    List<?> l = factory.find(hql, labels, values);      
    if (l != null && l.size() > 0)
    {
        if (l.size() > 1)
            throw new DomainRuntimeException("Duplicate data found for Patient and PasEvent");

        AdmissionDetailVoCollection  voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(l);
        return voColl.get(0).getAdmissionDateTime();
    }
    return null;
}
项目:openmaxims-linux    文件:ClinicalAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetail(Integer pasEventId) 
{
    if(pasEventId == null)
        return null;

    if(pasEventId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" select a1_1 from AdmissionDetail as a1_1 left join a1_1.pasEvent as p1_1 where  "); 
        String andStr = " ";

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

        hql.append(andStr + " p1_1.id = :pasEventId");
            markers.add("pasEventId");
        values.add(pasEventId);
        andStr = " and ";   

        List list = factory.find(hql.toString(), markers,values);
        if(list != null && list.size() > 0)
        { 
            AdmissionDetailVoCollection voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(list);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:openmaxims-linux    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createNewCatsReferralForAdmission(PatientShort patientShort, PatientWithGPForCCGVo patient, CareSpellVo careSpell, AdmissionDetailVo admission, ContractConfigShortVo contract)
{
    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patientShort);
    referral.setCareContext(careSpell.getEpisodes().get(0).getCareContexts().get(0));

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    String codeCCG = getCCGCode(patient);
    referral.setContract(contract);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setService(form.cmbService().getValue());
        referralDetails.setConsultant(domain.getHcpFromIMos(form.ccConsultant().getValue()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        referralDetails.setDateReferralReceived(new Date());
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(calculateEnd18WW(contract));
        referralDetails.setPCT(codeCCG);
        referralDetails.setGPName(patient.getGp());
        referralDetails.setPractice(getPatientGpDefaultPractice(patient));

    referral.setReferralDetails(referralDetails);

    return referral;
}
项目:openmaxims-linux    文件:EDischargePatientReadyToLeaveSTHKComponentImpl.java   
public DateTime getAdmissionDateTimeFromAdmissionDetail(CareContextRefVo ccRefVo, PatientRefVo voPatRefVo)
{
    DomainFactory factory = getDomainFactory();
    CareContextVo voCC = CareContextVoAssembler.create((CareContext)factory.getDomainObject(CareContext.class, ccRefVo.getID_CareContext()));

    if (voCC.getPasEvent() == null)
    {
        return null;
    }

    String hql = "from AdmissionDetail ad " + 
    " where ad.pasEvent.patient.id = :patId " + 
    " and ad.pasEvent.id = :eventId ";

    ArrayList<String> labels = new ArrayList<String>();
    labels.add("patId");
    labels.add("eventId");

    ArrayList<Object> values = new ArrayList<Object>();
    values.add(voPatRefVo.getID_Patient());
    values.add(voCC.getPasEvent().getID_PASEvent());

    List<?> l = factory.find(hql, labels, values);      
    if (l != null && l.size() > 0)
    {
        if (l.size() > 1)
            throw new DomainRuntimeException("Duplicate data found for Patient and PasEvent");

        AdmissionDetailVoCollection  voColl = AdmissionDetailVoAssembler.createAdmissionDetailVoCollectionFromAdmissionDetail(l);
        return voColl.get(0).getAdmissionDateTime();
    }
    return null;
}
项目:openMAXIMS    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createCatsReferral(PatientLite_IdentifiersVo patient, AdmissionDetailVo admission, CareSpellAdmitVo careSpell)
{
    if (careSpell == null || careSpell.getEpisodes() == null || careSpell.getEpisodes().size() < 1
            || careSpell.getEpisodes().get(0).getCareContexts() == null)
        throw new CodingRuntimeException("Invalid care spell created.");

    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patient);

    for (CareContextAdmitVo careContext : careSpell.getEpisodes().get(0).getCareContexts())
    {
        if (ContextType.REFERRAL.equals(careContext.getContext()))
        {
            referral.setCareContext(careContext);
            referral.setEpisodeOfCare(careSpell.getEpisodes().get(0));
            break;
        }
    }

    //WDEV-22214
    PatientWithGPForCCGVo patientWithGP = domain.getPatientForCCG(patient);
    String codeCCG = getCCGCode(patientWithGP);

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    referral.setContract(null);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setReferrerType(form.cmbSourceOfReferral().getValue() != null ? form.cmbSourceOfReferral().getValue() : SourceOfReferral.ED);
        referralDetails.setService(admission.getService());
        referralDetails.setConsultant(domain.getHcpFromIMos(admission.getConsultant()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        //referralDetails.setDateReferralReceived(new Date());WDEV-22688
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(null);
        referralDetails.setPCT(codeCCG);

    referral.setReferralDetails(referralDetails);
    referral.setIsEmergencyReferral(Boolean.TRUE);
    referral.setUrgency(ReferralUrgency.EMERGENCY); //WDEV-22229

    return referral;
}
项目:openMAXIMS    文件:Logic.java   
private CatsReferralEmergencyAdmissionVo createCatsReferral(PatientLite_IdentifiersVo patient, AdmissionDetailVo admission, CareSpellAdmitVo careSpell)
{
    if (careSpell == null || careSpell.getEpisodes() == null || careSpell.getEpisodes().size() < 1
            || careSpell.getEpisodes().get(0).getCareContexts() == null)
        throw new CodingRuntimeException("Invalid care spell created.");

    CatsReferralEmergencyAdmissionVo referral = new CatsReferralEmergencyAdmissionVo();

    referral.setPatient(patient);

    for (CareContextAdmitVo careContext : careSpell.getEpisodes().get(0).getCareContexts())
    {
        if (ContextType.REFERRAL.equals(careContext.getContext()))
        {
            referral.setCareContext(careContext);
            referral.setEpisodeOfCare(careSpell.getEpisodes().get(0));
            break;
        }
    }
    PatientWithGPForCCGVo patientWithGP = domain.getPatientForCCG(patient);
    String codeCCG = getCCGCode(patientWithGP);

    CatsReferralStatusVo referralStatus = new CatsReferralStatusVo();
    referralStatus.setReferralStatus(ReferralApptStatus.REFERRAL_ACCEPTED);
    referralStatus.setStatusDateTime(new DateTime());
    referralStatus.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
    referral.setCurrentStatus(referralStatus);
    referral.setStatusHistory(new CATSReferralStatusRefVoCollection());
    referral.getStatusHistory().add(referralStatus);

    referral.setContract(null);
    referral.setHasAppointments(false);

    referral.setAdmissions(new AdmissionDetailVoCollection());
    referral.getAdmissions().add(admission);

        ReferralDetailsEmergencyAdmissionVo referralDetails = new ReferralDetailsEmergencyAdmissionVo();
        referralDetails.setReferrerType(form.cmbSourceOfReferral().getValue() != null ? form.cmbSourceOfReferral().getValue() : SourceOfReferral.ED);
        referralDetails.setService(admission.getService());
        referralDetails.setConsultant(domain.getHcpFromIMos(admission.getConsultant()));
        referralDetails.setAuthoringUser((MemberOfStaffRefVo) domain.getMosUser());
        referralDetails.setAuthoringDateTime(new DateTime());
        //referralDetails.setDateReferralReceived(new Date());//WDEV-22688
        referralDetails.setDateOfReferral(new Date());
        referralDetails.setEnd18WW(null);
        referralDetails.setPCT(codeCCG);

    referral.setReferralDetails(referralDetails);
    referral.setIsEmergencyReferral(Boolean.TRUE);
    referral.setUrgency(ReferralUrgency.EMERGENCY); //WDEV-22229

    return referral;
}