dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25474
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12649: Minor
------------------------------------------------------------
revno: 12649
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-14 19:07:32 +0200
message:
Minor
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.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 2013-10-14 17:00:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-10-14 17:07:32 +0000
@@ -304,8 +304,49 @@
return jdbcTemplate.queryForObject( sql, Integer.class );
}
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max )
+ {
+ String hql = "select p from Patient p where p.phoneNumber like '%" + phoneNumber + "%'";
+ Query query = getQuery( hql );
+
+ if ( min != null && max != null )
+ {
+ query.setFirstResult( min ).setMaxResults( max );
+ }
+
+ return query.list();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Collection<Patient> getByFullName( String name, OrganisationUnit organisationUnit )
+ {
+ Criteria criteria = getCriteria( Restrictions.eq( "name", name ).ignoreCase() );
+
+ if ( organisationUnit != null )
+ {
+ criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
+ }
+
+ return criteria.setMaxResults( MAX_RESULTS ).list();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate )
+ {
+ Criteria criteria = getCriteria();
+ criteria.add( Restrictions.between( "registrationDate", startDate, endDate ) );
+ criteria.createAlias( "organisationUnit", "orgunit" );
+ criteria.setProjection( Projections.distinct( Projections.projectionList().add(
+ Projections.property( "orgunit.id" ), "orgunitid" ) ) );
+
+ return criteria.list();
+ }
+
// -------------------------------------------------------------------------
- // Supportive methods
+ // Supportive methods TODO Remplement all this!
// -------------------------------------------------------------------------
private String searchPatientSql( boolean count, List<String> searchKeys, Collection<OrganisationUnit> orgunits,
@@ -692,51 +733,6 @@
return sql;
}
- @Override
- @SuppressWarnings( "unchecked" )
- public Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max )
- {
- String hql = "select p from Patient p where p.phoneNumber like '%" + phoneNumber + "%'";
- Query query = getQuery( hql );
-
- if ( min != null && max != null )
- {
- query.setFirstResult( min ).setMaxResults( max );
- }
-
- return query.list();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Collection<Patient> getByFullName( String name, OrganisationUnit organisationUnit )
- {
- Criteria criteria = getCriteria( Restrictions.eq( "name", name ).ignoreCase() );
-
- if ( organisationUnit != null )
- {
- criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
- }
-
- return criteria.setMaxResults( MAX_RESULTS ).list();
- }
-
- @SuppressWarnings( "unchecked" )
- public Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate )
- {
- Criteria criteria = getCriteria();
- criteria.add( Restrictions.between( "registrationDate", startDate, endDate ) );
- criteria.createAlias( "organisationUnit", "orgunit" );
- criteria.setProjection( Projections.distinct( Projections.projectionList().add(
- Projections.property( "orgunit.id" ), "orgunitid" ) ) );
-
- return criteria.list();
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
private Collection<Integer> getOrgunitChildren( Collection<OrganisationUnit> orgunits )
{
Collection<Integer> orgUnitIds = new HashSet<Integer>();