← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4482: Show patient list by id desc.

 

------------------------------------------------------------
revno: 4482
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-08-30 16:00:29 +0700
message:
  Show patient list by id desc.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java


--
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-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2011-07-29 08:58:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2011-08-30 09:00:29 +0000
@@ -193,7 +193,7 @@
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByOrgUnit( OrganisationUnit organisationUnit )
     {
-        String hql = "select distinct p from Patient p where p.organisationUnit = :organisationUnit order by p.id";
+        String hql = "select distinct p from Patient p where p.organisationUnit = :organisationUnit order by p.id DESC";
 
         return getQuery( hql ).setEntity( "organisationUnit", organisationUnit ).list();
     }
@@ -201,7 +201,7 @@
     @SuppressWarnings( "unchecked" )
     public Collection<Patient> getByOrgUnit( OrganisationUnit organisationUnit, int min, int max )
     {
-        String hql = "select p from Patient p where p.organisationUnit = :organisationUnit order by p.id";
+        String hql = "select p from Patient p where p.organisationUnit = :organisationUnit order by p.id DESC";
 
         return getQuery( hql ).setEntity( "organisationUnit", organisationUnit ).setFirstResult( min ).setMaxResults(
             max ).list();
@@ -211,7 +211,7 @@
     public Collection<Patient> getByOrgUnitProgram( OrganisationUnit organisationUnit, Program program, int min, int max )
     {
         return getCriteria( Restrictions.eq( "organisationUnit", organisationUnit ) ).createAlias( "programs",
-            "program" ).add( Restrictions.eq( "program.id", program.getId() ) ).addOrder( Order.asc( "id" ) )
+            "program" ).add( Restrictions.eq( "program.id", program.getId() ) ).addOrder( Order.desc( "id" ) )
             .setFirstResult( min ).setMaxResults( max ).list();
     }
 
@@ -268,7 +268,7 @@
     @SuppressWarnings("unchecked")
     public Collection<Patient> getRepresentatives( Patient patient )
     {
-        String hql = "select distinct p from Patient p where p.representative = :representative order by p.id";
+        String hql = "select distinct p from Patient p where p.representative = :representative order by p.id DESC";
 
         return getQuery( hql ).setEntity( "representative", patient ).list();
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.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/patient/AddRepresentativeAction.java	2011-08-30 09:00:29 +0000
@@ -28,7 +28,6 @@
  */
 
 import java.util.Collection;
-import java.util.Date;
 
 import javax.servlet.http.HttpServletRequest;