=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-10-23 15:14:18 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-11-08 02:58:24 +0000 @@ -28,10 +28,7 @@ package org.hisp.dhis.caseentry.action.report; import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_DATA_ELEMENT; -import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_FIXED_ATTRIBUTE; -import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_IDENTIFIER_TYPE; import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_NUMBER_DATA_ELEMENT; -import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE; import static org.hisp.dhis.patientreport.PatientTabularReport.VALUE_TYPE_OPTION_SET; import java.util.ArrayList; @@ -52,11 +49,6 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.paging.ActionPagingSupport; -import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeOption; -import org.hisp.dhis.patient.PatientAttributeService; -import org.hisp.dhis.patient.PatientIdentifierType; -import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patientreport.TabularReportColumn; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.program.ProgramStageInstance; @@ -104,20 +96,6 @@ this.programStageInstanceService = programStageInstanceService; } - private PatientAttributeService patientAttributeService; - - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - - private PatientIdentifierTypeService patientIdentifierTypeService; - - public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) - { - this.patientIdentifierTypeService = patientIdentifierTypeService; - } - // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -217,21 +195,7 @@ { this.format = format; } - - private List identifierTypes = new ArrayList(); - - public List getIdentifierTypes() - { - return identifierTypes; - } - - private List patientAttributes = new ArrayList(); - - public List getPatientAttributes() - { - return patientAttributes; - } - + private List dataElements = new ArrayList(); public List getDataElements() @@ -341,9 +305,6 @@ // --------------------------------------------------------------------- ProgramStage programStage = programStageService.getProgramStage( programStageId ); - - // TODO check sql traffic - Date startValue = format.parseDate( startDate ); Date endValue = format.parseDate( endDate ); List columns = getTableColumns(); @@ -361,8 +322,7 @@ total = getNumberOfPages( totalRecords ); this.paging = createPaging( totalRecords ); - // total = paging.getTotal(); //TODO - + grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, getStartPos(), paging.getPageSize() ); } @@ -401,7 +361,7 @@ startPos = (startPos > total) ? total : startPos; return startPos; } - + private List getTableColumns() { List columns = new ArrayList(); @@ -422,29 +382,7 @@ column.setHidden( Boolean.parseBoolean( values[2] ) ); column.setQuery( values.length == 4 ? TextUtils.lower( values[3] ) : null ); - if ( PREFIX_FIXED_ATTRIBUTE.equals( prefix ) ) - { - column.setName( values[1] ); - } - else if ( PREFIX_IDENTIFIER_TYPE.equals( prefix ) ) - { - PatientIdentifierType identifierType = patientIdentifierTypeService - .getPatientIdentifierType( column.getIdentifierAsInt() ); - - column.setName( identifierType.getName() ); - } - else if ( PREFIX_PATIENT_ATTRIBUTE.equals( prefix ) ) - { - int objectId = Integer.parseInt( values[1] ); - PatientAttribute attribute = patientAttributeService.getPatientAttribute( objectId ); - patientAttributes.add( attribute ); - - valueTypes.add( attribute.getValueType() ); - mapSuggestedValues.put( index, getSuggestedAttributeValues( attribute ) ); - - column.setName( attribute.getName() ); - } - else if ( PREFIX_DATA_ELEMENT.equals( prefix ) ) + if ( PREFIX_DATA_ELEMENT.equals( prefix ) ) { int objectId = Integer.parseInt( values[1] ); DataElement dataElement = dataElementService.getDataElement( objectId ); @@ -459,7 +397,7 @@ valueTypes.add( valueType ); mapSuggestedValues.put( index, getSuggestedDataElementValues( dataElement ) ); - column.setName( dataElement.getName() ); + column.setName( dataElement.getFormNameFallback() ); } columns.add( column ); @@ -471,27 +409,6 @@ return columns; } - private List getSuggestedAttributeValues( PatientAttribute patientAttribute ) - { - List values = new ArrayList(); - String valueType = patientAttribute.getValueType(); - - if ( valueType.equals( PatientAttribute.TYPE_BOOL ) ) - { - values.add( i18n.getString( "yes" ) ); - values.add( i18n.getString( "no" ) ); - } - else if ( valueType.equals( PatientAttribute.TYPE_COMBO ) ) - { - for ( PatientAttributeOption attributeOption : patientAttribute.getAttributeOptions() ) - { - values.add( attributeOption.getName() ); - } - } - - return values; - } - private List getSuggestedDataElementValues( DataElement dataElement ) { List values = new ArrayList(); === 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-11-07 15:43:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-11-08 02:58:24 +0000 @@ -843,10 +843,6 @@ - -