Java 类ims.clinical.vo.domain.OnAdmissionSummaryVoAssembler 实例源码

项目:AvoinApotti    文件:OnAdmissionSummaryImpl.java   
/**
* save admission record
*/
public OnAdmissionSummaryVo save(OnAdmissionSummaryVo admissionSummary) throws StaleObjectException, UniqueKeyViolationException, DomainInterfaceException 
{
    // Check for a valid record to save
    if (admissionSummary == null || !admissionSummary.isValidated())
        throw new DomainRuntimeException("Admission Summary record is null or has not been validated");

    DomainFactory factory = getDomainFactory();     
    OnAdmissionSummary admSumBo = OnAdmissionSummaryVoAssembler.extractOnAdmissionSummary(factory,admissionSummary);

    // Check for existing AdmissionSummary record for clinical contact
    StringBuilder hqlCheck = new StringBuilder();

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

    hqlCheck.append("SELECT COUNT(admission.id) FROM OnAdmissionSummary AS admission ");
    hqlCheck.append("WHERE admission.clinicalContact.id = :CLINICAL_CONTACT AND admission.isRIE is null ");

    paramNames.add("CLINICAL_CONTACT");         paramValues.add(admissionSummary.getClinicalContact().getID_ClinicalContact());

    if (admissionSummary.getID_OnAdmissionSummary() != null)
    {
        hqlCheck.append("AND admission.id <> :ADMISSION_ID ");

        paramNames.add("ADMISSION_ID");             paramValues.add(admissionSummary.getID_OnAdmissionSummary());
    }

    long records = factory.countWithHQL(hqlCheck.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray());

    if (records > 0)
    {
        throw new StaleObjectException(admSumBo);
    }

    try
    {
        factory.save(admSumBo);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return OnAdmissionSummaryVoAssembler.create(admSumBo);      
}
项目:AvoinApotti    文件:OnAdmissionSummaryImpl.java   
/**
* get admission recod fo a context
*/
public OnAdmissionSummaryVo get(ClinicalContactRefVo clinicalContactRefVo, ClinicalNoteType noteType, HcpDisType disciplineType, CareContextRefVo careContextRefVo)
{
    if(careContextRefVo == null)
        throw new DomainRuntimeException("Cannot get OnAdmissionSummaryVo for null CareContextRefVo ");

    ArrayList<Serializable> values = new ArrayList<Serializable>();
    ArrayList<String> params   = new ArrayList<String>();
    StringBuffer hql = new StringBuffer();
    hql.append("from OnAdmissionSummary oas");
    String clause = " where ";
    if(clinicalContactRefVo != null)
    {   
        hql.append(clause);
        hql.append("oas.clinicalContact.id = :clinicalContactId");
        params.add("clinicalContactId");
        values.add(clinicalContactRefVo.getID_ClinicalContact());
        clause = " and "; 
    }


    hql.append(clause);
    hql.append("oas.careContext.id = :careContextId");
    params.add("careContextId");
    values.add(careContextRefVo.getID_CareContext());
    clause = " and ";

    if(noteType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.noteType = :noteType");
        params.add("noteType");
        values.add(getDomLookup(noteType));
        clause = " and "; 
    }

    if(disciplineType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.discipline = :discType");
        params.add("discType");
        values.add(getDomLookup(disciplineType));
        clause = " and "; 
    }

    DomainFactory factory = getDomainFactory();
    java.util.List assSumList = factory.find(hql.toString(), params, values);

    if  ((assSumList != null) && (assSumList.size()>0))
    {
        //wdev-7165 - assSumList contains records RIE, but col will not.
        OnAdmissionSummaryVoCollection col = OnAdmissionSummaryVoAssembler.createOnAdmissionSummaryVoCollectionFromOnAdmissionSummary(assSumList);

        return col.size() > 0 ? col.get(0) : null;
    }
    else
        return null;
}
项目:openMAXIMS    文件:OnAdmissionSummaryImpl.java   
/**
* save admission record
*/
public OnAdmissionSummaryVo save(OnAdmissionSummaryVo admissionSummary) throws StaleObjectException, UniqueKeyViolationException, DomainInterfaceException 
{
    // Check for a valid record to save
    if (admissionSummary == null || !admissionSummary.isValidated())
        throw new DomainRuntimeException("Admission Summary record is null or has not been validated");

    DomainFactory factory = getDomainFactory();     
    OnAdmissionSummary admSumBo = OnAdmissionSummaryVoAssembler.extractOnAdmissionSummary(factory,admissionSummary);

    // Check for existing AdmissionSummary record for clinical contact
    StringBuilder hqlCheck = new StringBuilder();

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

    hqlCheck.append("SELECT COUNT(admission.id) FROM OnAdmissionSummary AS admission ");
    hqlCheck.append("WHERE admission.clinicalContact.id = :CLINICAL_CONTACT AND admission.isRIE is null ");

    paramNames.add("CLINICAL_CONTACT");         paramValues.add(admissionSummary.getClinicalContact().getID_ClinicalContact());

    if (admissionSummary.getID_OnAdmissionSummary() != null)
    {
        hqlCheck.append("AND admission.id <> :ADMISSION_ID ");

        paramNames.add("ADMISSION_ID");             paramValues.add(admissionSummary.getID_OnAdmissionSummary());
    }

    long records = factory.countWithHQL(hqlCheck.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray());

    if (records > 0)
    {
        throw new StaleObjectException(admSumBo);
    }

    try
    {
        factory.save(admSumBo);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return OnAdmissionSummaryVoAssembler.create(admSumBo);      
}
项目:openMAXIMS    文件:OnAdmissionSummaryImpl.java   
/**
* get admission recod fo a context
*/
public OnAdmissionSummaryVo get(ClinicalContactRefVo clinicalContactRefVo, ClinicalNoteType noteType, HcpDisType disciplineType, CareContextRefVo careContextRefVo)
{
    if(careContextRefVo == null)
        throw new DomainRuntimeException("Cannot get OnAdmissionSummaryVo for null CareContextRefVo ");

    ArrayList<Serializable> values = new ArrayList<Serializable>();
    ArrayList<String> params   = new ArrayList<String>();
    StringBuffer hql = new StringBuffer();
    hql.append("from OnAdmissionSummary oas");
    String clause = " where ";
    if(clinicalContactRefVo != null)
    {   
        hql.append(clause);
        hql.append("oas.clinicalContact.id = :clinicalContactId");
        params.add("clinicalContactId");
        values.add(clinicalContactRefVo.getID_ClinicalContact());
        clause = " and "; 
    }


    hql.append(clause);
    hql.append("oas.careContext.id = :careContextId");
    params.add("careContextId");
    values.add(careContextRefVo.getID_CareContext());
    clause = " and ";

    if(noteType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.noteType = :noteType");
        params.add("noteType");
        values.add(getDomLookup(noteType));
        clause = " and "; 
    }

    if(disciplineType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.discipline = :discType");
        params.add("discType");
        values.add(getDomLookup(disciplineType));
        clause = " and "; 
    }

    DomainFactory factory = getDomainFactory();
    java.util.List assSumList = factory.find(hql.toString(), params, values);

    if  ((assSumList != null) && (assSumList.size()>0))
    {
        //wdev-7165 - assSumList contains records RIE, but col will not.
        OnAdmissionSummaryVoCollection col = OnAdmissionSummaryVoAssembler.createOnAdmissionSummaryVoCollectionFromOnAdmissionSummary(assSumList);

        return col.size() > 0 ? col.get(0) : null;
    }
    else
        return null;
}
项目:openMAXIMS    文件:OnAdmissionSummaryImpl.java   
/**
* save admission record
*/
public OnAdmissionSummaryVo save(OnAdmissionSummaryVo admissionSummary) throws StaleObjectException, UniqueKeyViolationException, DomainInterfaceException 
{
    // Check for a valid record to save
    if (admissionSummary == null || !admissionSummary.isValidated())
        throw new DomainRuntimeException("Admission Summary record is null or has not been validated");

    DomainFactory factory = getDomainFactory();     
    OnAdmissionSummary admSumBo = OnAdmissionSummaryVoAssembler.extractOnAdmissionSummary(factory,admissionSummary);

    // Check for existing AdmissionSummary record for clinical contact
    StringBuilder hqlCheck = new StringBuilder();

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

    hqlCheck.append("SELECT COUNT(admission.id) FROM OnAdmissionSummary AS admission ");
    hqlCheck.append("WHERE admission.clinicalContact.id = :CLINICAL_CONTACT AND admission.isRIE is null ");

    paramNames.add("CLINICAL_CONTACT");         paramValues.add(admissionSummary.getClinicalContact().getID_ClinicalContact());

    if (admissionSummary.getID_OnAdmissionSummary() != null)
    {
        hqlCheck.append("AND admission.id <> :ADMISSION_ID ");

        paramNames.add("ADMISSION_ID");             paramValues.add(admissionSummary.getID_OnAdmissionSummary());
    }

    long records = factory.countWithHQL(hqlCheck.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray());

    if (records > 0)
    {
        throw new StaleObjectException(admSumBo);
    }

    try
    {
        factory.save(admSumBo);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return OnAdmissionSummaryVoAssembler.create(admSumBo);      
}
项目:openMAXIMS    文件:OnAdmissionSummaryImpl.java   
/**
* get admission recod fo a context
*/
public OnAdmissionSummaryVo get(ClinicalContactRefVo clinicalContactRefVo, ClinicalNoteType noteType, HcpDisType disciplineType, CareContextRefVo careContextRefVo)
{
    if(careContextRefVo == null)
        throw new DomainRuntimeException("Cannot get OnAdmissionSummaryVo for null CareContextRefVo ");

    ArrayList<Serializable> values = new ArrayList<Serializable>();
    ArrayList<String> params   = new ArrayList<String>();
    StringBuffer hql = new StringBuffer();
    hql.append("from OnAdmissionSummary oas");
    String clause = " where ";
    if(clinicalContactRefVo != null)
    {   
        hql.append(clause);
        hql.append("oas.clinicalContact.id = :clinicalContactId");
        params.add("clinicalContactId");
        values.add(clinicalContactRefVo.getID_ClinicalContact());
        clause = " and "; 
    }


    hql.append(clause);
    hql.append("oas.careContext.id = :careContextId");
    params.add("careContextId");
    values.add(careContextRefVo.getID_CareContext());
    clause = " and ";

    if(noteType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.noteType = :noteType");
        params.add("noteType");
        values.add(getDomLookup(noteType));
        clause = " and "; 
    }

    if(disciplineType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.discipline = :discType");
        params.add("discType");
        values.add(getDomLookup(disciplineType));
        clause = " and "; 
    }

    DomainFactory factory = getDomainFactory();
    java.util.List assSumList = factory.find(hql.toString(), params, values);

    if  ((assSumList != null) && (assSumList.size()>0))
    {
        //wdev-7165 - assSumList contains records RIE, but col will not.
        OnAdmissionSummaryVoCollection col = OnAdmissionSummaryVoAssembler.createOnAdmissionSummaryVoCollectionFromOnAdmissionSummary(assSumList);

        return col.size() > 0 ? col.get(0) : null;
    }
    else
        return null;
}
项目:openmaxims-linux    文件:OnAdmissionSummaryImpl.java   
/**
* save admission record
*/
public OnAdmissionSummaryVo save(OnAdmissionSummaryVo admissionSummary) throws StaleObjectException, UniqueKeyViolationException, DomainInterfaceException 
{
    // Check for a valid record to save
    if (admissionSummary == null || !admissionSummary.isValidated())
        throw new DomainRuntimeException("Admission Summary record is null or has not been validated");

    DomainFactory factory = getDomainFactory();     
    OnAdmissionSummary admSumBo = OnAdmissionSummaryVoAssembler.extractOnAdmissionSummary(factory,admissionSummary);

    // Check for existing AdmissionSummary record for clinical contact
    StringBuilder hqlCheck = new StringBuilder();

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

    hqlCheck.append("SELECT COUNT(admission.id) FROM OnAdmissionSummary AS admission ");
    hqlCheck.append("WHERE admission.clinicalContact.id = :CLINICAL_CONTACT AND admission.isRIE is null ");

    paramNames.add("CLINICAL_CONTACT");         paramValues.add(admissionSummary.getClinicalContact().getID_ClinicalContact());

    if (admissionSummary.getID_OnAdmissionSummary() != null)
    {
        hqlCheck.append("AND admission.id <> :ADMISSION_ID ");

        paramNames.add("ADMISSION_ID");             paramValues.add(admissionSummary.getID_OnAdmissionSummary());
    }

    long records = factory.countWithHQL(hqlCheck.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray());

    if (records > 0)
    {
        throw new StaleObjectException(admSumBo);
    }

    try
    {
        factory.save(admSumBo);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException(e.getMessage());
    }

    return OnAdmissionSummaryVoAssembler.create(admSumBo);      
}
项目:openmaxims-linux    文件:OnAdmissionSummaryImpl.java   
/**
* get admission recod fo a context
*/
public OnAdmissionSummaryVo get(ClinicalContactRefVo clinicalContactRefVo, ClinicalNoteType noteType, HcpDisType disciplineType, CareContextRefVo careContextRefVo)
{
    if(careContextRefVo == null)
        throw new DomainRuntimeException("Cannot get OnAdmissionSummaryVo for null CareContextRefVo ");

    ArrayList<Serializable> values = new ArrayList<Serializable>();
    ArrayList<String> params   = new ArrayList<String>();
    StringBuffer hql = new StringBuffer();
    hql.append("from OnAdmissionSummary oas");
    String clause = " where ";
    if(clinicalContactRefVo != null)
    {   
        hql.append(clause);
        hql.append("oas.clinicalContact.id = :clinicalContactId");
        params.add("clinicalContactId");
        values.add(clinicalContactRefVo.getID_ClinicalContact());
        clause = " and "; 
    }


    hql.append(clause);
    hql.append("oas.careContext.id = :careContextId");
    params.add("careContextId");
    values.add(careContextRefVo.getID_CareContext());
    clause = " and ";

    if(noteType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.noteType = :noteType");
        params.add("noteType");
        values.add(getDomLookup(noteType));
        clause = " and "; 
    }

    if(disciplineType != null)
    {
        hql.append(clause);
        hql.append("oas.admissionNotes.discipline = :discType");
        params.add("discType");
        values.add(getDomLookup(disciplineType));
        clause = " and "; 
    }

    DomainFactory factory = getDomainFactory();
    java.util.List assSumList = factory.find(hql.toString(), params, values);

    if  ((assSumList != null) && (assSumList.size()>0))
    {
        //wdev-7165 - assSumList contains records RIE, but col will not.
        OnAdmissionSummaryVoCollection col = OnAdmissionSummaryVoAssembler.createOnAdmissionSummaryVoCollectionFromOnAdmissionSummary(assSumList);

        return col.size() > 0 ? col.get(0) : null;
    }
    else
        return null;
}