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

项目:AvoinApotti    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo saveMedicationOnAdmission(PatientMedicationVo medicationOnAdmissionItem) throws StaleObjectException
{
    if (!medicationOnAdmissionItem.isValidated())
    {
        throw new DomainRuntimeException("PatientMedication ValueObject has not been validated");
    }

    DomainFactory factory = getDomainFactory();

    PatientMedication doPatientMedication = PatientMedicationVoAssembler.extractPatientMedication(factory, medicationOnAdmissionItem);
    factory.save(doPatientMedication);
    return (PatientMedicationVoAssembler.create(doPatientMedication));
}
项目:AvoinApotti    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:AvoinApotti    文件:MedicationOnAdmissionImpl.java   
/**
 * Lists Medication
 */
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo, Boolean isDiscontinued) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }
    if (isDiscontinued != null)
    {
        hql.append(andStr + " t.isDiscontinued = :IsDiscontinued");
        markers.add("IsDiscontinued");
        values.add(isDiscontinued);
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:AvoinApotti    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo getPatientMedication(PatientMedicationRefVo patientMedicationId) 
{
    if(patientMedicationId == null || !patientMedicationId.getID_PatientMedicationIsNotNull())
        throw new CodingRuntimeException("Can not get PatientMedication on null Id.");

    return PatientMedicationVoAssembler.create((PatientMedication) getDomainFactory().getDomainObject(PatientMedication.class, patientMedicationId.getID_PatientMedication()));
}
项目:AvoinApotti    文件:MedicationDosesImpl.java   
public PatientMedicationVoCollection listMedications(MedicationOverviewRefVo medOverview) {
    if (medOverview==null)
    {
        throw new DomainRuntimeException("Invalid Medication Overview");
    }
    String hql = "from PatientMedication as p1_1 where (p1_1.id in (select p1_1.id  from MedicationOverview as m1_1 left join m1_1.medication as p1_1  where   (m1_1.id = :MedicationOverview_id)))";
    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hql, new String[]{"MedicationOverview_id"}, new Object[]{medOverview.getID_MedicationOverview()}));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo saveMedicationOnAdmission(PatientMedicationVo medicationOnAdmissionItem) throws StaleObjectException
{
    if (!medicationOnAdmissionItem.isValidated())
    {
        throw new DomainRuntimeException("PatientMedication ValueObject has not been validated");
    }

    DomainFactory factory = getDomainFactory();

    PatientMedication doPatientMedication = PatientMedicationVoAssembler.extractPatientMedication(factory, medicationOnAdmissionItem);
    factory.save(doPatientMedication);
    return (PatientMedicationVoAssembler.create(doPatientMedication));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
/**
 * Lists Medication
 */
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo, Boolean isDiscontinued) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }
    if (isDiscontinued != null)
    {
        hql.append(andStr + " t.isDiscontinued = :IsDiscontinued");
        markers.add("IsDiscontinued");
        values.add(isDiscontinued);
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo getPatientMedication(PatientMedicationRefVo patientMedicationId) 
{
    if(patientMedicationId == null || !patientMedicationId.getID_PatientMedicationIsNotNull())
        throw new CodingRuntimeException("Can not get PatientMedication on null Id.");

    return PatientMedicationVoAssembler.create((PatientMedication) getDomainFactory().getDomainObject(PatientMedication.class, patientMedicationId.getID_PatientMedication()));
}
项目:openMAXIMS    文件:PatientMedicationMultipleDosesImpl.java   
public PatientMedicationVoCollection listMedications(MedicationOverviewRefVo medOverview) {
    if (medOverview==null)
    {
        throw new DomainRuntimeException("Invalid Medication Overview");
    }
    String hql = "from PatientMedication as p1_1 where (p1_1.id in (select p1_1.id  from MedicationOverview as m1_1 left join m1_1.medication as p1_1  where   (m1_1.id = :MedicationOverview_id)))";
    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hql, new String[]{"MedicationOverview_id"}, new Object[]{medOverview.getID_MedicationOverview()}));
}
项目:openMAXIMS    文件:MedicationDosesImpl.java   
public PatientMedicationVoCollection listMedications(MedicationOverviewRefVo medOverview) {
    if (medOverview==null)
    {
        throw new DomainRuntimeException("Invalid Medication Overview");
    }
    String hql = "from PatientMedication as p1_1 where (p1_1.id in (select p1_1.id  from MedicationOverview as m1_1 left join m1_1.medication as p1_1  where   (m1_1.id = :MedicationOverview_id)))";
    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hql, new String[]{"MedicationOverview_id"}, new Object[]{medOverview.getID_MedicationOverview()}));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo saveMedicationOnAdmission(PatientMedicationVo medicationOnAdmissionItem) throws StaleObjectException
{
    if (!medicationOnAdmissionItem.isValidated())
    {
        throw new DomainRuntimeException("PatientMedication ValueObject has not been validated");
    }

    DomainFactory factory = getDomainFactory();

    PatientMedication doPatientMedication = PatientMedicationVoAssembler.extractPatientMedication(factory, medicationOnAdmissionItem);
    factory.save(doPatientMedication);
    return (PatientMedicationVoAssembler.create(doPatientMedication));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
/**
 * Lists Medication
 */
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo, Boolean isDiscontinued) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }
    if (isDiscontinued != null)
    {
        hql.append(andStr + " t.isDiscontinued = :IsDiscontinued");
        markers.add("IsDiscontinued");
        values.add(isDiscontinued);
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:openMAXIMS    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo getPatientMedication(PatientMedicationRefVo patientMedicationId) 
{
    if(patientMedicationId == null || !patientMedicationId.getID_PatientMedicationIsNotNull())
        throw new CodingRuntimeException("Can not get PatientMedication on null Id.");

    return PatientMedicationVoAssembler.create((PatientMedication) getDomainFactory().getDomainObject(PatientMedication.class, patientMedicationId.getID_PatientMedication()));
}
项目:openMAXIMS    文件:MedicationDosesImpl.java   
public PatientMedicationVoCollection listMedications(MedicationOverviewRefVo medOverview) {
    if (medOverview==null)
    {
        throw new DomainRuntimeException("Invalid Medication Overview");
    }
    String hql = "from PatientMedication as p1_1 where (p1_1.id in (select p1_1.id  from MedicationOverview as m1_1 left join m1_1.medication as p1_1  where   (m1_1.id = :MedicationOverview_id)))";
    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hql, new String[]{"MedicationOverview_id"}, new Object[]{medOverview.getID_MedicationOverview()}));
}
项目:openmaxims-linux    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo saveMedicationOnAdmission(PatientMedicationVo medicationOnAdmissionItem) throws StaleObjectException
{
    if (!medicationOnAdmissionItem.isValidated())
    {
        throw new DomainRuntimeException("PatientMedication ValueObject has not been validated");
    }

    DomainFactory factory = getDomainFactory();

    PatientMedication doPatientMedication = PatientMedicationVoAssembler.extractPatientMedication(factory, medicationOnAdmissionItem);
    factory.save(doPatientMedication);
    return (PatientMedicationVoAssembler.create(doPatientMedication));
}
项目:openmaxims-linux    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:openmaxims-linux    文件:MedicationOnAdmissionImpl.java   
/**
 * Lists Medication
 */
public PatientMedicationVoCollection listMedicationOnAdmission(ClinicalContactShortVo clinicalContactShortVo, CareContextRefVo careContextRefVo, Boolean isDiscontinued) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from PatientMedication t ";
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (clinicalContactShortVo != null)
    {
        hql.append(andStr + " t.clinicalContact.id = :Id");
        markers.add("Id");
        values.add(clinicalContactShortVo.getID_ClinicalContact());
        andStr = " and ";
    }
    if (careContextRefVo != null)
    {
        hql.append(andStr + " t.careContext.id = :IdCX");
        markers.add("IdCX");
        values.add(careContextRefVo.getID_CareContext());
        andStr = " and ";
    }
    if (isDiscontinued != null)
    {
        hql.append(andStr + " t.isDiscontinued = :IsDiscontinued");
        markers.add("IsDiscontinued");
        values.add(isDiscontinued);
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(factory.find(query, markers, values));
}
项目:openmaxims-linux    文件:MedicationOnAdmissionImpl.java   
public PatientMedicationVo getPatientMedication(PatientMedicationRefVo patientMedicationId) 
{
    if(patientMedicationId == null || !patientMedicationId.getID_PatientMedicationIsNotNull())
        throw new CodingRuntimeException("Can not get PatientMedication on null Id.");

    return PatientMedicationVoAssembler.create((PatientMedication) getDomainFactory().getDomainObject(PatientMedication.class, patientMedicationId.getID_PatientMedication()));
}
项目:openmaxims-linux    文件:MedicationDosesImpl.java   
public PatientMedicationVoCollection listMedications(MedicationOverviewRefVo medOverview) {
    if (medOverview==null)
    {
        throw new DomainRuntimeException("Invalid Medication Overview");
    }
    String hql = "from PatientMedication as p1_1 where (p1_1.id in (select p1_1.id  from MedicationOverview as m1_1 left join m1_1.medication as p1_1  where   (m1_1.id = :MedicationOverview_id)))";
    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hql, new String[]{"MedicationOverview_id"}, new Object[]{medOverview.getID_MedicationOverview()}));
}
项目:AvoinApotti    文件:CopyLastMedicationImpl.java   
public PatientMedicationVoCollection listMedications(PatientRefVo patientRef, DateTime startDateTime)
{
    // Check patient
    if (patientRef == null || !patientRef.getID_PatientIsNotNull())
        return null;

    // Get last care context (of type INPATIET)
    StringBuilder ccQuery = new StringBuilder();
    ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)");

    ArrayList<String> paramCCNames = new ArrayList<String>();
    ArrayList<Object> paramCCValues = new ArrayList<Object>();

    paramCCNames.add("PAT_ID");
    paramCCNames.add("CC_TYPE");
    paramCCValues.add(patientRef.getID_Patient());
    paramCCValues.add(ContextType.INPATIENT.getID());

    if (startDateTime != null)
    {
        ccQuery.append(" and cc.startDateTime <= :DATE");
        paramCCNames.add("DATE");
        paramCCValues.add(startDateTime.getJavaDate());
    }

    ccQuery.append(" order by cc.startDateTime desc");

    CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues));

    if (careContext == null || !careContext.getID_CareContextIsNotNull())
        return null;

    String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID and (pmed.isDiscontinued is null or pmed.isDiscontinued is false)";
    ArrayList<String> paramPMedNames = new ArrayList<String>();
    ArrayList<Object> paramPMedValues = new ArrayList<Object>();

    paramPMedNames.add("PAT_ID");
    paramPMedNames.add("CC_ID");
    paramPMedValues.add(patientRef.getID_Patient());
    paramPMedValues.add(careContext.getID_CareContext());

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues));
}
项目:AvoinApotti    文件:CopyMedicationImpl.java   
public ims.core.vo.PatientMedicationVoCollection listPatientMedication(ims.core.vo.PatientShort patient, ims.core.vo.ClinicalContactShortVo contact)
{
    String hqlQuery = "from PatientMedication patMed where patMed.patient.id = " + patient.getID_Patient();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery));
}
项目:openMAXIMS    文件:CopyLastMedicationImpl.java   
public PatientMedicationVoCollection listMedications(PatientRefVo patientRef, DateTime startDateTime)
{
    // Check patient
    if (patientRef == null || !patientRef.getID_PatientIsNotNull())
        return null;

    // Get last care context (of type INPATIET)
    StringBuilder ccQuery = new StringBuilder();
    ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)");

    ArrayList<String> paramCCNames = new ArrayList<String>();
    ArrayList<Object> paramCCValues = new ArrayList<Object>();

    paramCCNames.add("PAT_ID");
    paramCCNames.add("CC_TYPE");
    paramCCValues.add(patientRef.getID_Patient());
    paramCCValues.add(ContextType.INPATIENT.getID());

    if (startDateTime != null)
    {
        ccQuery.append(" and cc.startDateTime <= :DATE");
        paramCCNames.add("DATE");
        paramCCValues.add(startDateTime.getJavaDate());
    }

    ccQuery.append(" order by cc.startDateTime desc");

    CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues));

    if (careContext == null || !careContext.getID_CareContextIsNotNull())
        return null;

    String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID and (pmed.isDiscontinued is null or pmed.isDiscontinued is false)";
    ArrayList<String> paramPMedNames = new ArrayList<String>();
    ArrayList<Object> paramPMedValues = new ArrayList<Object>();

    paramPMedNames.add("PAT_ID");
    paramPMedNames.add("CC_ID");
    paramPMedValues.add(patientRef.getID_Patient());
    paramPMedValues.add(careContext.getID_CareContext());

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues));
}
项目:openMAXIMS    文件:CopyMedicationImpl.java   
public ims.core.vo.PatientMedicationVoCollection listPatientMedication(ims.core.vo.PatientShort patient, ims.core.vo.ClinicalContactShortVo contact)
{
    String hqlQuery = "from PatientMedication patMed where patMed.patient.id = " + patient.getID_Patient();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery));
}
项目:openMAXIMS    文件:CopyLastMedicationImpl.java   
public PatientMedicationVoCollection listMedications(PatientRefVo patientRef, DateTime startDateTime)
{
    // Check patient
    if (patientRef == null || !patientRef.getID_PatientIsNotNull())
        return null;

    // Get last care context (of type INPATIET)
    StringBuilder ccQuery = new StringBuilder();
    ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)");

    ArrayList<String> paramCCNames = new ArrayList<String>();
    ArrayList<Object> paramCCValues = new ArrayList<Object>();

    paramCCNames.add("PAT_ID");
    paramCCNames.add("CC_TYPE");
    paramCCValues.add(patientRef.getID_Patient());
    paramCCValues.add(ContextType.INPATIENT.getID());

    if (startDateTime != null)
    {
        ccQuery.append(" and cc.startDateTime <= :DATE");
        paramCCNames.add("DATE");
        paramCCValues.add(startDateTime.getJavaDate());
    }

    ccQuery.append(" order by cc.startDateTime desc");

    CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues));

    if (careContext == null || !careContext.getID_CareContextIsNotNull())
        return null;

    String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID and (pmed.isDiscontinued is null or pmed.isDiscontinued is false)";
    ArrayList<String> paramPMedNames = new ArrayList<String>();
    ArrayList<Object> paramPMedValues = new ArrayList<Object>();

    paramPMedNames.add("PAT_ID");
    paramPMedNames.add("CC_ID");
    paramPMedValues.add(patientRef.getID_Patient());
    paramPMedValues.add(careContext.getID_CareContext());

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues));
}
项目:openMAXIMS    文件:CopyMedicationImpl.java   
public ims.core.vo.PatientMedicationVoCollection listPatientMedication(ims.core.vo.PatientShort patient, ims.core.vo.ClinicalContactShortVo contact)
{
    String hqlQuery = "from PatientMedication patMed where patMed.patient.id = " + patient.getID_Patient();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery));
}
项目:openmaxims-linux    文件:CopyLastMedicationImpl.java   
public PatientMedicationVoCollection listMedications(PatientRefVo patientRef, DateTime startDateTime)
{
    // Check patient
    if (patientRef == null || !patientRef.getID_PatientIsNotNull())
        return null;

    // Get last care context (of type INPATIET)
    StringBuilder ccQuery = new StringBuilder();
    ccQuery.append("select cc from PatientMedication as pmed join pmed.careContext as cc where pmed.patient.id = :PAT_ID and cc.context.id = :CC_TYPE and (pmed.isRIE is null or pmed.isRIE = 0) and (pmed.isDiscontinued is null or pmed.isDiscontinued = 0)");

    ArrayList<String> paramCCNames = new ArrayList<String>();
    ArrayList<Object> paramCCValues = new ArrayList<Object>();

    paramCCNames.add("PAT_ID");
    paramCCNames.add("CC_TYPE");
    paramCCValues.add(patientRef.getID_Patient());
    paramCCValues.add(ContextType.INPATIENT.getID());

    if (startDateTime != null)
    {
        ccQuery.append(" and cc.startDateTime <= :DATE");
        paramCCNames.add("DATE");
        paramCCValues.add(startDateTime.getJavaDate());
    }

    ccQuery.append(" order by cc.startDateTime desc");

    CareContextLiteVo careContext = CareContextLiteVoAssembler.create((CareContext) getDomainFactory().findFirst(ccQuery.toString(), paramCCNames, paramCCValues));

    if (careContext == null || !careContext.getID_CareContextIsNotNull())
        return null;

    String hqlQuery = "select pmed from PatientMedication as pmed where pmed.patient.id = :PAT_ID and pmed.careContext.id = :CC_ID and (pmed.isDiscontinued is null or pmed.isDiscontinued is false)";
    ArrayList<String> paramPMedNames = new ArrayList<String>();
    ArrayList<Object> paramPMedValues = new ArrayList<Object>();

    paramPMedNames.add("PAT_ID");
    paramPMedNames.add("CC_ID");
    paramPMedValues.add(patientRef.getID_Patient());
    paramPMedValues.add(careContext.getID_CareContext());

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery, paramPMedNames, paramPMedValues));
}
项目:openmaxims-linux    文件:CopyMedicationImpl.java   
public ims.core.vo.PatientMedicationVoCollection listPatientMedication(ims.core.vo.PatientShort patient, ims.core.vo.ClinicalContactShortVo contact)
{
    String hqlQuery = "from PatientMedication patMed where patMed.patient.id = " + patient.getID_Patient();

    return PatientMedicationVoAssembler.createPatientMedicationVoCollectionFromPatientMedication(getDomainFactory().find(hqlQuery));
}