← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10862: [mobile] update get patient for mobile

 

------------------------------------------------------------
revno: 10862
committer: Hong Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-17 11:15:47 +0700
message:
  [mobile] update get patient for mobile
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  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-api/src/main/java/org/hisp/dhis/patient/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-05-16 08:40:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-05-17 04:15:47 +0000
@@ -43,206 +43,186 @@
  * @version $Id$
  */
 
-public interface PatientService {
-	String ID = PatientService.class.getName();
-
-	int savePatient(Patient patient);
-
-	void deletePatient(Patient patient);
-
-	void updatePatient(Patient patient);
-
-	Patient getPatient(int id);
-
-	Collection<Patient> getAllPatients();
-
-	/**
-	 * Search Patient base on firstname/middlename/lastname/birthDate/gender
-	 * 
-	 * @param firstName
-	 * @param middleName
-	 * @param lastName
-	 * @param birthdate
-	 * @param gender
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatients(String firstName, String middleName,
-			String lastName, Date birthdate, String gender);
-
-	/**
-	 * Search Patient base on gender
-	 * 
-	 * @param gender
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatiensByGender(String gender);
-
-	/**
-	 * Search Patient base on birthDate
-	 * 
-	 * @param birthdate
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatientsByBirthDate(Date birthDate);
-
-	/**
-	 * Search Patient base on fullName
-	 * 
-	 * @param name
-	 *            fullName
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatientsByNames(String name, Integer min, Integer max);
-
-	/**
-	 * Search Patient base on full-name or identifier value
-	 * 
-	 * @param searchText
-	 *            value
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatients(String searchText, Integer min, Integer max);
-
-	/**
-	 * Search Patient for mobile base on identifier value
-	 * 
-	 * @param searchText
-	 *            value
-	 * @param orgUnitId
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatientsForMobile(String searchText, int orgUnitId);
-
-	/**
-	 * Search Patient base on organization unit with result limited
-	 * 
-	 * @param organisationUnit
-	 *            organisationUnit
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatients(OrganisationUnit organisationUnit,
-			Integer min, Integer max);
-
-	/**
-	 * Search Patient base on organization unit and sort the result by
-	 * PatientAttribute
-	 * 
-	 * @param organisationUnit
-	 *            organisationUnit
-	 * @param patientAttribute
-	 * @param min
-	 * @param max
-	 * @return Patient List
-	 */
-	Collection<Patient> getPatients(OrganisationUnit organisationUnit,
-			PatientAttribute patientAttribute, Integer min, Integer max);
-
-	/**
-	 * Search Patient base on organisationUnit and identifier value name
-	 * 
-	 * @param organisationUnit
-	 * @param searchText
-	 *            identifier value
-	 * @param min
-	 * @param max
-	 * @return
-	 */
-	Collection<Patient> getPatients(OrganisationUnit organisationUnit,
-			String searchText, Integer min, Integer max);
-
-	/**
-	 * Search Patient base on PatientIdentifierType or Attribute or Patient's
-	 * name
-	 * 
-	 * @param identifierTypeId
-	 * @param attributeId
-	 * @param value
-	 * @return
-	 */
-	Collection<Patient> getPatient(Integer identifierTypeId,
-			Integer attributeId, String value);
-
-	/**
-	 * Search Patient base on OrganisationUnit and Program with result limited
-	 * name
-	 * 
-	 * @param organisationUnit
-	 * @param program
-	 * @param min
-	 * @param max
-	 * @return
-	 */
-	Collection<Patient> getPatients(OrganisationUnit organisationUnit,
-			Program program, Integer min, Integer max);
-
-	/**
-	 * Sort the result by PatientAttribute
-	 * 
-	 * @param patients
-	 * @param patientAttribute
-	 * @return Patient List
-	 */
-	Collection<Patient> sortPatientsByAttribute(Collection<Patient> patients,
-			PatientAttribute patientAttribute);
-
-	Collection<Patient> getRepresentatives(Patient patient);
-
-	/**
-	 * Search Patient base on identifier value and get number of result
-	 * 
-	 * @param searchText
-	 * @return number of patients
-	 */
-	int countGetPatients(String searchText);
-
-	/**
-	 * Search Patient base on firstname/middlename/lastname and get number of
-	 * result
-	 * 
-	 * @param name
-	 * @return number of patients
-	 */
-	int countGetPatientsByName(String name);
-
-	int createPatient(Patient patient, Integer representativeId,
-			Integer relationshipTypeId,
-			List<PatientAttributeValue> patientAttributeValues);
-
-	void updatePatient(Patient patient, Integer representativeId,
-			Integer relationshipTypeId,
-			List<PatientAttributeValue> valuesForSave,
-			List<PatientAttributeValue> valuesForUpdate,
-			Collection<PatientAttributeValue> valuesForDelete);
-
-	int countGetPatientsByOrgUnit(OrganisationUnit organisationUnit);
-
-	int countGetPatientsByOrgUnitProgram(OrganisationUnit organisationUnit,
-			Program program);
-
-	Object getObjectValue(String property, String value, I18nFormat format);
-
-	void removeErollmentPrograms(Program program);
-
-	Collection<Patient> searchPatients(List<String> searchKeys,
-			OrganisationUnit orgunit, Integer min, Integer max);
-
-	int countSearchPatients(List<String> searchKeys, OrganisationUnit orgunit);
-
-	Collection<String> getPatientPhoneNumbers(List<String> searchKeys,
-			OrganisationUnit orgunit, Integer min, Integer max);
-
-	List<Integer> getProgramStageInstances(List<String> searchKeys,
-			OrganisationUnit orgunit, Integer min, Integer max);
-
-	Grid getScheduledEventsReport(List<String> searchKeys,
-			OrganisationUnit orgunit, I18n i18n);
-
-	Collection<Patient> getPatientsByPhone(String phoneNumber, Integer min,
-			Integer max);
-
-	Collection<Patient> getPatientByFullname(String fullName, Integer orgunitId);
-	
-	Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate );
-
-        Patient getLatestPatient(Integer patientId);
+public interface PatientService
+{
+    String ID = PatientService.class.getName();
+
+    int savePatient( Patient patient );
+
+    void deletePatient( Patient patient );
+
+    void updatePatient( Patient patient );
+
+    Patient getPatient( int id );
+
+    Collection<Patient> getAllPatients();
+
+    /**
+     * Search Patient base on firstname/middlename/lastname/birthDate/gender
+     * 
+     * @param firstName
+     * @param middleName
+     * @param lastName
+     * @param birthdate
+     * @param gender
+     * @return Patient List
+     */
+    Collection<Patient> getPatients( String firstName, String middleName, String lastName, Date birthdate, String gender );
+
+    /**
+     * Search Patient base on gender
+     * 
+     * @param gender
+     * @return Patient List
+     */
+    Collection<Patient> getPatiensByGender( String gender );
+
+    /**
+     * Search Patient base on birthDate
+     * 
+     * @param birthdate
+     * @return Patient List
+     */
+    Collection<Patient> getPatientsByBirthDate( Date birthDate );
+
+    /**
+     * Search Patient base on fullName
+     * 
+     * @param name fullName
+     * @return Patient List
+     */
+    Collection<Patient> getPatientsByNames( String name, Integer min, Integer max );
+
+    /**
+     * Search Patient base on full-name or identifier value
+     * 
+     * @param searchText value
+     * @return Patient List
+     */
+    Collection<Patient> getPatients( String searchText, Integer min, Integer max );
+
+    /**
+     * Search Patient for mobile base on identifier value
+     * 
+     * @param searchText value
+     * @param orgUnitId
+     * @return Patient List
+     */
+    Collection<Patient> getPatientsForMobile( String searchText, int orgUnitId );
+
+    /**
+     * Search Patient base on organization unit with result limited
+     * 
+     * @param organisationUnit organisationUnit
+     * @return Patient List
+     */
+    Collection<Patient> getPatients( OrganisationUnit organisationUnit, Integer min, Integer max );
+
+    /**
+     * Search Patient base on organization unit and sort the result by
+     * PatientAttribute
+     * 
+     * @param organisationUnit organisationUnit
+     * @param patientAttribute
+     * @param min
+     * @param max
+     * @return Patient List
+     */
+    Collection<Patient> getPatients( OrganisationUnit organisationUnit, PatientAttribute patientAttribute, Integer min,
+        Integer max );
+
+    /**
+     * Search Patient base on organisationUnit and identifier value name
+     * 
+     * @param organisationUnit
+     * @param searchText identifier value
+     * @param min
+     * @param max
+     * @return
+     */
+    Collection<Patient> getPatients( OrganisationUnit organisationUnit, String searchText, Integer min, Integer max );
+
+    /**
+     * Search Patient base on PatientIdentifierType or Attribute or Patient's
+     * name
+     * 
+     * @param identifierTypeId
+     * @param attributeId
+     * @param value
+     * @return
+     */
+    Collection<Patient> getPatient( Integer identifierTypeId, Integer attributeId, String value );
+
+    /**
+     * Search Patient base on OrganisationUnit and Program with result limited
+     * name
+     * 
+     * @param organisationUnit
+     * @param program
+     * @param min
+     * @param max
+     * @return
+     */
+    Collection<Patient> getPatients( OrganisationUnit organisationUnit, Program program, Integer min, Integer max );
+
+    /**
+     * Sort the result by PatientAttribute
+     * 
+     * @param patients
+     * @param patientAttribute
+     * @return Patient List
+     */
+    Collection<Patient> sortPatientsByAttribute( Collection<Patient> patients, PatientAttribute patientAttribute );
+
+    Collection<Patient> getRepresentatives( Patient patient );
+
+    /**
+     * Search Patient base on identifier value and get number of result
+     * 
+     * @param searchText
+     * @return number of patients
+     */
+    int countGetPatients( String searchText );
+
+    /**
+     * Search Patient base on firstname/middlename/lastname and get number of
+     * result
+     * 
+     * @param name
+     * @return number of patients
+     */
+    int countGetPatientsByName( String name );
+
+    int createPatient( Patient patient, Integer representativeId, Integer relationshipTypeId,
+        List<PatientAttributeValue> patientAttributeValues );
+
+    void updatePatient( Patient patient, Integer representativeId, Integer relationshipTypeId,
+        List<PatientAttributeValue> valuesForSave, List<PatientAttributeValue> valuesForUpdate,
+        Collection<PatientAttributeValue> valuesForDelete );
+
+    int countGetPatientsByOrgUnit( OrganisationUnit organisationUnit );
+
+    int countGetPatientsByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
+
+    Object getObjectValue( String property, String value, I18nFormat format );
+
+    void removeErollmentPrograms( Program program );
+
+    Collection<Patient> searchPatients( List<String> searchKeys, OrganisationUnit orgunit, Integer min, Integer max );
+
+    int countSearchPatients( List<String> searchKeys, OrganisationUnit orgunit );
+
+    Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit, Integer min,
+        Integer max );
+
+    List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Integer min, Integer max );
+
+    Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, I18n i18n );
+
+    Collection<Patient> getPatientsByPhone( String phoneNumber, Integer min, Integer max );
+
+    Collection<Patient> getPatientByFullname( String fullName, Integer orgunitId );
+
+    Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate );
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-05-16 08:40:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-05-17 04:15:47 +0000
@@ -85,6 +85,4 @@
 
     Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate );
 
-    Patient getLatestPatient(Integer patientId);
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-05-16 08:40:58 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-05-17 04:15:47 +0000
@@ -1673,7 +1673,7 @@
     public org.hisp.dhis.api.mobile.model.LWUITmodel.Patient findLatestPatient()
         throws NotAllowedException
     {
-        Patient patient = (Patient) this.patientService.getLatestPatient( this.getPatientId() );
+        Patient patient = (Patient) this.patientService.getPatient( this.patientId );
 
         org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patientMobile = getPatientModel( patient );
         return patientMobile;

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-05-16 08:40:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-05-17 04:15:47 +0000
@@ -600,11 +600,4 @@
         return patientStore.getRegistrationOrgunitIds( startDate, endDate );
     }
 
-    @Override
-    public Patient getLatestPatient(Integer patientId)
-    {
-        
-        return patientStore.getLatestPatient(patientId);
-    }
-
 }

=== 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-05-16 08:40:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-05-17 04:15:47 +0000
@@ -712,17 +712,4 @@
         return orgunitIds;
     }
 
-    @Override
-    public Patient getLatestPatient( Integer patientId )
-    {
-        Patient patient = new Patient();
-        String hql = "select p from Patient p where p.id = " + patientId;
-        Query query = getQuery( hql );
-        query.setMaxResults( 1 );
-
-        patient = (Patient) query.uniqueResult();
-
-        return patient;
-    }
-
 }