=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java 2011-01-07 11:37:47 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java 2011-01-12 02:26:26 +0000 @@ -59,4 +59,5 @@ Collection getPatientDataValues( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit, Period period ); + String getConditionDescription( String condition ); } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2011-01-07 11:37:47 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java 2011-01-12 02:26:26 +0000 @@ -44,7 +44,9 @@ import java.util.regex.Pattern; import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategory; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.patient.Patient; @@ -52,6 +54,8 @@ import org.hisp.dhis.patientdatavalue.PatientDataValue; import org.hisp.dhis.patientdatavalue.PatientDataValueService; import org.hisp.dhis.period.Period; +import org.hisp.dhis.program.ProgramStage; +import org.hisp.dhis.program.ProgramStageService; import org.hisp.dhis.system.util.DateUtils; import org.nfunk.jep.JEP; import org.springframework.transaction.annotation.Transactional; @@ -83,6 +87,10 @@ private PatientDataValueService dataValueService; + private ProgramStageService programStageService; + + private DataElementCategoryService categoryService; + // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -92,6 +100,16 @@ this.aggregationConditionStore = aggregationConditionStore; } + public void setProgramStageService( ProgramStageService programStageService ) + { + this.programStageService = programStageService; + } + + public void setCategoryService( DataElementCategoryService categoryService ) + { + this.categoryService = categoryService; + } + public void setDataElementService( DataElementService dataElementService ) { this.dataElementService = dataElementService; @@ -154,7 +172,7 @@ Period period ) { String sql = createSQL( aggregationCondition, orgunit, period ); - + Collection patientIds = aggregationConditionStore.executeSQL( sql ); return calValue( patientIds, aggregationCondition.getOperator() ); @@ -168,7 +186,7 @@ String sql = createSQL( aggregationCondition, orgunit, period ); - Collection dataElements = getDataElementsInExpression( aggregationCondition + Collection dataElements = getDataElementsInCondition( aggregationCondition .getAggregationExpression() ); Collection patientIds = aggregationConditionStore.executeSQL( sql ); @@ -186,6 +204,47 @@ return result; } + public String getConditionDescription( String condition ) + { + StringBuffer decription = new StringBuffer(); + + String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "[0-9]+" + SEPARATOR_ID + + "[0-9]+" + SEPARATOR_ID + "[0-9]+" + "\\]"; + + // --------------------------------------------------------------------- + // parse expressions + // --------------------------------------------------------------------- + + Pattern pattern = Pattern.compile( regExp ); + + Matcher matcher = pattern.matcher( condition ); + + while ( matcher.find() ) + { + String match = matcher.group(); + match = match.replaceAll( "[\\[\\]]", "" ); + + String[] info = match.split( SEPARATOR_OBJECT ); + String[] ids = info[1].split( SEPARATOR_ID ); + + int programStageId = Integer.parseInt( ids[0] ); + ProgramStage programStage = programStageService.getProgramStage( programStageId ); + + int dataElementId = Integer.parseInt( ids[1] ); + DataElement dataElement = dataElementService.getDataElement( dataElementId ); + + int categoryOptionId = Integer.parseInt( ids[2] ); + DataElementCategory category = categoryService.getDataElementCategory( categoryOptionId ); + + matcher.appendReplacement( decription, "[" + programStage.getName() + SEPARATOR_ID + + dataElement.getName() + SEPARATOR_ID + category.getName() + "]" ); + } + + matcher.appendTail( decription ); + + return decription.toString(); + } + // ------------------------------------------------------------------------- // Support Methods // ------------------------------------------------------------------------- @@ -316,7 +375,7 @@ } - private Collection getDataElementsInExpression( String aggregationExpression ) + private Collection getDataElementsInCondition( String aggregationExpression ) { String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "[0-9]+" + SEPARATOR_ID + "[0-9]+" + SEPARATOR_ID + "[0-9]+" + "\\]"; === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggConditionDescriptionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggConditionDescriptionAction.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/caseaggregation/GetAggConditionDescriptionAction.java 2011-01-12 02:26:26 +0000 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2004-2010, 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.caseaggregation; + +import org.hisp.dhis.caseaggregation.CaseAggregationConditionService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $ID : GetAggConditionDescriptionAction.java Jan 11, 2011 9:14:19 PM + * $ + */ +public class GetAggConditionDescriptionAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependency + // ------------------------------------------------------------------------- + + private CaseAggregationConditionService aggregationConditionService; + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + private String condition; + + private String description; + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService ) + { + this.aggregationConditionService = aggregationConditionService; + } + + public String getDescription() + { + return description; + } + + public void setCondition( String condition ) + { + this.condition = condition; + } + + // ------------------------------------------------------------------------- + // Implementation Action + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + description = aggregationConditionService.getConditionDescription( condition ); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggDataElementsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggDataElementsAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggDataElementsAction.java 2011-01-12 02:26:26 +0000 @@ -97,7 +97,7 @@ dataElementList = new ArrayList( dataElementService.getDataElementGroup( dataElementGroupId ) .getMembers() ); - + Iterator deIterator = dataElementList.iterator(); while ( deIterator.hasNext() ) @@ -108,6 +108,7 @@ { deIterator.remove(); } + } if ( dataElementList != null && !dataElementList.isEmpty() ) === 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 2011-01-11 10:06:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2011-01-12 02:26:26 +0000 @@ -1118,6 +1118,15 @@ + + + + + + plainTextError + + + /dhis-web-maintenance-patient/responseCaseAggDescription.vm + plainTextError + + - + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm 2011-01-11 07:06:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm 2011-01-12 02:26:26 +0000 @@ -57,7 +57,7 @@ - + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm 2011-01-11 16:52:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/index.vm 2011-01-12 02:26:26 +0000 @@ -1,7 +1,7 @@

$i18n.getString( "dhis-web-maintenance-patient" )

-
    +
      #introListImgItem( "patient.action" "patient" "patient" ) #introListImgItem( "patientAttribute.action" "patient_attribute" "patient" ) #introListImgItem( "patientAttributeGroup.action" "patient_attribute_group" "patient" ) @@ -11,7 +11,7 @@ #introListImgItem( "programAttribute.action" "program_attribute" "program" ) #introListImgItem( "caseAggregation.action" "case_aggregation_mapping" "caseaggregationmapping" ) #introListImgItem( "validationCriteria.action" "validation_criteria" "validationcriteria" ) - #introListImgItem( "patientMobileSetting.action" "patient_mobile_setting" "systemsettings" ) + #introListImgItem( "patientMobileSetting.action" "patientMobileSetting" "systemsettings" ) #introListImgItem( "configuration.action" "configuration" "systemsettings" ) #introListImgItem( "importPatientForm.action" "import_data" "excel" )
    \ 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/commons.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js 2011-01-11 01:56:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js 2011-01-12 02:26:26 +0000 @@ -55,4 +55,17 @@ function showSearchPatients() { tb_show( i18n_child_representative, "#TB_inline?height=350&width=580&inlineId=searchResults",null); +} + +function isDeathOnChange() +{ + var isDeath = byId('isDead').checked; + if(isDeath) + { + showById('deathDateTR'); + } + else + { + hideById('deathDateTR'); + } } \ 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/underAgeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm 2011-01-11 07:06:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm 2011-01-12 02:26:26 +0000 @@ -166,7 +166,7 @@ - + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm 2011-01-11 07:06:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm 2011-01-12 02:26:26 +0000 @@ -12,7 +12,8 @@ jQuery(document).ready( function(){ - datePickerValid( 'birthDate' ); + datePickerValid( 'birthDate' ); + datePickerValid( 'deathDate' ); jQuery("#btnRepresentativeInfo").cluetip({local:"#representativeInfo"}); jQuery("#updatePatientForm").validate({ @@ -97,9 +98,8 @@ - + - @@ -112,7 +112,6 @@ - @@ -142,10 +141,29 @@ $i18n.getString("is_underage") - + + + + + + $i18n.getString("is_dead") + + + + + + + + + + + + +   + #if($patient.underAge) #set( $representative = $patient.representative ) @@ -333,4 +351,5 @@ var i18n_please_select_relationshipType = '$encoder.jsEscape( $i18n.getString( "please_verify_birthday" ) , "'")'; alert(i18n_please_select_relationshipType); } + \ No newline at end of file