← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12644: PatientStore, re-using patient search method and getting phone numbers from patient object instea...

 

------------------------------------------------------------
revno: 12644
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 17:55:28 +0200
message:
  PatientStore, re-using patient search method and getting phone numbers from patient object instead of having separate query just for phone numbers.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css


--
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	2013-10-14 14:03:52 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-10-14 15:55:28 +0000
@@ -46,6 +46,7 @@
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -284,25 +285,18 @@
         Boolean followup, Collection<PatientAttribute> patientAttributes, Integer statusEnrollment, Integer min,
         Integer max )
     {
-        String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, null,
-            statusEnrollment, min, max );
-        Collection<String> phoneNumbers = new HashSet<String>();
-        try
+        Collection<Patient> patients = search( searchKeys, orgunits, followup, patientAttributes, statusEnrollment, min, max );
+        
+        Set<String> phoneNumbers = new HashSet<String>();
+        
+        for ( Patient patient : patients )
         {
-            phoneNumbers = jdbcTemplate.query( sql, new RowMapper<String>()
+            if ( patient.getPhoneNumber() != null )
             {
-                public String mapRow( ResultSet rs, int rowNum )
-                    throws SQLException
-                {
-                    String phoneNumber = rs.getString( "phonenumber" );
-                    return (phoneNumber == null || phoneNumber.isEmpty()) ? "0" : phoneNumber;
-                }
-            } );
-        }
-        catch ( Exception ex )
-        {
-            ex.printStackTrace();
-        }
+                phoneNumbers.add( patient.getPhoneNumber() );
+            }
+        }
+        
         return phoneNumbers;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2013-10-11 10:56:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2013-10-14 15:55:28 +0000
@@ -674,7 +674,7 @@
 .tr-accordion .x-accordion-body { /* accordion item body */
 	padding: 8px 2px 2px 2px;
 	border-top: 1px solid #c5c5c5 !important;
-	border-bottom: 2px solid #C5C5C5 !important;
+	border-bottom: 1px solid #C5C5C5 !important;
 }
 
 .tr-accordion .x-accordion-hd-sibling-expanded {