dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15054
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5282: Replace dollar sign by jQuery in commons.js and js files into patient module; fix bug for agg-que...
------------------------------------------------------------
revno: 5282
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-12-05 11:29:29 +0700
message:
Replace dollar sign by jQuery in commons.js and js files into patient module; fix bug for agg-query builder.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2011-11-07 07:56:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2011-12-05 04:29:29 +0000
@@ -584,13 +584,13 @@
else if ( info[0].equalsIgnoreCase( OBJECT_PATIENT_PROPERTY ) )
{
String propertyName = info[1];
- condition = getConditionForPatientProperty( propertyName, operator, orgunitId, startDate, endDate );
+ condition = getConditionForPatientProperty( propertyName, operator, startDate, endDate );
}
else if ( info[0].equalsIgnoreCase( OBJECT_PATIENT_ATTRIBUTE ) )
{
int attributeId = Integer.parseInt( info[1] );
- condition = getConditionForPatientAttribute( attributeId, operator, orgunitId, startDate, endDate );
+ condition = getConditionForPatientAttribute( attributeId, operator );
}
else if ( info[0].equalsIgnoreCase( OBJECT_PROGRAM_STAGE_DATAELEMENT ) )
{
@@ -720,23 +720,18 @@
+ "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' ";
}
- private String getConditionForPatientAttribute( int attributeId, String operator, int orgunitId, String startDate,
- String endDate )
+ private String getConditionForPatientAttribute( int attributeId, String operator )
{
String sql = "SELECT distinct(pi.patientid) ";
if ( operator.equals( AGGRERATION_SUM ) )
{
- sql = "SELECT pi.patientid ";
+ sql = "SELECT p.patientid ";
}
- return sql + "FROM programstageinstance as psi "
- + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
- + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
- + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
+ return sql + "FROM patient as pi "
+ "INNER JOIN patientattributevalue as pav ON pav.patientid = pi.patientid "
- + "WHERE pav.patientattributeid = " + attributeId + " " + " AND pd.organisationunitid = " + orgunitId + " "
- + " AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
+ + "WHERE pav.patientattributeid = " + attributeId + " "
+ "AND pav.value ";
}
@@ -755,23 +750,16 @@
return sql;
}
- private String getConditionForPatientProperty( String propertyName, String operator, int orgunitId,
+ private String getConditionForPatientProperty( String propertyName, String operator,
String startDate, String endDate )
{
- String sql = "SELECT distinct(p.patientid) ";
+ String sql = "SELECT distinct(pi.patientid) FROM patient as pi ";
if ( operator.equals( AGGRERATION_SUM ) )
{
- sql = "SELECT p.patientid ";
+ sql = "SELECT pi.patientid ";
}
- sql += "FROM programstageinstance as psi INNER JOIN programstage as ps "
- + "ON psi.programstageid = ps.programstageid INNER JOIN patientdatavalue as pd ON "
- + "psi.programstageinstanceid = pd.programstageinstanceid INNER JOIN programinstance as pi ON "
- + "psi.programinstanceid = pi.programinstanceid INNER JOIN patient as p ON "
- + "p.patientid = pi.patientid WHERE pd.organisationunitid = " + orgunitId + " "
- + "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate;
-
if ( propertyName.equals( PROPERTY_AGE ) )
{
sql += "' AND (( 12 * ( EXTRACT(YEAR FROM '" + startDate + "' ) - EXTRACT(YEAR FROM birthdate ) ) ) + "
@@ -787,34 +775,34 @@
private String getConditionForProgramProperty( int orgunitId, String operator, String startDate, String endDate )
{
- String sql = "SELECT distinct(p.patientid) ";
+ String sql = "SELECT distinct(pi.patientid) ";
if ( operator.equals( AGGRERATION_SUM ) )
{
- sql = "SELECT p.patientid ";
+ sql = "SELECT pi.patientid ";
}
return sql + "FROM programstageinstance as psi "
- + "INNER JOIN programinstance as pi ON psi.programinstanceid = pi.programinstanceid "
- + "INNER JOIN patient as p ON p.patientid = pi.patientid WHERE p.organisationunitid = " + orgunitId + " "
+ + "INNER JOIN programinstance as pgi ON psi.programinstanceid = pgi.programinstanceid "
+ + "INNER JOIN patient as pi ON pi.patientid = pgi.patientid WHERE pi.organisationunitid = " + orgunitId + " "
+ "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' AND ";
}
private String getConditionForProgram( String programId, String operator, int orgunitId, String startDate,
String endDate )
{
- String sql = "SELECT distinct(p.patientid) ";
+ String sql = "SELECT distinct(pi.patientid) ";
if ( operator.equals( AGGRERATION_SUM ) )
{
- sql = "SELECT p.patientid ";
+ sql = "SELECT pi.patientid ";
}
return sql + "FROM programstageinstance as psi "
- + "INNER JOIN programinstance as pi ON psi.programinstanceid = pi.programinstanceid "
- + "INNER JOIN patient as p ON p.patientid = pi.patientid " + "WHERE pi.programid=" + programId + " "
- + "AND p.organisationunitid = " + orgunitId + " " + "AND pi.enrollmentdate >= '" + startDate
- + "' AND pi.enrollmentdate <= '" + endDate + "' ";
+ + "INNER JOIN programinstance as pgi ON psi.programinstanceid = pgi.programinstanceid "
+ + "INNER JOIN patient as pi ON pi.patientid = pgi.patientid " + "WHERE pgi.programid=" + programId + " "
+ + "AND pi.organisationunitid = " + orgunitId + " " + "AND pgi.enrollmentdate >= '" + startDate
+ + "' AND pgi.enrollmentdate <= '" + endDate + "' ";
}
private String getSQL( List<String> conditions, List<String> operators )