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

项目:AvoinApotti    文件:ClinicalNoteDrawingImpl.java   
/**
* getClinicalNotesAdditional
*/
public ims.core.vo.ClinicalNotesAdditionalVo getClinicalNotesAdditional(Integer clinicalNotesId)
{
    if(clinicalNotesId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" from ClinicalNotesAdditional noteadd where "); 
        String andStr = " ";

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

        hql.append(andStr + " noteadd.clinialNotes.id = :clinicNoteId");
            markers.add("clinicNoteId");
        values.add(clinicalNotesId);
        andStr = " and ";   

        List listAdditional = factory.find(hql.toString(), markers,values);
        if(listAdditional != null && listAdditional.size() > 0)
        { 
            ClinicalNotesAdditionalVoCollection voColl = ClinicalNotesAdditionalVoAssembler.createClinicalNotesAdditionalVoCollectionFromClinicalNotesAdditional(listAdditional);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:openMAXIMS    文件:Logic.java   
private ClinicalNotesAdditionalVo getNotesAdditional(ClinicalNotesVo voClinicalNotes)
{
    ClinicalNotesAdditionalVo voAdditional = null;
    if (voClinicalNotes != null && voClinicalNotes.getID_ClinicalNotesIsNotNull())
        voAdditional = domain.getClinicalNotesAdditional(voClinicalNotes.getID_ClinicalNotes());

    return voAdditional != null ? voAdditional : new ClinicalNotesAdditionalVo();
}
项目:openMAXIMS    文件:ClinicalNotingImpl.java   
public ims.core.vo.ClinicalNotesVo saveClinicalNotes(ims.core.vo.ClinicalNotesVo voClinicalNotes, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if (voClinicalNotes == null)
        throw new RuntimeException("Cannot save null value for voClinicalNotes");
    if(!voClinicalNotes.isValidated())
        throw new CodingRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    if (voClinicalNotes.getID_ClinicalNotes() == null)//Inserting a record
    {
        ClinicalNotesVo voCN = getClinicalContactNote(voClinicalNotes.getClinicalContact());
        if(voCN != null)
            throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed");
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        if(!voClinicalNotesAdditional.isValidated())
            throw new CodingRuntimeException("ClinicalNotesAdditionalVo has not been validated");

        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openMAXIMS    文件:ClinicalNotingImpl.java   
public ClinicalNotesAdditionalVo getClinicalNotesAdditional(Integer clinicalNotesId) 
{
    if (clinicalNotesId == null)
        throw new RuntimeException("Cannot get ClinicalNotesAdditionalVo for null clinicalNotesId");

    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" from ClinicalNotesAdditional noteadd where "); 
    String andStr = " ";

    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    hql.append(andStr + " noteadd.clinialNotes.id = :clinicNoteId");
        markers.add("clinicNoteId");
    values.add(clinicalNotesId);
    andStr = " and ";   

    List listAdditional = factory.find(hql.toString(), markers,values);
    if(listAdditional != null && listAdditional.size() > 0)
    { 
        ClinicalNotesAdditionalVoCollection voColl = ClinicalNotesAdditionalVoAssembler.createClinicalNotesAdditionalVoCollectionFromClinicalNotesAdditional(listAdditional);
        if(voColl != null && voColl.size() > 0)
            return voColl.get(0);
    }

    return null;
}
项目:openMAXIMS    文件:ClinicalNoteDrawingImpl.java   
/**
* getClinicalNotesAdditional
*/
public ims.core.vo.ClinicalNotesAdditionalVo getClinicalNotesAdditional(Integer clinicalNotesId)
{
    if(clinicalNotesId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" from ClinicalNotesAdditional noteadd where "); 
        String andStr = " ";

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

        hql.append(andStr + " noteadd.clinialNotes.id = :clinicNoteId");
            markers.add("clinicNoteId");
        values.add(clinicalNotesId);
        andStr = " and ";   

        List listAdditional = factory.find(hql.toString(), markers,values);
        if(listAdditional != null && listAdditional.size() > 0)
        { 
            ClinicalNotesAdditionalVoCollection voColl = ClinicalNotesAdditionalVoAssembler.createClinicalNotesAdditionalVoCollectionFromClinicalNotesAdditional(listAdditional);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:openMAXIMS    文件:ClinicalNoteDrawingImpl.java   
/**
* getClinicalNotesAdditional
*/
public ims.core.vo.ClinicalNotesAdditionalVo getClinicalNotesAdditional(Integer clinicalNotesId)
{
    if(clinicalNotesId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" from ClinicalNotesAdditional noteadd where "); 
        String andStr = " ";

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

        hql.append(andStr + " noteadd.clinialNotes.id = :clinicNoteId");
            markers.add("clinicNoteId");
        values.add(clinicalNotesId);
        andStr = " and ";   

        List listAdditional = factory.find(hql.toString(), markers,values);
        if(listAdditional != null && listAdditional.size() > 0)
        { 
            ClinicalNotesAdditionalVoCollection voColl = ClinicalNotesAdditionalVoAssembler.createClinicalNotesAdditionalVoCollectionFromClinicalNotesAdditional(listAdditional);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:openmaxims-linux    文件:ClinicalNoteDrawingImpl.java   
/**
* getClinicalNotesAdditional
*/
public ims.core.vo.ClinicalNotesAdditionalVo getClinicalNotesAdditional(Integer clinicalNotesId)
{
    if(clinicalNotesId != null)
    {
        DomainFactory factory = getDomainFactory();
        StringBuffer hql = new StringBuffer(" from ClinicalNotesAdditional noteadd where "); 
        String andStr = " ";

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

        hql.append(andStr + " noteadd.clinialNotes.id = :clinicNoteId");
            markers.add("clinicNoteId");
        values.add(clinicalNotesId);
        andStr = " and ";   

        List listAdditional = factory.find(hql.toString(), markers,values);
        if(listAdditional != null && listAdditional.size() > 0)
        { 
            ClinicalNotesAdditionalVoCollection voColl = ClinicalNotesAdditionalVoAssembler.createClinicalNotesAdditionalVoCollectionFromClinicalNotesAdditional(listAdditional);
            if(voColl != null && voColl.size() > 0)
                return voColl.get(0);
        }
    }
    return null;
}
项目:AvoinApotti    文件:ClinicalNoteDrawingImpl.java   
/**
* saveClinicalNotes
*/
public ClinicalNotesVo saveClinicalNotes(ClinicalNotesVo voClinicalNotes, ClinicalContactShortVo voClinicalContactShort, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException //WDEV-19027
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    ClinicalContact doClinicalContact = getCurrentClinicalContact(voClinicalNotes.getClinicalContact());
    doNote.setClinicalContact(doClinicalContact);

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:AvoinApotti    文件:ClinicalNoteDrawingImpl.java   
public ClinicalNotesVo saveClinicalNotesForCareContext(ClinicalNotesVo voClinicalNotes, CareContextRefVo voCareContext, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this Care Context, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    CareContext doCareContext = getCurrentCareContext(voClinicalNotes.getCareContext()); //WDEV-19027
    doNote.setCareContext(doCareContext);//WDEV-19027

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openMAXIMS    文件:Logic.java   
private ClinicalNotesAdditionalVo getVoAdditional(ClinicalNotesVo voClinicalNotes)
{
    ClinicalNotesAdditionalVo voClinNoteAdditional = getNotesAdditional(voClinicalNotes);
    return voClinNoteAdditional;
}
项目:openMAXIMS    文件:ClinicalNoteDrawingImpl.java   
/**
* saveClinicalNotes
*/
public ClinicalNotesVo saveClinicalNotes(ClinicalNotesVo voClinicalNotes, ClinicalContactShortVo voClinicalContactShort, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException //WDEV-19027
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    ClinicalContact doClinicalContact = getCurrentClinicalContact(voClinicalNotes.getClinicalContact());
    doNote.setClinicalContact(doClinicalContact);

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openMAXIMS    文件:ClinicalNoteDrawingImpl.java   
public ClinicalNotesVo saveClinicalNotesForCareContext(ClinicalNotesVo voClinicalNotes, CareContextRefVo voCareContext, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this Care Context, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    CareContext doCareContext = getCurrentCareContext(voClinicalNotes.getCareContext()); //WDEV-19027
    doNote.setCareContext(doCareContext);//WDEV-19027

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openMAXIMS    文件:ClinicalNoteDrawingImpl.java   
/**
* saveClinicalNotes
*/
public ClinicalNotesVo saveClinicalNotes(ClinicalNotesVo voClinicalNotes, ClinicalContactShortVo voClinicalContactShort, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException //WDEV-19027
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    ClinicalContact doClinicalContact = getCurrentClinicalContact(voClinicalNotes.getClinicalContact());
    doNote.setClinicalContact(doClinicalContact);

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openMAXIMS    文件:ClinicalNoteDrawingImpl.java   
public ClinicalNotesVo saveClinicalNotesForCareContext(ClinicalNotesVo voClinicalNotes, CareContextRefVo voCareContext, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this Care Context, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    CareContext doCareContext = getCurrentCareContext(voClinicalNotes.getCareContext()); //WDEV-19027
    doNote.setCareContext(doCareContext);//WDEV-19027

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openmaxims-linux    文件:ClinicalNoteDrawingImpl.java   
/**
* saveClinicalNotes
*/
public ClinicalNotesVo saveClinicalNotes(ClinicalNotesVo voClinicalNotes, ClinicalContactShortVo voClinicalContactShort, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException //WDEV-19027
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + 
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    ClinicalContact doClinicalContact = getCurrentClinicalContact(voClinicalNotes.getClinicalContact());
    doNote.setClinicalContact(doClinicalContact);

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}
项目:openmaxims-linux    文件:ClinicalNoteDrawingImpl.java   
public ClinicalNotesVo saveClinicalNotesForCareContext(ClinicalNotesVo voClinicalNotes, CareContextRefVo voCareContext, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException
{
    if(voClinicalNotes.isValidated() == false)
        throw new DomainRuntimeException("ClinicalNotesVo has not been validated");

    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1");
    if(voClinicalNotes.getID_ClinicalNotes()== null)
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883)"); 
                        // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) 
    }
    else
    {
        hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() +   //WDEV-19027
                        "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " +  voClinicalNotes.getID_ClinicalNotes() +")");
                        //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883))
    }

    List list = (factory.find(hql.toString()));

    if(list.size() > 0)
    {

        ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list);
        if (doClinNotes.get(0).getSourceOfNote() != null &&
                !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())))
        {
            return null;
        }
        else
        {
            throw new DomainRuntimeException("A record exists for this Care Context, the screen will be refreshed");    
        }
    }

    ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes);
    CareContext doCareContext = getCurrentCareContext(voClinicalNotes.getCareContext()); //WDEV-19027
    doNote.setCareContext(doCareContext);//WDEV-19027

    factory.save(doNote);

    if(voClinicalNotesAdditional != null)
    {
        ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional);
        doClinNotesAdditional.setClinialNotes(doNote);
        factory.save(doClinNotesAdditional);
    }

    return ClinicalNotesVoAssembler.create(doNote);
}