dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18758
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7943: Only show the events which satisfied tsearching conditions in SMS Reminder
------------------------------------------------------------
revno: 7943
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-08-21 13:18:26 +0700
message:
Only show the events which satisfied tsearching conditions in SMS Reminder
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/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.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/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/smsPatientRecords.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-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 2012-08-20 03:18:20 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2012-08-21 06:18:26 +0000
@@ -414,7 +414,7 @@
patientWhere += "psi.completed=true";
break;
case ProgramStageInstance.VISITED_STATUS:
- patientWhere += "psi.executiondate is not null";
+ patientWhere += "psi.executiondate is not null and psi.completed=false";
break;
case ProgramStageInstance.FUTURE_VISIT_STATUS:
patientWhere += "psi.executiondate is null and psi.duedate >= now()";
@@ -464,6 +464,7 @@
{
sql += statementBuilder.limitRecord( min, max );
}
+
return sql;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-08-20 03:18:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java 2012-08-21 06:18:26 +0000
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.caseentry;
+
+import java.util.Date;
+
+import org.hisp.dhis.caseentry.state.SelectedStateManager;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $Id: CreateAnonymousEncounterAction.java Dec 16, 2011 9:08:12 AM $
+ */
+public class CreateAnonymousEncounterAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SelectedStateManager selectedStateManager;
+
+ public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+ {
+ this.selectedStateManager = selectedStateManager;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private ProgramInstanceService programInstanceService;
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer programId;
+
+ public void setProgramId( Integer programId )
+ {
+ this.programId = programId;
+ }
+
+ public String executionDate;
+
+ public void setExecutionDate( String executionDate )
+ {
+ this.executionDate = executionDate;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ Date date = format.parseDate( executionDate );
+
+ if ( date == null )
+ {
+ message = i18n.getString( "please_enter_report_date" );
+ }
+ else
+ {
+ Program program = programService.getProgram( programId );
+ ProgramStage programStage = program.getProgramStages().iterator().next();
+
+ ProgramInstance programInstance = programInstanceService.getProgramInstances( program ).iterator().next();
+
+ ProgramStageInstance programStageInstance = new ProgramStageInstance();
+ programStageInstance.setProgramInstance( programInstance );
+ programStageInstance.setProgramStage( programStage );
+ programStageInstance.setDueDate( date );
+ programStageInstance.setExecutionDate( date );
+ programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
+
+ int id = programStageInstanceService.addProgramStageInstance( programStageInstance );
+
+ message = id + "";
+ }
+
+ return (date != null) ? SUCCESS : INPUT;
+ }
+}
\ No newline at end of file
=== 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 2012-08-13 07:40:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2012-08-21 06:18:26 +0000
@@ -106,14 +106,14 @@
{
this.listAll = listAll;
}
-
+
private Boolean searchBySelectedOrgunit;
-
+
public void setSearchBySelectedOrgunit( Boolean searchBySelectedOrgunit )
{
this.searchBySelectedOrgunit = searchBySelectedOrgunit;
}
-
+
private List<String> searchTexts = new ArrayList<String>();
public void setSearchTexts( List<String> searchTexts )
@@ -163,6 +163,13 @@
return patients;
}
+ private Collection<Integer> programStageInstanceIds;
+
+ public Collection<Integer> getProgramStageInstanceIds()
+ {
+ return programStageInstanceIds;
+ }
+
// -------------------------------------------------------------------------
// Implementation Action
// -------------------------------------------------------------------------
@@ -177,7 +184,7 @@
// ---------------------------------------------------------------------
// Program instances for the selected program
// ---------------------------------------------------------------------
-
+
// List all patients
if ( listAll )
{
@@ -192,11 +199,12 @@
else if ( searchTexts.size() > 0 )
{
orgunit = (searchBySelectedOrgunit) ? orgunit : null;
+
+ total = patientService.countSearchPatients( searchTexts, orgunit );
+ this.paging = createPaging( total );
+ patients = patientService.searchPatients( searchTexts, orgunit, paging.getStartPos(), paging.getPageSize() );
- total = patientService.countSearchPatients( searchTexts, orgunit );
- this.paging = createPaging( total );
- patients = patientService.searchPatients( searchTexts, orgunit, paging.getStartPos(),
- paging.getPageSize() );
+ programStageInstanceIds = patientService.getProgramStageInstances( searchTexts, orgunit, paging.getStartPos(), paging.getPageSize() );
}
Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
=== 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 2012-08-20 08:50:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-08-21 06:18:26 +0000
@@ -418,4 +418,5 @@
no_sms_service_available = No Sms service available
due_date_from_to = Due date (from-to)
no_phone_number = No phone number
-no_comment = No comment
\ No newline at end of file
+no_comment = No comment
+please_select_program_stage = Please select program stage
\ 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 2012-08-20 08:50:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2012-08-21 06:18:26 +0000
@@ -22,6 +22,7 @@
function listAllPatient()
{
+ setFieldValue('listAll', "true");
hideById('listPatientDiv');
contentDiv = 'listPatientDiv';
$('#contentDataRecord').html('');
@@ -41,6 +42,8 @@
function advancedSearch( params )
{
+
+ setFieldValue('listAll', "false");
$('#contentDataRecord').html('');
params += "&searchTexts=prg_" + getFieldValue('programIdAddPatient');
params += "&programId=" + getFieldValue('programIdAddPatient');
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm 2012-08-20 08:50:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/smsPatientRecords.vm 2012-08-21 06:18:26 +0000
@@ -46,14 +46,13 @@
<tr>
#set( $flag = "false" )
#foreach( $programStageInstance in $programStageInstances )
- <td>
+ <td id="img_$programStageInstance.id">
<img src='images/rightarrow.png'>
</td>
- <td>
+ <td id="td_$programStageInstance.id">
<table class='stage-object'>
<tr>
<td>
-
<input type='button' id='ps_$programStageInstance.id' name='programStageBtn'
programStageInstanceId='$programStageInstance.id'
programStageId='$programStageInstance.programStage.id'
@@ -61,23 +60,11 @@
class='stage-object'
value='$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )'
onclick='javascript:getOutboundSmsList( $programStageInstance.id, false );'>
- </div>
</td>
<script>
var status = $statusMap.get( $programStageInstance.id );
- var programStageId = '$programStageInstance.programStage.id';
- var dueDate = '$programStageInstance.dueDate';
- var flag = "$flag"
- setEventColorStatus( 'ps_' + $programStageInstance.id ,status);
-
- if( status == getFieldValue('statusEvent')
- && programStageId == getFieldValue('programStageAddPatient')
- && dueDate >= getFieldValue('startDueDate') && dueDate <= getFieldValue('endDueDate')
- && flag == "false")
- {
- jQuery("#ps_$programStageInstance.id").addClass("stage-object-selected");
- #set( $flag = "true" )
- }
+ var dueDate = "$format.formatDate($programStageInstance.dueDate)";
+ setEventColorStatus( 'ps_' + $programStageInstance.id ,status, dueDate );
</script>
</tr>
<tr>
@@ -137,4 +124,21 @@
</div>
<div id="detailsInfo"></div>
-#end
\ No newline at end of file
+#end
+
+<script>
+ #if( $programStageInstanceIds )
+ jQuery("#patientList .stage-object").each( function(){
+ var programStageInstance = this.id.split('_')[1];
+ hideById('img_' + programStageInstance );
+ hideById('td_' + programStageInstance );
+ });
+
+ jQuery(".arrow-left").css("display", "none");
+ jQuery(".arrow-right").css("display", "none");
+ #foreach( $id in $programStageInstanceIds )
+ showById('td_$id');
+ jQuery("#ps_$id").addClass("stage-object-selected");
+ #end
+ #end
+</script>
\ No newline at end of file