dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20907
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9759: Add SUM operator for case-aggregation query builder.
------------------------------------------------------------
revno: 9759
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-07 15:12:12 +0700
message:
Add SUM operator for case-aggregation query builder.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java
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/resources/org/hisp/dhis/caseaggregation/hibernate/CaseAggregationCondition.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
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/caseAggregation.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.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-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java 2012-12-21 09:23:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java 2013-02-07 08:12:12 +0000
@@ -48,6 +48,8 @@
public static final String AGGRERATION_COUNT = "COUNT";
public static final String AGGRERATION_SUM = "SUM";
+
+ public static final String AGGRERATION_SUM_VALUE = "SUM_VALUE";
public static final String OPERATOR_AND = "AND";
@@ -85,6 +87,8 @@
private DataElement aggregationDataElement;
private DataElementCategoryOptionCombo optionCombo;
+
+ private DataElement deSum;
// -------------------------------------------------------------------------
// Constructors
@@ -105,6 +109,18 @@
this.optionCombo = optionCombo;
}
+
+ public CaseAggregationCondition( String name, String operator, String aggregationExpression, DataElement aggregationDataElement,
+ DataElementCategoryOptionCombo optionCombo, DataElement deSum )
+ {
+ this.name = name;
+ this.operator = operator;
+ this.aggregationExpression = aggregationExpression;
+ this.aggregationDataElement = aggregationDataElement;
+ this.optionCombo = optionCombo;
+ this.deSum = deSum;
+ }
+
// -------------------------------------------------------------------------
// Logical
// -------------------------------------------------------------------------
@@ -194,4 +210,14 @@
{
this.aggregationExpression = aggregationExpression;
}
+
+ public DataElement getDeSum()
+ {
+ return deSum;
+ }
+
+ public void setDeSum( DataElement deSum )
+ {
+ this.deSum = deSum;
+ }
}
=== 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 2013-01-28 06:35:55 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2013-02-07 08:12:12 +0000
@@ -29,6 +29,7 @@
import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.AGGRERATION_COUNT;
import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.AGGRERATION_SUM;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.AGGRERATION_SUM_VALUE;
import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT;
import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE;
import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT_PROGRAM_STAGE_PROPERTY;
@@ -226,15 +227,31 @@
Period period )
{
String sql = convertCondition( aggregationCondition, orgunit, period );
+ String operator = aggregationCondition.getOperator();
+
+ if ( operator.equals( CaseAggregationCondition.AGGRERATION_COUNT )
+ || operator.equals( CaseAggregationCondition.AGGRERATION_SUM ) )
+ {
+ Collection<Integer> ids = aggregationConditionStore.executeSQL( sql );
+ return (ids == null) ? null : ids.size();
+ }
+
+ String sumSql = "SELECT sum( cast( pdv.value as DOUBLE PRECISION ) ) ";
+ sumSql += "FROM patientdatavalue pdv ";
+ sumSql += " INNER JOIN programstageinstance psi ";
+ sumSql += " ON psi.programstageinstanceid = pdv.programstageinstanceid ";
+ sumSql += "WHERE executiondate >= '" + DateUtils.getMediumDateString( period.getStartDate() ) + "' ";
+ sumSql += " AND executiondate>='" + DateUtils.getMediumDateString( period.getStartDate() )
+ + "' AND pdv.dataelementid=" + aggregationCondition.getDeSum().getId();
+
+ if ( !sql.trim().isEmpty() )
+ {
+ sql = sumSql + " AND pdv.programstageinstanceid in ( " + sql + " ) ";
+ }
- Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
-
- if ( patientIds == null )
- {
- return null;
- }
-
- return calValue( patientIds, aggregationCondition.getOperator() );
+ Collection<Integer> ids = aggregationConditionStore.executeSQL( sql );
+
+ return (ids == null) ? null : ids.iterator().next();
}
@Override
@@ -328,7 +345,7 @@
{
String match = matcher.group();
match = match.replaceAll( "[\\[\\]]", "" );
-
+
String[] info = match.split( SEPARATOR_OBJECT );
if ( info[0].equalsIgnoreCase( OBJECT_PROGRAM_STAGE_DATAELEMENT ) )
@@ -388,8 +405,8 @@
return INVALID_CONDITION;
}
- matcher.appendReplacement( description, "[" + OBJECT_PROGRAM + SEPARATOR_OBJECT + program.getDisplayName()
- + "]" );
+ matcher.appendReplacement( description,
+ "[" + OBJECT_PROGRAM + SEPARATOR_OBJECT + program.getDisplayName() + "]" );
}
else if ( info[0].equalsIgnoreCase( OBJECT_PROGRAM_STAGE ) )
{
@@ -785,7 +802,7 @@
from = "FROM programstageinstance as psi "
+ "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid ";
}
-
+
sql += from + " WHERE pd.dataelementid=" + dataElementId + " AND psi.organisationunitid=" + orgunitId
+ " AND psi.executionDate>='" + startDate + "' AND psi.executionDate <= '" + endDate + "'";
@@ -820,7 +837,7 @@
String where = "WHERE pi.organisationunitid=" + orgunitId + " AND pi.registrationdate>= '" + startDate + "' "
+ "AND pi.registrationdate <= '" + endDate + "'";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM ) || operator.equals( AGGRERATION_SUM_VALUE ) )
{
sql = "SELECT psi.programstageinstanceid ";
from = "FROM programstageinstance psi inner join programinstance pi "
@@ -863,13 +880,13 @@
String sql = "SELECT distinct(pi.patientid) ";
String from = "FROM programinstance pi INNER JOIN programstageinstance psi "
+ "ON psi.programinstanceid=pi.programinstanceid ";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM ) || operator.equals( AGGRERATION_SUM_VALUE ) )
{
sql = "SELECT psi.programstageinstance ";
from = "FROM programstageinstance psi ";
}
-
- from += "inner join patient p on p.patientid=pi.patientid ";
+
+ from += "inner join patient p on p.patientid=pi.patientid ";
sql += from + "WHERE executionDate>='" + startDate + "' and executionDate<='" + endDate + "' and "
+ propertyName;
@@ -881,7 +898,7 @@
{
String sql = "SELECT pi.patientid FROM programinstance as pi ";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM ) || operator.equals( AGGRERATION_SUM_VALUE ) )
{
sql = "SELECT psi.programstageinstanceid FROM programinstance as pi "
+ "INNER JOIN programstageinstance psi ON psi.programinstanceid=pi.programinstanceid ";
@@ -895,9 +912,9 @@
String endDate )
{
String sql = "SELECT distinct(pi.patientid) FROM programinstance as pi "
- + "inner join patient psi on psi.patientid=pi.patientid ";
+ + "inner join patient psi on psi.patientid=pi.patientid ";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM )|| operator.equals( AGGRERATION_SUM_VALUE ) )
{
sql = "SELECT psi.programstageinstanceid FROM programinstance as pi "
+ "INNER JOIN programstageinstance psi ON pi.programinstanceid=psi.programinstanceid ";
@@ -912,7 +929,7 @@
{
String select = "SELECT distinct(pi.patientid) ";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM ) || operator.equals( AGGRERATION_SUM_VALUE ) )
{
select = "SELECT psi.programstageinstanceid ";
}
@@ -928,7 +945,7 @@
{
String select = "SELECT distinct(pi.patientid) ";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM ) || operator.equals( AGGRERATION_SUM_VALUE ) )
{
select = "SELECT psi.programstageinstanceid ";
}
@@ -955,7 +972,7 @@
{
String select = "SELECT distinct(pi.patientid) ";
- if ( operator.equals( AGGRERATION_SUM ) )
+ if ( operator.equals( AGGRERATION_SUM ) || operator.equals( AGGRERATION_SUM_VALUE ) )
{
select = "SELECT psi.programstageinstanceid ";
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/caseaggregation/hibernate/CaseAggregationCondition.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/caseaggregation/hibernate/CaseAggregationCondition.hbm.xml 2012-06-04 04:06:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/caseaggregation/hibernate/CaseAggregationCondition.hbm.xml 2013-02-07 08:12:12 +0000
@@ -23,6 +23,10 @@
<many-to-one name="optionCombo" class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="optionComboid"
foreign-key="fk_caseaggregationcondition_categoryoptioncomboid" />
+
+ <many-to-one name="deSum" class="org.hisp.dhis.dataelement.DataElement" column="deSum"
+ foreign-key="fk_caseaggregationcondition_deSum" />
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java 2012-06-04 04:06:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java 2013-02-07 08:12:12 +0000
@@ -66,6 +66,8 @@
private String aggregationDataElementId;
+ private Integer deSumId;
+
// -------------------------------------------------------------------------
// Getters && Setters
// -------------------------------------------------------------------------
@@ -100,6 +102,11 @@
this.aggregationCondition = aggregationCondition;
}
+ public void setDeSumId( Integer deSumId )
+ {
+ this.deSumId = deSumId;
+ }
+
public void setName( String name )
{
this.name = name;
@@ -123,6 +130,11 @@
CaseAggregationCondition condition = new CaseAggregationCondition( name, operator, aggregationCondition,
aggregationDataElement, optionCombo );
+ if ( deSumId != null )
+ {
+ DataElement deSum = dataElementService.getDataElement( deSumId );
+ condition.setDeSum( deSum );
+ }
aggregationConditionService.addCaseAggregationCondition( condition );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java 2013-01-24 06:03:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/TestCaseAggregationConditionAction.java 2013-02-07 08:12:12 +0000
@@ -101,7 +101,7 @@
public String execute()
throws Exception
{
- CaseAggregationCondition aggCondition = new CaseAggregationCondition( "", AGGRERATION_COUNT, condition, null,
+ CaseAggregationCondition aggCondition = new CaseAggregationCondition( "", operator, condition, null,
null );
Collection<Program> programs = aggregationConditionService.getProgramsInCondition( condition );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java 2012-06-04 04:06:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java 2013-02-07 08:12:12 +0000
@@ -68,6 +68,8 @@
private String aggregationDataElementId;
+ private Integer deSumId;
+
// -------------------------------------------------------------------------
// Getters && Setters
// -------------------------------------------------------------------------
@@ -107,6 +109,11 @@
this.aggregationCondition = aggregationCondition;
}
+ public void setDeSumId( Integer deSumId )
+ {
+ this.deSumId = deSumId;
+ }
+
public void setName( String name )
{
this.name = name;
@@ -133,7 +140,12 @@
expression.setName( name );
expression.setAggregationDataElement( aggregationDataElement );
expression.setOptionCombo( optionCombo );
-
+ if ( deSumId != null )
+ {
+ DataElement deSum = dataElementService.getDataElement( deSumId );
+ expression.setDeSum( deSum );
+ }
+
aggregationConditionService.updateCaseAggregationCondition( expression );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-05 14:51:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-07 08:12:12 +0000
@@ -345,4 +345,6 @@
identifier_types = Identifier types
attributes = Attributes
left_side_expression = Left side expression
-right_side_expression = Right side expression:
\ No newline at end of file
+right_side_expression = Right side expression
+sum_dataelement_value = Sum values of data element
+data_element_for_summary = Data element for summary
\ No newline at end of file
=== 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 2013-02-03 10:13:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm 2013-02-07 08:12:12 +0000
@@ -33,7 +33,7 @@
<select id="dataSets" name="dataSets" onChange="getDataElementsByDataset();">
<option value="">[$i18n.getString('please_select')]</option>
#foreach( $dataSet in $dataSets)
- <option value="$dataSet.id" #if( $dataSetId=="$dataSet.id") selected #end>$dataSet.displayNamew</option>
+ <option value="$dataSet.id" #if( $dataSetId=="$dataSet.id") selected #end>$dataSet.displayName</option>
#end
</select>
</td>
@@ -51,8 +51,9 @@
<tr>
<td><label for="operator">$i18n.getString( "operator" )</label></td>
<td>
- <input type="radio" id="operator" name="operator" value="COUNT" checked >$i18n.getString('number_of_patients')
- <input type="radio" id="operator" name="operator" value="SUM"> $i18n.getString('number_of_visits')
+ <input type="radio" id="operator" name="operator" value="COUNT" checked onchange='operatorOnchange(this.value)'>$i18n.getString('number_of_patients')<br>
+ <input type="radio" id="operator" name="operator" value="SUM" onchange='operatorOnchange(this.value)'> $i18n.getString('number_of_visits')<br>
+ <input type="radio" id="operator" name="operator" value="SUM_VALUE" onchange='operatorOnchange(this.value)'> $i18n.getString('sum_dataelement_value')
</td>
</tr>
@@ -80,6 +81,15 @@
</tr>
<tr>
+ <td>
+ <label for="deSumId">$i18n.getString( "data_element_for_summary" ) <em title="$i18n.getString( "required" )" class="required">*</em></label>
+ </td>
+ <td>
+ <select id="deSumId" name="deSumId" disabled class="{validate:{required:true}}"></select>
+ </td>
+ </tr>
+
+ <tr>
<td colspan="2"><p></p></td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregation.vm 2013-02-03 10:13:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregation.vm 2013-02-07 08:12:12 +0000
@@ -52,6 +52,7 @@
<p><label class="bold">$i18n.getString( "operator" ):</label><br><span id="operatorField"></span></p>
<p><label class="bold">$i18n.getString( "aggregation_data_element" ):</label><br><span id="aggregationDataElementField"></span></p>
<p><label class="bold">$i18n.getString( "option_combo" ):</label><br><span id="optionComboField"></span></p>
+ <p><label class="bold">$i18n.getString( "data_element_for_summary" ):</label><br><span id="deSumField"></span></p>
<p><label class="bold">$i18n.getString( "aggregation_expression" ):</label><br><span id="aggregationExpressionField"></span></p>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-01-24 06:03:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-02-07 08:12:12 +0000
@@ -181,6 +181,7 @@
function getPatientDataElements()
{
clearListById( 'dataElements' );
+ clearListById( 'deSumId' );
var programStageId = getFieldValue('programStageId');
jQuery.getJSON( 'getPatientDataElements.action',
@@ -197,9 +198,14 @@
disable('programStageProperty');
}
var dataElements = jQuery('#dataElements');
+ var deSumId = jQuery('#deSumId');
for ( i in json.dataElements )
{
dataElements.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
+ if( json.dataElements[i].type=='int')
+ {
+ deSumId.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
+ }
}
});
@@ -265,7 +271,7 @@
setInnerHTML( 'aggregationDataElementField', json.caseAggregation.aggregationDataElement );
setInnerHTML( 'optionComboField', json.caseAggregation.optionCombo );
setInnerHTML( 'aggregationExpressionField', json.caseAggregation.aggregationExpression );
-
+ setInnerHTML( 'deSumField', json.caseAggregation.deSum );
showDetails();
});
}
@@ -387,3 +393,13 @@
{
window.location.href='showAddCaseAggregationForm.action?dataSetId=' + getFieldValue( 'dataSetId' );
}
+
+function operatorOnchange(operator)
+{
+ if(operator=='SUM_VALUE'){
+ enable('deSumId');
+ }
+ else{
+ disable('deSumId');
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm 2012-06-04 04:06:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonPatientDataElements.vm 2013-02-07 08:12:12 +0000
@@ -4,6 +4,7 @@
{
"id": "${dataElement.id}",
"name": "$!encoder.jsonEncode( ${dataElement.name} )",
+ "type": "${dataElement.type}",
"optionset":
#if( $!dataElement.optionSet )
"$encoder.xmlEncode($!dataElement.optionSet.options.toString())"
=== 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 2013-02-03 10:13:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2013-02-07 08:12:12 +0000
@@ -49,8 +49,9 @@
<tr>
<td><label for="operator">$i18n.getString( "operator" )</label></td>
<td>
- <input type="radio" id="operator" name="operator" value="COUNT" #if($caseAggregation.operator=="COUNT") checked #end > $i18n.getString('number_of_patients')
- <input type="radio" id="operator" name="operator" value="SUM" #if($caseAggregation.operator=="SUM") checked #end > $i18n.getString('number_of_visits')
+ <input type="radio" id="operator" name="operator" value="COUNT" onchange='operatorOnchange(this.value)' #if($caseAggregation.operator=="COUNT") checked #end > $i18n.getString('number_of_patients')<br>
+ <input type="radio" id="operator" name="operator" value="SUM" onchange='operatorOnchange(this.value)' #if($caseAggregation.operator=="SUM") checked #end > $i18n.getString('number_of_visits')<br>
+ <input type="radio" id="operator" name="operator" value="SUM_VALUE" onchange='operatorOnchange(this.value)' #if($caseAggregation.operator=="SUM_VALUE") checked #end > $i18n.getString('sum_dataelement_value')
</td>
</tr>
<tr>
@@ -77,6 +78,19 @@
</tr>
<tr>
+ <td>
+ <label for="deSumId">$i18n.getString( "data_element_for_summary" ) <em title="$i18n.getString( "required" )" class="required">*</em></label>
+ </td>
+ <td>
+ <select id="deSumId" name="deSumId" class="{validate:{required:true}}" #if( $caseAggregation.deSum ) #else disabled #end>
+ #if( $caseAggregation.deSum )
+ <option value='$caseAggregation.deSum.id'>$caseAggregation.deSum.displayName</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
<td colspan="2"><p></p></td>
</tr>