dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09470
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2517: Button "Back to search" cannot run ( in Patient module ) and add a missing file.
------------------------------------------------------------
revno: 2517
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-11 17:06:47 +0700
message:
Button "Back to search" cannot run ( in Patient module ) and add a missing file.
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/unenroll.png
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/patient/UpdatePatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.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/webapp/dhis-web-maintenance-patient/patient.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
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/unenroll.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/unenroll.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/unenroll.png 2011-01-11 10:06:47 +0000 differ
=== 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-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2011-01-11 10:06:47 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientAttributeService;
import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.patient.state.SelectedStateManager;
import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
import org.hisp.dhis.relationship.Relationship;
@@ -51,15 +52,13 @@
public class SearchPatientAction
extends ActionPagingSupport<Patient>
{
- public static String LIST_ALL_PATIENT = "All";
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
private OrganisationUnitSelectionManager selectionManager;
- // private SelectedStateManager selectedStateManager;
+ private SelectedStateManager selectedStateManager;
private PatientService patientService;
@@ -75,7 +74,7 @@
private String searchText;
- private boolean listAll;
+ private Boolean listAll;
private Integer searchingAttributeId;
@@ -97,6 +96,10 @@
private Map<Patient, String> mapPatientOrgunit = new HashMap<Patient, String>();
+ private PatientAttribute sortingPatientAttribute = null;
+
+ private PatientAttribute searchingPatientAttribute = null;
+
// -------------------------------------------------------------------------
// Getters/Setters
// -------------------------------------------------------------------------
@@ -141,7 +144,7 @@
return searchText;
}
- public void setListAll( boolean listAll )
+ public void setListAll( Boolean listAll )
{
this.listAll = listAll;
}
@@ -186,6 +189,11 @@
this.sortPatientAttributeId = sortPatientAttributeId;
}
+ public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+ {
+ this.selectedStateManager = selectedStateManager;
+ }
+
public Map<Patient, String> getMapPatientPatientAttr()
{
return mapPatientPatientAttr;
@@ -203,8 +211,7 @@
public String execute()
throws Exception
{
- System.out.println("\n\n ============ \n sortPatientAttributeId : " + sortPatientAttributeId);
- System.out.println("\n searchingAttributeId : " + searchingAttributeId);
+ OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
// ---------------------------------------------------------------------
// Get all of Patient-Attributes
@@ -212,62 +219,136 @@
patientAttributes = patientAttributeService.getAllPatientAttributes();
- // ---------------------------------------------------------------------
- // Get sorting patient-attribute
- // ---------------------------------------------------------------------
+ getParamsToSearch();
- PatientAttribute sortingPatientAttribute = null;
- if ( sortPatientAttributeId != null )
- {
- sortingPatientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId );
- }
-
- // ---------------------------------------------------------------------
- // Get and searching patient-attribute
- // ---------------------------------------------------------------------
-
- PatientAttribute searchingPatientAttribute = null;
- if ( searchingAttributeId != null )
- {
- searchingPatientAttribute = patientAttributeService.getPatientAttribute( searchingAttributeId );
- }
-
// ---------------------------------------------------------------------
// Get all of patient into the selected organisation unit
// ---------------------------------------------------------------------
-
- if ( listAll || ( searchText != null && searchText.equalsIgnoreCase( LIST_ALL_PATIENT ) ) )
- {System.out.println("\n 1");
- searchText = LIST_ALL_PATIENT;
-
- OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
+
+ if ( listAll != null && listAll )
+ {
+ selectedStateManager.clearSearchingAttributeId();
+ selectedStateManager.clearSortingAttributeId();
+ selectedStateManager.clearSearchText();
+ selectedStateManager.setListAll( listAll );
+
+ searchText = "list_all_patients";
+
listAllPatient( organisationUnit, sortingPatientAttribute );
-
+
+ return SUCCESS;
}
// ---------------------------------------------------------------------
// Get patients by searchingAttributeId and searchText
// and sort result by sortingAttributeId
// ---------------------------------------------------------------------
+
+ if ( searchingPatientAttribute != null && searchText != null )
+ {
+ selectedStateManager.clearListAll();
+ selectedStateManager.setSearchingAttributeId( searchingAttributeId );
+
+ if( sortPatientAttributeId != null )
+ {
+ selectedStateManager.setSortingAttributeId( sortPatientAttributeId );
+ }else
+ {
+ selectedStateManager.clearSortingAttributeId();
+ }
+
+ selectedStateManager.setSearchText( searchText );
- else if ( searchingPatientAttribute != null && searchText != null )
- {System.out.println("\n 2");
searchPatientByAttribute( searchingPatientAttribute, searchText, sortingPatientAttribute );
- }
- else if ( searchingPatientAttribute == null && searchText != null )
- {System.out.println("\n 3");
- searchPatientByAttribute( searchText, sortingPatientAttribute );
- }
- System.out.println("\n 4");
+
+ return SUCCESS;
+ }
+
+ if ( searchingPatientAttribute == null && searchText != null )
+ {
+ selectedStateManager.clearListAll();
+
+ selectedStateManager.clearSearchingAttributeId();
+
+ if( sortPatientAttributeId != null )
+ {
+ selectedStateManager.setSortingAttributeId( sortPatientAttributeId );
+ }else
+ {
+ selectedStateManager.clearSortingAttributeId();
+ }
+
+
+ selectedStateManager.setSearchText( searchText );
+
+ searchPatientByAttribute( searchText, sortingPatientAttribute );
+
+ return SUCCESS;
+ }
+
+ // ---------------------------------------------------------------------
+ // Search patients by values into section
+ // ---------------------------------------------------------------------
+
+ listAll = selectedStateManager.getListAll();
+
+ if ( listAll )
+ {
+ patients = patientService.getPatients( organisationUnit );
+
+ searchText = "list_all_patients";
+
+ return SUCCESS;
+
+ }
+
+ searchingAttributeId = selectedStateManager.getSearchingAttributeId();
+ sortPatientAttributeId = selectedStateManager.getSortAttributeId();
+ searchText = selectedStateManager.getSearchText();
+
+ getParamsToSearch();
+
+ if ( searchingAttributeId != null && searchText != null )
+ {
+ searchPatientByAttribute( searchText, sortingPatientAttribute );
+
+ return SUCCESS;
+ }
+
+ if ( searchingAttributeId == null && searchText != null )
+ {
+ searchPatientByAttribute( searchText, sortingPatientAttribute );
+ return SUCCESS;
+ }
+
return SUCCESS;
-
}
// -------------------------------------------------------------------------
// Support methods
// -------------------------------------------------------------------------
+ private void getParamsToSearch()
+ {
+ // ---------------------------------------------------------------------
+ // Get sorting patient-attribute
+ // ---------------------------------------------------------------------
+
+ if ( sortPatientAttributeId != null )
+ {
+ sortingPatientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId );
+ }
+
+ // ---------------------------------------------------------------------
+ // Get and searching patient-attribute
+ // ---------------------------------------------------------------------
+
+ if ( searchingAttributeId != null )
+ {
+ searchingPatientAttribute = patientAttributeService.getPatientAttribute( searchingAttributeId );
+ }
+ }
+
private void listAllPatient( OrganisationUnit organisationUnit, PatientAttribute sortingPatientAttribute )
{
// Get patients by the selected organisation - unit
@@ -343,17 +424,14 @@
private void searchPatientByAttribute( String searchText, PatientAttribute sortingPatientAttribute )
{
-System.out.println("\n\n *********** \n 1 ");
total = patientService.countGetPatients( searchText );
-System.out.println("\n total : " + total );
+
this.paging = createPaging( total );
-System.out.println("\n paging.getStartPos() : " + paging.getStartPos() );
-System.out.println("\n paging.getPageSize() : " + paging.getPageSize() );
patients = patientService.getPatients( searchText, paging.getStartPos(), paging.getPageSize() );
-System.out.println("\n patients : " + patients );
+
if ( patients != null && patients.size() > 0 )
{
- if ( sortPatientAttributeId != null && sortingPatientAttribute != null )
+ if ( sortingPatientAttribute != null )
{
patients = patientService.sortPatientsByAttribute( patients, sortingPatientAttribute );
}
@@ -384,14 +462,14 @@
private String getHierarchyOrgunit( OrganisationUnit orgunit )
{
String hierarchyOrgunit = orgunit.getName();
-
+
while ( orgunit.getParent() != null )
{
hierarchyOrgunit = orgunit.getParent().getName() + " / " + hierarchyOrgunit;
-
+
orgunit = orgunit.getParent();
}
-
+
return hierarchyOrgunit;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java 2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java 2011-01-11 10:06:47 +0000
@@ -94,6 +94,7 @@
// -------------------------------------------------------------------------
// Input - demographics
// -------------------------------------------------------------------------
+
private String birthDate;
private Integer age;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java 2010-12-22 10:16:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java 2011-01-11 10:06:47 +0000
@@ -38,16 +38,23 @@
*/
public interface SelectedStateManager
{
-
-
+
OrganisationUnit getSelectedOrganisationUnit();
+ // -------------------------------------------------------------------------
+ // for Patient
+ // -------------------------------------------------------------------------
+
void setSelectedPatient( Patient patient );
Patient getSelectedPatient();
void clearSelectedPatient();
+ // -------------------------------------------------------------------------
+ // for Program
+ // -------------------------------------------------------------------------
+
void setSelectedProgram( Program program );
Program getSelectedProgram();
@@ -60,16 +67,10 @@
void clearSelectedProgramStage();
- void setListAll( boolean listAll );
-
- boolean getListAll();
-
- void clearListAll();
-
-
+
// -------------------------------------------------------------------------
- // Search patients by patient-attribute
+ // for Searching patients - SearchingAttribute
// -------------------------------------------------------------------------
void setSearchingAttributeId( int searchingAttributeId );
@@ -77,22 +78,29 @@
Integer getSearchingAttributeId();
void clearSearchingAttributeId();
+
-
void setSearchText( String searchText );
String getSearchText();
void clearSearchText();
- // -------------------------------------------------------------------------
- // Sort by patient-attribute
- // -------------------------------------------------------------------------
+ void setListAll( boolean listAll );
+
+ boolean getListAll();
+
+ void clearListAll();
+
+ // -------------------------------------------------------------------------
+ // for Sorting patients - Sort by patient-attribute
+ // -------------------------------------------------------------------------
+
void setSortingAttributeId( int sortAttributeId );
-
+
Integer getSortAttributeId();
-
+
void clearSortingAttributeId();
}
=== 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 07:06:28 +0000
+++ 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
@@ -384,6 +384,8 @@
scope="prototype">
<property name="selectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ <property name="selectedStateManager"
+ ref="org.hisp.dhis.patient.state.SelectedStateManager" />
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
<property name="patientAttributeValueService"
ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm 2010-12-22 07:59:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm 2011-01-11 10:06:47 +0000
@@ -36,7 +36,7 @@
<td></td>
<td>
<select id="sortPatientAttributeId" name="sortPatientAttributeId" maxlength="30" style="width:20.2em" onchange="validateSearchPatient()">
- <option value="0">[ $i18n.getString( "sort_by" ) ]</option>
+ <option value="">[ $i18n.getString( "sort_by" ) ]</option>
#foreach( $patientAttribute in $patientAttributes )
<option value="$patientAttribute.id" #if( $!sortPatientAttributeId && $!patientAttribute.id == $!sortPatientAttributeId ) selected="selected" #end>$encoder.htmlEncode( $patientAttribute.name )</option>
#end