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

项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
/**
* saveDiagnosisVo
*/
public PatientDiagnosisEDischargeListVo saveDiagnosisVo(PatientDiagnosisEDischargeListVo patientDiagnosisEDischargeListVo, SummaryRefVo summaryVo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException
{
    // Ensure the value object has been validated
    if (!patientDiagnosisEDischargeListVo.isValidated())
        throw new DomainRuntimeException("Diagnosis has not been validated");

    DomainFactory factory = getDomainFactory();
    @SuppressWarnings("rawtypes")
    HashMap map = new HashMap();
    PatientDiagnosis doPatDiag = PatientDiagnosisEDischargeListVoAssembler.extractPatientDiagnosis(factory, patientDiagnosisEDischargeListVo, map);

    factory.save(doPatDiag);

    if (summaryVo != null
        && patientDiagnosisEDischargeListVo.getIsComplicationIsNotNull()
        && patientDiagnosisEDischargeListVo.getIsComorbidityIsNotNull()
        && ! patientDiagnosisEDischargeListVo.getIsComplication()
        && ! patientDiagnosisEDischargeListVo.getIsComorbidity())
    {
        IEDischargeHelper impl = (IEDischargeHelper) getDomainImpl(EDischargeHelper.class); 
        impl.updateSummaryIfRequired(patientDiagnosisEDischargeListVo, summaryVo, factory);
    }

    return PatientDiagnosisEDischargeListVoAssembler.create(doPatDiag);//Create here to avoid possible StaleObj in PMH save
}
项目:AvoinApotti    文件:EDischargeDiagnosisEtcComponentImpl.java   
public PatientDiagnosisEDischargeListVoCollection listComorbidity(EpisodeOfCareRefVo episodeOfCareRefVo) 
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb) ");
        markers.add("notCommorb");
        values.add(new Boolean(true));

        condStr.append(andStr + " ( patdiag.isComplication = :complication or patdiag.isComplication is null) ");
        markers.add("complication");
        values.add(new Boolean(false));
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
public PatientDiagnosisEDischargeListVoCollection listComorbidity(EpisodeOfCareRefVo episodeOfCareRefVo) 
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb) ");
        markers.add("notCommorb");
        values.add(new Boolean(true));

        condStr.append(andStr + " ( patdiag.isComplication = :complication or patdiag.isComplication is null) ");
        markers.add("complication");
        values.add(new Boolean(false));
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
public PatientDiagnosisEDischargeListVoCollection listComorbidity(EpisodeOfCareRefVo episodeOfCareRefVo) 
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb) ");
        markers.add("notCommorb");
        values.add(new Boolean(true));

        condStr.append(andStr + " ( patdiag.isComplication = :complication or patdiag.isComplication is null) ");
        markers.add("complication");
        values.add(new Boolean(false));
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openmaxims-linux    文件:EDischargeDiagnosisEtcComponentImpl.java   
public PatientDiagnosisEDischargeListVoCollection listComorbidity(EpisodeOfCareRefVo episodeOfCareRefVo) 
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb) ");
        markers.add("notCommorb");
        values.add(new Boolean(true));

        condStr.append(andStr + " ( patdiag.isComplication = :complication or patdiag.isComplication is null) ");
        markers.add("complication");
        values.add(new Boolean(false));
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:AvoinApotti    文件:EDischargeDiagnosisEtcComponentImpl.java   
/**
* listDiagnosisComplicationsByPatient
 * @param careContextDate 
*/
private ims.core.vo.PatientDiagnosisEDischargeListVoCollection domListAll(ims.core.patient.vo.PatientRefVo voPatRef, ims.core.admin.vo.EpisodeOfCareRefVo episodeOfCareRefVo, boolean bComplication, boolean bComorbidity, Date careContextDate,String ignored)//WDEV-12105
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (voPatRef != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";   

        if (careContextDate != null)
        {
            condStr.append(andStr + " patdiag.careContext.episodeOfCare.startDate <= :ccStartDate");//WDEV-12042
            markers.add("ccStartDate");
            values.add(careContextDate.getDate());
        }
    }
    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb");
        if (!bComorbidity)
        {
            condStr.append(" or patdiag.isComorbidity is null");
        }
        condStr.append(" ) ");
        markers.add("notCommorb");
        values.add(bComorbidity);

        condStr.append(andStr + " ( patdiag.isComplication = :complication");
        if (!bComplication)
        {
            condStr.append(" or patdiag.isComplication is null");
        }
        condStr.append(" ) ");
        markers.add("complication");
        values.add(bComplication);
    }

    if (ignored!=null && ignored.length() > 0)//WDEV-12105
    {
        condStr.append(andStr+" patdiag.id not in ("+ignored+")");//WDEV-12105
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:AvoinApotti    文件:EDischargeDiagnosisComponentImpl.java   
/**
    * listDiagnosisComplicationsByPatient
    */
    public PatientDiagnosisEDischargeListVoCollection listDiagnosisComplicationsByPatient(PatientRefVo voPatRef, EpisodeOfCareRefVo episodeOfCareRefVo, Boolean bPrevious, Date ccStartDate, Boolean bCopied) 
    {
        DomainFactory factory = getDomainFactory();

        String hql = new String();
        hql = " select patdiag from PatientDiagnosis patdiag ";

        StringBuffer condStr = new StringBuffer();
        ArrayList markers = new ArrayList();
        ArrayList values = new ArrayList();
        String andStr = " ";

        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";           

        if (episodeOfCareRefVo != null) 
        {
//          if (bCopied)
//          {
//              hql += " left join patdiag.coMorbidityForEpisodeOfCares as eps ";
//              
//              condStr.append(andStr + " eps.careContext.id = :carecontextId");
//          }
//          else
                condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

            markers.add("epsId");
            values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
            andStr = " and ";           
        }

        if (!bPrevious)
        {
            condStr.append(andStr + " patdiag.isPrevRelevantDiagnosis = :prevRel");
            markers.add("prevRel");
            values.add(Boolean.FALSE);

            condStr.append(andStr + " patdiag.isComorbidity = :notCommorb");
            markers.add("notCommorb");
            values.add(Boolean.FALSE);
        }

        if (bPrevious)
        {
            condStr.append(andStr + " patdiag.isComplication = :complication");
            markers.add("complication");
            values.add(Boolean.FALSE);

            if (ccStartDate != null)
            {
                condStr.append(andStr + " patdiag.careContext.startDateTime <= :ccStartDate");
                markers.add("ccStartDate");
                values.add(new DateTime(ccStartDate, new Time("23:59:59")).getJavaDate());
//              values.add(new DateTime(new Date(ccStartDate).addDay(-1), new Time("23:59:59")).getJavaDate());
            }
        }

        hql += " where ";
        hql += condStr.toString();
        return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
    }
项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
/**
 * Lists previous diagnosis for patient
 * @param voPatRef
 * @param episodeOfCareRefVo
 * @param bComplication
 * @param bComorbidity
 * @param careContextDate
 * @param ignored
 * @return
 */
private PatientDiagnosisEDischargeListVoCollection domListAll(PatientRefVo voPatRef, EpisodeOfCareRefVo episodeOfCareRefVo, boolean bComplication, boolean bComorbidity, Date careContextDate, String ignored)//WDEV-12105
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (voPatRef != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";   

        if (careContextDate != null)
        {
            condStr.append(andStr + " patdiag.careContext.episodeOfCare.startDate <= :ccStartDate");//WDEV-12042
            markers.add("ccStartDate");
            values.add(careContextDate.getDate());
        }
    }

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr).append(" patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";

        condStr.append(andStr).append(" ( patdiag.isComplication = :complication");
        if (!bComplication)
        {
            condStr.append(" or patdiag.isComplication is null");
        }
        condStr.append(" ) ");
        markers.add("complication");
        values.add(bComplication);
    }

    condStr.append(andStr).append(" ( patdiag.isComorbidity = :notCommorb");
    if (!bComorbidity)
    {
        condStr.append(" or patdiag.isComorbidity is null");
    }
    condStr.append(" ) ");
    markers.add("notCommorb");
    values.add(bComorbidity);


    if (ignored!=null && ignored.length() > 0)//WDEV-12105
    {
        condStr.append(andStr+" patdiag.id not in (").append(ignored).append(")");//WDEV-12105
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
public PatientDiagnosisEDischargeListVoCollection listRelevantComorbidities(
        EpisodeOfCareRefVo episodeOfCareRefVo,
        CareContextRefVo careContextRefVo) 
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " SELECT pdiag FROM EpisodeOfCareCoMorbidity AS relevantDiag LEFT JOIN relevantDiag.diagnosis AS pdiag LEFT JOIN relevantDiag.careContext AS ccontext";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " ccontext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";

        condStr.append(andStr + " ( pdiag.isComorbidity = :notCommorb) ");
        markers.add("notCommorb");
        values.add(new Boolean(true));

        condStr.append(andStr + " ( pdiag.isComplication = :complication or pdiag.isComplication is null) ");
        markers.add("complication");
        values.add(new Boolean(false));
    }
    if (careContextRefVo != null)
    {           
        condStr.append(andStr + " ccontext.id = :ccId and relevantDiag.isActive = :inclD ");
        markers.add("ccId");
        values.add(careContextRefVo.getID_CareContext());
        markers.add("inclD");
        values.add(Boolean.TRUE);
        andStr = " and ";   
    }


    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
public PatientDiagnosisEDischargeListVoCollection listIncludedComorbidities(EpisodeOfCareRefVo episodeOfCareRefVo, CareContextRefVo careContextRefVo) 
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select pdiag from IncludeDiagnosisInDischargeReport as inclDiag left join inclDiag.diagnosis as pdiag left join inclDiag.careContext as ccontext";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " ccontext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";

        condStr.append(andStr + " ( pdiag.isComorbidity = :notCommorb) ");
        markers.add("notCommorb");
        values.add(new Boolean(true));

        condStr.append(andStr + " ( pdiag.isComplication = :complication or pdiag.isComplication is null) ");
        markers.add("complication");
        values.add(new Boolean(false));
    }
    if (careContextRefVo != null)
    {           
        condStr.append(andStr + " ccontext.id = :ccId and inclDiag.includeInReport = :inclD ");
        markers.add("ccId");
        values.add(careContextRefVo.getID_CareContext());
        markers.add("inclD");
        values.add(Boolean.TRUE);
        andStr = " and ";   
    }


    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openMAXIMS    文件:EDischargeDiagnosisComponentImpl.java   
/**
    * listDiagnosisComplicationsByPatient
    */
    public PatientDiagnosisEDischargeListVoCollection listDiagnosisComplicationsByPatient(PatientRefVo voPatRef, EpisodeOfCareRefVo episodeOfCareRefVo, Boolean bPrevious, Date ccStartDate, Boolean bCopied) 
    {
        DomainFactory factory = getDomainFactory();

        String hql = new String();
        hql = " select patdiag from PatientDiagnosis patdiag ";

        StringBuffer condStr = new StringBuffer();
        ArrayList markers = new ArrayList();
        ArrayList values = new ArrayList();
        String andStr = " ";

        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";           

        if (episodeOfCareRefVo != null) 
        {
//          if (bCopied)
//          {
//              hql += " left join patdiag.coMorbidityForEpisodeOfCares as eps ";
//              
//              condStr.append(andStr + " eps.careContext.id = :carecontextId");
//          }
//          else
                condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

            markers.add("epsId");
            values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
            andStr = " and ";           
        }

        if (!bPrevious)
        {
            condStr.append(andStr + " patdiag.isPrevRelevantDiagnosis = :prevRel");
            markers.add("prevRel");
            values.add(Boolean.FALSE);

            condStr.append(andStr + " patdiag.isComorbidity = :notCommorb");
            markers.add("notCommorb");
            values.add(Boolean.FALSE);
        }

        if (bPrevious)
        {
            condStr.append(andStr + " patdiag.isComplication = :complication");
            markers.add("complication");
            values.add(Boolean.FALSE);

            if (ccStartDate != null)
            {
                condStr.append(andStr + " patdiag.careContext.startDateTime <= :ccStartDate");
                markers.add("ccStartDate");
                values.add(new DateTime(ccStartDate, new Time("23:59:59")).getJavaDate());
//              values.add(new DateTime(new Date(ccStartDate).addDay(-1), new Time("23:59:59")).getJavaDate());
            }
        }

        hql += " where ";
        hql += condStr.toString();
        return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
    }
项目:openMAXIMS    文件:EDischargeDiagnosisEtcComponentImpl.java   
/**
* listDiagnosisComplicationsByPatient
 * @param careContextDate 
*/
private ims.core.vo.PatientDiagnosisEDischargeListVoCollection domListAll(ims.core.patient.vo.PatientRefVo voPatRef, ims.core.admin.vo.EpisodeOfCareRefVo episodeOfCareRefVo, boolean bComplication, boolean bComorbidity, Date careContextDate,String ignored)//WDEV-12105
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (voPatRef != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";   

        if (careContextDate != null)
        {
            condStr.append(andStr + " patdiag.careContext.episodeOfCare.startDate <= :ccStartDate");//WDEV-12042
            markers.add("ccStartDate");
            values.add(careContextDate.getDate());
        }
    }
    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb");
        if (!bComorbidity)
        {
            condStr.append(" or patdiag.isComorbidity is null");
        }
        condStr.append(" ) ");
        markers.add("notCommorb");
        values.add(bComorbidity);

        condStr.append(andStr + " ( patdiag.isComplication = :complication");
        if (!bComplication)
        {
            condStr.append(" or patdiag.isComplication is null");
        }
        condStr.append(" ) ");
        markers.add("complication");
        values.add(bComplication);
    }

    if (ignored!=null && ignored.length() > 0)//WDEV-12105
    {
        condStr.append(andStr+" patdiag.id not in ("+ignored+")");//WDEV-12105
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openMAXIMS    文件:EDischargeDiagnosisComponentImpl.java   
/**
    * listDiagnosisComplicationsByPatient
    */
    public PatientDiagnosisEDischargeListVoCollection listDiagnosisComplicationsByPatient(PatientRefVo voPatRef, EpisodeOfCareRefVo episodeOfCareRefVo, Boolean bPrevious, Date ccStartDate, Boolean bCopied) 
    {
        DomainFactory factory = getDomainFactory();

        String hql = new String();
        hql = " select patdiag from PatientDiagnosis patdiag ";

        StringBuffer condStr = new StringBuffer();
        ArrayList markers = new ArrayList();
        ArrayList values = new ArrayList();
        String andStr = " ";

        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";           

        if (episodeOfCareRefVo != null) 
        {
//          if (bCopied)
//          {
//              hql += " left join patdiag.coMorbidityForEpisodeOfCares as eps ";
//              
//              condStr.append(andStr + " eps.careContext.id = :carecontextId");
//          }
//          else
                condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

            markers.add("epsId");
            values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
            andStr = " and ";           
        }

        if (!bPrevious)
        {
            condStr.append(andStr + " patdiag.isPrevRelevantDiagnosis = :prevRel");
            markers.add("prevRel");
            values.add(Boolean.FALSE);

            condStr.append(andStr + " patdiag.isComorbidity = :notCommorb");
            markers.add("notCommorb");
            values.add(Boolean.FALSE);
        }

        if (bPrevious)
        {
            condStr.append(andStr + " patdiag.isComplication = :complication");
            markers.add("complication");
            values.add(Boolean.FALSE);

            if (ccStartDate != null)
            {
                condStr.append(andStr + " patdiag.careContext.startDateTime <= :ccStartDate");
                markers.add("ccStartDate");
                values.add(new DateTime(ccStartDate, new Time("23:59:59")).getJavaDate());
//              values.add(new DateTime(new Date(ccStartDate).addDay(-1), new Time("23:59:59")).getJavaDate());
            }
        }

        hql += " where ";
        hql += condStr.toString();
        return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
    }
项目:openmaxims-linux    文件:EDischargeDiagnosisEtcComponentImpl.java   
/**
* listDiagnosisComplicationsByPatient
 * @param careContextDate 
*/
private ims.core.vo.PatientDiagnosisEDischargeListVoCollection domListAll(ims.core.patient.vo.PatientRefVo voPatRef, ims.core.admin.vo.EpisodeOfCareRefVo episodeOfCareRefVo, boolean bComplication, boolean bComorbidity, Date careContextDate,String ignored)//WDEV-12105
{
    DomainFactory factory = getDomainFactory();

    String hql = new String();
    hql = " select patdiag from PatientDiagnosis patdiag ";

    StringBuffer condStr = new StringBuffer();
    ArrayList<String> markers = new ArrayList<String>();
    ArrayList<Object> values = new ArrayList<Object>();
    String andStr = " ";

    if (voPatRef != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";   

        if (careContextDate != null)
        {
            condStr.append(andStr + " patdiag.careContext.episodeOfCare.startDate <= :ccStartDate");//WDEV-12042
            markers.add("ccStartDate");
            values.add(careContextDate.getDate());
        }
    }
    if (episodeOfCareRefVo != null) 
    {
        condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

        markers.add("epsId");
        values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
        andStr = " and ";           

        condStr.append(andStr + " ( patdiag.isComorbidity = :notCommorb");
        if (!bComorbidity)
        {
            condStr.append(" or patdiag.isComorbidity is null");
        }
        condStr.append(" ) ");
        markers.add("notCommorb");
        values.add(bComorbidity);

        condStr.append(andStr + " ( patdiag.isComplication = :complication");
        if (!bComplication)
        {
            condStr.append(" or patdiag.isComplication is null");
        }
        condStr.append(" ) ");
        markers.add("complication");
        values.add(bComplication);
    }

    if (ignored!=null && ignored.length() > 0)//WDEV-12105
    {
        condStr.append(andStr+" patdiag.id not in ("+ignored+")");//WDEV-12105
    }

    hql += " where ";
    hql += condStr.toString();
    return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
}
项目:openmaxims-linux    文件:EDischargeDiagnosisComponentImpl.java   
/**
    * listDiagnosisComplicationsByPatient
    */
    public PatientDiagnosisEDischargeListVoCollection listDiagnosisComplicationsByPatient(PatientRefVo voPatRef, EpisodeOfCareRefVo episodeOfCareRefVo, Boolean bPrevious, Date ccStartDate, Boolean bCopied) 
    {
        DomainFactory factory = getDomainFactory();

        String hql = new String();
        hql = " select patdiag from PatientDiagnosis patdiag ";

        StringBuffer condStr = new StringBuffer();
        ArrayList markers = new ArrayList();
        ArrayList values = new ArrayList();
        String andStr = " ";

        condStr.append(andStr + " patdiag.careContext.episodeOfCare.careSpell.patient.id = :patientId");
        markers.add("patientId");
        values.add(voPatRef.getID_Patient());
        andStr = " and ";           

        if (episodeOfCareRefVo != null) 
        {
//          if (bCopied)
//          {
//              hql += " left join patdiag.coMorbidityForEpisodeOfCares as eps ";
//              
//              condStr.append(andStr + " eps.careContext.id = :carecontextId");
//          }
//          else
                condStr.append(andStr + " patdiag.careContext.episodeOfCare.id = :epsId");

            markers.add("epsId");
            values.add(episodeOfCareRefVo.getID_EpisodeOfCare());
            andStr = " and ";           
        }

        if (!bPrevious)
        {
            condStr.append(andStr + " patdiag.isPrevRelevantDiagnosis = :prevRel");
            markers.add("prevRel");
            values.add(Boolean.FALSE);

            condStr.append(andStr + " patdiag.isComorbidity = :notCommorb");
            markers.add("notCommorb");
            values.add(Boolean.FALSE);
        }

        if (bPrevious)
        {
            condStr.append(andStr + " patdiag.isComplication = :complication");
            markers.add("complication");
            values.add(Boolean.FALSE);

            if (ccStartDate != null)
            {
                condStr.append(andStr + " patdiag.careContext.startDateTime <= :ccStartDate");
                markers.add("ccStartDate");
                values.add(new DateTime(ccStartDate, new Time("23:59:59")).getJavaDate());
//              values.add(new DateTime(new Date(ccStartDate).addDay(-1), new Time("23:59:59")).getJavaDate());
            }
        }

        hql += " where ";
        hql += condStr.toString();
        return PatientDiagnosisEDischargeListVoAssembler.createPatientDiagnosisEDischargeListVoCollectionFromPatientDiagnosis(factory.find(hql,markers,values)).sort();     
    }