/** * */ public RadiologyResultListVoCollection listClinicalImaging(PatientRefVo patient, Date fromDate, Date toDate) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("Patient parameter can not be null when listing pathology results"); StringBuilder query = new StringBuilder(); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); query.append("SELECT orderInv FROM OrderInvestigation AS orderInv "); query.append(" LEFT JOIN FETCH orderInv.orderDetails AS details LEFT JOIN details.patient AS patient "); query.append("WHERE patient.id = :PATIENT_ID "); paramNames.add("PATIENT_ID"); paramValues.add(patient.getID_Patient()); query.append("AND orderInv.investigation.investigationIndex.category.id = :CATEGORY "); paramNames.add("CATEGORY"); paramValues.add(Category.CLINICALIMAGING.getID()); if (fromDate != null && toDate != null) { query.append(" AND orderInv.displayDateTime BETWEEN :FROM_DATE AND :END_DATE "); paramNames.add("FROM_DATE"); paramValues.add(new DateTime(fromDate, new Time(0, 0, 0)).getJavaDate()); paramNames.add("END_DATE"); paramValues.add(new DateTime(toDate, new Time(23, 59, 59)).getJavaDate()); } else if (fromDate == null && toDate != null) { query.append(" AND orderInv.displayDateTime <= :END_DATE "); paramNames.add("END_DATE"); paramValues.add(new DateTime(toDate, new Time(23, 59, 59)).getJavaDate()); } else if (fromDate != null && toDate == null) { query.append(" AND orderInv.dislayDateTime >= :FROM_DATE "); paramNames.add("FROM_DATE"); paramValues.add(new DateTime(fromDate, new Time(23,59, 59)).getJavaDate()); } query.append(" ORDER BY orderInv.displayDateTime DESC, orderInv.ordInvSeq ASC, orderInv.systemInformation.creationDateTime, orderInv.systemInformation.creationUser"); return RadiologyResultListVoAssembler.createRadiologyResultListVoCollectionFromOrderInvestigation(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
/** * */ public RadiologyResultListVoCollection listClinicalImaging(PatientRefVo patient, Date fromDate, Date toDate) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("Patient parameter can not be null when listing pathology results"); StringBuilder query = new StringBuilder(); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); query.append("SELECT orderInv FROM OrderInvestigation AS orderInv "); query.append(" LEFT JOIN FETCH orderInv.orderDetails AS details LEFT JOIN details.patient AS patient "); query.append("WHERE patient.id = :PATIENT_ID "); paramNames.add("PATIENT_ID"); paramValues.add(patient.getID_Patient()); query.append("AND orderInv.investigation.investigationIndex.category.id = :CATEGORY "); paramNames.add("CATEGORY"); paramValues.add(Category.CLINICALIMAGING.getID()); if (fromDate != null && toDate != null) { query.append(" AND orderInv.systemInformation.creationDateTime BETWEEN :FROM_DATE AND :END_DATE "); paramNames.add("FROM_DATE"); paramValues.add(new DateTime(fromDate, new Time(0, 0, 0)).getJavaDate()); paramNames.add("END_DATE"); paramValues.add(new DateTime(toDate, new Time(23, 59, 59)).getJavaDate()); } else if (fromDate == null && toDate != null) { query.append(" AND orderInv.systemInformation.creationDateTime <= :END_DATE "); paramNames.add("END_DATE"); paramValues.add(new DateTime(toDate, new Time(23, 59, 59)).getJavaDate()); } else if (fromDate != null && toDate == null) { query.append(" AND orderInv.systemInformation.creationDateTime >= :FROM_DATE "); paramNames.add("FROM_DATE"); paramValues.add(new DateTime(fromDate, new Time(23,59, 59)).getJavaDate()); } query.append(" ORDER BY orderInv.displayDateTime DESC, orderInv.ordInvSeq ASC, orderInv.systemInformation.creationDateTime, orderInv.systemInformation.creationUser"); return RadiologyResultListVoAssembler.createRadiologyResultListVoCollectionFromOrderInvestigation(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
public RadiologyResultListVoCollection listClinicalImaging(PatientRefVo patient, Date fromDate, Date toDate, ServiceLiteVoCollection selectedDisciplines) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("Patient parameter can not be null when listing pathology results"); StringBuilder query = new StringBuilder(); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); query.append("SELECT orderInv FROM OrderInvestigation AS orderInv "); query.append(" LEFT JOIN FETCH orderInv.orderDetails AS details LEFT JOIN details.patient AS patient "); query.append("WHERE patient.id = :PATIENT_ID "); paramNames.add("PATIENT_ID"); paramValues.add(patient.getID_Patient()); query.append("AND orderInv.investigation.investigationIndex.category.id = :CATEGORY "); paramNames.add("CATEGORY"); paramValues.add(Category.CLINICALIMAGING.getID()); if (fromDate != null && toDate != null) { query.append(" AND orderInv.displayDateTime BETWEEN :FROM_DATE AND :END_DATE "); paramNames.add("FROM_DATE"); paramValues.add(new DateTime(fromDate, new Time(0, 0, 0)).getJavaDate()); paramNames.add("END_DATE"); paramValues.add(new DateTime(toDate, new Time(23, 59, 59)).getJavaDate()); } else if (fromDate == null && toDate != null) { query.append(" AND orderInv.displayDateTime <= :END_DATE "); paramNames.add("END_DATE"); paramValues.add(new DateTime(toDate, new Time(23, 59, 59)).getJavaDate()); } else if (fromDate != null && toDate == null) { query.append(" AND orderInv.displayDateTime >= :FROM_DATE "); paramNames.add("FROM_DATE"); paramValues.add(new DateTime(fromDate, new Time(23,59, 59)).getJavaDate()); } if (selectedDisciplines != null && selectedDisciplines.size() > 0) { String disciplineList = getDisciplineList(selectedDisciplines); query.append(" AND orderInv.investigation.providerService.locationService.service.id in (" + disciplineList + ") "); } query.append(" ORDER BY orderInv.displayDateTime DESC, orderInv.ordInvSeq ASC, orderInv.systemInformation.creationDateTime, orderInv.systemInformation.creationUser"); return RadiologyResultListVoAssembler.createRadiologyResultListVoCollectionFromOrderInvestigation(getDomainFactory().find(query.toString(), paramNames, paramValues)); }