dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16568
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6328: (patient) Error when running Age formula in case aggregation.
------------------------------------------------------------
revno: 6328
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-03-21 16:19:26 +0700
message:
(patient) Error when running Age formula in case aggregation.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm
--
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 2012-03-16 07:50:14 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2012-03-21 09:19:26 +0000
@@ -210,7 +210,7 @@
Period period )
{
String sql = convertCondition( aggregationCondition, orgunit, period );
-
+
Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
if ( patientIds == null )
@@ -777,8 +777,11 @@
sql = "SELECT pi.patientid ";
}
- sql += "FROM patient as pi WHERE pi.organisationunitid = " + orgunitId + " " + "AND pi.registrationdate >= '"
- + startDate + "' AND pi.registrationdate <= '" + endDate + "' ";
+ sql += "FROM patient as pi INNER JOIN programinstance pgi ON pi.patientid = pgi.patientid "
+ + "INNER JOIN programstageinstance psi ON psi.programinstanceid = pgi.programinstanceid "
+ + "INNER JOIN patientattributevalue as pav ON pav.patientid = pi.patientid "
+ + "WHERE pi.organisationunitid = " + orgunitId + " " + "AND pi.registrationdate >= '" + startDate
+ + "' AND pi.registrationdate <= '" + endDate + "' ";
return sql;
}
@@ -793,12 +796,13 @@
sql = "SELECT pi.patientid ";
}
- sql += "FROM patient as pi WHERE ";
+ sql += "FROM patient as pi INNER JOIN programinstance pgi ON pi.patientid = pgi.patientid "
+ + "INNER JOIN programstageinstance psi ON psi.programinstanceid = pgi.programinstanceid WHERE ";
if ( propertyName.equals( PROPERTY_AGE ) )
{
- sql += "(( 12 * ( EXTRACT(YEAR FROM '" + startDate + "' ) - EXTRACT(YEAR FROM birthdate ) ) ) + "
- + "EXTRACT( MONTH FROM '" + startDate + "' ) - EXTRACT( MONTH FROM birthdate ) )" + " ";
+ sql += "(( 12 * ( EXTRACT(YEAR FROM DATE '" + startDate + "' ) - EXTRACT(YEAR FROM birthdate ) ) ) + "
+ + "EXTRACT( MONTH FROM DATE '" + startDate + "' ) - EXTRACT( MONTH FROM birthdate ) )" + " ";
}
else
{
@@ -842,7 +846,7 @@
String startDate, String endDate )
{
String select = "SELECT distinct(pi.patientid) ";
-
+
if ( operator.equals( AGGRERATION_SUM ) )
{
select = "SELECT psi.programstageinstanceid ";
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm 2012-03-21 05:48:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm 2012-03-21 09:19:26 +0000
@@ -137,7 +137,7 @@
<table>
<tr>
<td>
- <select id="caseProperty" name="caseProperty" size="8" ondblclick="insertSingleValue('caseProperty');" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
+ <select id="caseProperty" name="caseProperty" size="8" ondblclick="insertInfo(this);" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
<option value="[PT:count]" suggestedValues=''>$i18n.getString( "patients_registered" )</option>
<option value="[CP:gender]" suggestedValues='F, M' title='$i18n.getString( "gender" )'>$i18n.getString( "gender" )</option>
<option value="[CP:dobType]" suggestedValues='V, D, A' title='$i18n.getString( "dob_type" )'>$i18n.getString( "dob_type" )</option>
@@ -156,7 +156,7 @@
<td>
<fieldset style="border: 1px solid #3f5d8e; ">
<legend>$i18n.getString( "suggested_values" )</legend>
- <select multiple size="10" id='caSuggestedValues' style="width:20em; height: 17em" ondblclick="insertInfo(this);">
+ <select multiple size="10" id='caSuggestedValues' style="width:20em; height: 17em" ondblclick="insertSingleValue('caSuggestedValues');">
</select>
</fieldset>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2012-03-21 05:48:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2012-03-21 09:19:26 +0000
@@ -138,7 +138,7 @@
<table>
<tr>
<td>
- <select id="caseProperty" name="caseProperty" size="8" ondblclick="insertSingleValue('caseProperty');" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
+ <select id="caseProperty" name="caseProperty" size="8" ondblclick="insertInfo(this);" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
<option value="[PT:count]" suggestedValues=''>$i18n.getString( "patients_registered" )</option>
<option value="[CP:gender]" suggestedValues='F, M' title='$i18n.getString( "gender" )'>$i18n.getString( "gender" )</option>
<option value="[CP:dobType]" suggestedValues='V, D, A' title='$i18n.getString( "dob_type" )'>$i18n.getString( "dob_type" )</option>
@@ -157,7 +157,7 @@
<td>
<fieldset style="border: 1px solid #3f5d8e; ">
<legend>$i18n.getString( "suggested_values" )</legend>
- <select multiple size="10" id='caSuggestedValues' style="width:20em; height: 17em" ondblclick="insertInfo(this);">
+ <select multiple size="10" id='caSuggestedValues' style="width:20em; height: 17em" ondblclick="insertSingleValue('caSuggestedValues');" >
</select>
</fieldset>
</td>