dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09266
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2409: Nested Search Engine for Patient module.
------------------------------------------------------------
revno: 2409
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-12-22 14:59:59 +0700
message:
Nested Search Engine for 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/patient/ValidateSearchPatientAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/DefaultSelectedStateManager.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/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
=== 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 2010-10-29 05:33:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2010-12-22 07:59:59 +0000
@@ -58,59 +58,76 @@
private OrganisationUnitSelectionManager selectionManager;
+ private SelectedStateManager selectedStateManager;
+
+ private PatientService patientService;
+
+ private PatientAttributeService patientAttributeService;
+
+ private PatientAttributeValueService patientAttributeValueService;
+
+ private RelationshipService relationshipService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String searchText;
+
+ private boolean listAll;
+
+ private Integer searchingAttributeId;
+
+ private Integer sortPatientAttributeId;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Integer total;
+
+ private Collection<PatientAttribute> patientAttributes;
+
+ private Collection<Patient> patients = new ArrayList<Patient>();
+
+ private Map<Integer, Collection<Relationship>> mapRelationShip = new HashMap<Integer, Collection<Relationship>>();
+
+ private Map<Patient, String> mapPatientPatientAttr = new HashMap<Patient, String>();
+
+ // -------------------------------------------------------------------------
+ // Getters/Setters
+ // -------------------------------------------------------------------------
+
public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
{
this.selectionManager = selectionManager;
}
- private SelectedStateManager selectedStateManager;
-
public void setSelectedStateManager( SelectedStateManager selectedStateManager )
{
this.selectedStateManager = selectedStateManager;
}
- private PatientService patientService;
-
public void setPatientService( PatientService patientService )
{
this.patientService = patientService;
}
- private PatientAttributeService patientAttributeService;
-
public void setPatientAttributeService( PatientAttributeService patientAttributeService )
{
this.patientAttributeService = patientAttributeService;
}
- private PatientAttributeValueService patientAttributeValueService;
-
public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
{
this.patientAttributeValueService = patientAttributeValueService;
}
- private RelationshipService relationshipService;
-
public void setRelationshipService( RelationshipService relationshipService )
{
this.relationshipService = relationshipService;
}
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
-
- private OrganisationUnit organisationUnit;
-
- public OrganisationUnit getOrganisationUnit()
- {
- return organisationUnit;
- }
-
- private String searchText;
-
public void setSearchText( String searchText )
{
this.searchText = searchText;
@@ -121,15 +138,11 @@
return searchText;
}
- private boolean listAll;
-
public void setListAll( boolean listAll )
{
this.listAll = listAll;
}
- private Integer searchingAttributeId;
-
public Integer getSearchingAttributeId()
{
return searchingAttributeId;
@@ -140,36 +153,26 @@
this.searchingAttributeId = searchingAttributeId;
}
- Collection<PatientAttribute> patientAttributes;
-
public Collection<PatientAttribute> getPatientAttributes()
{
return patientAttributes;
}
- private Collection<Patient> patients = new ArrayList<Patient>();
-
public Collection<Patient> getPatients()
{
return patients;
}
- private Integer total;
-
public Integer getTotal()
{
return total;
}
- private Map<Integer, Collection<Relationship>> mapRelationShip = new HashMap<Integer, Collection<Relationship>>();
-
public Map<Integer, Collection<Relationship>> getMapRelationShip()
{
return mapRelationShip;
}
- public Integer sortPatientAttributeId;
-
public Integer getSortPatientAttributeId()
{
return sortPatientAttributeId;
@@ -180,8 +183,6 @@
this.sortPatientAttributeId = sortPatientAttributeId;
}
- private Map<Patient, String> mapPatientPatientAttr = new HashMap<Patient, String>();
-
public Map<Patient, String> getMapPatientPatientAttr()
{
return mapPatientPatientAttr;
@@ -192,13 +193,6 @@
this.mapPatientPatientAttr = mapPatientPatientAttr;
}
- PatientAttribute patientAttribute;
-
- public PatientAttribute getPatientAttribute()
- {
- return patientAttribute;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -207,220 +201,143 @@
throws Exception
{
// ---------------------------------------------------------------------
- // Validate selected OrganisationUnit
+ // Get all of Patient-Attributes
// ---------------------------------------------------------------------
- if ( sortPatientAttributeId != null )
- {
- patientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId );
- }
-
- organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
patientAttributes = patientAttributeService.getAllPatientAttributes();
- if ( listAll )
- {
- selectedStateManager.setListAll( listAll );
-
+ // ---------------------------------------------------------------------
+ // Get sorting patient-attribute
+ // ---------------------------------------------------------------------
+
+ PatientAttribute sortingPatientAttribute = null;
+ if ( sortPatientAttributeId == null )
+ {
+ selectedStateManager.clearSortingAttributeId();
+
+ }
+ else
+ {
+ sortingPatientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId );
+ selectedStateManager.setSortingAttributeId( sortPatientAttributeId );
+ }
+
+ // ---------------------------------------------------------------------
+ // Get and searching patient-attribute
+ // ---------------------------------------------------------------------
+
+ PatientAttribute searchingPatientAttribute = null;
+ if ( searchingAttributeId == null )
+ {
selectedStateManager.clearSearchingAttributeId();
- selectedStateManager.clearSearchTest();
-
- total = patientService.countGetPatientsByOrgUnit( organisationUnit );
-
- this.paging = createPaging( total );
- patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, paging.getStartPos(),
- paging.getPageSize() ) );
-
- if ( patients != null && patients.size() > 0 )
- {
- for ( Patient patient : patients )
- {
- mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, patientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient, value );
- }
- }
- }
-
- searchText = "list_all_patients";
-
- return SUCCESS;
}
-
- if ( searchingAttributeId != null && searchText != null )
+ else
{
- selectedStateManager.clearListAll();
-
+ searchingPatientAttribute = patientAttributeService.getPatientAttribute( searchingAttributeId );
selectedStateManager.setSearchingAttributeId( searchingAttributeId );
- selectedStateManager.setSearchText( searchText );
-
- PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( searchingAttributeId );
-
- total = patientAttributeValueService.countSearchPatientAttributeValue( patientAttribute, searchText );
- this.paging = createPaging( total );
-
- patients = patientAttributeValueService.searchPatients( patientAttribute, searchText, paging.getStartPos(),
- paging.getPageSize() );
-
- if ( patients != null && patients.size() > 0 )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- patients = patientService.sortPatientsByAttribute( patients, patientAttribute );
- }
-
- for ( Patient patient : patients )
- {
- mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, patientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient, value );
- }
- }
- }
-
- return SUCCESS;
- }
-
- if ( searchingAttributeId == null && searchText != null )
- {
- selectedStateManager.clearListAll();
- selectedStateManager.clearSearchingAttributeId();
-
- selectedStateManager.setSearchText( searchText );
-
-
- total = patientService.countGetPatients( searchText );
- this.paging = createPaging( total );
- patients = patientService.getPatients( searchText, paging.getStartPos(), paging.getPageSize() );
-
- if ( patients != null && patients.size() > 0 )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- patients = patientService.sortPatientsByAttribute( patients, patientAttribute );
- }
- for ( Patient patient : patients )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, patientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient, value );
- }
- }
- }
-
- return SUCCESS;
- }
-
- listAll = selectedStateManager.getListAll();
+ }
+
+ // ---------------------------------------------------------------------
+ // Get all of patient into the selected organisation unit
+ // ---------------------------------------------------------------------
if ( listAll )
{
- selectedStateManager.setListAll( listAll );
-
- selectedStateManager.clearSearchingAttributeId();
- selectedStateManager.clearSearchTest();
-
- total = patientService.countGetPatientsByOrgUnit( organisationUnit );
- this.paging = createPaging( total );
- patients = patientService.getPatients( organisationUnit , paging.getStartPos(), paging.getPageSize() );
-
- if ( patients != null && patients.size() > 0 )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- patients = patientService.sortPatientsByAttribute( patients, patientAttribute );
- }
- for ( Patient patient : patients )
- {
- mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, patientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient, value );
- }
- }
- }
-
- searchText = "list_all_patients";
-
- return SUCCESS;
-
+ searchText = SelectedStateManager.LIST_ALL_PATIENT;
+
+ OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+ listAllPatient( organisationUnit, sortingPatientAttribute );
}
- searchingAttributeId = selectedStateManager.getSearchingAttributeId();
- searchText = selectedStateManager.getSearchText();
+ // ---------------------------------------------------------------------
+ // Get patients by searchingAttributeId and searchText
+ // and sort result by sortingAttributeId
+ // ---------------------------------------------------------------------
- if ( searchingAttributeId != null && searchText != null )
+ else if ( searchingPatientAttribute != null && searchText != null )
{
- PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( searchingAttributeId );
-
- total = patientAttributeValueService.countSearchPatientAttributeValue( patientAttribute, searchText );
- this.paging = createPaging( total );
- patients = patientAttributeValueService.searchPatients( patientAttribute, searchText, paging.getStartPos(), paging.getPageSize() );
-
- if ( patients != null && patients.size() > 0 )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- patients = patientService.sortPatientsByAttribute( patients, patientAttribute );
- }
- for ( Patient patient : patients )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, patientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient, value );
- }
- }
- }
+ searchPatientByAttribute( searchingPatientAttribute, searchText, sortingPatientAttribute );
}
+
+ selectedStateManager.setSearchText( searchText );
- total = patientService.countGetPatients( searchText );
- this.paging = createPaging( total );
- patients =patientService.getPatients( searchText, paging.getStartPos(), paging.getPageSize() );
-
- if ( patients != null && patients.size() > 0 )
- {
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- patients = patientService.sortPatientsByAttribute( patients, patientAttribute );
- }
- for ( Patient patient : patients )
- {
- mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
- if ( sortPatientAttributeId != null && patientAttribute != null )
- {
- PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
- patient, patientAttribute );
- String value = (attributeValue == null) ? "" : attributeValue.getValue();
-
- mapPatientPatientAttr.put( patient, value );
- }
- }
- }
-
return SUCCESS;
}
+
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Support methods
+ // Support methods
+ // -------------------------------------------------------------------------
+
+ private void listAllPatient( OrganisationUnit organisationUnit, PatientAttribute sortingPatientAttribute )
+ {
+ // Get patients by the selected organisation - unit
+
+ total = patientService.countGetPatientsByOrgUnit( organisationUnit );
+
+ this.paging = createPaging( total );
+
+ patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit, paging.getStartPos(), paging
+ .getPageSize() ) );
+
+ if ( patients != null && patients.size() > 0 )
+ {
+ for ( Patient patient : patients )
+ {
+ mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) );
+
+ // Get patient-attribute-values
+ if ( sortingPatientAttribute != null )
+ {
+ PatientAttributeValue attributeValue = patientAttributeValueService.getPatientAttributeValue(
+ patient, sortingPatientAttribute );
+ String value = (attributeValue == null) ? "" : attributeValue.getValue();
+
+ mapPatientPatientAttr.put( patient, value );
+ }
+ }
+ }
+ }
+
+ private void searchPatientByAttribute( PatientAttribute searchingPatientAttribute, String searchText,
+ PatientAttribute sortingPatientAttribute )
+ {
+ selectedStateManager.clearListAll();
+
+ selectedStateManager.setSearchingAttributeId( searchingAttributeId );
+ selectedStateManager.setSearchText( searchText );
+
+ total = patientAttributeValueService.countSearchPatientAttributeValue( searchingPatientAttribute, searchText );
+ this.paging = createPaging( total );
+
+ patients = patientAttributeValueService.searchPatients( searchingPatientAttribute, searchText, paging
+ .getStartPos(), paging.getPageSize() );
+
+ if ( patients != null && patients.size() > 0 )
+ {
+ if ( sortingPatientAttribute != null )
+ {
+ patients = patientService.sortPatientsByAttribute( patients, sortingPatientAttribute );
+ }
+
+ 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, value );
+ }
+ }
+ }
+
+ }
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidateSearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidateSearchPatientAction.java 2009-09-28 15:11:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidateSearchPatientAction.java 2010-12-22 07:59:59 +0000
@@ -94,26 +94,13 @@
return INPUT;
}
- if ( searchText == null )
+ if ( searchText == null || searchText.trim().length() == 0 )
{
message = i18n.getString( "specify_a_search_criteria" );
return INPUT;
}
- else
- {
- searchText = searchText.trim();
-
- if ( searchText.length() == 0 )
- {
- message = i18n.getString( "specify_a_search_criteria" );
-
- return INPUT;
- }
-
- }
-
// ---------------------------------------------------------------------
// Validation success
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/DefaultSelectedStateManager.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/DefaultSelectedStateManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/DefaultSelectedStateManager.java 2010-12-22 07:59:59 +0000
@@ -48,6 +48,14 @@
implements SelectedStateManager
{
+ public static final String SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID = "selected_searching_attribute_id";
+
+ public static final String SESSION_KEY_SPECIFIED_SEARCH_TEXT = "specified_search_text";
+
+ public static final String SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID = "selected_sort_attribute_id";
+
+
+
public static final String SESSION_KEY_SELECTED_PATIENT_ID = "selected_patient_id";
public static final String SESSION_KEY_SELECTED_PROGRAM_ID = "selected_program_id";
@@ -56,10 +64,6 @@
public static final String SESSION_KEY_LISTALL = "list_all_value";
- public static final String SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID = "selected_searching_attribute_id";
-
- public static final String SESSION_KEY_SPECIFIED_SEARCH_TEXT = "specified_search_text";
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -175,16 +179,6 @@
getSession().remove( SESSION_KEY_LISTALL );
}
- public void clearSearchTest()
- {
- getSession().remove( SESSION_KEY_SPECIFIED_SEARCH_TEXT );
- }
-
- public void clearSearchingAttributeId()
- {
- getSession().remove( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID );
- }
-
public boolean getListAll()
{
if ( getSession().get( SESSION_KEY_LISTALL ) != null )
@@ -198,34 +192,12 @@
}
}
- public String getSearchText()
- {
- return (String) getSession().get( SESSION_KEY_SPECIFIED_SEARCH_TEXT );
- }
-
- public Integer getSearchingAttributeId()
- {
- return (Integer) getSession().get( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID );
- }
-
@SuppressWarnings( "unchecked" )
public void setListAll( boolean listAll )
{
getSession().put( SESSION_KEY_LISTALL, listAll );
}
- @SuppressWarnings( "unchecked" )
- public void setSearchText( String searchText )
- {
- getSession().put( SESSION_KEY_SPECIFIED_SEARCH_TEXT, searchText );
- }
-
- @SuppressWarnings( "unchecked" )
- public void setSearchingAttributeId( int searchingAttributeId )
- {
- getSession().put( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID, searchingAttributeId );
- }
-
// -------------------------------------------------------------------------
// Support methods
// -------------------------------------------------------------------------
@@ -236,4 +208,59 @@
return ActionContext.getContext().getSession();
}
+ // -------------------------------------------------------------------------
+ // Search patients by patient-attribute
+ // -------------------------------------------------------------------------
+
+ @SuppressWarnings( "unchecked" )
+ public void setSearchingAttributeId( int searchingAttributeId )
+ {
+ getSession().put( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID, searchingAttributeId );
+ }
+
+ public Integer getSearchingAttributeId()
+ {
+ return (Integer) getSession().get( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID );
+ }
+
+ public void clearSearchingAttributeId()
+ {
+ getSession().remove( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public void setSearchText( String searchText )
+ {
+ getSession().put( SESSION_KEY_SPECIFIED_SEARCH_TEXT, searchText );
+ }
+
+ public String getSearchText()
+ {
+ return (String) getSession().get( SESSION_KEY_SPECIFIED_SEARCH_TEXT );
+ }
+
+ public void clearSearchText()
+ {
+ getSession().remove( SESSION_KEY_SPECIFIED_SEARCH_TEXT );
+ }
+
+ // -------------------------------------------------------------------------
+ // Sort by patient-attribute
+ // -------------------------------------------------------------------------
+
+ @SuppressWarnings( "unchecked" )
+ public void setSortingAttributeId( int sortAttributeId )
+ {
+ getSession().put( SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID, sortAttributeId );
+ }
+
+ public Integer getSortAttributeId()
+ {
+ return (Integer) getSession().get( SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID );
+ }
+
+ public void clearSortingAttributeId()
+ {
+ getSession().remove( SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID );
+ }
}
=== 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-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java 2010-12-22 07:59:59 +0000
@@ -38,41 +38,61 @@
*/
public interface SelectedStateManager
{
- OrganisationUnit getSelectedOrganisationUnit();
+ public static String LIST_ALL_PATIENT = "All";
+ OrganisationUnit getSelectedOrganisationUnit();
+
void setSelectedPatient( Patient patient );
Patient getSelectedPatient();
void clearSelectedPatient();
-
+
void setSelectedProgram( Program program );
Program getSelectedProgram();
void clearSelectedProgram();
-
- void setSelectedProgramStage( ProgramStage programStage );
-
- ProgramStage getSelectedProgramStage();
+
+ void setSelectedProgramStage( ProgramStage programStage );
+
+ ProgramStage getSelectedProgramStage();
void clearSelectedProgramStage();
-
+
void setListAll( boolean listAll );
-
+
boolean getListAll();
-
+
void clearListAll();
+
+
+ // -------------------------------------------------------------------------
+ // Search patients by patient-attribute
+ // -------------------------------------------------------------------------
+
void setSearchingAttributeId( int searchingAttributeId );
-
+
Integer getSearchingAttributeId();
-
+
void clearSearchingAttributeId();
+
void setSearchText( String searchText );
-
+
String getSearchText();
-
- void clearSearchTest();
+
+ void clearSearchText();
+
+ // -------------------------------------------------------------------------
+ // 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/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-10 04:02:52 +0000
+++ 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
@@ -6,18 +6,7 @@
<td><label>$i18n.getString( "registering_unit" )</label></td>
<td><input type="text" readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "please_select_village" )]" #end style="min-width:22em"></td>
<td> </td>
- <td><input type="button" value="$i18n.getString( "list_all_patients" )" onclick="window.location.href='listAllPatients.action'"></td>
- </tr>
- <tr>
- <td>$i18n.getString( "sort_by" )</td>
- <td>
- <select id="patientAttributeId" name="patientAttributeId" maxlength="30" style="width:22.2em" onchange="javascript:selectPatientAttribute()" #if( $programs.size() == 0 ) disabled="disabled" #end>
- <option value="0">[$i18n.getString( "select" )]</option>
- #foreach( $patientAttribute in $patientAttributes )
- <option value="$patientAttribute.id" #if( $sortPatientAttributeId && $patientAttribute.id == $sortPatientAttributeId ) selected="selected" #end>$encoder.htmlEncode( $patientAttribute.name )</option>
- #end
- </select>
- </td>
+ <td><input type="button" value="$i18n.getString( "list_all_patients" )" onclick="window.location.href='searchPatient.action?listAll=true'"></td>
</tr>
</table>
@@ -31,17 +20,30 @@
<select id="searchingAttributeId" name="searchingAttributeId" style="min-width:20.2em" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end>
<option value="">$i18n.getString( "search_by_name_identifier" )</option>
#foreach( $attribute in $patientAttributes )
- <option value="$attribute.id" #if( $searchingAttributeId && $attribute.id == $searchingAttributeId ) selected="selected" #end>$encoder.htmlEncode( $attribute.name )</option>
+ <option value="$attribute.id" #if( $!searchingAttributeId && $!attribute.id == $!searchingAttributeId ) selected="selected" #end>$encoder.htmlEncode( $attribute.name )</option>
#end
</select>
<em title="$i18n.getString( "required" )" class="required">*</em></label>
</td>
- <td><input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em"></td>
+ <td><input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText"></td>
<td><input type="submit" value="$i18n.getString( "search" )"</td>
<td> </td>
<td><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddPatientForm.action'"></td>
</tr>
+
+ <tr>
+ <td></td>
+ <td>
+ <select id="sortPatientAttributeId" name="sortPatientAttributeId" maxlength="30" style="width:20.2em" onchange="validateSearchPatient()">
+ <option value="0">[ $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
+ </select>
+ </td>
+ </tr>
+
</table>
<p></p>