dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13187
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4174: Fixed bug: The patient list is not displayed properly when selecting sorted attributes ( Patient...
------------------------------------------------------------
revno: 4174
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-07-20 16:15:06 +0700
message:
Fixed bug: The patient list is not displayed properly when selecting sorted attributes ( Patient module ).
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
--
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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2011-07-19 03:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2011-07-20 09:15:06 +0000
@@ -232,7 +232,7 @@
}
selectedStateManager.setSelectedProgram( program );
selectedStateManager.setSearchingAttributeId( searchingAttributeId );
-
+
searchPatientByProgram( organisationUnit, program, sortingPatientAttribute );
return SUCCESS;
@@ -262,7 +262,7 @@
selectedStateManager.clearSortingAttributeId();
}
selectedStateManager.setSearchText( searchText );
-
+
searchPatientByAttribute( searchingPatientAttribute, searchText, sortingPatientAttribute );
return SUCCESS;
@@ -367,20 +367,19 @@
patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, paging.getStartPos(), paging
.getPageSize() ) );
-
- if ( patients != null && patients.size() > 0 )
+
+ if ( patients != null && patients.size() > 0 && sortingPatientAttribute != null )
{
for ( Patient patient : patients )
{
- if ( sortingPatientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, sortingPatientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
+ PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient,
+ sortingPatientAttribute );
+ String value = (attributeValue == null) ? "" : attributeValue.getValue();
- mapPatientPatientAttr.put( patient.getId(), value );
- }
+ mapPatientPatientAttr.put( patient.getId(), value );
}
+
+ patients = patientService.sortPatientsByAttribute( patients, sortingPatientAttribute );
}
}
@@ -393,22 +392,18 @@
patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, program, paging.getStartPos(),
paging.getPageSize() ) );
- if ( patients != null && patients.size() > 0 )
+ if ( patients != null && patients.size() > 0 && sortingPatientAttribute != null )
{
for ( Patient patient : patients )
{
- // mapRelationShip.put( patient.getId(),
- // relationshipService.getRelationshipsForPatient( patient ) );
-
- if ( sortingPatientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, sortingPatientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient.getId(), value );
- }
+ PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue( patient,
+ sortingPatientAttribute );
+ String value = (attributeValue == null) ? "" : attributeValue.getValue();
+
+ mapPatientPatientAttr.put( patient.getId(), value );
}
+
+ patients = patientService.sortPatientsByAttribute( patients, sortingPatientAttribute );
}
}
@@ -430,16 +425,8 @@
for ( Patient patient : patients )
{
- // -------------------------------------------------------------
- // Get hierarchy organisation unit
- // -------------------------------------------------------------
-
mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
- // -------------------------------------------------------------
- // Sort patients
- // -------------------------------------------------------------
-
if ( sortingPatientAttribute != null )
{
PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java 2011-07-11 03:52:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/AddRelationshipPatientAction.java 2011-07-20 09:15:06 +0000
@@ -1,7 +1,32 @@
-package org.hisp.dhis.patient.action.relationship;
+/* 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.relationship;
import java.util.Collection;
-import java.util.Date;
import javax.servlet.http.HttpServletRequest;
@@ -10,7 +35,6 @@
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeOption;
@@ -51,8 +75,6 @@
private PatientIdentifierTypeService patientIdentifierTypeService;
- private OrganisationUnitSelectionManager selectionManager;
-
private SelectedStateManager selectedStateManager;
private PatientAttributeService patientAttributeService;
@@ -108,7 +130,7 @@
public String execute()
{
- OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+ OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
patient = new Patient();
@@ -191,6 +213,7 @@
selectedStateManager.clearListAll();
selectedStateManager.clearSearchingAttributeId();
+ selectedStateManager.clearSortingAttributeId();
selectedStateManager.setSearchText( systemGenerateIdentifier.getIdentifier() );
// ---------------------------------------------------------------------
@@ -327,11 +350,6 @@
this.patientIdentifierService = patientIdentifierService;
}
- public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
- {
- this.selectionManager = selectionManager;
- }
-
public void setSelectedStateManager( SelectedStateManager selectedStateManager )
{
this.selectedStateManager = selectedStateManager;
=== 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-07-19 03:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2011-07-20 09:15:06 +0000
@@ -180,8 +180,6 @@
id="org.hisp.dhis.patient.action.relationship.AddRelationshipPatientAction"
class="org.hisp.dhis.patient.action.relationship.AddRelationshipPatientAction"
scope="prototype">
- <property name="selectionManager"
- ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="patientIdentifierService"
ref="org.hisp.dhis.patient.PatientIdentifierService" />