← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11041: Add option to alllow displaying only risk cases in program tracking

 

------------------------------------------------------------
revno: 11041
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-05-28 16:04:10 +0700
message:
  Add option to alllow displaying only risk cases in program tracking
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-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
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.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-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-24 09:10:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-05-28 09:04:10 +0000
@@ -209,16 +209,16 @@
     void removeErollmentPrograms( Program program );
 
     Collection<Patient> searchPatients( List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
-
-    int countSearchPatients( List<String> searchKeys, OrganisationUnit orgunit );
-
-    Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit, Integer min,
+       Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
+
+    int countSearchPatients( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup );
+
+    Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup, Integer min,
         Integer max );
 
-    List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Integer min, Integer max );
+    List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup, Integer min, Integer max );
 
-    Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, Integer min, Integer max,
+    Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup, Integer min, Integer max,
         I18n i18n );
 
     Collection<Patient> getPatientsByPhone( String phoneNumber, Integer min, Integer max );

=== 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-24 09:10:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-05-28 09:04:10 +0000
@@ -68,7 +68,7 @@
 
     void removeErollmentPrograms( Program program );
 
-    int countSearch( List<String> searchKeys, OrganisationUnit orgunit );
+    int countSearch( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup );
 
     Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max );
 
@@ -76,16 +76,16 @@
 
     Collection<Integer> getRegistrationOrgunitIds( Date startDate, Date endDate );
 
-    Collection<Patient> search( List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
-
-    Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
-
-    List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
-
-    Grid getPatientEventReport( Grid grid, List<String> searchKeys, OrganisationUnit orgunit,
+    Collection<Patient> search( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
+        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
+
+    Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
+        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
+
+    List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
+        Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
+
+    Grid getPatientEventReport( Grid grid, List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
         Collection<PatientAttribute> patientAttributes, Integer min, Integer max );
 
 }

=== 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-24 09:10:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-05-28 09:04:10 +0000
@@ -523,27 +523,27 @@
         patientStore.removeErollmentPrograms( program );
     }
 
-    public Collection<Patient> searchPatients( List<String> searchKeys, OrganisationUnit orgunit,
+    public Collection<Patient> searchPatients( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
         Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
     {
-        return patientStore.search( searchKeys, orgunit, patientAttributes, min, max );
+        return patientStore.search( searchKeys, orgunit, followup, patientAttributes, min, max );
     }
 
-    public int countSearchPatients( List<String> searchKeys, OrganisationUnit orgunit )
+    public int countSearchPatients( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup )
     {
-        return patientStore.countSearch( searchKeys, orgunit );
+        return patientStore.countSearch( searchKeys, orgunit, followup );
     }
 
     public Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit,
+        Boolean followup, Integer min, Integer max )
+    {
+        return patientStore.getPatientPhoneNumbers( searchKeys, orgunit, followup, null, min, max );
+    }
+
+    public List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
         Integer min, Integer max )
     {
-        return patientStore.getPatientPhoneNumbers( searchKeys, orgunit, null, min, max );
-    }
-
-    public List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Integer min,
-        Integer max )
-    {
-        return patientStore.getProgramStageInstances( searchKeys, orgunit, null, min, max );
+        return patientStore.getProgramStageInstances( searchKeys, orgunit, followup, null, min, max );
     }
 
     @Override
@@ -553,8 +553,8 @@
     }
 
     @Override
-    public Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, Integer min, Integer max,
-        I18n i18n )
+    public Grid getScheduledEventsReport( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
+        Integer min, Integer max, I18n i18n )
     {
         String startDate = "";
         String endDate = "";
@@ -593,7 +593,7 @@
         grid.addHeader( new GridHeader( i18n.getString( "program_stage" ), false, true ) );
         grid.addHeader( new GridHeader( i18n.getString( "due_date" ), false, true ) );
 
-        return patientStore.getPatientEventReport( grid, searchKeys, orgunit, patientAttributes, min, max );
+        return patientStore.getPatientEventReport( grid, searchKeys, orgunit, followup, patientAttributes, min, max );
 
     }
 
@@ -608,5 +608,5 @@
     {
         return patientStore.getRegistrationOrgunitIds( startDate, endDate );
     }
-    
+
 }

=== 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-24 09:10:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-05-28 09:04:10 +0000
@@ -255,9 +255,9 @@
 
     @Override
     public Collection<Patient> search( List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
+        Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
     {
-        String sql = searchPatientSql( false, searchKeys, orgunit, patientAttributes, min, max );
+        String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, min, max );
         Collection<Patient> patients = new HashSet<Patient>();
         try
         {
@@ -279,9 +279,9 @@
 
     @Override
     public Collection<String> getPatientPhoneNumbers( List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
+        Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
     {
-        String sql = searchPatientSql( false, searchKeys, orgunit, patientAttributes, min, max );
+        String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, min, max );
         Collection<String> phoneNumbers = new HashSet<String>();
         try
         {
@@ -303,10 +303,10 @@
     }
 
     @Override
-    public List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit,
+    public List<Integer> getProgramStageInstances( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup,
         Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
     {
-        String sql = searchPatientSql( false, searchKeys, orgunit, patientAttributes, min, max );
+        String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, min, max );
         List<Integer> programStageInstanceIds = new ArrayList<Integer>();
         try
         {
@@ -327,21 +327,21 @@
         return programStageInstanceIds;
     }
 
-    public int countSearch( List<String> searchKeys, OrganisationUnit orgunit )
+    public int countSearch( List<String> searchKeys, OrganisationUnit orgunit, Boolean followup )
     {
-        String sql = searchPatientSql( true, searchKeys, orgunit, null, null, null );
+        String sql = searchPatientSql( true, searchKeys, orgunit, followup, null, null, null );
         return jdbcTemplate.queryForObject( sql, Integer.class );
     }
 
     @Override
     public Grid getPatientEventReport( Grid grid, List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
+        Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
     {
         // ---------------------------------------------------------------------
         // Get SQL and build grid
         // ---------------------------------------------------------------------
 
-        String sql = searchPatientSql( false, searchKeys, orgunit, patientAttributes, null, null );
+        String sql = searchPatientSql( false, searchKeys, orgunit, followup, patientAttributes, null, null );
 
         SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
 
@@ -355,7 +355,7 @@
     // -------------------------------------------------------------------------
 
     private String searchPatientSql( boolean count, List<String> searchKeys, OrganisationUnit orgunit,
-        Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
+        Boolean followup, Collection<PatientAttribute> patientAttributes, Integer min, Integer max )
     {
         String selector = count ? "count(*) " : "* ";
 
@@ -633,6 +633,10 @@
         }
 
         sql += from + patientWhere;
+        if ( followup != null )
+        {
+            sql += " AND pgi.followup=" + followup;
+        }
         if ( isSearchEvent )
         {
             sql += patientGroupBy;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java	2013-05-24 09:10:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java	2013-05-28 09:04:10 +0000
@@ -195,6 +195,13 @@
         return patientAttributeValueMap;
     }
 
+    private Boolean followup;
+
+    public void setFollowup( Boolean followup )
+    {
+        this.followup = followup;
+    }
+
     // -------------------------------------------------------------------------
     // Implementation Action
     // -------------------------------------------------------------------------
@@ -218,10 +225,10 @@
                 patientAttributes = new ArrayList<PatientAttribute>(
                     patientAttributeService.getPatientAttributesByDisplayOnVisitSchedule( true ) );
 
-                total = patientService.countSearchPatients( searchTexts, orgunit );
+                total = patientService.countSearchPatients( searchTexts, orgunit, followup );
                 this.paging = createPaging( total );
 
-                List<Integer> stageInstanceIds = patientService.getProgramStageInstances( searchTexts, orgunit,
+                List<Integer> stageInstanceIds = patientService.getProgramStageInstances( searchTexts, orgunit, followup,
                     paging.getStartPos(), paging.getPageSize() );
 
                 for ( Integer stageInstanceId : stageInstanceIds )
@@ -251,7 +258,7 @@
             }
             else
             {
-                grid = patientService.getScheduledEventsReport( searchTexts, orgunit, null, null, i18n );
+                grid = patientService.getScheduledEventsReport( searchTexts, orgunit, followup, null, null, i18n );
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java	2013-05-24 09:10:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java	2013-05-28 09:04:10 +0000
@@ -166,9 +166,9 @@
         {
             organisationUnit = (searchBySelectedOrgunit) ? organisationUnit : null;
 
-            total = patientService.countSearchPatients( searchTexts, organisationUnit );
+            total = patientService.countSearchPatients( searchTexts, organisationUnit, null );
             this.paging = createPaging( total );
-            patients = patientService.searchPatients( searchTexts, organisationUnit, null, paging.getStartPos(),
+            patients = patientService.searchPatients( searchTexts, organisationUnit, null, null, paging.getStartPos(),
                 paging.getPageSize() );
 
             if ( !searchBySelectedOrgunit )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java	2012-09-23 11:52:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java	2013-05-28 09:04:10 +0000
@@ -77,10 +77,12 @@
 
     private Boolean searchBySelectedOrgunit;
 
+    private Boolean followup;
+
     // -------------------------------------------------------------------------
     // Getters && Setters
     // -------------------------------------------------------------------------
-    
+
     public void setCurrentUserService( CurrentUserService currentUserService )
     {
         this.currentUserService = currentUserService;
@@ -101,6 +103,11 @@
         this.i18n = i18n;
     }
 
+    public void setFollowup( Boolean followup )
+    {
+        this.followup = followup;
+    }
+
     public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
     {
         this.selectionManager = selectionManager;
@@ -151,10 +158,10 @@
             : null;
 
         Collection<Integer> programStageInstanceIds = patientService.getProgramStageInstances( searchTexts,
-            organisationUnit, null, null );
+            organisationUnit, followup, null, null );
 
         Set<String> phoneNumberList = new HashSet<String>( patientService.getPatientPhoneNumbers( searchTexts,
-            organisationUnit, null, null ) );
+            organisationUnit, followup, null, null ) );
         try
         {
             OutboundSms outboundSms = new OutboundSms();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-05-28 06:42:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-05-28 09:04:10 +0000
@@ -650,4 +650,5 @@
 none_program = None program
 none_dataset = None dataset
 access_log = Access Log
-risk = Risk
\ No newline at end of file
+risk = Risk
+show_only_risk_cases = Show only Risk cases
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-05-28 07:09:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-05-28 09:04:10 +0000
@@ -77,9 +77,12 @@
 				+ startDate + "_" + endDate + "_" 
 				+ getFieldValue('orgunitId') + "_true_" 
 				+ getFieldValue('statusEvent');
-	
+	var followup = "";
+	if( byId('followup').checked ){
+		followup = "?followup=true";
+	}
 	showLoader();
-	jQuery('#listEventDiv').load('getSMSPatientRecords.action',
+	jQuery('#listEventDiv').load('getSMSPatientRecords.action' + followup,
 		{
 			programId:programId,
 			listAll:false,

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm	2013-05-28 07:09:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm	2013-05-28 09:04:10 +0000
@@ -20,7 +20,9 @@
 		setFieldValue('hideLink', 'true');
 		isDashboard = true;
 		showById('dueDateTR');
+		showById('followupTR');
 		setFieldValue('listPatientBtn','$encoder.jsEscape( $i18n.getString( "list_events" ) , "'")');
+		
 		mainPage = 0;
 	});	
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-05-28 03:10:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2013-05-28 09:04:10 +0000
@@ -11,7 +11,7 @@
 		<td>
 			<input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end >
 		</td>
-		<td rowspan='4' valign='bottom'>
+		<td rowspan='5' valign='bottom'>
 			<input type="button" style='width:130px' id='listPatientBtn' style='260px;' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" >
 			<input type="button" style='width:130px' id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();" >
 			<input type="button" style='width:130px' id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();" >
@@ -56,6 +56,12 @@
 			</select>
 		</td>
 	</tr>
+	<tr id='followupTR' class='hidden'>
+		<td>$i18n.getString('show_only_risk_cases')</td>
+		<td>
+			<input type='checkbox' id='followup' name='followup' />
+		</td>
+	</tr>
 </table>
 
 <div id='advanced-search' class='hidden advanced-search'>