dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22084
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10594: Add a new function for defining program iIndicators.
------------------------------------------------------------
revno: 10594
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-04-17 14:58:14 +0700
message:
Add a new function for defining program iIndicators.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramIndicatorComparator.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramIndicatorStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addCaseAggregation.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregation.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramIndicator.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/AddProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/RemoveProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/UpdateProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/ValidateProgramIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramIndicator.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/program_indicator.png
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicatorForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramIndicator.vm
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionManager.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/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
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/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.program;
+
+import org.hisp.dhis.common.BaseNameableObject;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ProgramIndicator.java Apr 16, 2013 1:00:15 PM $
+ */
+public class ProgramIndicator
+ extends BaseNameableObject
+{
+ private static final long serialVersionUID = 7920320128945484331L;
+
+ public static final String VALUE_TYPE_DATE = "date";
+
+ public static final String VALUE_TYPE_INT = "int";
+
+ public static final String INCIDENT_DATE = "incident_date";
+
+ public static final String ENROLLEMENT_DATE = "enrollment_date";
+
+ public static final String CURRENT_DATE = "current_date";
+
+ private String valueType;
+
+ private String expression;
+
+ private String rootDate;
+
+ private Program program;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public ProgramIndicator()
+ {
+
+ }
+
+ public ProgramIndicator( String name, String description, String valueType, String expression )
+ {
+ this.name = name;
+ this.description = description;
+ this.valueType = valueType;
+ this.expression = expression;
+ }
+
+ // -------------------------------------------------------------------------
+ // Logical
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ return true;
+ if ( !super.equals( obj ) )
+ return false;
+ if ( getClass() != obj.getClass() )
+ return false;
+ ProgramIndicator other = (ProgramIndicator) obj;
+ if ( name == null )
+ {
+ if ( other.name != null )
+ return false;
+ }
+ else if ( !name.equals( other.name ) )
+ return false;
+ return true;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------
+
+ public String getValueType()
+ {
+ return valueType;
+ }
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ public String getExpression()
+ {
+ return expression;
+ }
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
+ public String getRootDate()
+ {
+ return rootDate;
+ }
+
+ public void setRootDate( String rootDate )
+ {
+ this.rootDate = rootDate;
+ }
+
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ public void setProgram( Program program )
+ {
+ this.program = program;
+ }
+
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorService.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.program;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ProgramIndicatorService.java Apr 16, 2013 1:11:07 PM $
+ */
+public interface ProgramIndicatorService
+{
+ int addProgramIndicator( ProgramIndicator programIndicator );
+
+ void updateProgramIndicator( ProgramIndicator programIndicator );
+
+ void deleteProgramIndicator( ProgramIndicator programIndicator );
+
+ ProgramIndicator getProgramIndicator( int id );
+
+ ProgramIndicator getProgramIndicator( String name );
+
+ ProgramIndicator getProgramIndicatorByShortName( String shortName );
+
+ ProgramIndicator getProgramIndicatorByUid( String uid );
+
+ Collection<ProgramIndicator> getAllProgramIndicators();
+
+ Collection<ProgramIndicator> getProgramIndicators( Program program );
+
+ String getProgramIndicatorValue( ProgramInstance programInstance, ProgramIndicator programIndicator );
+
+ Map<String, String> getProgramIndicatorValues( ProgramInstance programInstance );
+
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicatorStore.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.program;
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.GenericNameableObjectStore;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ProgramIndicatorStore.java Apr 16, 2013 1:15:12 PM $
+ */
+public interface ProgramIndicatorStore
+ extends GenericNameableObjectStore<ProgramIndicator>
+{
+ Collection<ProgramIndicator> getByProgram( Program program );
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramIndicatorComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramIndicatorComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/comparator/ProgramIndicatorComparator.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.program.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.program.ProgramIndicator;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ProgramIndicatorComparator.java Apr 16, 2013 3:47:30 PM $
+ */
+public class ProgramIndicatorComparator
+ implements Comparator<ProgramIndicator>
+{
+ public int compare( ProgramIndicator programIndicator0, ProgramIndicator programIndicator1 )
+ {
+ return programIndicator0.getDisplayName().compareTo( programIndicator1.getDisplayName() );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionManager.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionManager.java 2013-04-05 04:23:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionManager.java 2013-04-17 07:58:14 +0000
@@ -58,7 +58,6 @@
* @param operator There are six operators, includes Number of persons,
* Number of visits, Sum, Average, Minimum and Maximum of data
* element values.
- * @param deType Aggregate Data element type
* @param deSumId The id of aggregate data element which used for aggregate
* data values for operator Sum, Average, Minimum and Maximum of data
* element values. This fill is null for other operators.
@@ -66,7 +65,7 @@
* value
* @param period The date range for aggregate data value
*/
- Double getAggregateValue( String caseExpression, String operator, String deType, Integer deSumId,
+ Double getAggregateValue( String caseExpression, String operator, Integer deSumId,
Integer orgunitId, Period period );
/**
@@ -76,7 +75,6 @@
* @param operator There are six operators, includes Number of persons,
* Number of visits, Sum, Average, Minimum and Maximum of data
* element values.
- * @param deType Aggregate Data element type
* @param deSumId The id of aggregate data element which used for aggregate
* data values for operator Sum, Average, Minimum and Maximum of data
* element values. This fill is null for other operators.
@@ -85,7 +83,7 @@
* @param startDate Start date
* @param endDate End date
*/
- String parseExpressionToSql( String aggregationExpression, String operator, String deType, Integer deSumId,
+ String parseExpressionToSql( String aggregationExpression, String operator, Integer deSumId,
Integer orgunitId, String startDate, String endDate );
}
=== 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-04-03 15:46:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2013-04-17 07:58:14 +0000
@@ -222,12 +222,11 @@
public Double getAggregateValue( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit,
Period period )
{
- DataElement aggDataElement = aggregationCondition.getAggregationDataElement();
DataElement deSum = aggregationCondition.getDeSum();
Integer deSumId = (deSum == null) ? null : deSum.getId();
return aggregationConditionManager.getAggregateValue( aggregationCondition.getAggregationExpression(),
- aggregationCondition.getOperator(), aggDataElement.getType(), deSumId, orgunit.getId(), period );
+ aggregationCondition.getOperator(), deSumId, orgunit.getId(), period );
}
@Override
@@ -239,14 +238,13 @@
int orgunitId = orgunit.getId();
String startDate = DateUtils.getMediumDateString( period.getStartDate() );
String endDate = DateUtils.getMediumDateString( period.getEndDate() );
- DataElement aggDataElement = aggregationCondition.getAggregationDataElement();
DataElement deSum = aggregationCondition.getDeSum();
Integer deSumId = (deSum == null) ? null : deSum.getId();
Collection<PatientDataValue> result = new HashSet<PatientDataValue>();
String sql = aggregationConditionManager.parseExpressionToSql( aggregationCondition.getAggregationExpression(),
- aggregationCondition.getOperator(), aggDataElement.getType(), deSumId, orgunitId, startDate, endDate );
+ aggregationCondition.getOperator(), deSumId, orgunitId, startDate, endDate );
Collection<DataElement> dataElements = getDataElementsInCondition( aggregationCondition
.getAggregationExpression() );
@@ -272,14 +270,12 @@
public Collection<Patient> getPatients( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit,
Period period )
{
- DataElement aggDataElement = aggregationCondition.getAggregationDataElement();
DataElement deSum = aggregationCondition.getDeSum();
Integer deSumId = (deSum == null) ? null : deSum.getId();
String sql = aggregationConditionManager
.parseExpressionToSql( aggregationCondition.getAggregationExpression(), aggregationCondition.getOperator(),
- aggDataElement.getType(), deSumId, orgunit.getId(),
- DateUtils.getMediumDateString( period.getStartDate() ),
+ deSumId, orgunit.getId(), DateUtils.getMediumDateString( period.getStartDate() ),
DateUtils.getMediumDateString( period.getEndDate() ) );
Collection<Patient> result = new HashSet<Patient>();
@@ -316,12 +312,11 @@
// get params
- DataElement aggDataElement = aggregationCondition.getAggregationDataElement();
DataElement deSum = aggregationCondition.getDeSum();
Integer deSumId = (deSum == null) ? null : deSum.getId();
sql = aggregationConditionManager.parseExpressionToSql( aggregationCondition.getAggregationExpression(),
- aggregationCondition.getOperator(), aggDataElement.getType(), deSumId, orgunitId, startDate, endDate );
+ aggregationCondition.getOperator(), deSumId, orgunitId, startDate, endDate );
}
else
{
@@ -340,14 +335,12 @@
// Get params
- DataElement aggDataElement = aggregationCondition.getAggregationDataElement();
DataElement deSum = aggregationCondition.getDeSum();
Integer deSumId = (deSum == null) ? null : deSum.getId();
String conditionSql = aggregationConditionManager.parseExpressionToSql(
- aggregationCondition.getAggregationExpression(), aggregationCondition.getOperator(),
- aggDataElement.getType(), deSumId, orgunit.getId(),
- DateUtils.getMediumDateString( period.getStartDate() ),
+ aggregationCondition.getAggregationExpression(), aggregationCondition.getOperator(), deSumId,
+ orgunit.getId(), DateUtils.getMediumDateString( period.getStartDate() ),
DateUtils.getMediumDateString( period.getEndDate() ) );
sql += conditionSql + " ) ";
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java 2013-04-15 17:06:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java 2013-04-17 07:58:14 +0000
@@ -62,6 +62,7 @@
import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
import org.hisp.dhis.caseaggregation.CaseAggregationConditionManager;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.jdbc.StatementBuilder;
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
@@ -117,6 +118,13 @@
this.statementBuilder = statementBuilder;
}
+ public DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
// -------------------------------------------------------------------------
// Implementation Methods
// -------------------------------------------------------------------------
@@ -164,8 +172,8 @@
return null;
}
- public Double getAggregateValue( String caseExpression, String operator, String deType, Integer deSumId,
- Integer orgunitId, Period period )
+ public Double getAggregateValue( String caseExpression, String operator, Integer deSumId, Integer orgunitId,
+ Period period )
{
String startDate = DateUtils.getMediumDateString( period.getStartDate() );
String endDate = DateUtils.getMediumDateString( period.getEndDate() );
@@ -173,7 +181,7 @@
if ( operator.equals( CaseAggregationCondition.AGGRERATION_COUNT )
|| operator.equals( CaseAggregationCondition.AGGRERATION_SUM ) )
{
- String sql = parseExpressionToSql( caseExpression, operator, deType, deSumId, orgunitId, startDate, endDate );
+ String sql = parseExpressionToSql( caseExpression, operator, deSumId, orgunitId, startDate, endDate );
Collection<Integer> ids = this.executeSQL( sql );
return (ids == null) ? null : ids.size() + 0.0;
}
@@ -189,15 +197,14 @@
if ( caseExpression != null && !caseExpression.isEmpty() )
{
sql = sql + " AND pdv.programstageinstanceid in ( "
- + parseExpressionToSql( caseExpression, operator, deType, deSumId, orgunitId, startDate, endDate )
- + " ) ";
+ + parseExpressionToSql( caseExpression, operator, deSumId, orgunitId, startDate, endDate ) + " ) ";
}
Collection<Integer> ids = this.executeSQL( sql );
return (ids == null) ? null : ids.iterator().next() + 0.0;
}
- public String parseExpressionToSql( String aggregationExpression, String operator, String deType, Integer deSumId,
+ public String parseExpressionToSql( String aggregationExpression, String operator, Integer deSumId,
Integer orgunitId, String startDate, String endDate )
{
// Get operators between ( )
@@ -219,7 +226,7 @@
// Create SQL statement for the first condition
String condition = conditions[0].replace( "(", "" ).replace( ")", "" );
- String sql = createSQL( condition, operator, deType, orgunitId, startDate, endDate );
+ String sql = createSQL( condition, operator, orgunitId, startDate, endDate );
subSQL.add( sql );
@@ -228,13 +235,14 @@
{
condition = conditions[index].replace( "(", "" ).replace( ")", "" );
- sql = "(" + createSQL( condition, operator, deType, orgunitId, startDate, endDate ) + ")";
+ sql = "(" + createSQL( condition, operator, orgunitId, startDate, endDate ) + ")";
subSQL.add( sql );
}
sql = getSQL( operator, subSQL, operators ).replace( IN_CONDITION_START_SIGN, "(" ).replaceAll(
IN_CONDITION_END_SIGN, ")" );
+
return sql;
}
@@ -249,7 +257,7 @@
*/
private void runAggregate( Collection<Integer> orgunitIds, CaseAggregateSchedule dataSet, Collection<Period> periods )
{
- String sql = "select caseaggregationconditionid, aggregationdataelementid, optioncomboid, de.valuetype as deType, "
+ String sql = "select caseaggregationconditionid, aggregationdataelementid, optioncomboid, "
+ " cagg.aggregationexpression as caseexpression, cagg.\"operator\" as caseoperator, cagg.desum as desumid "
+ " from caseaggregationcondition cagg inner join datasetmembers dm "
+ " on cagg.aggregationdataelementid=dm.dataelementid "
@@ -276,7 +284,6 @@
int optionComboId = rs.getInt( "optioncomboid" );
String caseExpression = rs.getString( "caseexpression" );
String caseOperator = rs.getString( "caseoperator" );
- String deType = rs.getString( "deType" );
int deSumId = rs.getInt( "desumid" );
Collection<Integer> _orgunitIds = getServiceOrgunit(
@@ -305,7 +312,7 @@
boolean hasValue = jdbcTemplate.queryForRowSet( dataValueSql ).next();
- Double resultValue = getAggregateValue( caseExpression, caseOperator, deType, deSumId, orgunitId,
+ Double resultValue = getAggregateValue( caseExpression, caseOperator, deSumId, orgunitId,
period );
if ( resultValue != null && resultValue != 0 )
@@ -447,8 +454,7 @@
* @param startDate Start date
* @param endDate End date
*/
- private String createSQL( String caseExpression, String operator, String deType, int orgunitId, String startDate,
- String endDate )
+ private String createSQL( String caseExpression, String operator, int orgunitId, String startDate, String endDate )
{
// ---------------------------------------------------------------------
// get operators
@@ -501,7 +507,6 @@
{
String propertyName = info[1];
condition = getConditionForPatientProperty( propertyName, operator, startDate, endDate );
-
}
else if ( info[0].equalsIgnoreCase( OBJECT_PATIENT_ATTRIBUTE ) )
{
@@ -515,6 +520,7 @@
int programId = Integer.parseInt( ids[0] );
String programStageId = ids[1];
int dataElementId = Integer.parseInt( ids[2] );
+ DataElement dataElement = dataElementService.getDataElement( dataElementId );
String valueToCompare = expression[i].replace( "[" + match + "]", "" ).trim();
@@ -532,7 +538,7 @@
if ( !expression[i].contains( "+" ) )
{
- if ( deType.equals( DataElement.VALUE_TYPE_INT ) )
+ if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
{
condition += " AND cast( pd.value as " + statementBuilder.getDoubleColumnType() + ") ";
}
@@ -904,7 +910,8 @@
}
/**
- * Return standard SQL by combining all sub-expressions of an aggregate query builder formula.
+ * Return standard SQL by combining all sub-expressions of an aggregate
+ * query builder formula.
*
*/
private String getSQL( String aggregateOperator, List<String> conditions, List<String> operators )
@@ -943,7 +950,8 @@
}
/**
- * Return the Ids of organisation units which patients registered or events happened.
+ * Return the Ids of organisation units which patients registered or events
+ * happened.
*
*/
private Collection<Integer> getServiceOrgunit( String startDate, String endDate )
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.program;
+
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.SEPARATOR_ID;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.SEPARATOR_OBJECT;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.system.util.DateUtils;
+import org.nfunk.jep.JEP;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ DefaultProgramIndicatorService.java Apr 16, 2013 1:29:00 PM $
+ */
+
+@Transactional
+public class DefaultProgramIndicatorService
+ implements ProgramIndicatorService
+{
+ private final String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "([a-zA-Z0-9\\- ]+["
+ + SEPARATOR_ID + "[0-9]*]*)" + "\\]";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramIndicatorStore programIndicatorStore;
+
+ public void setProgramIndicatorStore( ProgramIndicatorStore programIndicatorStore )
+ {
+ this.programIndicatorStore = programIndicatorStore;
+ }
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private PatientDataValueService patientDataValueService;
+
+ public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+ {
+ this.patientDataValueService = patientDataValueService;
+ }
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation methods
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int addProgramIndicator( ProgramIndicator programIndicator )
+ {
+ return programIndicatorStore.save( programIndicator );
+ }
+
+ @Override
+ public void updateProgramIndicator( ProgramIndicator programIndicator )
+ {
+ programIndicatorStore.update( programIndicator );
+ }
+
+ @Override
+ public void deleteProgramIndicator( ProgramIndicator programIndicator )
+ {
+ programIndicatorStore.delete( programIndicator );
+ }
+
+ @Override
+ public ProgramIndicator getProgramIndicator( int id )
+ {
+ return i18n( i18nService, programIndicatorStore.get( id ) );
+ }
+
+ @Override
+ public ProgramIndicator getProgramIndicator( String name )
+ {
+ return i18n( i18nService, programIndicatorStore.getByName( name ) );
+ }
+
+ @Override
+ public ProgramIndicator getProgramIndicatorByUid( String uid )
+ {
+ return i18n( i18nService, programIndicatorStore.getByUid( uid ) );
+ }
+
+ @Override
+ public ProgramIndicator getProgramIndicatorByShortName( String shortName )
+ {
+ return i18n( i18nService, programIndicatorStore.getByShortName( shortName ) );
+ }
+
+ @Override
+ public Collection<ProgramIndicator> getAllProgramIndicators()
+ {
+ return i18n( i18nService, programIndicatorStore.getAll() );
+ }
+
+ @Override
+ public Collection<ProgramIndicator> getProgramIndicators( Program program )
+ {
+ return i18n( i18nService, programIndicatorStore.getByProgram( program ) );
+ }
+
+ @Override
+ public String getProgramIndicatorValue( ProgramInstance programInstance, ProgramIndicator programIndicator )
+ {
+ Double value = getValue( programInstance, programIndicator.getValueType(), programIndicator.getExpression() );
+
+ if ( value != null )
+ {
+ if ( programIndicator.getValueType().equals( ProgramIndicator.VALUE_TYPE_DATE ) )
+ {
+ Date rootDate = new Date();
+
+ if ( ProgramIndicator.INCIDENT_DATE.equals( programIndicator.getRootDate() ) )
+ {
+ rootDate = programInstance.getDateOfIncident();
+ }
+ else if ( ProgramIndicator.ENROLLEMENT_DATE.equals( programIndicator.getRootDate() ) )
+ {
+ rootDate = programInstance.getEnrollmentDate();
+ }
+
+ Date date = DateUtils.getDateAfterAddition( rootDate, value.intValue() );
+
+ return DateUtils.getMediumDateString( date );
+ }
+
+ return Math.floor( value ) + "";
+ }
+
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getProgramIndicatorValues( ProgramInstance programInstance )
+ {
+ Map<String, String> result = new HashMap<String, String>();
+
+ Collection<ProgramIndicator> programIndicators = programIndicatorStore.getByProgram( programInstance
+ .getProgram() );
+
+ for ( ProgramIndicator programIndicator : programIndicators )
+ {
+ result
+ .put( programIndicator.getDisplayName(), getProgramIndicatorValue( programInstance, programIndicator ) );
+ }
+
+ return result;
+ }
+
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private Double getValue( ProgramInstance programInstance, String valueType, String expression )
+ {
+ String value = "";
+
+ if ( valueType.equals( ProgramIndicator.VALUE_TYPE_INT ) )
+ {
+ Date currentDate = new Date();
+ expression = expression.replaceAll( ProgramIndicator.ENROLLEMENT_DATE,
+ DateUtils.daysBetween( programInstance.getEnrollmentDate(), currentDate ) + "" );
+ expression = expression.replaceAll( ProgramIndicator.INCIDENT_DATE,
+ DateUtils.daysBetween( programInstance.getDateOfIncident(), currentDate ) + "" );
+ expression = expression.replaceAll( ProgramIndicator.CURRENT_DATE, "0" );
+ }
+
+ StringBuffer description = new StringBuffer();
+
+ Pattern pattern = Pattern.compile( regExp );
+ Matcher matcher = pattern.matcher( expression );
+ while ( matcher.find() )
+ {
+ DataElement dataElement = null;
+
+ String key = matcher.group().replaceAll( "[\\[\\]]", "" ).split( SEPARATOR_OBJECT )[1];
+
+ Integer programStageId = Integer.parseInt( key.split( "." )[0] );
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance(
+ programInstance, programStage );
+
+ Integer dataElementId = Integer.parseInt( key.split( "." )[1] );
+ dataElement = dataElementService.getDataElement( dataElementId );
+
+ PatientDataValue dataValue = patientDataValueService
+ .getPatientDataValue( programStageInstance, dataElement );
+
+ if ( dataValue == null )
+ {
+ return null;
+ }
+
+ value = dataValue.getValue();
+
+ if ( valueType.equals( ProgramIndicator.VALUE_TYPE_INT )
+ && (dataElement == null || dataElement.getType().equals( DataElement.VALUE_TYPE_DATE )) )
+ {
+ value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";
+ }
+
+ matcher.appendReplacement( description, value );
+
+ }
+ matcher.appendTail( description );
+
+ final JEP parser = new JEP();
+ parser.parseExpression( description.toString() );
+
+ return parser.getValue();
+
+ }
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramIndicatorStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramIndicatorStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramIndicatorStore.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.program.hibernate;
+
+import java.util.Collection;
+
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorStore;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ HibernateProgramIndicatorStore.java Apr 16, 2013 1:39:19 PM $
+ */
+public class HibernateProgramIndicatorStore
+ extends HibernateIdentifiableObjectStore<ProgramIndicator>
+ implements ProgramIndicatorStore
+{
+
+ @SuppressWarnings( "unchecked" )
+ @Override
+ public Collection<ProgramIndicator> getByProgram( Program program )
+ {
+ return getCriteria( Restrictions.eq( "program", program ) ).list();
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2013-04-11 06:26:56 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2013-04-17 07:58:14 +0000
@@ -5,11 +5,18 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">
<!-- Store definitions -->
-
+
+ <bean id="org.hisp.dhis.program.ProgramIndicatorStore"
+ class="org.hisp.dhis.program.hibernate.HibernateProgramIndicatorStore">
+ <property name="clazz" value="org.hisp.dhis.program.ProgramIndicator" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
<bean id="org.hisp.dhis.caseaggregation.CaseAggregationConditionManager"
class="org.hisp.dhis.caseaggregation.jdbc.JdbcCaseAggregationConditionManager">
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="statementBuilder" ref="statementBuilder" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
</bean>
<bean id="org.hisp.dhis.caseaggregation.CaseAggregationConditionStore"
@@ -328,6 +335,16 @@
<property name="patientAuditStore" ref="org.hisp.dhis.patient.PatientAuditStore" />
</bean>
+ <bean id="org.hisp.dhis.program.ProgramIndicatorService"
+ class="org.hisp.dhis.program.DefaultProgramIndicatorService">
+ <property name="programIndicatorStore" ref="org.hisp.dhis.program.ProgramIndicatorStore" />
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+ <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
+ </bean>
+
<!-- DeletionHandlers -->
<bean id="org.hisp.dhis.patient.PatientIdentifierDeletionHandler"
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramIndicator.hbm.xml 2013-04-17 07:58:14 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.program.ProgramIndicator" table="programindicator">
+
+ <id name="id" column="programindicatorid">
+ <generator class="native" />
+ </id>
+ &identifiableProperties;
+
+ <property name="name" column="name" not-null="true" unique="true" length="230" />
+
+ <property name="shortName" />
+
+ <property name="description" />
+
+ <many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid" foreign-key="fk_programindicator_program" />
+
+ <property name="valueType" />
+
+ <property name="expression" />
+
+ <property name="rootDate" />
+
+ </class>
+</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-04-17 07:58:14 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramIndicatorService;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramService;
@@ -80,6 +81,8 @@
private ProgramService programService;
+ private ProgramIndicatorService programIndicatorService;
+
// -------------------------------------------------------------------------
// Input && Output
// -------------------------------------------------------------------------
@@ -102,15 +105,27 @@
private Collection<Relationship> relationships = new HashSet<Relationship>();
+ private Map<String, String> programIndicatorsMap = new HashMap<String, String>();
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
+ public Map<String, String> getProgramIndicatorsMap()
+ {
+ return programIndicatorsMap;
+ }
+
public void setPatientAuditService( PatientAuditService patientAuditService )
{
this.patientAuditService = patientAuditService;
}
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
public void setProgramService( ProgramService programService )
{
this.programService = programService;
@@ -185,7 +200,7 @@
{
this.patientId = patientId;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -233,6 +248,8 @@
if ( programInstance.getStatus() == ProgramInstance.STATUS_ACTIVE )
{
activeProgramInstances.add( programInstance );
+
+ programIndicatorsMap.putAll( programIndicatorService.getProgramIndicatorValues( programInstance ) );
}
else
{
@@ -242,6 +259,10 @@
}
// ---------------------------------------------------------------------
+ // Get program-indicators
+ // ---------------------------------------------------------------------
+
+ // ---------------------------------------------------------------------
// Patient-Audit
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-04-16 05:41:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-04-17 07:58:14 +0000
@@ -62,6 +62,7 @@
<property name="patientDataValueService"
ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="programIndicatorService" ref="org.hisp.dhis.program.ProgramIndicatorService" />
</bean>
<bean
@@ -1082,6 +1083,7 @@
<property name="patientAuditService" ref="org.hisp.dhis.patient.PatientAuditService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+ <property name="programIndicatorService" ref="org.hisp.dhis.program.ProgramIndicatorService" />
</bean>
<bean
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addCaseAggregation.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addCaseAggregation.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,116 @@
+<script>
+ var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
+ var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )';
+ var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_item" ) , "'" )';
+ var i18n_all = '[' + '$encoder.jsEscape( $i18n.getString( "all" ) , "'" )' + ']';
+</script>
+
+<script type="text/javascript" src="javascript/addCaseAggregationForm.js"></script>
+
+<h3>$i18n.getString( "create_new_aggregation_query_builder" )</h3>
+
+<form id="addCaseAggregationForm" action="addCaseAggregation.action" method="post" >
+
+<table>
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "case_aggregation_query_builder_detail" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <input type="text" id="name" name="name" class="{validate:{required:true,minlength:2}}">
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="dataSets">$i18n.getString( "dataset" )</label></td>
+ <td>
+ <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.displayName</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="dataElement">$i18n.getString( "dataelement" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <input id="aggregationDataElementInput" name="aggregationDataElementInput" style='width:300px;'>
+ <a style='width:20px; margin-bottom:-5px;height:20px;' id='dataElementsButton' name='dataElementsButton'></a>
+ <input type='hidden' id="aggregationDataElementId" name="aggregationDataElementId" class="{validate:{required:true}}" >
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="operator">$i18n.getString( "operator" )</label></td>
+ <td>
+ <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="times" onchange='operatorOnchange(this.value)'> $i18n.getString('number_of_visits')<br>
+ <input type="radio" id="operator" name="operator" value="sum" onchange='operatorOnchange(this.value)'> $i18n.getString('sum_dataelement_value')<br>
+ <input type="radio" id="operator" name="operator" value="avg" onchange='operatorOnchange(this.value)'> $i18n.getString('avg_dataelement_value')<br>
+ <input type="radio" id="operator" name="operator" value="min" onchange='operatorOnchange(this.value)'> $i18n.getString('min_dataelement_value')<br>
+ <input type="radio" id="operator" name="operator" value="max" onchange='operatorOnchange(this.value)'> $i18n.getString('max_dataelement_value')
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <label for="programId">$i18n.getString( "program" )</label>
+ </td>
+ <td>
+ <select id="programId" name="programId" onChange="getParams();">
+ <option value="">[$i18n.getString('please_select')]</option>
+ #foreach( $program in $programs )
+ <option value="$program.id" title='$program.displayName' programType='$program.type'>$encoder.htmlEncode( $program.displayName )</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <label for="programStage">$i18n.getString( "program_stage" )</label>
+ </td>
+ <td>
+ <select id="programStageId" name="programStageId" onChange="getPatientDataElements();"></select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <label for="deSumId">$i18n.getString( "data_element_for_sum_avg_min_max" ) <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>
+
+ </tbody>
+</table>
+
+#parse( "/dhis-web-maintenance-patient/caseAggregationForm.vm" )
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" />
+ <input type="button" value="$i18n.getString( 'test_condition' )" onclick='testCaseAggregationCondition();'/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onClick="window.location.href='caseAggregation.action?dataSetId=$!dataSetId'" />
+</p>
+
+</form>
+
+<script>
+ #if( $dataSetId )
+ getDataElementsByDataset();
+ #end
+</script>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregation.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregation.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,88 @@
+<h3>$i18n.getString( 'patient_aggregation_query_builder_management' ) #openHelp( "patient_aggregation_query_builder" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+
+ <tr>
+ <td>$i18n.getString( "filter_by_data_set" )</td>
+ <td>
+ <select id='dataSetId' name='dataSetId' onchange='getCaseAggConditionByDataset();'>
+ <option value=''>[ $i18n.getString( "all" ) ]</option>
+ #foreach( $dataSet in $dataSets )
+ <option value='$dataSet.id' #if( $dataSetId=="$dataSet.id") selected #end >$dataSet.displayName</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "filter_by_name" )</td>
+ <td>
+ <input type="text" onkeyup="filterValues( this.value , 1)" />
+ </td>
+ <td colspan="3" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="showAddCaseAggregationForm();" >
+ </td>
+ </tr>
+ </table>
+
+ <table class="listTable">
+ <col>
+ <col width="120">
+
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th>$i18n.getString( "operations" )</th>
+ </tr>
+
+ <tbody id="list">
+ #set( $mark = true )
+ #foreach( $aggregationCondition in $aggregationConditions )
+ <tr id="tr${aggregationCondition.id}" #alternate( $mark )>
+ <td onclick="javascript:showCaseAggregationDetails( $aggregationCondition.id )" >$encoder.htmlEncode( $aggregationCondition.displayName )</td>
+ <td>
+ <a href="showUpdateCaseAggregationForm.action?id=$aggregationCondition.id&dataSetId=$!dataSetId" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <a href="javascript:translate( 'CaseAggregationCondition', '$aggregationCondition.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeCaseAggregation( '$aggregationCondition.id', '$encoder.jsEncode( $aggregationCondition.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:showCaseAggregationDetails( $aggregationCondition.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+
+ </tr>
+ #set( $mark = !$mark )
+ #end
+ </tbody>
+
+ </table>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" class="hidden">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <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_sum_avg_min_max" ):</label><br><span id="deSumField"></span></p>
+ <p><label class="bold">$i18n.getString( "aggregation_expression" ):</label><br><span id="aggregationExpressionField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient_attribute" ) , "'" )';
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+ var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
+ var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
+ var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
+ var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';
+ var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
+ var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
+ var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ) , "'")';
+</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-04-03 07:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2013-04-17 07:58:14 +0000
@@ -44,6 +44,14 @@
#end
</td>
</tr>
+
+ #foreach($key in $programIndicatorsMap.keySet())
+ <tr class='bold'>
+ <td>$key</td>
+ <td>$programIndicatorsMap.get($key)</td>
+ </tr>
+ #end
+
<tr>
<td>$i18n.getString("health_worker")</td>
<td>
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramIndicator.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgramIndicator.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,11 @@
+{ "programIndicator":
+ {
+ "id": $!{programIndicator.id},
+ "name": "$!encoder.jsonEncode( ${programIndicator.displayName} )",
+ "code": "$!encoder.jsonEncode( ${programIndicator.code} )",
+ "description": "$!encoder.xmlEncode( ${programIndicator.displayDescription} )",
+ "valueType": "$!{programIndicator.valueType}",
+ "rootDate" : "$!format.formatDate( $programIndicator.rootDate )",
+ "expression": "$!encoder.jsonEncode( $!{programIndicator.expression} )"
+ }
+}
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/AddProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/AddProgramIndicatorAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/AddProgramIndicatorAction.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.programtindicator;
+
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ AddProgramIndicatorAction.java Apr 16, 2013 3:24:51 PM $
+ */
+public class AddProgramIndicatorAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private ProgramIndicatorService programIndicatorService;
+
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------
+
+ private Integer programId;
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ public Integer getProgramId()
+ {
+ return programId;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String shortName;
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ private String valueType;
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ private String expression;
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
+ private String rootDate;
+
+ public void setRootDate( String rootDate )
+ {
+ this.rootDate = rootDate;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ code = (code == null && code.trim().length() == 0) ? null : code;
+
+ Program program = programService.getProgram( programId );
+ ProgramIndicator programIndicator = new ProgramIndicator( name, description, valueType, expression );
+ programIndicator.setShortName( shortName );
+ programIndicator.setCode( code );
+ programIndicator.setRootDate( rootDate );
+ programIndicator.setProgram( program );
+
+ programIndicatorService.addProgramIndicator( programIndicator );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorAction.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.programtindicator;
+
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ DeleteProgramIndicatorAction Apr 16, 2013 3:24:51 PM $
+ */
+public class GetProgramIndicatorAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramIndicatorService programIndicatorService;
+
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private ProgramIndicator programIndicator;
+
+ public ProgramIndicator getProgramIndicator()
+ {
+ return programIndicator;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ programIndicator = programIndicatorService.getProgramIndicator( id );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/GetProgramIndicatorListAction.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.programtindicator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.comparator.ProgramIndicatorComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ UpdateProgramIndicatorAction Apr 16, 2013 3:24:51 PM $
+ */
+public class GetProgramIndicatorListAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramIndicatorService programIndicatorService;
+
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------
+
+ private Integer programId;
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ private List<ProgramIndicator> programIndicators;
+
+ public List<ProgramIndicator> getProgramIndicators()
+ {
+ return programIndicators;
+ }
+
+ private Program program;
+
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ program = programService.getProgram( programId );
+
+ programIndicators = new ArrayList<ProgramIndicator>( programIndicatorService.getProgramIndicators( program ) );
+
+ Collections.sort( programIndicators, new ProgramIndicatorComparator() );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/RemoveProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/RemoveProgramIndicatorAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/RemoveProgramIndicatorAction.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.programtindicator;
+
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ RemoveProgramIndicatorAction Apr 16, 2013 3:24:51 PM $
+ */
+public class RemoveProgramIndicatorAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramIndicatorService programIndicatorService;
+
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ ProgramIndicator programIndicator = programIndicatorService.getProgramIndicator( id );
+
+ programIndicatorService.deleteProgramIndicator( programIndicator );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/UpdateProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/UpdateProgramIndicatorAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/UpdateProgramIndicatorAction.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.programtindicator;
+
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ UpdateProgramIndicatorAction Apr 16, 2013 3:24:51 PM $
+ */
+public class UpdateProgramIndicatorAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramIndicatorService programIndicatorService;
+
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ private String valueType;
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ private String expression;
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
+ private String rootDate;
+
+ public void setRootDate( String rootDate )
+ {
+ this.rootDate = rootDate;
+ }
+
+ private String shortName;
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ private Integer programId;
+
+ public Integer getProgramId()
+ {
+ return programId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ code = (code == null && code.trim().length() == 0) ? null : code;
+
+ ProgramIndicator programIndicator = programIndicatorService.getProgramIndicator( id );
+
+ programIndicator.setName( name );
+ programIndicator.setShortName( shortName );
+ programIndicator.setCode( code );
+ programIndicator.setDescription( description );
+ programIndicator.setExpression( expression );
+ programIndicator.setValueType( valueType );
+ programIndicator.setRootDate( rootDate );
+
+ programIndicatorService.updateProgramIndicator( programIndicator );
+
+ programId = programIndicator.getProgram().getId();
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/ValidateProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/ValidateProgramIndicatorAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/programtindicator/ValidateProgramIndicatorAction.java 2013-04-17 07:58:14 +0000
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.patient.action.programtindicator;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.program.ProgramIndicator;
+import org.hisp.dhis.program.ProgramIndicatorService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ ValidateProgramIndicatorAction.java Apr 16, 2013 3:29:11 PM $
+ */
+public class ValidateProgramIndicatorAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramIndicatorService programIndicatorService;
+
+ public void setProgramIndicatorService( ProgramIndicatorService programIndicatorService )
+ {
+ this.programIndicatorService = programIndicatorService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String shortName;
+
+ public void setShortName( String shortName )
+ {
+ this.shortName = shortName;
+ }
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ ProgramIndicator match = null;
+
+ if ( name != null )
+ {
+ name = name.trim();
+
+ match = programIndicatorService.getProgramIndicator( name );
+ }
+ else if ( shortName != null )
+ {
+ shortName = shortName.trim();
+
+ match = programIndicatorService.getProgramIndicatorByShortName( shortName );
+ }
+ else if ( code != null )
+ {
+ code = code.trim();
+
+ match = programIndicatorService.getProgramIndicator( code );
+ }
+
+ if ( match != null && (id == null || match.getId() != id.intValue()) )
+ {
+ message = i18n.getString( "name_exists" );
+
+ return ERROR;
+ }
+
+ message = i18n.getString( "everything_is_ok" );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-04-11 06:26:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2013-04-17 07:58:14 +0000
@@ -370,8 +370,7 @@
scope="prototype">
<property name="programStageSectionService"
ref="org.hisp.dhis.program.ProgramStageSectionService" />
- <property name="programStageService"
- ref="org.hisp.dhis.program.ProgramStageService" />
+ <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
</bean>
<bean
@@ -568,7 +567,7 @@
<ref bean="org.hisp.dhis.user.UserSettingService" />
</property>
</bean>
-
+
<bean
id="org.hisp.dhis.patient.action.dataentryform.SetAutoSavePatientRegistrationSettingAction"
class="org.hisp.dhis.patient.action.dataentryform.SetAutoSavePatientRegistrationSettingAction"
@@ -1071,4 +1070,59 @@
<property name="aggregateConditionTask" ref="aggregateQueryBuilder" />
</bean>
+ <!-- Program Indicator -->
+
+ <bean
+ id="org.hisp.dhis.patient.action.programtindicator.AddProgramIndicatorAction"
+ class="org.hisp.dhis.patient.action.programtindicator.AddProgramIndicatorAction"
+ scope="prototype">
+ <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+ <property name="programIndicatorService">
+ <ref bean="org.hisp.dhis.program.ProgramIndicatorService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.programtindicator.RemoveProgramIndicatorAction"
+ class="org.hisp.dhis.patient.action.programtindicator.RemoveProgramIndicatorAction"
+ scope="prototype">
+ <property name="programIndicatorService">
+ <ref bean="org.hisp.dhis.program.ProgramIndicatorService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorAction"
+ class="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorAction"
+ scope="prototype">
+ <property name="programIndicatorService"
+ ref="org.hisp.dhis.program.ProgramIndicatorService" />
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorListAction"
+ class="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorListAction"
+ scope="prototype">
+ <property name="programIndicatorService" ref="org.hisp.dhis.program.ProgramIndicatorService" />
+ <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.programtindicator.UpdateProgramIndicatorAction"
+ class="org.hisp.dhis.patient.action.programtindicator.UpdateProgramIndicatorAction"
+ scope="prototype">
+ <property name="programIndicatorService">
+ <ref bean="org.hisp.dhis.program.ProgramIndicatorService" />
+ </property>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.programtindicator.ValidateProgramIndicatorAction"
+ class="org.hisp.dhis.patient.action.programtindicator.ValidateProgramIndicatorAction"
+ scope="prototype">
+ <property name="programIndicatorService">
+ <ref bean="org.hisp.dhis.program.ProgramIndicatorService" />
+ </property>
+ </bean>
+
</beans>
\ No newline at end of file
=== 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-04-11 03:23:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-04-17 07:58:14 +0000
@@ -380,4 +380,11 @@
days_before_after_comparison_date = Days before/after comparison date
enrollment_date = Enrollment date
incident_date = Incident date
-date_to_compare = Date to compare
\ No newline at end of file
+date_to_compare = Date to compare
+program_indicator_management = Program Indicator Management
+program_indicator_management_form = Program indicator management
+confirm_delete_prorgam_indicator=Are you sure you want to delete this program indicator?
+program_indicator_details = Program indicator details
+date_for_calculating = Date for calculating
+create_new_program_indicator = Create new program indicator
+update_program_indicator = Edit program indicator
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-04-11 06:26:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2013-04-17 07:58:14 +0000
@@ -498,7 +498,7 @@
programStage.action?id=${programId}
</result>
</action>
-
+
<action name="autoSaveDataEntryForm"
class="org.hisp.dhis.patient.action.dataentryform.SaveDataEntryFormAction">
<result name="success" type="velocity-json">
@@ -537,7 +537,7 @@
/dhis-web-maintenance-patient/dataEntryFormCode.vm
</result>
</action>
-
+
<action name="setAutoSaveDataEntrySetting"
class="org.hisp.dhis.patient.action.dataentryform.SetAutoSaveDataEntrySettingAction">
<result name="success" type="velocity-json">
@@ -573,7 +573,7 @@
<result name="success" type="redirect">patientRegistrationForm.action
</result>
</action>
-
+
<action name="autoSavePatientRegistrationForm"
class="org.hisp.dhis.patient.action.dataentryform.SavePatientRegistrationFormAction">
<result name="success" type="velocity-json">
@@ -587,10 +587,11 @@
/dhis-web-commons/ajax/jsonResponseSuccess.vm
</result>
</action>
-
+
<action name="delRegistrationEntryFormAction"
class="org.hisp.dhis.patient.action.dataentryform.DelRegistrationFormAction">
- <result name="success" type="redirect">patientRegistrationForm.action</result>
+ <result name="success" type="redirect">patientRegistrationForm.action
+ </result>
</action>
<action name="showPatientRegistrationForm"
@@ -599,7 +600,7 @@
/dhis-web-maintenance-patient/dataEntryFormCode.vm
</result>
</action>
-
+
<action name="setAutoSavePatientRegistrationSetting"
class="org.hisp.dhis.patient.action.dataentryform.SetAutoSavePatientRegistrationSettingAction">
<result name="success" type="velocity-json">
@@ -1083,5 +1084,73 @@
<param name="requiredAuthorities">F_SCHEDULING_CASE_AGGREGATE_QUERY_BUILDER</param>
</action>
+ <!-- Program Indicator -->
+
+ <action name="programIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-patient/programIndicator.vm</param>
+ <param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
+ <param name="javascripts">javascript/programIndicator.js</param>
+ <param name="requiredAuthorities">F_PROGRAM_INDICATOR_MANAGEMENT</param>
+ </action>
+
+ <action name="getProgramIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonProgramIndicator.vm
+ </result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <action name="showAddProgramIndicator"
+ class="org.hisp.dhis.patient.action.program.GetProgramAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-patient/addProgramIndicator.vm</param>
+ <param name="javascripts">javascript/programIndicator.js</param>
+ <param name="requiredAuthorities">F_ADD_PROGRAM_INDICATOR</param>
+ </action>
+
+ <action name="addProgramIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.AddProgramIndicatorAction">
+ <result name="success" type="redirect">programIndicator.action?programId=${programId}
+ </result>
+ <param name="requiredAuthorities">F_ADD_PROGRAM_INDICATOR</param>
+ </action>
+
+ <action name="showUpdateProgramIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.GetProgramIndicatorAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-patient/updateProgramIndicator.vm</param>
+ <param name="javascripts">javascript/programIndicator.js</param>
+ <param name="requiredAuthorities">F_UPDATE_PROGRAM_INDICATOR</param>
+ </action>
+
+ <action name="updateProgramIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.UpdateProgramIndicatorAction">
+ <result name="success" type="redirect">programIndicator.action?programId=${programId}
+ </result>
+ <param name="requiredAuthorities">F_UPDATE_PROGRAM_INDICATOR</param>
+ </action>
+
+ <action name="removeProgramIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.RemoveProgramIndicatorAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm
+ </result>
+ <param name="requiredAuthorities">F_ADD_PROGRAM_INDICATOR</param>
+ </action>
+
+ <action name="validateProgramIndicator"
+ class="org.hisp.dhis.patient.action.programtindicator.ValidateProgramIndicatorAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm
+ </result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm
+ </result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
</package>
</struts>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramIndicator.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramIndicator.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,94 @@
+<script>
+jQuery( document ).ready( function()
+{
+ validation( 'programIndicatorForm', function(form){
+ form.submit();
+ });
+
+ checkValueIsExist( "name", "validateProgramIndicator.action" );
+ checkValueIsExist( "shortName", "validateProgramIndicator.action" );
+ checkValueIsExist( "code", "validateProgramIndicator.action" );
+});
+</script>
+
+<h3>$i18n.getString( "create_new_program_indicator" )</h3>
+
+<form id="programIndicatorForm" action="addProgramIndicator.action" method="post" >
+<input type='hidden' id='programId' name='programId' value='$program.id'>
+
+<table>
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "program_indicator_details" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td><input style="width: 330px;" type="text" id="name" name="name" class="{validate:{required:true,minlength:2}}"></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "short_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td><input style="width: 330px;" type="text" id="shortName" name="shortName" class="{validate:{required:true,minlength:2}}"></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "code" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td><input style="width: 330px;" type="text" id="code" name="code" class="{validate:{required:true,minlength:2}}"></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "description" ) </label></td>
+ <td><textarea style="width: 330px;" type="text" id="description" name="description" ></textarea></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "value_type" ) </label></td>
+ <td>
+ <select style="width: 336px;" id="valueType" name="valueType" onchange='programIndicatorOnChange();' class="{validate:{required:true}}">
+ <option value='int'>$i18n.getString('int')</option>
+ <option value='date'>$i18n.getString('date')</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tr id='rootDateTR' style='display:none'>
+ <td><label>$i18n.getString( "date_for_calculating" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td>
+ <select style="width:336px;" id="rootDate" name="rootDate" class="{validate:{required:true}}">
+ <option value=''>[$i18n.getString('please_select')]</option>
+ <option value='incident_date'>$i18n.getString('incident_date')</option>
+ <option value='execution_date'>$i18n.getString('execution_date')</option>
+ <option value='current_date'>$i18n.getString('current_date')</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "program_stage" ) </label></td>
+ <td>
+ <select style="width:336px;" id="programStageId" name="programStageId" onChange="getPatientDataElements();">
+ <option value=''>[$i18n.getString('please_select')]</option>
+ #foreach( $programStage in $program.programStages )
+ <option value='$programStage.id'>$programStage.displayName</option>
+ #end
+ </select>
+ </td>
+ <td></td>
+ </tr>
+</table>
+<br>
+
+#parse( "/dhis-web-maintenance-patient/programIndicatorForm.vm" )
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:163px;" >
+ <input type="button" value="$i18n.getString( 'cancel' )" style="width:163px;" onclick="window.location.href='programIndicator.action?programId=$program.id'" >
+</p>
+
+</form>
+
+<script>
+ $('#tabs').tabs();
+</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm 2013-03-08 14:07:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm 2013-04-17 07:58:14 +0000
@@ -1,7 +1,6 @@
<div id="tabs">
<ul>
<li><a href="#tab-1">$i18n.getString("dataelements")</a></li>
- <li><a href="#tab-2">$i18n.getString("patient_attributes")</a></li>
<li><a href="#tab-3">$i18n.getString("program")</a></li>
</ul>
@@ -110,7 +109,7 @@
<input type='button' style="width:45px;" align="right" alt="$i18n.getString( 'clear' )" onclick="byId('aggregationCondition').value='';" value="$i18n.getString('clear')" />
</td>
-
+ </tr>
</tbody>
<tr>
<td>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/program_indicator.png'
Binary files dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/program_indicator.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/images/program_indicator.png 2013-04-17 07:58:14 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2013-04-08 04:21:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2013-04-17 07:58:14 +0000
@@ -32,6 +32,7 @@
typeMap['combo'] = i18n_attribute_combo_type;
return typeMap;
}
+
// -----------------------------------------------------------------------------
// Remove Patient Attribute
// -----------------------------------------------------------------------------
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js 2013-04-17 07:58:14 +0000
@@ -0,0 +1,116 @@
+
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showProgramIndicatorDetails( programIndicatorId )
+{
+ jQuery.getJSON( 'getProgramIndicator.action', { id: programIndicatorId }, function ( json ) {
+ setInnerHTML( 'nameField', json.programIndicator.name );
+ setInnerHTML( 'codeField', json.programIndicator.code );
+ setInnerHTML( 'descriptionField', json.programIndicator.description );
+ setInnerHTML( 'valueTypeField', json.programIndicator.valueType );
+ setInnerHTML( 'rootDateField', json.programIndicator.rootDate );
+ setInnerHTML( 'expressionField', json.programIndicator.expression );
+
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove Program Indicator
+// -----------------------------------------------------------------------------
+
+function removeProgramIndicator( programIndicatorId, name )
+{
+ removeItem( programIndicatorId, name, i18n_confirm_delete, 'removeProgramIndicator.action' );
+}
+
+function getPatientDataElements()
+{
+ clearListById( 'dataElements' );
+ clearListById( 'deSumId' );
+ var programStageId = getFieldValue('programStageId');
+
+ jQuery.getJSON( 'getPatientDataElements.action',
+ {
+ programId:getFieldValue( 'programId' ),
+ programStageId:programStageId
+ }
+ ,function( json )
+ {
+ if( programStageId!='' ){
+ enable('programStageProperty');
+ }
+ else{
+ 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>" );
+ }
+ }
+
+ });
+}
+
+function insertDataElement( element )
+{
+ var programStageId = getFieldValue('programStageId');
+ var dataElementId = element.options[element.selectedIndex].value;
+
+ insertTextCommon( 'expression', "[DE:" + programStageId + "." + dataElementId + "]" );
+ getConditionDescription();
+}
+
+function insertInfo( element, isProgramStageProperty )
+{
+ var id = "";
+ if( isProgramStageProperty )
+ {
+ id = getFieldValue('programStageId');
+ }
+ else
+ {
+ id = getFieldValue('programId');
+ }
+
+ value = element.options[element.selectedIndex].value.replace( '*', id );
+ insertTextCommon('expression', value );
+ getConditionDescription();
+}
+
+function insertOperator( value )
+{
+ insertTextCommon('expression', ' ' + value + ' ' );
+ getConditionDescription();
+}
+
+function getConditionDescription ()
+{
+ var valueType = getFieldValue('valueType');
+ if( valueType == 'int' ){
+ hideById('rootDateTR');
+ }
+ else{
+ showById('rootDateTR');
+ }
+}
+
+function programIndicatorOnChange()
+{
+ var valueType = getFieldValue('valueType');
+ if(valueType=='int'){
+ hideById('rootDateTR');
+ disable('rootDate');
+ }
+ else{
+ showById('rootDateTR');
+ enable('rootDate');
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,65 @@
+<h3>$i18n.getString( "program_indicator_management_form" )</h3>
+
+<h4>$program.displayName</h4>
+
+<input type='hidden' id='id' name='id' value='$program.id'>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddProgramIndicator.action?id=$program.id'" style="width:150px"><br>
+ <input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='program.action'" style="width:150px">
+ </td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top" colspan=2>
+ <table class="listTable" id="listTable">
+ <col>
+ <col>
+ <col width="180">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th>$i18n.getString( "description" )</th>
+ <th>$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $programIndicator in $programIndicators )
+ <tr id="tr${programIndicator.id}" #alternate( $mark )>
+ <td onclick="showProgramIndicatorDetails( $programIndicator.id )">$encoder.htmlEncode( $programIndicator.displayName )</td>
+ <td onclick="showProgramIndicatorDetails( $programIndicator.id )">$encoder.htmlEncode( $programIndicator.description )</td>
+ <td style="text-align:center"#alternate( $mark )>
+ <a href="showUpdateProgramIndicator.action?id=$programIndicator.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <a href="javascript:translate( 'ProgramIndicator', '$programIndicator.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeItem( '$programIndicator.id', '$encoder.jsEncode( $programIndicator.displayName )', i18n_confirm_delete , 'removeProgramIndicator.action' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:showProgramIndicatorDetails( $programIndicator.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+ </tr>
+ #set( $mark = !$mark )
+ #end
+ </tbody>
+ </table>
+ </td>
+
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "code" ):</label><br><span id="codeField"></span></p>
+ <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "valueType" ):</label><br><span id="valueTypeField"></span></p>
+ <p><label class="bold">$i18n.getString( "rootDate" ):</label><br><span id="rootDateField"></span></p>
+ <p><label class="bold">$i18n.getString( "expression" ):</label><br><span id="expressionField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_prorgam_indicator" ) , "'" )';
+</script>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicatorForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicatorForm.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,80 @@
+<div id="tabs">
+ <ul>
+ <li><a href="#tab-1">$i18n.getString("dataelements")</a></li>
+ <li><a href="#tab-2">$i18n.getString("program")</a></li>
+ </ul>
+
+ <div id="tab-1">
+ <table>
+ <tr>
+ <td><label for="dataelement">$i18n.getString( "dataelement" )</label></td>
+ </tr>
+ <tr>
+ <td>
+ <input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDE(event, this.value, 'dataElements');" style='width:265px;'/>
+ <input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchValue', '');" style='width:50px'>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <select id="dataElements" name="dataElements" size="8" ondblclick="insertDataElement(this);"></select>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="tab-2">
+ <table>
+ <tr>
+ <td><label>$i18n.getString('program_properties')</label></td>
+ </tr>
+ <tr>
+ <td>
+ <select id="programProperty" name="programProperty" size="10" ondblclick="insertInfo(this, false);" >
+ <option value="incident_date">$i18n.getString( "incident_date" )</option>
+ <option value="enrollment_date">$i18n.getString( "date_of_enrollment" )</option>
+ <option value="current_date">$i18n.getString( "current_date" )</option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+<tr>
+ <td>
+ <input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "+" );' value="+" />
+ <input type='button' class="small-button" alt="$i18n.getString( 'minus' )" onclick='insertOperator( "-" );' value="-" />
+ <input type='button' class="small-button" alt="$i18n.getString( 'multiply' )" onclick='insertOperator( "*" );' value="*" />
+ <input type='button' class="small-button" alt="$i18n.getString( 'divide' )" onclick='insertOperator( "/" );' value="/" />
+
+ <input type='button' class="small-button" alt="$i18n.getString( 'left_parent' )" onclick='insertOperator( "(" );' value="(" />
+ <input type='button' class="small-button" alt="$i18n.getString( 'right_parent' )" onclick='insertOperator( ")" );' value=")" />
+ </td>
+</tr>
+
+<p></p>
+<table>
+
+ <tr>
+ <td>
+ <fieldset>
+ <legend>$i18n.getString( "expression" )</legend>
+ <textarea style="width:660px" id="expression" name="expression" onkeyup='getConditionDescription();' maxlength="254" class="{validate:{required:true}}">$!programIndicator.expression</textarea>
+ </fieldset>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <fieldset>
+ <legend>$i18n.getString( "description" )</legend>
+ <div id='aggregationDescription'>$!description</div>
+ </fieldset>
+ </td>
+ </tr>
+</table>
+
+<script>
+ $('#tabs').tabs();
+</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-04-10 04:22:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-04-17 07:58:14 +0000
@@ -11,7 +11,7 @@
<table class="listTable" id="listTable">
<col>
- <col width="270">
+ <col width="300">
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
@@ -45,6 +45,10 @@
<img src="../images/assign_b-denied.png">
#end
+ #if( $auth.hasAccess( "dhis-web-maintenance-patient", "programIndicator" ) )
+ <a href="programIndicator.action?programId=$program.id" title="$i18n.getString( 'program_indicator_management_form' )"><img src="images/program_indicator.png" ></a>
+ #end
+
#if ( $security.canManage( $program ) )
<a href="javascript:showSharingDialog('program', '$program.uid');" title="$i18n.getString( 'sharing_settings' )"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
#else
@@ -79,19 +83,11 @@
<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "code" ):</label><br><span id="codeField"></span></p>
<p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "type" ):</label><br><span id="typeField"></span></p>
- <p><label class="bold">$i18n.getString( "display_provided_other_facility_column" ):</label><br><span id="displayProvidedOtherFacilityField"></span></p>
- <p><label class="bold">$i18n.getString( "display_date_of_incident" ):</label><br><span id="displayIncidentDateField"></span></p>
- <p><label class="bold">$i18n.getString( "generated_events_by_enrollment_date" ):</label><br><span id="generatedByEnrollmentDateField"></span></p>
- <p><label class="bold">$i18n.getString( "ignore_to_generate_overdue_events" ):</label><br><span id="ignoreOverdueEventsField"></span></p>
- <p><label class="bold">$i18n.getString( "only_enroll_once" ):</label><br><span id="onlyEnrollOnceField"></span></p>
- <p><label class="bold">$i18n.getString( "block_entry_form_after_completed" ):</label><br><span id="blockEntryFormField"></span></p>
- <p><label class="bold">$i18n.getString( "remind_completing_program_after_program_stage_completed" ):</label><br><span id="remindCompletedField"></span></p>
- <p><label class="bold">$i18n.getString( "date_of_enrollment_description" ):</label><br><span id="dateOfEnrollmentDescriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "date_of_incident_description" ):</label><br><span id="dateOfIncidentDescriptionField"></span></p>
- <p><label class="bold">$i18n.getString( "number_of_attributes" ):</label><br><span id="noAttributesField"></span></p>
- <p><label class="bold">$i18n.getString( "number_of_identifier_types" ):</label><br><span id="noIdentifierTypesField"></span></p>
+ <p><label class="bold">$i18n.getString( "valueType" ):</label><br><span id="valueTypeField"></span></p>
+ <p><label class="bold">$i18n.getString( "rootDate" ):</label><br><span id="rootDateField"></span></p>
+ <p><label class="bold">$i18n.getString( "expression" ):</label><br><span id="expressionField"></span></p>
</div>
</td>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramIndicator.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramIndicator.vm 2013-04-17 07:58:14 +0000
@@ -0,0 +1,95 @@
+<script>
+jQuery( document ).ready( function()
+{
+ validation( 'programIndicatorForm', function(form){
+ form.submit();
+ });
+
+ checkValueIsExist( "name", "validateProgramIndicator.action",{id:getFieldValue('id')} );
+ checkValueIsExist( "shortName", "validateProgramIndicator.action",{id:getFieldValue('id')} );
+ checkValueIsExist( "code", "validateProgramIndicator.action",{id:getFieldValue('id')} );
+});
+</script>
+
+<h3>$i18n.getString( "update_program_indicator" )</h3>
+
+<form id="programIndicatorForm" action="updateProgramIndicator.action" method="post" >
+<input type='hidden' id='programId' name='programId' value='$program.id'>
+<input type='hidden' id='id' name='id' value='$programIndicator.id'>
+
+<table>
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "program_indicator_details" )</th>
+ </tr>
+ </thead>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td><input style="width: 330px;" type="text" id="name" name="name" class="{validate:{required:true,minlength:2}}" value='$programIndicator.name'></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "short_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td><input style="width: 330px;" type="text" id="shortName" name="shortName" class="{validate:{required:true,minlength:2}}" value='$programIndicator.shortName'></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "code" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td><input style="width: 330px;" type="text" id="code" name="code" class="{validate:{required:true,minlength:2}}" value='$programIndicator.code'></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "description" ) </label></td>
+ <td><textarea style="width: 330px;" type="text" id="description" name="description">$programIndicator.description</textarea></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "value_type" )</label></td>
+ <td>
+ <select style="width: 336px;" id="valueType" name="valueType" onchange='programIndicatorOnChange();' class="{validate:{required:true}}">
+ <option value='int' #if( '$programIndicator.valueType'=='int' ) selected #end>$i18n.getString('int')</option>
+ <option value='date' #if( '$programIndicator.valueType'=='date' ) selected #end>$i18n.getString('date')</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tr id='rootDateTR' #if($programIndicator.valueType!='date') style='display:none' #end >
+ <td><label>$i18n.getString( "date_for_calculating" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td>
+ <select style="width:336px;" id="rootDate" name="rootDate" class="{validate:{required:true}}">
+ <option value=''>[$i18n.getString('please_select')]</option>
+ <option value='incident_date'>$i18n.getString('incident_date')</option>
+ <option value='execution_date'>$i18n.getString('execution_date')</option>
+ <option value='current_date'>$i18n.getString('current_date')</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+</table>
+<br>
+
+#parse( "/dhis-web-maintenance-patient/programIndicatorForm.vm" )
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:163px;" >
+ <input type="button" value="$i18n.getString( 'cancel' )" style="width:163px;" onclick="window.location.href='programIndicator.action?programId=$programIndicator.program.id'" >
+</p>
+
+</form>
+
+<script>
+ var i18n_reminder = '$encoder.jsEscape( $i18n.getString( "reminder" ) , "'")';
+ var i18n_remove_reminder = '$encoder.jsEscape( $i18n.getString( "remove_reminder" ) , "'")';
+ var i18n_days_before_after_comparison_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_comparison_date" ) , "'")';
+ var i18n_params = '$encoder.jsEscape( $i18n.getString( "params" ) , "'")';
+ var i18n_patient_name = '$encoder.jsEscape( $i18n.getString( "patient_name" ) , "'")';
+ var i18n_program_name = '$encoder.jsEscape( $i18n.getString( "program_name" ) , "'")';
+ var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'")';
+ var i18n_days_since_incident_date = '$encoder.jsEscape( $i18n.getString( "days_since_incident_date" ) , "'")';
+ var i18n_orgunit_name = '$encoder.jsEscape( $i18n.getString( "orgunit_name" ) , "'")';
+ var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';
+ var i18n_days_since_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_since_enrollment_date" ) , "'")';
+ var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
+ var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';
+ var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")';
+</script>