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

项目: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;
}
项目:AvoinApotti    文件:EDischargeSummarySthkComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
    if (voCC == null || voCC.getID_CareContext() == null)
        throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");

    List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
    if(items != null && items.size() > 0)
    {
        Integer eventId = (Integer) items.get(0);

        if(eventId!= null && eventId  > 0)
        {
            List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
            if(ieItems != null && ieItems.size() > 0)
                return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.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    文件:EDischargeSummarySthkComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
    if (voCC == null || voCC.getID_CareContext() == null)
        throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");

    List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
    if(items != null && items.size() > 0)
    {
        Integer eventId = (Integer) items.get(0);

        if(eventId!= null && eventId  > 0)
        {
            List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
            if(ieItems != null && ieItems.size() > 0)
                return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.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    文件:EDischargeSummarySthkComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
    if (voCC == null || voCC.getID_CareContext() == null)
        throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");

    List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
    if(items != null && items.size() > 0)
    {
        Integer eventId = (Integer) items.get(0);

        if(eventId!= null && eventId  > 0)
        {
            List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
            if(ieItems != null && ieItems.size() > 0)
                return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.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;
}
项目:openmaxims-linux    文件:EDischargeSummarySthkComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByCareContext(CareContextRefVo voCC) 
{
    if (voCC == null || voCC.getID_CareContext() == null)
        throw new CodingRuntimeException("careContext is null or id not provided in method getAdmissionDetailByCareContext");

    List items = getDomainFactory().find(" select cc.pasEvent.id from CareContext as cc where cc.id = " +  voCC.getID_CareContext());
    if(items != null && items.size() > 0)
    {
        Integer eventId = (Integer) items.get(0);

        if(eventId!= null && eventId  > 0)
        {
            List ieItems = getDomainFactory().find(" from AdmissionDetail ad where ad.pasEvent.id = " +  eventId);
            if(ieItems != null && ieItems.size() > 0)
                return AdmissionDetailVoAssembler.create((AdmissionDetail) ieItems.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    文件:ADTDischargeDetailsComponentImpl.java   
public ims.core.vo.AdmissionDetailVo getAdmissionDetailById(ims.core.admin.pas.vo.AdmissionDetailRefVo admDetRef)
{
    if( admDetRef == null)
        throw new CodingRuntimeException("This AdmissionDetailRefVo is null");

    DomainFactory factory = getDomainFactory();
    AdmissionDetail doAdmissionDetail = (AdmissionDetail) factory.getDomainObject(AdmissionDetail.class, admDetRef.getID_AdmissionDetail());

    return AdmissionDetailVoAssembler.create(doAdmissionDetail);
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEvent)
{
    if (pasEvent == null || pasEvent.getID_PASEvent() == null)
        throw new CodingRuntimeException("pasEvent is null or id not provided in method getAdmissionDetailByPasEvent");

    List lstAdmissions = getDomainFactory().find("from AdmissionDetail admDet where admDet.pasEvent.id = " + pasEvent.getID_PASEvent());
    if(lstAdmissions != null && lstAdmissions.size() == 1)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) lstAdmissions.get(0));

    return null;
}
项目: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    文件:AssignBedToHomeLeaveInpatientImpl.java   
public ims.core.vo.AdmissionDetailVo getAdmissionDetail(ims.core.admin.pas.vo.PASEventRefVo pasEventRef)
{
    if (pasEventRef == null)
        return null;
    DomainFactory factory = getDomainFactory();

    return AdmissionDetailVoAssembler.create((AdmissionDetail) factory.findFirst("select adm from AdmissionDetail adm left join adm.pasEvent as pevent where pevent.id = :PASEVENT_ID", "PASEVENT_ID", pasEventRef.getID_PASEvent()));
}
项目:openMAXIMS    文件:ADTDischargeDetailsComponentImpl.java   
public ims.core.vo.AdmissionDetailVo getAdmissionDetailById(ims.core.admin.pas.vo.AdmissionDetailRefVo admDetRef)
{
    if( admDetRef == null)
        throw new CodingRuntimeException("This AdmissionDetailRefVo is null");

    DomainFactory factory = getDomainFactory();
    AdmissionDetail doAdmissionDetail = (AdmissionDetail) factory.getDomainObject(AdmissionDetail.class, admDetRef.getID_AdmissionDetail());

    return AdmissionDetailVoAssembler.create(doAdmissionDetail);
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEvent)
{
    if (pasEvent == null || pasEvent.getID_PASEvent() == null)
        throw new CodingRuntimeException("pasEvent is null or id not provided in method getAdmissionDetailByPasEvent");

    List lstAdmissions = getDomainFactory().find("from AdmissionDetail admDet where admDet.pasEvent.id = " + pasEvent.getID_PASEvent());
    if(lstAdmissions != null && lstAdmissions.size() == 1)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) lstAdmissions.get(0));

    return null;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo getAdmissionDetails(AdmissionDetailRefVo admissionDetailsRef)
{
    if(admissionDetailsRef!=null)
    {
        AdmissionDetail admissionDom = (AdmissionDetail)getDomainFactory().getDomainObject(admissionDetailsRef);
        return AdmissionDetailVoAssembler.create(admissionDom);
    }
    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    文件:ADTDischargeDetailsComponentImpl.java   
public ims.core.vo.AdmissionDetailVo getAdmissionDetailById(ims.core.admin.pas.vo.AdmissionDetailRefVo admDetRef)
{
    if( admDetRef == null)
        throw new CodingRuntimeException("This AdmissionDetailRefVo is null");

    DomainFactory factory = getDomainFactory();
    AdmissionDetail doAdmissionDetail = (AdmissionDetail) factory.getDomainObject(AdmissionDetail.class, admDetRef.getID_AdmissionDetail());

    return AdmissionDetailVoAssembler.create(doAdmissionDetail);
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEvent)
{
    if (pasEvent == null || pasEvent.getID_PASEvent() == null)
        throw new CodingRuntimeException("pasEvent is null or id not provided in method getAdmissionDetailByPasEvent");

    List lstAdmissions = getDomainFactory().find("from AdmissionDetail admDet where admDet.pasEvent.id = " + pasEvent.getID_PASEvent());
    if(lstAdmissions != null && lstAdmissions.size() == 1)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) lstAdmissions.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-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    文件:ADTDischargeDetailsComponentImpl.java   
public ims.core.vo.AdmissionDetailVo getAdmissionDetailById(ims.core.admin.pas.vo.AdmissionDetailRefVo admDetRef)
{
    if( admDetRef == null)
        throw new CodingRuntimeException("This AdmissionDetailRefVo is null");

    DomainFactory factory = getDomainFactory();
    AdmissionDetail doAdmissionDetail = (AdmissionDetail) factory.getDomainObject(AdmissionDetail.class, admDetRef.getID_AdmissionDetail());

    return AdmissionDetailVoAssembler.create(doAdmissionDetail);
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEvent)
{
    if (pasEvent == null || pasEvent.getID_PASEvent() == null)
        throw new CodingRuntimeException("pasEvent is null or id not provided in method getAdmissionDetailByPasEvent");

    List lstAdmissions = getDomainFactory().find("from AdmissionDetail admDet where admDet.pasEvent.id = " + pasEvent.getID_PASEvent());
    if(lstAdmissions != null && lstAdmissions.size() == 1)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) lstAdmissions.get(0));

    return null;
}
项目: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;
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException
{
    if (admission == null)
        throw new CodingRuntimeException("Admission Details parameter is mandatory.");

    if (careSpell == null)
        throw new CodingRuntimeException("Care Spell parameter is mandatory.");

    if (catsReferral == null)
        throw new CodingRuntimeException("Cats Referral parameter is mandatory.");


    PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission);
    catsReferral.setJourney(journey);

    @SuppressWarnings("rawtypes")
    HashMap domMap = new HashMap();
    AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap);
    CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap);
    CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap);
    domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent());

    getDomainFactory().save(domAdmissionDetail);
    getDomainFactory().save(domCareSpell);
    getDomainFactory().save(domCatsReferral);

    InpatientEpisode inpatEpisode = new InpatientEpisode();
    inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent());
    inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant());
    inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime());
    inpatEpisode.setEstDischargeDate(null);
    inpatEpisode.setWardType(domAdmissionDetail.getWardType());

    if (wardStay != null)
        inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap));
    if (consultant != null)
        inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap));

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap);   
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(inpatEpisode);  
        inpatEpisode.setBed(doBedSpaceState);
        inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber());
    }

    if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true)
    {
        Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory());
        if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired()))
        {
            inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED));
        }
    }

    getDomainFactory().save(inpatEpisode);

    return null;
}
项目:AvoinApotti    文件:BedAdmissionComponentImpl.java   
public void allocateBed(BedSpaceStateLiteVo bedSpace, InpatientEpisodeLiteVo inpatientEpisode, AdmissionDetailVo admissionDetail, HomeLeaveVo voHomeLeave) throws StaleObjectException, DomainInterfaceException 
{
    if (inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method allocateBed");
    if (bedSpace == null)
        throw new CodingRuntimeException("bedSpace is null in method allocateBed");
    if (admissionDetail == null)
        throw new CodingRuntimeException("admissionDetail is null in method allocateBed");

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpace);    
    InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    AdmissionDetail doAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail);

    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(doInpatEpis);   
        doInpatEpis.setBed(doBedSpaceState);
    }

    if(voHomeLeave != null)
    {
        for(int i = 0 ; doInpatEpis.getHomeLeaves().size() > 0 && i < doInpatEpis.getHomeLeaves().size() ; i++)
        {
             HomeLeave doHL = (HomeLeave)doInpatEpis.getHomeLeaves().get(i);
             if (doHL != null
                && doHL.getDateReturnedFromHomeLeave() == null)
             {
                 doHL.setDateReturnedFromHomeLeave(voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getDateReturnedFromHomeLeave().getDate() : null);
                 doHL.setTimeReturnedFromHomeLeave(voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString() : null);

                 doInpatEpis.getHomeLeaves().set(i, doHL);
             }
        }
        doInpatEpis.setIsOnHomeLeave(false);
        doInpatEpis.setDateOnHomeLeave(null);
        doInpatEpis.setTimeOnHomeLeave(null);
        doInpatEpis.setExpectedDateOfReturn(null);
        doInpatEpis.setExpectedTimeOfReturn(null);
        doInpatEpis.setVacatedBedNumber(null);

        //UPDATE PAS THAT NO LONGER ON HOME LEAVE 
        if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
        {
            Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
            hlRec.DataCollection.add();

            copyHomeLeaveToDto(hlRec, doAdmissionDetail, voHomeLeave);

            Result res = hlRec.update();
            if (res != null && res.getId() < 0 )
            {
                if (res.getId() == -5)
                    throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
                else 
                    throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
            }
        }
    }

    getDomainFactory().save(doInpatEpis);

    if(doBedSpaceState != null)
        doAdmissionDetail.setBed(doBedSpaceState.getBedSpace());

    getDomainFactory().save(doAdmissionDetail);
}
项目:AvoinApotti    文件:ADTPatientAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEventRef)
{
    if (pasEventRef == null || pasEventRef.getID_PASEvent() == null)
        throw new CodingRuntimeException("Cannot get AdmissionDetails value on null pasEventRef.");

    StringBuffer hql = new StringBuffer("select admDetail from AdmissionDetail as admDetail left join admDetail.pasEvent as pasEvent where pasEvent.id = :pasEventID) ");

    DomainFactory factory = getDomainFactory();

    List<?> list = factory.find(hql.toString(), new String[] { "pasEventID" }, new Object[] { pasEventRef.getID_PASEvent() });

    if (list != null && list.size() > 0)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) list.get(0));

    return null;
}
项目:openMAXIMS    文件:BedInfoDialogImpl.java   
private AdmissionDetail updateExtendedDetails(AdmissionDetailVo admissionDetailsVo, DomainFactory factory, InpatientEpisodeLiteVo inpatEpisode,CareContextRefVo voCareContext)
{
    AdmissionDetail admissionDO = AdmissionDetailVoAssembler.extractAdmissionDetail(factory, admissionDetailsVo);
    PatientTransportRequirementsVo transportDetails = null;
    if (admissionDO.getTransportDetails() == null)
    {    
        transportDetails = getPatientTransportRequirements(voCareContext);

        if (transportDetails != null)
        {
            if (inpatEpisode.getTransportDetailsIsNotNull())
            {
                transportDetails.setCareContext(inpatEpisode.getTransportDetails().getCareContext());
                transportDetails.setTransport(inpatEpisode.getTransportDetails().getTransport());
                transportDetails.setTransportRequired(inpatEpisode.getTransportDetails().getTransportRequired());
            }   
        }
        else
        {
            transportDetails = inpatEpisode.getTransportDetails();
        }

     }
    else
    {
        transportDetails = admissionDetailsVo.getTransportDetails();
        if (inpatEpisode.getTransportDetailsIsNotNull())
        {
            transportDetails.setCareContext(inpatEpisode.getTransportDetails().getCareContext());
            transportDetails.setTransport(inpatEpisode.getTransportDetails().getTransport());
            transportDetails.setTransportRequired(inpatEpisode.getTransportDetails().getTransportRequired());
        }
    }
    admissionDO.setEstDischargeDate(inpatEpisode.getEstDischargeDateIsNotNull() ? inpatEpisode.getEstDischargeDate().getJavaDate() : null);
    admissionDO.setExtendedLengthOfStayReason(getDomLookup(inpatEpisode.getExtendedLengthOfStayReason()));
    admissionDO.setPatientRequiresTransport(inpatEpisode.getPatientRequiresTransport());
    admissionDO.setTransportDetails( transportDetails != null ? PatientTransportRequirementsVoAssembler.extractPatientTransportRequirements(factory,transportDetails) : null);

    admissionDO.setAbleToGoDischargeLounge(inpatEpisode.getAbleToGoDischargeLoungeIsNotNull() ? inpatEpisode.getAbleToGoDischargeLounge() : null);
    admissionDO.setReasonCannotGoDischargeLounge(getDomLookup(inpatEpisode.getReasonCannotGoDischargeLounge()));

    admissionDO.setReasonDelayedDischarge(inpatEpisode.getReasonDelayedDischargeIsNotNull() ? ReasonForDelayedDischargeVoAssembler.extractReasonForDelayedDischargeList(factory, inpatEpisode.getReasonDelayedDischarge()) : null); 

    admissionDO.setMedicallyFitForDischarge(inpatEpisode.getMedicallyFitForDischargeIsNotNull()  ? getDomLookup(inpatEpisode.getMedicallyFitForDischarge()) : null);

    return admissionDO;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
private void saveDementiaRecord(AdmissionDetailVo admissionDetailVo, HashMap domMap, DomainFactory factory) throws StaleObjectException
{
    ADT impl = (ADT) getDomainImpl(ADTImpl.class);
    AdmissionDetail domAdmDet = AdmissionDetailVoAssembler.extractAdmissionDetail(factory, admissionDetailVo, domMap);
    impl.createDementiaRecordIfRequired(factory, domAdmDet );
}
项目:openMAXIMS    文件:ADTPatientAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEventRef)
{
    if (pasEventRef == null || pasEventRef.getID_PASEvent() == null)
        throw new CodingRuntimeException("Cannot get AdmissionDetails value on null pasEventRef.");

    StringBuffer hql = new StringBuffer("select admDetail from AdmissionDetail as admDetail left join admDetail.pasEvent as pasEvent where pasEvent.id = :pasEventID) ");

    DomainFactory factory = getDomainFactory();

    List<?> list = factory.find(hql.toString(), new String[] { "pasEventID" }, new Object[] { pasEventRef.getID_PASEvent() });

    if (list != null && list.size() > 0)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) list.get(0));

    return null;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException
{
    if (admission == null)
        throw new CodingRuntimeException("Admission Details parameter is mandatory.");

    if (careSpell == null)
        throw new CodingRuntimeException("Care Spell parameter is mandatory.");

    if (catsReferral == null)
        throw new CodingRuntimeException("Cats Referral parameter is mandatory.");


    PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission);
    catsReferral.setJourney(journey);

    @SuppressWarnings("rawtypes")
    HashMap domMap = new HashMap();
    AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap);
    CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap);
    CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap);
    domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent());

    getDomainFactory().save(domAdmissionDetail);
    getDomainFactory().save(domCareSpell);
    getDomainFactory().save(domCatsReferral);

    InpatientEpisode inpatEpisode = new InpatientEpisode();
    inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent());
    inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant());
    inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime());
    inpatEpisode.setEstDischargeDate(null);
    inpatEpisode.setWardType(domAdmissionDetail.getWardType());

    if (wardStay != null)
        inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap));
    if (consultant != null)
        inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap));

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap);   
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(inpatEpisode);  
        inpatEpisode.setBed(doBedSpaceState);
        inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber());
    }

    if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true)
    {
        Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory());
        if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired()))
        {
            inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED));
        }
    }

    getDomainFactory().save(inpatEpisode);

    return null;
}
项目:openMAXIMS    文件:BedAdmissionComponentImpl.java   
public void allocateBed(BedSpaceStateLiteVo bedSpace, InpatientEpisodeLiteVo inpatientEpisode, AdmissionDetailVo admissionDetail, HomeLeaveVo voHomeLeave) throws StaleObjectException, DomainInterfaceException 
{
    if (inpatientEpisode == null)
        throw new CodingRuntimeException("inpatientEpisode is null in method allocateBed");
    if (bedSpace == null)
        throw new CodingRuntimeException("bedSpace is null in method allocateBed");
    if (admissionDetail == null)
        throw new CodingRuntimeException("admissionDetail is null in method allocateBed");

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpace);    
    InpatientEpisode doInpatEpis = InpatientEpisodeLiteVoAssembler.extractInpatientEpisode(getDomainFactory(), inpatientEpisode);
    AdmissionDetail doAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admissionDetail);

    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(doInpatEpis);   
        doInpatEpis.setBed(doBedSpaceState);
    }

    if(voHomeLeave != null)
    {
        for(int i = 0 ; doInpatEpis.getHomeLeaves().size() > 0 && i < doInpatEpis.getHomeLeaves().size() ; i++)
        {
             HomeLeave doHL = (HomeLeave)doInpatEpis.getHomeLeaves().get(i);
             if (doHL != null
                && doHL.getDateReturnedFromHomeLeave() == null)
             {
                 doHL.setDateReturnedFromHomeLeave(voHomeLeave.getDateReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getDateReturnedFromHomeLeave().getDate() : null);
                 doHL.setTimeReturnedFromHomeLeave(voHomeLeave.getTimeReturnedFromHomeLeaveIsNotNull() ? voHomeLeave.getTimeReturnedFromHomeLeave().toString() : null);

                 doInpatEpis.getHomeLeaves().set(i, doHL);
             }
        }
        doInpatEpis.setIsOnHomeLeave(false);
        doInpatEpis.setDateOnHomeLeave(null);
        doInpatEpis.setTimeOnHomeLeave(null);
        doInpatEpis.setExpectedDateOfReturn(null);
        doInpatEpis.setExpectedTimeOfReturn(null);
        doInpatEpis.setVacatedBedNumber(null);

        //UPDATE PAS THAT NO LONGER ON HOME LEAVE 
        if (Boolean.FALSE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue()))
        {
            Homeleave hlRec = (Homeleave)getDTOInstance(Homeleave.class);
            hlRec.DataCollection.add();

            copyHomeLeaveToDto(hlRec, doAdmissionDetail, voHomeLeave);

            Result res = hlRec.update();
            if (res != null && res.getId() < 0 )
            {
                if (res.getId() == -5)
                    throw new DomainInterfaceException("Error occurred saving Home Leave record to PAS " + res.getMessage());
                else 
                    throw new DTODomainInterfaceException(res.getId(), "Error occurred saving Home Leave record to PAS " + res.getMessage());   
            }
        }
    }

    getDomainFactory().save(doInpatEpis);

    if(doBedSpaceState != null)
        doAdmissionDetail.setBed(doBedSpaceState.getBedSpace());

    getDomainFactory().save(doAdmissionDetail);
}
项目:openMAXIMS    文件:ADTPatientAdmissionImpl.java   
public AdmissionDetailVo getAdmissionDetailByPasEvent(PASEventRefVo pasEventRef)
{
    if (pasEventRef == null || pasEventRef.getID_PASEvent() == null)
        throw new CodingRuntimeException("Cannot get AdmissionDetails value on null pasEventRef.");

    StringBuffer hql = new StringBuffer("select admDetail from AdmissionDetail as admDetail left join admDetail.pasEvent as pasEvent where pasEvent.id = :pasEventID) ");

    DomainFactory factory = getDomainFactory();

    List<?> list = factory.find(hql.toString(), new String[] { "pasEventID" }, new Object[] { pasEventRef.getID_PASEvent() });

    if (list != null && list.size() > 0)
        return AdmissionDetailVoAssembler.create((AdmissionDetail) list.get(0));

    return null;
}
项目:openmaxims-linux    文件:BedAdmissionComponentImpl.java   
public AdmissionDetailVo saveEmergencyAdmissionInElectiveCase(AdmissionDetailVo admission, CareSpellVo careSpell, CatsReferralEmergencyAdmissionVo catsReferral, BedSpaceStateLiteVo bedSpaceState, WardStayVo wardStay, ConsultantStayVo consultant) throws DomainInterfaceException, StaleObjectException
{
    if (admission == null)
        throw new CodingRuntimeException("Admission Details parameter is mandatory.");

    if (careSpell == null)
        throw new CodingRuntimeException("Care Spell parameter is mandatory.");

    if (catsReferral == null)
        throw new CodingRuntimeException("Cats Referral parameter is mandatory.");


    PatientPathwayJourneyRefVo journey = createPatientJourney(catsReferral, admission);
    catsReferral.setJourney(journey);

    @SuppressWarnings("rawtypes")
    HashMap domMap = new HashMap();
    AdmissionDetail domAdmissionDetail = AdmissionDetailVoAssembler.extractAdmissionDetail(getDomainFactory(), admission, domMap);
    CareSpell domCareSpell = CareSpellVoAssembler.extractCareSpell(getDomainFactory(), careSpell, domMap);
    CatsReferral domCatsReferral = CatsReferralEmergencyAdmissionVoAssembler.extractCatsReferral(getDomainFactory(), catsReferral, domMap);
    domCatsReferral.getCareContext().setPasEvent(domAdmissionDetail.getPasEvent());

    getDomainFactory().save(domAdmissionDetail);
    getDomainFactory().save(domCareSpell);
    getDomainFactory().save(domCatsReferral);

    InpatientEpisode inpatEpisode = new InpatientEpisode();
    inpatEpisode.setPasEvent(domAdmissionDetail.getPasEvent());
    inpatEpisode.getPasEvent().setConsultant(domAdmissionDetail.getConsultant());
    inpatEpisode.setAdmissionDateTime(domAdmissionDetail.getAdmissionDateTime());
    inpatEpisode.setEstDischargeDate(null);
    inpatEpisode.setWardType(domAdmissionDetail.getWardType());

    if (wardStay != null)
        inpatEpisode.getWardStays().add(WardStayVoAssembler.extractWardStay(getDomainFactory(), wardStay, domMap));
    if (consultant != null)
        inpatEpisode.getConsultantStays().add(ConsultantStayVoAssembler.extractConsultantStay(getDomainFactory(), consultant, domMap));

    BedSpaceState doBedSpaceState = BedSpaceStateLiteVoAssembler.extractBedSpaceState(getDomainFactory(), bedSpaceState, domMap);   
    if(doBedSpaceState != null)
    {
        doBedSpaceState.setInpatientEpisode(inpatEpisode);  
        inpatEpisode.setBed(doBedSpaceState);
        inpatEpisode.setBedNo(doBedSpaceState.getBedSpace().getBedNumber());
    }

    if (wardStay != null && wardStay.getWardIsNotNull() && ConfigFlag.UI.VTE_RISK_ASSESSMENT_FUNCTIONALITY.getValue() == true)
    {
        Location doloc = getLocation(wardStay.getWard().getID_Location(), getDomainFactory());
        if (doloc != null && !Boolean.TRUE.equals(doloc.isVTEAsessmentNotRequired()))
        {
            inpatEpisode.setVTEAssessmentStatus(getDomLookup(VTEAsessmentStatus.REQUIRED));
        }
    }

    getDomainFactory().save(inpatEpisode);

    return null;
}