Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,10 @@ public String buildQuery(PanelType panel, String pdoType)
// String mainQuerySql = "SELECT a.* " + mainSelectBlobClause + " FROM "
// + this.getDbSchemaName() + "observation_FACT obs ,( \n";

String mainQuerySql = "SELECT a.* " + mainSelectBlobClause + " FROM "
+ this.getDbSchemaName() + getFactTable() + " obs ,( \n";
String mainQuerySql = obsFactFactRelated.isSelectBlob() ?
"SELECT a.* " + mainSelectBlobClause + " FROM " + this.getDbSchemaName() + getFactTable() + " obs ,( \n"

: "( \n";

try {
if (panel != null) {
Expand Down Expand Up @@ -720,10 +722,17 @@ public String buildQuery(PanelType panel, String pdoType)
throw new I2B2DAOException(i2b2Ex.getMessage(), i2b2Ex);
}

mainQuerySql += " ) a ";

mainQuerySql += " where obs.encounter_num = a.obs_encounter_num and obs.patient_num = a.obs_patient_num ";
mainQuerySql += " and obs.concept_cd = a.obs_concept_cd and obs.provider_id = a.obs_provider_id and obs.start_date = a.obs_start_date and obs.modifier_cd = a.obs_modifier_cd and obs.instance_num = a.obs_instance_num ";
mainQuerySql += obsFactFactRelated.isSelectBlob() ?
" ) a "
+ " where obs.encounter_num = a.obs_encounter_num "
+ " and obs.patient_num = a.obs_patient_num "
+ " and obs.concept_cd = a.obs_concept_cd "
+ " and obs.provider_id = a.obs_provider_id "
+ " and obs.start_date = a.obs_start_date "
+ " and obs.modifier_cd = a.obs_modifier_cd "
+ " and obs.instance_num = a.obs_instance_num "

: " ) ";

if (panel != null) {
TotalItemOccurrences totOccurance = panel.getTotalItemOccurrences();
Expand Down