Exemplo n.º 1
0
  private TriageProtocolAssessmentShortVo getPreviousProtocolAssessment(
      CareContextRefVo careContext,
      DateTime assessmentDateTime,
      TriageProtocolAssessmentRefVo currentTriageProtocol) {
    String query =
        "SELECT tp FROM TriageProtocolAssessment AS tp LEFT JOIN tp.attendance AS attend WHERE (tp.isRIE is null OR tp.isRIE = 0) AND tp.isMain = 1 AND tp.id <> :PROTOCOL_ID AND attend.id = :CONTEXT_ID AND tp.assessmentDateTime <= :PROT_DATETIME ORDER BY tp.assessmentDateTime DESC";

    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();
    paramNames.add("PROTOCOL_ID");
    paramValues.add(currentTriageProtocol.getID_TriageProtocolAssessment());
    paramNames.add("CONTEXT_ID");
    paramValues.add(careContext.getID_CareContext());
    paramNames.add("PROT_DATETIME");
    paramValues.add(assessmentDateTime.getJavaDate());

    return TriageProtocolAssessmentShortVoAssembler.create(
        (TriageProtocolAssessment) getDomainFactory().findFirst(query, paramNames, paramValues));
  }
Exemplo n.º 2
0
  public TriageProtocolAssessmentShortVoCollection listTriageProtocols(
      PatientRefVo patient, CareContextRefVo careContext) {
    if (patient == null || careContext == null)
      throw new CodingRuntimeException("Parameters patient and careContext are mandatory");

    String query =
        "SELECT tp FROM TriageProtocolAssessment AS tp LEFT JOIN tp.patient AS pat LEFT JOIN tp.attendance AS attend WHERE tp.isMain = 1 AND pat.id = :PAT_ID AND attend.id = :CONTEXT_ID ORDER BY tp.assessmentDateTime DESC";
    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    paramNames.add("PAT_ID");
    paramValues.add(patient.getID_Patient());

    paramNames.add("CONTEXT_ID");
    paramValues.add(careContext.getID_CareContext());

    return TriageProtocolAssessmentShortVoAssembler
        .createTriageProtocolAssessmentShortVoCollectionFromTriageProtocolAssessment(
            getDomainFactory().find(query, paramNames, paramValues));
  }