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

项目:AvoinApotti    文件:AllergiesImpl.java   
/**
* lists patient allergies, filtering by patient and active status
*/
public ims.core.vo.PatientAllergyCollection listPatientAllergies(ims.core.vo.PatientShort patient, Boolean active)
{   
    if(patient == null)
        throw new CodingRuntimeException("Mandatory parameter - Patient not supplied");
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();

    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from PatientAllergy patAlrg ");
    hql.append(" where patAlrg.patient.id = :patient");
    names.add("patient");
    values.add(patient.getID_Patient());

    if (active.equals(Boolean.TRUE))
    {
        hql.append (" and patAlrg.isCurrentlyActiveAllergy = :isActive");
        names.add("isActive");
        values.add(Boolean.TRUE);   
    }
    List list = factory.find(hql.toString(), names,values);
    return(PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort());

}
项目:openMAXIMS    文件:AllergiesImpl.java   
/**
* lists patient allergies, filtering by patient and active status
*/
public ims.core.vo.PatientAllergyCollection listPatientAllergies(ims.core.vo.PatientShort patient, Boolean active)
{   
    if(patient == null)
        throw new CodingRuntimeException("Mandatory parameter - Patient not supplied");
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();

    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from PatientAllergy patAlrg ");
    hql.append(" where patAlrg.patient.id = :patient");
    names.add("patient");
    values.add(patient.getID_Patient());

    if (active.equals(Boolean.TRUE))
    {
        hql.append (" and patAlrg.isCurrentlyActiveAllergy = :isActive");
        names.add("isActive");
        values.add(Boolean.TRUE);   
    }
    List list = factory.find(hql.toString(), names,values);
    return(PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort());

}
项目:openMAXIMS    文件:AllergiesImpl.java   
/**
* lists patient allergies, filtering by patient and active status
*/
public ims.core.vo.PatientAllergyCollection listPatientAllergies(ims.core.vo.PatientShort patient, Boolean active)
{   
    if(patient == null)
        throw new CodingRuntimeException("Mandatory parameter - Patient not supplied");
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();

    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from PatientAllergy patAlrg ");
    hql.append(" where patAlrg.patient.id = :patient");
    names.add("patient");
    values.add(patient.getID_Patient());

    if (active.equals(Boolean.TRUE))
    {
        hql.append (" and patAlrg.isCurrentlyActiveAllergy = :isActive");
        names.add("isActive");
        values.add(Boolean.TRUE);   
    }
    List list = factory.find(hql.toString(), names,values);
    return(PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort());

}
项目:openmaxims-linux    文件:AllergiesImpl.java   
/**
* lists patient allergies, filtering by patient and active status
*/
public ims.core.vo.PatientAllergyCollection listPatientAllergies(ims.core.vo.PatientShort patient, Boolean active)
{   
    if(patient == null)
        throw new CodingRuntimeException("Mandatory parameter - Patient not supplied");
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();

    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from PatientAllergy patAlrg ");
    hql.append(" where patAlrg.patient.id = :patient");
    names.add("patient");
    values.add(patient.getID_Patient());

    if (active.equals(Boolean.TRUE))
    {
        hql.append (" and patAlrg.isCurrentlyActiveAllergy = :isActive");
        names.add("isActive");
        values.add(Boolean.TRUE);   
    }
    List list = factory.find(hql.toString(), names,values);
    return(PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort());

}
项目:AvoinApotti    文件:NotificationsImpl.java   
@SuppressWarnings("unchecked")
public PatientAllergyCollection getPatientAllergies(Integer patientId) 
{
    if(patientId == null)
        throw new CodingRuntimeException("Invalid patient Id.");

    DomainFactory factory = getDomainFactory();
    List list = factory.find("from PatientAllergy patAlrg where patAlrg.patient.id = :patient and patAlrg.isCurrentlyActiveAllergy = 1", new String[] {"patient"},new Object[] {patientId});

    return PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort();
}
项目:openMAXIMS    文件:NotificationsImpl.java   
@SuppressWarnings("unchecked")
public PatientAllergyCollection getPatientAllergies(Integer patientId) 
{
    if(patientId == null)
        throw new CodingRuntimeException("Invalid patient Id.");

    DomainFactory factory = getDomainFactory();
    List list = factory.find("from PatientAllergy patAlrg where patAlrg.patient.id = :patient and patAlrg.isCurrentlyActiveAllergy = 1", new String[] {"patient"},new Object[] {patientId});

    return PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort();
}
项目:openMAXIMS    文件:NotificationsImpl.java   
@SuppressWarnings("unchecked")
public PatientAllergyCollection getPatientAllergies(Integer patientId) 
{
    if(patientId == null)
        throw new CodingRuntimeException("Invalid patient Id.");

    DomainFactory factory = getDomainFactory();
    List list = factory.find("from PatientAllergy patAlrg where patAlrg.patient.id = :patient and patAlrg.isCurrentlyActiveAllergy = 1", new String[] {"patient"},new Object[] {patientId});

    return PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort();
}
项目:openmaxims-linux    文件:NotificationsImpl.java   
@SuppressWarnings("unchecked")
public PatientAllergyCollection getPatientAllergies(Integer patientId) 
{
    if(patientId == null)
        throw new CodingRuntimeException("Invalid patient Id.");

    DomainFactory factory = getDomainFactory();
    List list = factory.find("from PatientAllergy patAlrg where patAlrg.patient.id = :patient and patAlrg.isCurrentlyActiveAllergy = 1", new String[] {"patient"},new Object[] {patientId});

    return PatientAllergyAssembler.createPatientAllergyCollectionFromPatientAllergy(list).sort();
}
项目:AvoinApotti    文件:AllergiesImpl.java   
/**
* saves a patient allergy
*/
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy) throws ims.domain.exceptions.StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if(!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("PatientAllergy is not validated");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:AvoinApotti    文件:AllergiesImpl.java   
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy, PatientNoAllergyInfoVo patientNoAllergyInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException, DomainInterfaceException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if (!patientNoAllergyInfo.isValidated())
        throw new CodingRuntimeException("PatientNoAllergyInfoVo has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if (patientNoAllergyInfo == null)
        throw new CodingRuntimeException("Cannot save null PatientNoAllergyInfoVo");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    if (!voPatientAllergy.getID_PatientAllergyIsNotNull())
    {
        //Check the PatientNoAllergyInfo
        String hqlQuery = "select p1_1.allergyStatus from PatientNoAllergyInfo as p1_1 where (p1_1.patient.id = :Patient_id and p1_1.isRIE is null )";
        List<?> list = factory.find(hqlQuery,"Patient_id",voPatientAllergy.getPatient().getID_Patient());
        //If there is no PatientNoAllergiesInfo record, or the record exists and the status is NOKNOWNALLERGIES
        if ((list == null || list.size() == 0) || (getDomLookup(PatientAllergyStatus.NOKNOWNALLERGIES).equals(list.get(0))))
        {

            savePatientNoAllergyInfo(patientNoAllergyInfo);
        }

    }

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:openMAXIMS    文件:AllergiesImpl.java   
/**
* saves a patient allergy
*/
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy) throws ims.domain.exceptions.StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if(!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("PatientAllergy is not validated");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:openMAXIMS    文件:AllergiesImpl.java   
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy, PatientNoAllergyInfoVo patientNoAllergyInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException, DomainInterfaceException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if (!patientNoAllergyInfo.isValidated())
        throw new CodingRuntimeException("PatientNoAllergyInfoVo has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if (patientNoAllergyInfo == null)
        throw new CodingRuntimeException("Cannot save null PatientNoAllergyInfoVo");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    if (!voPatientAllergy.getID_PatientAllergyIsNotNull())
    {
        //Check the PatientNoAllergyInfo
        String hqlQuery = "select p1_1.allergyStatus from PatientNoAllergyInfo as p1_1 where (p1_1.patient.id = :Patient_id and p1_1.isRIE is null )";
        List<?> list = factory.find(hqlQuery,"Patient_id",voPatientAllergy.getPatient().getID_Patient());
        //If there is no PatientNoAllergiesInfo record, or the record exists and the status is NOKNOWNALLERGIES
        if ((list == null || list.size() == 0) || (getDomLookup(PatientAllergyStatus.NOKNOWNALLERGIES).equals(list.get(0))))
        {

            savePatientNoAllergyInfo(patientNoAllergyInfo);
        }

    }

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:openMAXIMS    文件:AllergiesImpl.java   
/**
* saves a patient allergy
*/
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy) throws ims.domain.exceptions.StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if(!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("PatientAllergy is not validated");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:openMAXIMS    文件:AllergiesImpl.java   
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy, PatientNoAllergyInfoVo patientNoAllergyInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException, DomainInterfaceException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if (!patientNoAllergyInfo.isValidated())
        throw new CodingRuntimeException("PatientNoAllergyInfoVo has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if (patientNoAllergyInfo == null)
        throw new CodingRuntimeException("Cannot save null PatientNoAllergyInfoVo");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    if (!voPatientAllergy.getID_PatientAllergyIsNotNull())
    {
        //Check the PatientNoAllergyInfo
        String hqlQuery = "select p1_1.allergyStatus from PatientNoAllergyInfo as p1_1 where (p1_1.patient.id = :Patient_id and p1_1.isRIE is null )";
        List<?> list = factory.find(hqlQuery,"Patient_id",voPatientAllergy.getPatient().getID_Patient());
        //If there is no PatientNoAllergiesInfo record, or the record exists and the status is NOKNOWNALLERGIES
        if ((list == null || list.size() == 0) || (getDomLookup(PatientAllergyStatus.NOKNOWNALLERGIES).equals(list.get(0))))
        {

            savePatientNoAllergyInfo(patientNoAllergyInfo);
        }

    }

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:openmaxims-linux    文件:AllergiesImpl.java   
/**
* saves a patient allergy
*/
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy) throws ims.domain.exceptions.StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if(!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("PatientAllergy is not validated");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:openmaxims-linux    文件:AllergiesImpl.java   
public ims.core.vo.PatientAllergy savePatientAllergy(ims.core.vo.PatientAllergy voPatientAllergy, PatientNoAllergyInfoVo patientNoAllergyInfo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException, DomainInterfaceException
{
    if (!voPatientAllergy.isValidated())
        throw new CodingRuntimeException("Patient Allergy has not been validated");
    if (!patientNoAllergyInfo.isValidated())
        throw new CodingRuntimeException("PatientNoAllergyInfoVo has not been validated");
    if(voPatientAllergy == null)
        throw new CodingRuntimeException("Cannot save null PatientAllergyVo");
    if (patientNoAllergyInfo == null)
        throw new CodingRuntimeException("Cannot save null PatientNoAllergyInfoVo");

    DomainFactory factory = getDomainFactory();

    //Check the allergy and save it
    if(voPatientAllergy.getAllergenIsNotNull() && voPatientAllergy.getAllergen().getID_Allergen() == null)
    {
        voPatientAllergy.setAllergen(saveAllergy(voPatientAllergy.getAllergen()));
    }       
    PatientAllergy doPatientAllergy = PatientAllergyAssembler.extractPatientAllergy(factory, voPatientAllergy);

    if (!voPatientAllergy.getID_PatientAllergyIsNotNull())
    {
        //Check the PatientNoAllergyInfo
        String hqlQuery = "select p1_1.allergyStatus from PatientNoAllergyInfo as p1_1 where (p1_1.patient.id = :Patient_id and p1_1.isRIE is null )";
        List<?> list = factory.find(hqlQuery,"Patient_id",voPatientAllergy.getPatient().getID_Patient());
        //If there is no PatientNoAllergiesInfo record, or the record exists and the status is NOKNOWNALLERGIES
        if ((list == null || list.size() == 0) || (getDomLookup(PatientAllergyStatus.NOKNOWNALLERGIES).equals(list.get(0))))
        {

            savePatientNoAllergyInfo(patientNoAllergyInfo);
        }

    }

    factory.save(doPatientAllergy);

    //if the allergy has a PAS mapping of "ALLE" then insert an ALERT of this type.

    if (voPatientAllergy.getAllergenIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMapIsNotNull()
        && voPatientAllergy.getAllergen().getTaxonomyMap().size() > 0)
    {
        for ( int i = 0 ; i < voPatientAllergy.getAllergen().getTaxonomyMap().size() ; i++)
        {
            if (voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCodeIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyCode().equals("ALLE")
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyNameIsNotNull()
                && voPatientAllergy.getAllergen().getTaxonomyMap().get(i).getTaxonomyName().getText().equals("PAS"))
            {
                Alerts impl = (Alerts) getDomainImpl(ims.core.domain.impl.AlertsImpl.class);
                impl.saveHeartsAlert(voPatientAllergy.getPatient(), "ALLE", voPatientAllergy.getIsCurrentlyActiveAllergy());
            }
        }
    }

    return (PatientAllergyAssembler.create(doPatientAllergy));      
}
项目:AvoinApotti    文件:AllergiesImpl.java   
/**
 * Returns a single PatientAllergy based on a given PatientAllergy id Integer. 
 * 
 * @param Integer patientAllergyID
 * @return PatientAllergy
 * @author mmccarthy
 */
public ims.core.vo.PatientAllergy getpatientAllergy(Integer patientAllergyID)
{
    DomainFactory factory = getDomainFactory();
    return PatientAllergyAssembler.create((PatientAllergy)factory.getDomainObject((PatientAllergy.class), patientAllergyID.intValue()));
}
项目:openMAXIMS    文件:AllergiesImpl.java   
/**
 * Returns a single PatientAllergy based on a given PatientAllergy id Integer. 
 * 
 * @param Integer patientAllergyID
 * @return PatientAllergy
 * @author mmccarthy
 */
public ims.core.vo.PatientAllergy getpatientAllergy(Integer patientAllergyID)
{
    DomainFactory factory = getDomainFactory();
    return PatientAllergyAssembler.create((PatientAllergy)factory.getDomainObject((PatientAllergy.class), patientAllergyID.intValue()));
}
项目:openMAXIMS    文件:AllergiesImpl.java   
/**
 * Returns a single PatientAllergy based on a given PatientAllergy id Integer. 
 * 
 * @param Integer patientAllergyID
 * @return PatientAllergy
 * @author mmccarthy
 */
public ims.core.vo.PatientAllergy getpatientAllergy(Integer patientAllergyID)
{
    DomainFactory factory = getDomainFactory();
    return PatientAllergyAssembler.create((PatientAllergy)factory.getDomainObject((PatientAllergy.class), patientAllergyID.intValue()));
}
项目:openmaxims-linux    文件:AllergiesImpl.java   
/**
 * Returns a single PatientAllergy based on a given PatientAllergy id Integer. 
 * 
 * @param Integer patientAllergyID
 * @return PatientAllergy
 * @author mmccarthy
 */
public ims.core.vo.PatientAllergy getpatientAllergy(Integer patientAllergyID)
{
    DomainFactory factory = getDomainFactory();
    return PatientAllergyAssembler.create((PatientAllergy)factory.getDomainObject((PatientAllergy.class), patientAllergyID.intValue()));
}