dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20507
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9382: Add calculated patient attribute and show the value into dashboard.
------------------------------------------------------------
revno: 9382
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-12-21 16:23:20 +0700
message:
Add calculated patient attribute and show the value into dashboard.
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetCalPatientAttributeParamsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonCalPatientAttributeParams.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java
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/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.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-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java
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/addPatientAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js
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/updatePatientAttributeForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java 2012-07-11 07:24:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationCondition.java 2012-12-21 09:23:20 +0000
@@ -70,6 +70,9 @@
public static String OBJECT_PROGRAM_STAGE_PROPERTY = "PSP";
public static String OBJECT_PATIENT_PROGRAM_STAGE_PROPERTY = "PC";
+
+ public static String OBJECT_PROGRAM_PROPERTY_INCIDENT_DATE = "dateOfIncident";
+ public static String OBJECT_PROGRAM_PROPERTY_ENROLLEMENT_DATE = "enrollmentDate";
// -------------------------------------------------------------------------
// Fields
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttribute.java 2012-12-21 09:23:20 +0000
@@ -60,6 +60,9 @@
public static final String TYPE_COMBO = "COMBO";
+ public static final String TYPE_CALCULATED = "CALCULATED";
+
+
private String description;
private String valueType;
@@ -74,6 +77,8 @@
private Set<PatientAttributeOption> attributeOptions;
+ private String expression;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -207,4 +212,14 @@
this.patientAttributeGroup = patientAttributeGroup;
}
+ public String getExpression()
+ {
+ return expression;
+ }
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientattributevalue/PatientAttributeValueService.java 2012-12-21 09:23:20 +0000
@@ -29,6 +29,7 @@
import java.util.Collection;
import java.util.Map;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeOption;
@@ -74,4 +75,6 @@
Collection<Patient> getPatient( PatientAttribute attribute, String value );
void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption);
+
+ Double getCalculatedPatientAttributeValue( Patient patient, PatientAttribute patientAttribute, I18nFormat format);
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java 2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/DefaultPatientAttributeValueService.java 2012-12-21 09:23:20 +0000
@@ -26,7 +26,22 @@
*/
package org.hisp.dhis.patientattributevalue;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT_ATTRIBUTE;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT_PROGRAM_STAGE_PROPERTY;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PATIENT_PROPERTY;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_PROPERTY;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_STAGE_PROPERTY;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_PROPERTY_INCIDENT_DATE;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.OBJECT_PROGRAM_PROPERTY_ENROLLEMENT_DATE;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.SEPARATOR_ID;
+import static org.hisp.dhis.caseaggregation.CaseAggregationCondition.SEPARATOR_OBJECT;
+
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -34,10 +49,19 @@
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeOption;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.nfunk.jep.JEP;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -48,6 +72,14 @@
public class DefaultPatientAttributeValueService
implements PatientAttributeValueService
{
+ private final String CURRENT_DATE = "current_date";
+
+ private final String regExp = "\\[(" + CURRENT_DATE + "|" + OBJECT_PATIENT + "|" + OBJECT_PROGRAM + "|" + OBJECT_PROGRAM_STAGE + "|"
+ + OBJECT_PROGRAM_STAGE_PROPERTY + "|" + OBJECT_PATIENT_PROGRAM_STAGE_PROPERTY + "|"
+ + OBJECT_PROGRAM_STAGE_DATAELEMENT + "|" + OBJECT_PATIENT_ATTRIBUTE + "|" + OBJECT_PATIENT_PROPERTY + "|"
+ + OBJECT_PROGRAM_PROPERTY + ")" + SEPARATOR_OBJECT + "([0-9]+[" + SEPARATOR_ID + "[a-zA-Z0-9]*]*)" + "\\]";
+
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -59,6 +91,27 @@
this.patientAttributeValueStore = patientAttributeValueStore;
}
+ private PatientAttributeService patientAttributeService;
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private ProgramInstanceService programInstanceService;
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
// -------------------------------------------------------------------------
// Implementation methods
// -------------------------------------------------------------------------
@@ -197,8 +250,8 @@
for ( PatientAttributeValue patientAttributeValue : getPatientAttributeValues( source ) )
{
- PatientAttributeValue attributeValue = new PatientAttributeValue( patientAttributeValue
- .getPatientAttribute(), destination, patientAttributeValue.getValue() );
+ PatientAttributeValue attributeValue = new PatientAttributeValue(
+ patientAttributeValue.getPatientAttribute(), destination, patientAttributeValue.getValue() );
savePatientAttributeValue( attributeValue );
}
@@ -213,9 +266,97 @@
{
return patientAttributeValueStore.getPatient( attribute, value );
}
-
+
public void updatePatientAttributeValues( PatientAttributeOption patientAttributeOption )
{
patientAttributeValueStore.updatePatientAttributeValues( patientAttributeOption );
}
+
+ public Double getCalculatedPatientAttributeValue( Patient patient, PatientAttribute patientAttribute,
+ I18nFormat format )
+ {
+ StringBuffer result = new StringBuffer();
+
+ String expression = patientAttribute.getExpression();
+
+ Pattern patternCondition = Pattern.compile( regExp );
+
+ Matcher matcher = patternCondition.matcher( expression );
+
+ Date currentDate = new Date();
+
+ while ( matcher.find() )
+ {
+ String match = matcher.group();
+ match = match.replaceAll( "[\\[\\]]", "" );
+ String property = matcher.group( 1 );
+ if ( CURRENT_DATE.equals( property ) )
+ {
+ matcher.appendReplacement( result, "0" );
+ }
+ else
+ {
+ String[] infor = matcher.group( 2 ).split( SEPARATOR_ID );
+ int id = Integer.parseInt( infor[0] );
+
+ if ( property.equalsIgnoreCase( OBJECT_PATIENT_ATTRIBUTE ) )
+ {
+ PatientAttribute attribute = patientAttributeService.getPatientAttribute( id );
+ PatientAttributeValue attributeValue = patientAttributeValueStore.get( patient, attribute );
+
+ if ( PatientAttribute.TYPE_INT.equals( attributeValue.getPatientAttribute().getValueType() ) )
+ {
+ matcher.appendReplacement( result, attributeValue.getValue() );
+ }
+ else if ( PatientAttribute.TYPE_DATE.equals( attributeValue.getPatientAttribute().getValueType() ) )
+ {
+ matcher.appendReplacement( result,
+ getDays( currentDate, format.parseDate( attributeValue.getValue() ) ) + "" );
+ }
+ }
+ else if ( property.equalsIgnoreCase( OBJECT_PATIENT_PROPERTY ) )
+ {
+ matcher.appendReplacement( result, getDays( currentDate, patient.getBirthDate() ) + "" );
+ }
+ else if ( property.equalsIgnoreCase( OBJECT_PROGRAM ) )
+ {
+ Program program = programService.getProgram( id );
+ Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient,
+ program, false );
+
+ Date value = null;
+ if ( programInstances != null && programInstances.size() > 0)
+ {
+ ProgramInstance programInstance = programInstances.iterator().next();
+ String propProgram = infor[1];
+ if ( OBJECT_PROGRAM_PROPERTY_INCIDENT_DATE.equals( propProgram ) )
+ {
+ value = programInstance.getDateOfIncident();
+ }
+ else if ( OBJECT_PROGRAM_PROPERTY_ENROLLEMENT_DATE.equals( propProgram ) )
+ {
+ value = programInstance.getEnrollmentDate();
+ }
+ }
+ else
+ {
+ return 0.0;
+ }
+ matcher.appendReplacement( result, getDays( currentDate, value ) + "" );
+ }
+ }
+ }
+
+ final JEP parser = new JEP();
+
+ parser.parseExpression( result.toString() );
+
+ return parser.getValue();
+ }
+
+ private long getDays( Date currentDate, Date dateValue )
+ {
+ long interval = currentDate.getTime() - dateValue.getTime();
+ return (-interval / 86400000);
+ }
}
=== 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 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-12-21 09:23:20 +0000
@@ -265,6 +265,12 @@
class="org.hisp.dhis.patientattributevalue.DefaultPatientAttributeValueService">
<property name="patientAttributeValueStore"
ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueStore" />
+ <property name="patientAttributeService"
+ ref="org.hisp.dhis.patient.PatientAttributeService" />
+ <property name="programService"
+ ref="org.hisp.dhis.program.ProgramService" />
+ <property name="programInstanceService"
+ ref="org.hisp.dhis.program.ProgramInstanceService" />
</bean>
<bean id="org.hisp.dhis.patient.PatientAttributeOptionService"
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientAttribute.hbm.xml 2012-12-21 09:23:20 +0000
@@ -31,6 +31,8 @@
</set>
<property name="inherit" column="inherit"/>
+
+ <property name="expression" column="expression"/>
</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 2012-12-18 05:57:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2012-12-21 09:23:20 +0000
@@ -29,10 +29,15 @@
import java.util.Collection;
import java.util.Date;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
+import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
import org.hisp.dhis.patient.PatientAudit;
import org.hisp.dhis.patient.PatientAuditService;
import org.hisp.dhis.patient.PatientIdentifier;
@@ -71,6 +76,10 @@
private CurrentUserService currentUserService;
+ private PatientAttributeService patientAttributeService;
+
+ private I18nFormat format;
+
// -------------------------------------------------------------------------
// Input && Output
// -------------------------------------------------------------------------
@@ -91,6 +100,8 @@
private Collection<PatientAudit> patientAudits;
+ private Map<String, Double> calAttributeValueMap = new HashMap<String, Double>();
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -100,6 +111,26 @@
this.patientAuditService = patientAuditService;
}
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ public void setAttributeValues( Collection<PatientAttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
+ public void setActiveProgramInstances( Collection<ProgramInstance> activeProgramInstances )
+ {
+ this.activeProgramInstances = activeProgramInstances;
+ }
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
{
this.patientAttributeValueService = patientAttributeValueService;
@@ -110,6 +141,11 @@
this.currentUserService = currentUserService;
}
+ public Map<String, Double> getCalAttributeValueMap()
+ {
+ return calAttributeValueMap;
+ }
+
public Collection<ProgramInstance> getActiveProgramInstances()
{
return activeProgramInstances;
@@ -179,6 +215,14 @@
attributeValues = patientAttributeValueService.getPatientAttributeValues( patient );
+ Collection<PatientAttribute> calAttributes = patientAttributeService.getPatientAttributesByValueType(PatientAttribute.TYPE_CALCULATED);
+
+ for( PatientAttribute calAttribute : calAttributes )
+ {
+ Double value = patientAttributeValueService.getCalculatedPatientAttributeValue( patient, calAttribute, format );
+ calAttributeValueMap.put( calAttribute.getName(), value );
+ }
+
relationship = relationshipService.getRelationshipsForPatient( patient );
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient );
@@ -219,5 +263,4 @@
return SUCCESS;
}
-
}
=== 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 2012-12-17 13:13:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-12-21 09:23:20 +0000
@@ -979,6 +979,7 @@
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="patientAuditService" ref="org.hisp.dhis.patient.PatientAuditService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
</bean>
<!-- Comment -->
=== 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 2012-12-20 07:35:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2012-12-21 09:23:20 +0000
@@ -62,6 +62,12 @@
<td>$identifier.identifier</td>
</tr>
#end
+ #foreach( $attributeName in $calAttributeValueMap.keySet() )
+ <tr>
+ <td>$attributeName</td>
+ <td>$calAttributeValueMap.get($attributeName)</td>
+ </tr>
+ #end
#foreach( $attributeValue in $attributeValues )
<tr>
<td>$attributeValue.patientAttribute.name</td>
@@ -72,8 +78,6 @@
#else
$i18n.getString("no")
#end
- #elseif($attributeValue.patientAttribute.valueType=='DATE')
- $format.formatDate( $attributeValue.value )
#else
$encoder.htmlEncode($attributeValue.value)
#end
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm 2012-10-23 04:48:39 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonPatientAttribute.vm 2012-12-21 09:23:20 +0000
@@ -5,6 +5,7 @@
"description": "$!encoder.jsonEncode( ${patientAttribute.description} )",
"mandatory": "$!{patientAttribute.mandatory}",
"valueType": "$!patientAttribute.valueType",
- "inherit": "$!patientAttribute.inherit"
+ "inherit": "$!patientAttribute.inherit",
+ "expression": "$!patientAttribute.expression"
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2012-12-21 09:23:20 +0000
@@ -60,7 +60,7 @@
{
this.patientAttributeOptionService = patientAttributeOptionService;
}
-
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -101,12 +101,19 @@
}
private Boolean inherit;
-
+
public void setInherit( Boolean inherit )
{
this.inherit = inherit;
}
-
+
+ private String expression;
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -119,13 +126,14 @@
patientAttribute.setName( name );
patientAttribute.setDescription( description );
patientAttribute.setValueType( valueType );
-
+ patientAttribute.setExpression( expression );
+
mandatory = (mandatory == null) ? false : true;
patientAttribute.setMandatory( mandatory );
-
+
inherit = (inherit == null) ? false : true;
patientAttribute.setInherit( inherit );
-
+
patientAttributeService.savePatientAttribute( patientAttribute );
if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetCalPatientAttributeParamsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetCalPatientAttributeParamsAction.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/patientattribute/GetCalPatientAttributeParamsAction.java 2012-12-21 09:23:20 +0000
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2004-2009, 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.patientattribute;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version GetCalPatientAttributeParamsAction.java 2:35:22 PM Dec 21, 2012 $
+ */
+public class GetCalPatientAttributeParamsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private PatientAttributeService patientAttributeService;
+
+ public void setPatientAttributeService( PatientAttributeService patientAttributeService )
+ {
+ this.patientAttributeService = patientAttributeService;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<Program> programs = new ArrayList<Program>();
+
+ public Collection<Program> getPrograms()
+ {
+ return programs;
+ }
+
+ private Collection<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
+
+ public Collection<PatientAttribute> getPatientAttributes()
+ {
+ return patientAttributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ programs = programService.getAllPrograms();
+ programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+
+ patientAttributes = patientAttributeService.getAllPatientAttributes();
+ patientAttributes.removeAll( patientAttributeService
+ .getPatientAttributesByValueType( PatientAttribute.TYPE_CALCULATED ) );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2012-12-21 09:23:20 +0000
@@ -129,6 +129,13 @@
this.inherit = inherit;
}
+ private String expression;
+
+ public void setExpression( String expression )
+ {
+ this.expression = expression;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -141,10 +148,11 @@
patientAttribute.setName( name );
patientAttribute.setDescription( description );
patientAttribute.setValueType( valueType );
+ patientAttribute.setExpression( expression );
mandatory = (mandatory == null) ? false : true;
patientAttribute.setMandatory( mandatory );
-
+
inherit = (inherit == null) ? false : true;
patientAttribute.setInherit( inherit );
=== 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 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-12-21 09:23:20 +0000
@@ -151,6 +151,15 @@
ref="org.hisp.dhis.patient.PatientAttributeService" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
</bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.patientattribute.GetCalPatientAttributeParamsAction"
+ class="org.hisp.dhis.patient.action.patientattribute.GetCalPatientAttributeParamsAction"
+ scope="prototype">
+ <property name="patientAttributeService"
+ ref="org.hisp.dhis.patient.PatientAttributeService" />
+ <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+ </bean>
<!-- Program -->
=== 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 2012-12-14 08:30:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-12-21 09:23:20 +0000
@@ -323,4 +323,7 @@
expression_not_null = Expression is not null
complete_allowed_only_if_validation_passes = Complete allowed only if validation passes
ignore_to_generate_overdue_events = Ignore to generate overdue events
-display_generate_event_box_after_completed = Display generate event box after completed
\ No newline at end of file
+display_generate_event_box_after_completed = Display generate event box after completed
+calculated = Calculated
+enrollment_date = Enrollment date
+incident_date = Incident date
\ 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 2012-11-12 07:04:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-12-21 09:23:20 +0000
@@ -120,7 +120,7 @@
</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
-
+
<action name="removePatientAttribute"
class="org.hisp.dhis.patient.action.patientattribute.RemovePatientAttributeAction">
<result name="success" type="velocity-json">
@@ -191,6 +191,14 @@
<param name="requiredAuthorities">F_PATIENTATTRIBUTE_DELETE</param>
</action>
+ <action name="getCalPatientAttributeParams"
+ class="org.hisp.dhis.patient.action.patientattribute.GetCalPatientAttributeParamsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-patient/jsonCalPatientAttributeParams.vm
+ </result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<!-- Program -->
<action name="program"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2012-12-21 09:23:20 +0000
@@ -46,18 +46,42 @@
<option value="YES/NO">$i18n.getString( "yes_no" )</option>
<option value="DATE">$i18n.getString( "date" )</option>
<option value="COMBO">$i18n.getString( "attribute_combo_type" )</option>
+ <option value="CALCULATED">$i18n.getString( "calculated" )</option>
</select>
</td>
<td></td>
</tr>
<tr id="attributeComboRow">
<td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
- </td>
- <td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
+ <td><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
+ </td>
+ <td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
+ </tr>
+
+ <tr id="calculatedAttrTR" class="hidden">
+ <td>$i18n.getString( "params" )</td>
+ <td>
+ <select multiple id="availableAttribute" name="availableAttribute" ondblclick="insertTextCommon( 'expression', this.value);getConditionDescription();"></select>
+ </td>
+ </tr>
+ <tr id="expressionTR" class="hidden">
+ <td>$i18n.getString( "expression" )</td>
+ <td>
+ <textarea id="expression" name="expression" style="width:320px;" onkeyup='getConditionDescription();'></textarea>
+ </td>
+ </tr>
+ <tr id="descriptionTR" class="hidden">
+ <td></td>
+ <td>
+ <fieldset>
+ <legend>$i18n.getString( "description" )</legend>
+ <div id='expDescription' style="width:320px;">$!description</div>
+ </fieldset>
+ </td>
</tr>
</tbody>
+
<tr>
<td></td>
<td>
@@ -73,5 +97,9 @@
<script type="text/javascript">
var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+ var i18n_current_date = '$encoder.jsEscape( $i18n.getString( "current_date" ) , "'") ';
+ var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'") ';
+ var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'") ';
+ var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollment_date" ) , "'") ';
var isSubmit = true;
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js 2012-03-19 09:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js 2012-12-21 09:23:20 +0000
@@ -16,6 +16,6 @@
});
jQuery("#attributeComboRow").hide();
-
+
checkValueIsExist( "name", "validatePatientAttribute.action");
});
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js 2012-12-21 09:23:20 +0000
@@ -13,6 +13,7 @@
var inherit = ( json.patientAttribute.inherit == 'true') ? i18n_yes : i18n_no;
setInnerHTML( 'inheritField', inherit );
setInnerHTML( 'valueTypeField', json.patientAttribute.valueType );
+ setInnerHTML( 'expressionField', json.patientAttribute.expression );
showDetails();
});
@@ -32,15 +33,50 @@
{
if ( jQuery(this_).val() == "COMBO" )
{
- jQuery("#attributeComboRow").show();
+ hideById("calculatedAttrTR");
+ hideById("expressionTR");
+ showById("attributeComboRow");
if( jQuery("#attrOptionContainer").find("input").length ==0 )
{
ATTRIBUTE_OPTION.addOption();
ATTRIBUTE_OPTION.addOption();
}
- }else {
- jQuery("#attributeComboRow").hide();
- }
+ }
+ else if (jQuery(this_).val() == "CALCULATED"){
+ if( jQuery("#availableAttribute option").length == 0 )
+ {
+ jQuery.getJSON( 'getCalPatientAttributeParams.action', { },
+ function ( json ) {
+ var patientAttributes = jQuery("#availableAttribute");
+ patientAttributes.append( "<option value='[current_date:0]' title='" + i18n_current_date + "'>" + i18n_current_date + "</option>" );
+ patientAttributes.append( "<option value='[CP:0]' title='" + i18n_date_of_birth + "'>" + i18n_date_of_birth + "</option>" );
+ for ( i in json.programs )
+ {
+ var id = "[PG:" + json.programs[i].id + ".dateOfIncident]";
+ patientAttributes.append( "<option value='" + id + "' title='" + json.programs[i].name + "( " + i18n_incident_date + " )" + "'>" + json.programs[i].name + "( " + i18n_incident_date + " )" + "</option>" );
+ var id = "[PG:" + json.programs[i].id + ".enrollmentDate]";
+ patientAttributes.append( "<option value='" + id + "' title='" + json.programs[i].name + "( " + i18n_enrollment_date + " )" + "'>" + json.programs[i].name + "( " + i18n_enrollment_date + " )" + "</option>" );
+ }
+ for ( i in json.patientAttributes )
+ {
+ var id = "[CA:" + json.patientAttributes[i].id + "]";
+ patientAttributes.append( "<option value='" + id + "' title='" + json.patientAttributes[i].name + "'>" + json.patientAttributes[i].name + "</option>" );
+ }
+ });
+ }
+ hideById("attributeComboRow");
+ showById("calculatedAttrTR");
+ showById("expressionTR");
+ showById("descriptionTR");
+ }
+ else
+ {
+ hideById("attributeComboRow");
+ hideById("calculatedAttrTR");
+ hideById("expressionTR");
+ hideById("descriptionTR");
+ }
+
},
checkOnSubmit : function ()
{
@@ -92,4 +128,15 @@
{
return "<tr><td><input type='text' name='attrOptions' /><a href='#' style='text-decoration: none; margin-left:0.5em;' title='"+i18n_remove_option+"' onClick='ATTRIBUTE_OPTION.remove(this,null)'>[ - ]</a></td></tr>";
}
+}
+
+function getConditionDescription()
+{
+ $.postUTF8( 'getCaseAggregationDescription.action',
+ {
+ condition:getFieldValue('expression')
+ },function(html)
+ {
+ setInnerHTML('expDescription', html);
+ });
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.js 2012-03-19 09:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.js 2012-12-21 09:23:20 +0000
@@ -15,5 +15,10 @@
});
});
+ ATTRIBUTE_OPTION.selectValueType(byId("valueType"));
+ if( getFieldValue('expression') != "" ){
+ getConditionDescription();
+ }
+
checkValueIsExist( "name", "validatePatientAttribute.action", {id:getFieldValue('id')});
});
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonCalPatientAttributeParams.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/jsonCalPatientAttributeParams.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/jsonCalPatientAttributeParams.vm 2012-12-21 09:23:20 +0000
@@ -0,0 +1,19 @@
+#set( $size = $!{patientAttributes.size()} )
+{ "patientAttributeParams": [
+ #foreach( $patientAttribute in $!{patientAttributes} )
+ {
+ "id": "$patientAttribute.id",
+ "name": "$!encoder.jsonEncode( ${patientAttribute.name} )"
+ }#if( $velocityCount < $size ),#end
+ #end
+ ],
+ #set( $size = $!{programs.size()} )
+ "programs":[
+ #foreach( $program in $programs )
+ {
+ "id": "$program.id",
+ "name": "$!encoder.jsonEncode( ${program.name} )"
+ }#if( $velocityCount < $size ),#end
+ #end
+ ]
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttribute.vm 2012-12-21 09:23:20 +0000
@@ -60,6 +60,7 @@
<p><label class="bold">$i18n.getString( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
<p><label class="bold">$i18n.getString( "inherit" ):</label><br><span id="inheritField"></span></p>
<p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
+ <p><label class="bold">$i18n.getString( "expression" ):</label><br><span id="expressionField"></span></p>
</div>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2012-09-23 09:30:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2012-12-21 09:23:20 +0000
@@ -49,6 +49,7 @@
<option value="YES/NO" #if( $patientAttribute.valueType == 'YES/NO' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
<option value="DATE" #if( $patientAttribute.valueType == 'DATE' ) selected="selected" #end>$i18n.getString( "date" )</option>
<option value="COMBO" #if( $patientAttribute.valueType == 'COMBO' ) selected="selected" #end>$i18n.getString( "attribute_combo_type" )</option>
+ <option value="CALCULATED" #if( $patientAttribute.valueType == 'CALCULATED' ) selected="selected" #end>$i18n.getString( "calculated" )</option>
</select>
</td>
</tr>
@@ -67,6 +68,27 @@
<td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
</tr>
+ <tr id="calculatedAttrTR">
+ <td>$i18n.getString( "params" )</td>
+ <td>
+ <select multiple id="availableAttribute" name="availableAttribute" ondblclick="insertTextCommon( 'expression', this.value);getConditionDescription();" ></select>
+ </td>
+ </tr>
+ <tr id="expressionTR" >
+ <td>$i18n.getString( "expression" )</td>
+ <td>
+ <textarea id="expression" name="expression" onkeyup='getConditionDescription();' style="width:320px;" >$!patientAttribute.expression</textarea>
+ </td>
+ </tr>
+ <tr id="descriptionTR">
+ <td></td>
+ <td>
+ <fieldset>
+ <legend>$i18n.getString( "description" )</legend>
+ <div id='expDescription' style="width:320px;">$!description</div>
+ </fieldset>
+ </td>
+ </tr>
</tbody>
<tr>
@@ -80,16 +102,12 @@
</form>
<script>
- if( jQuery('#valueType').val() == "COMBO")
- {
- jQuery("#attributeComboRow").show();
- }else
- {
- jQuery("#attributeComboRow").hide();
- }
-
var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
var i118_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+ var i18n_current_date = '$encoder.jsEscape( $i18n.getString( "current_date" ) , "'") ';
+ var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'") ';
+ var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'") ';
+ var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollment_date" ) , "'") ';
var isSubmit = true;
</script>