=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2013-08-29 09:34:09 +0000 @@ -38,6 +38,7 @@ import org.hisp.dhis.common.view.DetailedView; import org.hisp.dhis.common.view.ExportView; import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.user.User; @@ -60,44 +61,45 @@ private static final long serialVersionUID = -2880334669266185058L; public static String PREFIX_EXECUTION_DATE = "executiondate"; + public static String PREFIX_ORGUNIT = "orgunit"; + public static String PREFIX_META_DATA = "meta"; + public static String PREFIX_IDENTIFIER_TYPE = "iden"; + public static String PREFIX_FIXED_ATTRIBUTE = "fixedAttr"; + public static String PREFIX_PATIENT_ATTRIBUTE = "attr"; + public static String PREFIX_DATA_ELEMENT = "de"; + public static String PREFIX_NUMBER_DATA_ELEMENT = "numberDe"; public static String VALUE_TYPE_OPTION_SET = "optionSet"; + private Program program; + + private ProgramStage programStage; + private Date startDate; private Date endDate; - private ProgramStage programStage; - private Set organisationUnits; + private List items = new ArrayList(); + + private String sortByAsc; + + private String sortByDesc; + + private User user; + private int level; - private boolean sortedOrgunitAsc; - private String facilityLB; - private User user; - - private Boolean useCompletedEvents; - - private Boolean userOrganisationUnit; - - private Boolean userOrganisationUnitChildren; - - private List filterValues = new ArrayList(); - - private Boolean displayOrgunitCode; - - private Boolean useFormNameDataElement; - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -114,9 +116,9 @@ // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- - + @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getStartDate() { @@ -129,20 +131,7 @@ } @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Boolean getUseFormNameDataElement() - { - return useFormNameDataElement; - } - - public void setUseFormNameDataElement( Boolean useFormNameDataElement ) - { - this.useFormNameDataElement = useFormNameDataElement; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Date getEndDate() { @@ -170,21 +159,90 @@ } @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlElementWrapper( localName = "filterValues", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty( localName = "filterValue", namespace = DxfNamespaces.DXF_2_0) - public List getFilterValues() - { - return filterValues; - } - - public void setFilterValues( List filterValues ) - { - this.filterValues = filterValues; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "items", namespace = DxfNamespaces.DXF_2_0 ) + public List getItems() + { + return items; + } + + public void setItems( List items ) + { + this.items = items; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Program getProgram() + { + return program; + } + + public void setProgram( Program program ) + { + this.program = program; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getSortByAsc() + { + return sortByAsc; + } + + public void setSortByAsc( String sortByAsc ) + { + this.sortByAsc = sortByAsc; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getSortByDesc() + { + return sortByDesc; + } + + public void setSortByDesc( String sortByDesc ) + { + this.sortByDesc = sortByDesc; + } + + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlElementWrapper( localName = "users", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "user", namespace = DxfNamespaces.DXF_2_0 ) + public User getUser() + { + return user; + } + + public void setUser( User user ) + { + this.user = user; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlElementWrapper( localName = "programStages", namespace = DxfNamespaces.DXF_2_0 ) + @JacksonXmlProperty( localName = "programStage", namespace = DxfNamespaces.DXF_2_0 ) + public ProgramStage getProgramStage() + { + return programStage; + } + + public void setProgramStage( ProgramStage programStage ) + { + this.programStage = programStage; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public int getLevel() { @@ -197,20 +255,7 @@ } @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isSortedOrgunitAsc() - { - return sortedOrgunitAsc; - } - - public void setSortedOrgunitAsc( boolean sortedOrgunitAsc ) - { - this.sortedOrgunitAsc = sortedOrgunitAsc; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) + @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getFacilityLB() { @@ -222,83 +267,4 @@ this.facilityLB = facilityLB; } - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Boolean getUserOrganisationUnit() - { - return userOrganisationUnit; - } - - public void setUserOrganisationUnit( Boolean userOrganisationUnit ) - { - this.userOrganisationUnit = userOrganisationUnit; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Boolean getUserOrganisationUnitChildren() - { - return userOrganisationUnitChildren; - } - - public void setUserOrganisationUnitChildren( Boolean userOrganisationUnitChildren ) - { - this.userOrganisationUnitChildren = userOrganisationUnitChildren; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Boolean getUseCompletedEvents() - { - return useCompletedEvents; - } - - public void setUseCompletedEvents( Boolean useCompletedEvents ) - { - this.useCompletedEvents = useCompletedEvents; - } - - @JsonProperty - @JsonView({ DetailedView.class, ExportView.class }) - @JacksonXmlElementWrapper(localName = "users", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "user", namespace = DxfNamespaces.DXF_2_0) - public User getUser() - { - return user; - } - - public void setUser( User user ) - { - this.user = user; - } - - @JsonProperty - @JsonView({ DetailedView.class, ExportView.class }) - @JacksonXmlElementWrapper(localName = "programStages", namespace = DxfNamespaces.DXF_2_0) - @JacksonXmlProperty(localName = "programStage", namespace = DxfNamespaces.DXF_2_0) - public ProgramStage getProgramStage() - { - return programStage; - } - - public void setProgramStage( ProgramStage programStage ) - { - this.programStage = programStage; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Boolean getDisplayOrgunitCode() - { - return displayOrgunitCode; - } - - public void setDisplayOrgunitCode( Boolean displayOrgunitCode ) - { - this.displayOrgunitCode = displayOrgunitCode; - } } === modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml' --- dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2013-08-21 12:29:12 +0000 +++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2013-08-29 09:34:09 +0000 @@ -6,65 +6,62 @@ > - - - - - - &identifiableProperties; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - + &identifiableProperties; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/DeleteTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/DeleteTabularReportAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/DeleteTabularReportAction.java 2013-08-29 09:34:09 +0000 @@ -56,9 +56,9 @@ // Input // ------------------------------------------------------------------------- - private Integer id; + private String id; - public void setId( Integer id ) + public void setId( String id ) { this.id = id; } @@ -71,7 +71,7 @@ public String execute() throws Exception { - PatientTabularReport tabularReport = tabularReportService.getPatientTabularReport( id ); + PatientTabularReport tabularReport = tabularReportService.getPatientTabularReportByUid( id ); tabularReportService.deletePatientTabularReport( tabularReport ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2013-08-29 09:34:09 +0000 @@ -176,41 +176,41 @@ programStage = tabularReport.getProgramStage(); - for ( String filterValue : tabularReport.getFilterValues() ) - { - String[] values = filterValue.split( "_" ); - String filter = ""; - if ( values.length == 5 ) - { - filter = values[3] + "_" + values[4].trim().substring( 1, values[4].length() - 1 ); - } - - if ( values[0].equals( PatientTabularReport.PREFIX_FIXED_ATTRIBUTE ) ) - { - selectedFixedAttributes.add( values[1] ); - fixedAttributeFilters.add( filter ); - } - else - { - int id = Integer.parseInt( values[1] ); - - if ( values[0].equals( PatientTabularReport.PREFIX_IDENTIFIER_TYPE ) ) - { - selectedIdentifierTypes.add( patientIdentifierTypeService.getPatientIdentifierType( id ) ); - identifierTypeFilters.add( filter ); - } - else if ( values[0].equals( PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE ) ) - { - selectedAttributes.add( patientAttributeService.getPatientAttribute( id ) ); - patientAttributeFilters.add( filter ); - } - else if ( values[0].equals( PatientTabularReport.PREFIX_DATA_ELEMENT ) ) - { - selectedDataElements.add( dataElementService.getDataElement( id ) ); - dataelementFilters.add( filter ); - } - } - } +// for ( String filterValue : tabularReport.getItems() ) +// { +// String[] values = filterValue.split( "_" ); +// String filter = ""; +// if ( values.length == 5 ) +// { +// filter = values[3] + "_" + values[4].trim().substring( 1, values[4].length() - 1 ); +// } +// +// if ( values[0].equals( PatientTabularReport.PREFIX_FIXED_ATTRIBUTE ) ) +// { +// selectedFixedAttributes.add( values[1] ); +// fixedAttributeFilters.add( filter ); +// } +// else +// { +// int id = Integer.parseInt( values[1] ); +// +// if ( values[0].equals( PatientTabularReport.PREFIX_IDENTIFIER_TYPE ) ) +// { +// selectedIdentifierTypes.add( patientIdentifierTypeService.getPatientIdentifierType( id ) ); +// identifierTypeFilters.add( filter ); +// } +// else if ( values[0].equals( PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE ) ) +// { +// selectedAttributes.add( patientAttributeService.getPatientAttribute( id ) ); +// patientAttributeFilters.add( filter ); +// } +// else if ( values[0].equals( PatientTabularReport.PREFIX_DATA_ELEMENT ) ) +// { +// selectedDataElements.add( dataElementService.getDataElement( id ) ); +// dataelementFilters.add( filter ); +// } +// } +// } return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java 2013-08-28 06:43:27 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadDataElementsAction.java 2013-08-29 09:34:09 +0000 @@ -29,7 +29,15 @@ */ import java.util.Collection; +import java.util.HashSet; +import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patient.PatientIdentifierType; +import org.hisp.dhis.patient.PatientIdentifierTypeService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.program.ProgramStageDataElement; import org.hisp.dhis.program.ProgramStageSection; import org.hisp.dhis.program.ProgramStageSectionService; @@ -49,6 +57,13 @@ // Dependencies // ------------------------------------------------------------------------- + private ProgramService programService; + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + private ProgramStageService programStageService; public void setProgramStageService( ProgramStageService programStageService ) @@ -63,10 +78,31 @@ this.programStageSectionService = programStageSectionService; } + private PatientIdentifierTypeService identifierTypeService; + + public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) + { + this.identifierTypeService = identifierTypeService; + } + + private PatientAttributeService attributeService; + + public void setAttributeService( PatientAttributeService attributeService ) + { + this.attributeService = attributeService; + } + // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- + private String programId; + + public void setProgramId( String programId ) + { + this.programId = programId; + } + private String programStageId; public void setProgramStageId( String programStageId ) @@ -81,6 +117,20 @@ this.sectionId = sectionId; } + private Collection identifierTypes = new HashSet(); + + public Collection getIdentifierTypes() + { + return identifierTypes; + } + + private Collection patientAttributes = new HashSet(); + + public Collection getPatientAttributes() + { + return patientAttributes; + } + private Collection psDataElements; public Collection getPsDataElements() @@ -96,16 +146,36 @@ public String execute() throws Exception { + if ( programId != null ) + { + Program program = programService.getProgram( programId ); + if ( program.isRegistration() ) + { + Collection identifierTypes = identifierTypeService + .getAllPatientIdentifierTypes(); + Collection patientAttributes = attributeService.getAllPatientAttributes(); + + Collection programs = programService.getAllPrograms(); + programs.remove( program ); + + for ( Program _program : programs ) + { + identifierTypes.removeAll( _program.getPatientIdentifierTypes() ); + patientAttributes.removeAll( _program.getPatientAttributes() ); + } + } + } + if ( programStageId != null ) { psDataElements = programStageService.getProgramStage( programStageId ).getProgramStageDataElements(); } - else if( sectionId != null ) + else if ( sectionId != null ) { ProgramStageSection section = programStageSectionService.getProgramStageSection( sectionId ); psDataElements = section.getProgramStageDataElements(); } - + return SUCCESS; } } === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java 2013-08-28 06:43:27 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/LoadPatientPropertiesAction.java 1970-01-01 00:00:00 +0000 @@ -1,130 +0,0 @@ -package org.hisp.dhis.caseentry.action.report; - -/* - * Copyright (c) 2004-2013, 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. - */ - -import java.util.Collection; -import java.util.HashSet; - -import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeService; -import org.hisp.dhis.patient.PatientIdentifierType; -import org.hisp.dhis.patient.PatientIdentifierTypeService; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - * - * @version $LoadPatientPropertiesAction.java Apr 5, 2012 7:27:52 PM$ - */ -public class LoadPatientPropertiesAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private PatientIdentifierTypeService identifierTypeService; - - private ProgramService programService; - - private PatientAttributeService attributeService; - - // ------------------------------------------------------------------------- - // Input/Output - // ------------------------------------------------------------------------- - - private String programId; - - private Collection identifierTypes = new HashSet(); - - private Collection patientAttributes = new HashSet(); - - // ------------------------------------------------------------------------- - // Getter && Setters - // ------------------------------------------------------------------------- - - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - - public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) - { - this.identifierTypeService = identifierTypeService; - } - - public void setAttributeService( PatientAttributeService attributeService ) - { - this.attributeService = attributeService; - } - - public void setProgramId( String programId ) - { - this.programId = programId; - } - - public Collection getIdentifierTypes() - { - return identifierTypes; - } - - public Collection getPatientAttributes() - { - return patientAttributes; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() - throws Exception - { - Program program = programService.getProgram( programId ); - - identifierTypes = identifierTypeService.getAllPatientIdentifierTypes(); - patientAttributes = attributeService.getAllPatientAttributes(); - - Collection programs = programService.getAllPrograms(); - programs.remove( program ); - - for ( Program _program : programs ) - { - identifierTypes.removeAll( _program.getPatientIdentifierTypes() ); - patientAttributes.removeAll( _program.getPatientAttributes() ); - } - - return SUCCESS; - } - -} === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java 2013-08-29 09:34:09 +0000 @@ -29,7 +29,6 @@ */ import java.util.ArrayList; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -39,6 +38,8 @@ import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.patientreport.PatientTabularReport; import org.hisp.dhis.patientreport.PatientTabularReportService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.program.ProgramStageService; import org.hisp.dhis.user.CurrentUserService; @@ -64,6 +65,13 @@ this.tabularReportService = tabularReportService; } + private ProgramService programService; + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + private OrganisationUnitService organisationUnitService; public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) @@ -98,32 +106,26 @@ private String name; + private String programId; + + private String programStageId; + private String startDate; private String endDate; - private Integer programStageId; - - private List filterValues = new ArrayList(); - - private Collection orgunitIds; - - private boolean orderByOrgunitAsc; - - private Integer level; + private List orgunitIds; + + private List item = new ArrayList(); + + private String asc; + + private String desc; + + private int level; private String facilityLB; - private Boolean useCompletedEvents; - - private Boolean userOrganisationUnit; - - private Boolean userOrganisationUnitChildren; - - private Boolean displayOrgunitCode; - - private Boolean useFormNameDataElement; - // ------------------------------------------------------------------------- // Setters // ------------------------------------------------------------------------- @@ -133,69 +135,54 @@ this.name = name; } - public void setLevel( Integer level ) - { - this.level = level; - } - - public void setFilterValues( List filterValues ) - { - this.filterValues = filterValues; - } - - public void setFacilityLB( String facilityLB ) - { - this.facilityLB = facilityLB; - } - - public void setOrderByOrgunitAsc( boolean orderByOrgunitAsc ) - { - this.orderByOrgunitAsc = orderByOrgunitAsc; - } - - public void setEndDate( String endDate ) - { - this.endDate = endDate; - } - - public void setDisplayOrgunitCode( Boolean displayOrgunitCode ) - { - this.displayOrgunitCode = displayOrgunitCode; - } - public void setStartDate( String startDate ) { this.startDate = startDate; } - public void setOrgunitIds( Collection orgunitIds ) + public void setOrgunitIds( List orgunitIds ) { this.orgunitIds = orgunitIds; } - public void setProgramStageId( Integer programStageId ) + public void setProgramId( String programId ) + { + this.programId = programId; + } + + public void setProgramStageId( String programStageId ) { this.programStageId = programStageId; } - public void setUseCompletedEvents( Boolean useCompletedEvents ) - { - this.useCompletedEvents = useCompletedEvents; - } - - public void setUserOrganisationUnit( Boolean userOrganisationUnit ) - { - this.userOrganisationUnit = userOrganisationUnit; - } - - public void setUserOrganisationUnitChildren( Boolean userOrganisationUnitChildren ) - { - this.userOrganisationUnitChildren = userOrganisationUnitChildren; - } - - public void setUseFormNameDataElement( Boolean useFormNameDataElement ) - { - this.useFormNameDataElement = useFormNameDataElement; + public void setEndDate( String endDate ) + { + this.endDate = endDate; + } + + public void setItem( List item ) + { + this.item = item; + } + + public void setAsc( String asc ) + { + this.asc = asc; + } + + public void setDesc( String desc ) + { + this.desc = desc; + } + + public void setLevel( int level ) + { + this.level = level; + } + + public void setFacilityLB( String facilityLB ) + { + this.facilityLB = facilityLB; } // ------------------------------------------------------------------------- @@ -206,14 +193,10 @@ public String execute() throws Exception { - userOrganisationUnit = (userOrganisationUnit == null) ? false : userOrganisationUnit; - userOrganisationUnitChildren = (userOrganisationUnitChildren == null) ? false : userOrganisationUnitChildren; - displayOrgunitCode = (displayOrgunitCode == null) ? false : displayOrgunitCode; - ; - Set orgunits = new HashSet( - organisationUnitService.getOrganisationUnits( orgunitIds ) ); + organisationUnitService.getOrganisationUnitsByUid( orgunitIds ) ); + Program program = programService.getProgram( programId ); ProgramStage programStage = programStageService.getProgramStage( programStageId ); // --------------------------------------------------------------------- @@ -226,23 +209,16 @@ tabularReport.setOrganisationUnits( orgunits ); tabularReport.setLevel( level ); tabularReport.setFacilityLB( facilityLB ); - tabularReport.setSortedOrgunitAsc( orderByOrgunitAsc ); tabularReport.setUser( currentUserService.getCurrentUser() ); - tabularReport.setDisplayOrgunitCode( displayOrgunitCode ); - tabularReport.setUseFormNameDataElement( useFormNameDataElement ); - - if ( useCompletedEvents != null ) - { - tabularReport.setUseCompletedEvents( useCompletedEvents ); - } - - tabularReport.setUserOrganisationUnit( userOrganisationUnit ); - tabularReport.setUserOrganisationUnitChildren( userOrganisationUnitChildren ); - tabularReport.setFilterValues( filterValues ); + tabularReport.setItems( item ); + tabularReport.setSortByAsc( asc ); + tabularReport.setSortByDesc( desc ); tabularReport.setProgramStage( programStage ); + tabularReport.setProgram( program ); tabularReportService.saveOrUpdate( tabularReport ); 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 2013-08-19 06:54:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-08-29 09:34:09 +0000 @@ -886,18 +886,7 @@ - - - - - - - + @@ -907,9 +896,14 @@ + + + + F_GENERATE_BENEFICIARY_TABULAR_REPORT - - - - /dhis-web-caseentry/jsonPatientProperties.vm - - F_GENERATE_BENEFICIARY_TABULAR_REPORT - - + /dhis-web-caseentry/jsonProgramStages.vm === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-08-28 08:42:25 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-08-29 09:34:09 +0000 @@ -30,8 +30,6 @@ obj.system.level.push({value: r.levels[i].value, name: r.levels[i].name}); } - obj.system.accessPatientAttributes = r.user.accessPatientAttributes; - obj.report={}; obj.report.id = r.id; @@ -47,7 +45,6 @@ path_api: '../../api/', path_images: 'images/', initialize: 'tabularInitialize.action', - patientproperties_get: 'loadPatientProperties.action', programstages_get: '../api/programs/', programstagesections_get: 'loadProgramStageSections.action', dataelements_get: 'loadDataElements.action', @@ -91,10 +88,6 @@ filter: TR.i18n.wm_multiple_filter_orgunit } }, - patientProperties: { - value: 'patientProperties', - rawvalue: TR.i18n.patientProperties - }, programStage: { value: 'programStage', rawvalue: TR.i18n.program_stage @@ -267,7 +260,6 @@ params: { program:{}, programStage: {}, - patientProperty: {}, dataelement: {}, organisationunit: {}, relativeperiod: { @@ -338,8 +330,7 @@ return ((screen.height/2)-((cmp.height/2)-100)); }, resizeParams: function() { - var a = [TR.cmp.params.patientProperty.panel, - TR.cmp.params.dataelement.panel, + var a = [TR.cmp.params.dataelement.panel, TR.cmp.params.organisationunit.treepanel]; for (var i = 0; i < a.length; i++) { if (!a[i].collapsed) { @@ -358,7 +349,7 @@ var data = a.store.findExact('id', item); var name = a.store.getAt(data).data.name; var valueType = a.store.getAt(data).data.valueType; - array.push({id: item, localid:a.store.getAt(data).data.localid, name:name, valueType:valueType}); + array.push({id: item, name:name, valueType:valueType}); if(f!=undefined) { TR.util.multiselect.addFilterField( f, item, name, valueType ); @@ -376,11 +367,11 @@ { if( elements[i].style.display != 'none' ) { - var localid = a.store.getAt(i).data.localid; + var id = a.store.getAt(i).data.id; var name = a.store.getAt(i).data.name; var valueType = a.store.getAt(i).data.valueType; - array.push({id: a.store.getAt(i).data.id, localid:localid, name: name, valueType: valueType}); + array.push({id: a.store.getAt(i).data.id, name: name, valueType: valueType}); if(f!=undefined) { TR.util.multiselect.addFilterField( f, a.store.getAt(i).data.id, name, valueType ); @@ -491,7 +482,7 @@ var filter = ""; if( filterValue!=undefined && filterValue != "" ) { - var arrFilter = filterValue.split("_"); + var arrFilter = filterValue.split(";"); opt = arrFilter[0]; filter = arrFilter[1]; } @@ -1114,65 +1105,12 @@ success: function(r) { var f = Ext.JSON.decode(r.responseText); - Ext.getCmp('programCombobox').setValue( f.programId ); - TR.store.programStage.removeAll(); - TR.store.programStage.add({'id': f.programStageId, 'localid': f.programStageLocalid, 'name': f.programStageName}); Ext.getCmp('startDate').setValue( f.startDate ); Ext.getCmp('endDate').setValue( f.endDate ); - Ext.getCmp('facilityLBCombobox').setValue( f.facilityLB ); - Ext.getCmp('levelCombobox').setValue( f.level ); - Ext.getCmp('userOrgunit').setValue( f.userOrganisationUnit ); - Ext.getCmp('userOrgunitChildren').setValue( f.userOrganisationUnitChildren ); - Ext.getCmp('completedEventsOpt').setValue(f.useCompletedEvents); - Ext.getCmp('displayOrgunitCode').setValue(f.displayOrgunitCode); - - // Orgunits - - var treepanel = TR.cmp.params.organisationunit.treepanel; - treepanel.getSelectionModel().deselectAll(); - TR.state.orgunitIds = []; - var orgunitUids = []; - for (var i = 0; i < f.orgunitIds.length; i++) { - TR.state.orgunitIds.push( f.orgunitIds[i].localid ); - orgunitUids.push( f.orgunitIds[i].id ); - } - treepanel.selectByIds(orgunitUids); - - // Patient properties - Ext.getCmp('filterPropPanel').removeAll(); - Ext.getCmp('filterPropPanel').doLayout(); - TR.store.patientProperty.selected.removeAll(); - - // programs with registration - TR.cmp.params.patientProperty.objects = []; - if (f.patientProperties && f.type != "3" ) { - for (var i = 0; i < f.patientProperties.length; i++) { - var name = TR.util.string.getEncodedString(f.patientProperties[i].name); - TR.cmp.params.patientProperty.objects.push({id: f.patientProperties[i].id, name: name}); - TR.util.multiselect.addFilterField( 'filterPropPanel', f.patientProperties[i].id, name, f.patientProperties[i].valueType, f.patientProperties[i].filter ); - } - - TR.store.patientProperty.selected.add(TR.cmp.params.patientProperty.objects); - - var storePatientProperty = TR.store.patientProperty.available; - storePatientProperty.parent = f.programId; - if (TR.util.store.containsParent(storePatientProperty)) { - TR.util.store.loadFromStorage(storePatientProperty); - TR.util.multiselect.filterAvailable(TR.cmp.params.patientProperty.available, TR.cmp.params.patientProperty.selected); - } - else { - storePatientProperty.load({params: {programId: f.programId}}); - } - } - - // Program stage - - var storeProgramStage = TR.store.programStage; - storeProgramStage.parent = f.programStageId; - storeProgramStage.isLoadFromFavorite = true; - - TR.cmp.params.organisationunit.treepanel.getSelectionModel().deselectAll(); - + + Ext.getCmp('programCombobox').setValue( f.programId ); + TR.store.programStage.parent = f.programStageId; + TR.store.programStage.isLoadFromFavorite = true; TR.store.programStage.removeAll(); for (var i = 0; i < f.programStages.length; i++) { @@ -1181,6 +1119,18 @@ ); } Ext.getCmp('programStageCombobox').setValue( f.programStageId ); + Ext.getCmp('facilityLBCombobox').setValue( f.facilityLB ); + Ext.getCmp('levelCombobox').setValue( f.level ); + + // Orgunits + + var treepanel = TR.cmp.params.organisationunit.treepanel; + treepanel.getSelectionModel().deselectAll(); + TR.state.orgunitIds = []; + for (var i = 0; i < f.orgunitIds.length; i++) { + TR.state.orgunitIds.push( f.orgunitIds[i].id ); + } + treepanel.selectByIds(TR.state.orgunitIds); // Data element @@ -1188,13 +1138,19 @@ Ext.getCmp('filterPanel').doLayout(); TR.store.dataelement.selected.removeAll(); - if (f.dataElements) { - for (var i = 0; i < f.dataElements.length; i++) { - var name = TR.util.string.getEncodedString(f.dataElements[i].name); - var valueType = f.dataElements[i].valueType; - var localid = f.dataElements[i].localid; - TR.store.dataelement.selected.add({id: f.dataElements[i].id, name: name, valueType: valueType, localid:localid}); - TR.util.multiselect.addFilterField( 'filterPanel', f.dataElements[i].id, name, valueType, f.dataElements[i].filter ); + if (f.items) { + for (var i = 0; i < f.items.length; i++) { + var filter = f.items[i].id.split(';'); + var id = filter[0]; + var filterVal = ""; + if( filter.length == 3 ){ + filterVal = filter[1] + ";" + filter[2]; + } + + var name = TR.util.string.getEncodedString(f.items[i].name); + var valueType = f.items[i].valueType; + TR.store.dataelement.selected.add({id: id, name: name, valueType: valueType}); + TR.util.multiselect.addFilterField( 'filterPanel', id, name, valueType, filterVal ); } if( f.singleEvent == 'false' ) @@ -1376,12 +1332,10 @@ var treepanel = TR.cmp.params.organisationunit.treepanel; treepanel.getSelectionModel().deselectAll(); TR.state.orgunitIds = []; - var orgunitUids = []; for (var i = 0; i < f.orgunitIds.length; i++) { - TR.state.orgunitIds.push( f.orgunitIds[i].localid ); - orgunitUids.push( f.orgunitIds[i].id ); + TR.state.orgunitIds.push( f.orgunitIds[i].id ); } - treepanel.selectByIds(orgunitUids); + treepanel.selectByIds(TR.state.orgunitIds); // Selected data elements @@ -1515,32 +1469,6 @@ } } }), - patientProperty: { - available: Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'valueType'], - proxy: { - type: 'ajax', - url: TR.conf.finals.ajax.path_commons + TR.conf.finals.ajax.patientproperties_get, - reader: { - type: 'json', - root: 'patientProperties' - } - }, - isloaded: false, - storage: {}, - listeners: { - load: function(s) { - this.isloaded = true; - TR.util.store.addToStorage(s); - TR.util.multiselect.filterAvailable(TR.cmp.params.patientProperty.available, TR.cmp.params.patientProperty.selected); - } - } - }), - selected: Ext.create('Ext.data.Store', { - fields: ['id', 'name'], - data: [] - }) - }, programStage: Ext.create('Ext.data.Store', { fields: ['id', 'name'], proxy: { @@ -1611,7 +1539,7 @@ } }), programStageSection: Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'localid'], + fields: ['id', 'name'], proxy: { type: 'ajax', url: TR.conf.finals.ajax.path_commons + TR.conf.finals.ajax.programstagesections_get, @@ -1645,13 +1573,13 @@ }), dataelement: { available: Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'valueType', 'localid'], + fields: ['id', 'name', 'valueType'], proxy: { type: 'ajax', url: TR.conf.finals.ajax.path_commons + TR.conf.finals.ajax.dataelements_get, reader: { type: 'json', - root: 'dataElements' + root: 'items' } }, isloaded: false, @@ -1688,7 +1616,7 @@ } }), selected: Ext.create('Ext.data.Store', { - fields: ['id', 'name', 'valueType', 'localid'], + fields: ['id', 'name', 'valueType'], data: [] }) }, @@ -1853,7 +1781,6 @@ currentPage: 1, total: 1, totalRecords: 0, - isFilter:false, asc: "", desc: "", orgunitIds: [], @@ -1971,6 +1898,9 @@ p.endDate = TR.cmp.settings.endDate.rawValue; p.facilityLB = TR.cmp.settings.facilityLB.getValue(); p.level = Ext.getCmp('levelCombobox').getValue(); + p.orgunitIds = TR.state.orgunitIds; + p.programStageId = TR.cmp.params.programStage.getValue(); + p.programId = Ext.getCmp('programCombobox').getValue(); // order-by @@ -1981,7 +1911,6 @@ p.desc= TR.state.desc; } - p.programStageId = TR.cmp.params.programStage.getValue(); p.currentPage = TR.state.currentPage; // organisation unit @@ -2018,56 +1947,7 @@ p.item = []; - // Patient properties - - TR.cmp.params.patientProperty.selected.store.each( function(r) { - var propId = r.data.id; - var valueType = r.data.valueType; - var length = Ext.getCmp('filterPropPanel_' + propId).items.length/4; - var hidden = TR.state.caseBasedReport.isColHidden(propId); - - for(var idx=0;idx