← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10520: improved program tracking with easier tagging/focus of risk cases.

 

------------------------------------------------------------
revno: 10520
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-11 15:30:45 +0700
message:
  improved program tracking with easier tagging/focus of risk cases.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MarkForFollowupAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
  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/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  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/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  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/visitSchedule.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/program/ProgramInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java	2013-04-11 08:30:45 +0000
@@ -36,6 +36,7 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patientcomment.PatientComment;
 import org.hisp.dhis.sms.outbound.OutboundSms;
 
 import java.io.Serializable;
@@ -81,6 +82,10 @@
 
     private List<OutboundSms> outboundSms;
 
+    private Boolean followup;
+
+    private PatientComment patientComment;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -337,6 +342,38 @@
         this.outboundSms = outboundSms;
     }
 
+    /**
+     * @return the followup
+     */
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Boolean getFollowup()
+    {
+        return followup;
+    }
+
+    public void setFollowup( Boolean followup )
+    {
+        this.followup = followup;
+    }
+
+    /**
+     * @return the patientComment
+     */
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public PatientComment getPatientComment()
+    {
+        return patientComment;
+    }
+
+    public void setPatientComment( PatientComment patientComment )
+    {
+        this.patientComment = patientComment;
+    }
+
     // -------------------------------------------------------------------------
     // Convenience method
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java	2013-04-11 08:30:45 +0000
@@ -106,11 +106,7 @@
         String facilityLB, Integer deGroupBy, Integer deSum, Map<Integer, Collection<String>> deFilters,
         List<Period> periods, String aggregateType, Integer limit, Boolean useCompletedEvents,
         Boolean displayTotals, I18nFormat format, I18n i18n );
-
-    // -------------------------------------------------------------------------
-    // Activity plans
-    // -------------------------------------------------------------------------
-
+    
     Collection<ProgramStageInstance> get( Program program, Collection<Integer> orgunitIds, Date startDate,
         Date endDate, Boolean completed );
 

=== 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-04-10 03:13:47 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-04-11 08:30:45 +0000
@@ -465,6 +465,7 @@
                         patientWhere += condition + operatorStatus
                             + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
                             + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=false ";
+
                         // get events by orgunit children
                         if ( keys[4].equals( "-1" ) )
                         {
@@ -592,15 +593,22 @@
         if ( isSearchEvent )
         {
             String subSQL = " , psi.programstageinstanceid as programstageinstanceid, pgs.name as programstagename, psi.duedate as duedate ";
+            if ( isPriorityEvent )
+            {
+                subSQL += ",pgi.followup ";
+                orderBy = " ORDER BY pgi.followup desc, duedate asc ";
+                patientGroupBy += ",pgi.followup ";
+            }
+            else
+            {
+                orderBy = " ORDER BY duedate asc ";
+            }
             sql = sql + subSQL + from + " inner join programinstance pgi on " + " (pgi.patientid=p.patientid) "
                 + " inner join programstageinstance psi on " + " (psi.programinstanceid=pgi.programinstanceid) "
                 + " inner join programstage pgs on (pgs.programstageid=psi.programstageid) ";
-            if ( isPriorityEvent )
-            {
-                sql += " inner join patientattributevalue pav on p.patientid=pav.patientid ";
-            }
+
             patientGroupBy += ",psi.programstageinstanceid, pgs.name ";
-            orderBy = " ORDER BY duedate asc ";
+
             from = " ";
         }
 
@@ -684,11 +692,11 @@
             Projections.property( "orgunit.id" ), "orgunitid" ) ) );
         return criteria.list();
     }
-    
+
     // -------------------------------------------------------------------------
     // Supportive methods
     // -------------------------------------------------------------------------
-    
+
     private Collection<Integer> getOrgunitChildren( OrganisationUnit orgunit )
     {
         Collection<Integer> orgunitIds = new HashSet<Integer>();

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-04-11 03:23:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2013-04-11 08:30:45 +0000
@@ -202,6 +202,7 @@
         
         executeSql( "update program set remindCompleted=false where remindCompleted is null" );
         executeSql( "update patientreminder set dateToCompare='duedate' where programstageid is not null" );
+        executeSql( "UPDATE programinstance SET followup=false where followup is null" );
         
         updateUid();
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2013-04-10 08:45:43 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramInstance.hbm.xml	2013-04-11 08:30:45 +0000
@@ -4,36 +4,45 @@
   "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
 
 <hibernate-mapping>
-  <class name="org.hisp.dhis.program.ProgramInstance" table="programinstance">
-
-    <id name="id" column="programinstanceid">
-      <generator class="native" />
-    </id>
-
-    <property name="dateOfIncident" column="dateofincident" not-null="true" />
-
-    <property name="enrollmentDate" column="enrollmentdate" not-null="true" />
-
-    <property name="endDate" column="enddate" />
-
-    <property name="status" />
-
-    <many-to-one name="patient" class="org.hisp.dhis.patient.Patient" column="patientid"
-      foreign-key="fk_programinstance_patientid" />
-
-    <many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid" not-null="true"
-      foreign-key="fk_programinstance_programid" />
-
-    <set name="programStageInstances" order-by="executionDate,duedate" >
-      <key column="programinstanceid" />
-      <one-to-many class="org.hisp.dhis.program.ProgramStageInstance" />
-    </set>
-    
-    <list name="outboundSms" table="programinstance_outboundsms">
-      <key column="programinstanceid" />
-      <list-index column="sort_order" base="1" />
-      <many-to-many class="org.hisp.dhis.sms.outbound.OutboundSms" column="outboundsmsid" />
-    </list>
-
-  </class>
+	<class name="org.hisp.dhis.program.ProgramInstance" table="programinstance">
+
+		<id name="id" column="programinstanceid">
+			<generator class="native" />
+		</id>
+
+		<property name="dateOfIncident" column="dateofincident"
+			not-null="true" />
+
+		<property name="enrollmentDate" column="enrollmentdate"
+			not-null="true" />
+
+		<property name="endDate" column="enddate" />
+
+		<property name="status" />
+
+		<many-to-one name="patient" class="org.hisp.dhis.patient.Patient"
+			column="patientid" foreign-key="fk_programinstance_patientid" />
+
+		<many-to-one name="program" class="org.hisp.dhis.program.Program"
+			column="programid" not-null="true" foreign-key="fk_programinstance_programid" />
+
+		<set name="programStageInstances" order-by="executionDate,duedate">
+			<key column="programinstanceid" />
+			<one-to-many class="org.hisp.dhis.program.ProgramStageInstance" />
+		</set>
+
+		<list name="outboundSms" table="programinstance_outboundsms">
+			<key column="programinstanceid" />
+			<list-index column="sort_order" base="1" />
+			<many-to-many class="org.hisp.dhis.sms.outbound.OutboundSms"
+				column="outboundsmsid" />
+		</list>
+
+		<property name="followup" />
+
+		<many-to-one name="patientComment"
+			class="org.hisp.dhis.patientcomment.PatientComment" column="patientcommentid"
+			foreign-key="fk_programinstance_patientcommentid" />
+
+	</class>
 </hibernate-mapping>

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MarkForFollowupAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MarkForFollowupAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/MarkForFollowupAction.java	2013-04-11 08:30:45 +0000
@@ -0,0 +1,88 @@
+/*
+ * 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 org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $ MarkForFollowupAction.java Apr 11, 2013 1:49:41 PM $
+ */
+public class MarkForFollowupAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ProgramInstanceService programInstanceService;
+
+    public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+    {
+        this.programInstanceService = programInstanceService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer programInstanceId;
+
+    public void setProgramInstanceId( Integer programInstanceId )
+    {
+        this.programInstanceId = programInstanceId;
+    }
+
+    private boolean followup;
+
+    public void setFollowup( boolean followup )
+    {
+        this.followup = followup;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId );
+
+        programInstance.setFollowup( followup );
+        
+        programInstanceService.updateProgramInstance( programInstance );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-04-11 08:30:45 +0000
@@ -87,17 +87,17 @@
 			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 	</bean>
 
-  <bean id="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"
-    class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction" scope="prototype">
-    <property name="programDataEntryService" ref="org.hisp.dhis.program.ProgramDataEntryService" />
-    <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-    <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
-    <property name="selectedStateManager" ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
-    <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-  </bean>
+    <bean id="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction"
+      class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction" scope="prototype">
+      <property name="programDataEntryService" ref="org.hisp.dhis.program.ProgramDataEntryService" />
+      <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+      <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+      <property name="selectedStateManager" ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
+      <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+      <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+    </bean>
 
-  <bean
+    <bean
 		id="org.hisp.dhis.caseentry.action.caseentry.CompleteDataEntryAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.CompleteDataEntryAction"
 		scope="prototype">
@@ -148,6 +148,13 @@
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 	</bean>
 
+	<bean id="org.hisp.dhis.caseentry.action.caseentry.MarkForFollowupAction"
+		class="org.hisp.dhis.caseentry.action.caseentry.MarkForFollowupAction"
+		scope="prototype">
+		<property name="programInstanceService"
+			ref="org.hisp.dhis.program.ProgramInstanceService" />
+	</bean>
+	
 	<!-- Multi DataEntry -->
 
 	<bean

=== 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-04-10 04:35:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-04-11 08:30:45 +0000
@@ -622,4 +622,6 @@
 aggregate_options = Aggregate options
 display_totals = Display totals
 cancelled_programs = Cancelled programs
-quit = Quit
\ No newline at end of file
+quit = Quit
+unmark_followup = Un-mark followup
+mark_followup = Mark followup
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-03-30 10:45:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-04-11 08:30:45 +0000
@@ -211,6 +211,15 @@
 		<result name="success" type="velocity-json">
 			/dhis-web-caseentry/jsonminOrganisationUnitPaths.vm</result>
 	</action>
+	
+    <action name="markForFollowup"
+      class="org.hisp.dhis.caseentry.action.caseentry.MarkForFollowupAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
+    </action>
+	
 
     <!-- save value -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-10 09:52:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-11 08:30:45 +0000
@@ -650,26 +650,15 @@
 
 // execution date module
 var service = (function () {
-    var executionDateStore = new dhis2.storage.Store( {name: 'anonymousExecutionDate' }, function ( store ) {
-    } );
-
-    var dataValueStore = new dhis2.storage.Store( {name: 'anonymousDataValue' }, function ( store ) {
-    } );
-
-
     return {
         saveExecutionDate: function( programId, programStageInstanceId, executionDate, organisationUnitId ) {
-            $.ajax( {
-                url: 'saveExecutionDate.action',
-                data: {
-                    programId: programId,
-                    programStageInstanceId: programStageInstanceId,
-                    executionDate: executionDate,
-                    organisationUnitId: organisationUnitId
-                },
-                type: 'POST',
-                dataType: 'json'
-            } ).done(function ( json ) {
+            jQuery.postJSON( "saveExecutionDate.action", {
+                programId: programId,
+                programStageInstanceId: programStageInstanceId,
+                executionDate: executionDate,
+                organisationUnitId: organisationUnitId
+            },
+            function ( json ) {
                 if ( json.response == 'success' ) {
                     jQuery( "#executionDate" ).css( 'background-color', SUCCESS_COLOR );
                     setFieldValue( 'programStageInstanceId', json.message );
@@ -681,57 +670,45 @@
                     jQuery( "#executionDate" ).css( 'background-color', ERROR_COLOR );
                     showWarningMessage( json.message );
                 }
-            } ).fail( function () {
-                console.log("should save execution date locally.")
             } );
         },
 
         loadDataEntryForm: function( programStageInstanceId, organisationUnitId ) {
-            $.ajax( {
-                url: 'dataentryform.action',
-                data: {
-                    programStageInstanceId: programStageInstanceId,
-                    organisationUnitId: organisationUnitId
-                },
-                dataType: 'html'
-            } ).done(function(data) {
-                $( '#dataEntryFormDiv' ).html( data );
-                updateDataForm();
-            } ).fail(function() {
-                $( '#dataEntryFormDiv' ).html( "not available offline." );
-            });
+            $( '#dataEntryFormDiv' ).load( "dataentryform.action", {
+                programStageInstanceId: programStageInstanceId,
+                organisationUnitId: organisationUnitId
+            }, function () {
+                jQuery( '#inputCriteriaDiv' ).remove();
+                showById( 'programName' );
+                showById( 'actionDiv' );
+                var programName = jQuery( '#programId option:selected' ).text();
+                var programStageId = jQuery( '#programId option:selected' ).attr( 'psid' );
+                jQuery( '.stage-object-selected' ).attr( 'psid', programStageId );
+                setInnerHTML( 'programName', programName );
+                jQuery('#executionDate').css('width',430);
+                jQuery('#executionDate').css('margin-right',30);
+
+                if ( getFieldValue( 'completed' ) == 'true' ) {
+                    disable( "completeBtn" );
+                    enable( "uncompleteBtn" );
+                }
+                else {
+                    enable( "completeBtn" );
+                    disable( "uncompleteBtn" );
+                }
+                hideById( 'loaderDiv' );
+                showById( 'dataEntryInfor' );
+                showById( 'entryFormContainer' );
+
+                jQuery( "#entryForm :input" ).each( function () {
+                    if ( ( jQuery( this ).attr( 'options' ) != null && jQuery( this ).attr( 'options' ) == 'true' )
+                        || ( jQuery( this ).attr( 'username' ) != null && jQuery( this ).attr( 'username' ) == 'true' ) ) {
+                        var input = jQuery( this );
+                        input.parent().width( input.width() + 200 );
+                    }
+                } );
+            } );
+
         }
     }
 })();
-
-function updateDataForm() {
-    jQuery( '#inputCriteriaDiv' ).remove();
-    showById( 'programName' );
-    showById( 'actionDiv' );
-    var programName = jQuery( '#programId option:selected' ).text();
-    var programStageId = jQuery( '#programId option:selected' ).attr( 'psid' );
-    jQuery( '.stage-object-selected' ).attr( 'psid', programStageId );
-    setInnerHTML( 'programName', programName );
-    jQuery('#executionDate').css('width',430);
-    jQuery('#executionDate').css('margin-right',30);
-
-    if ( getFieldValue( 'completed' ) == 'true' ) {
-        disable( "completeBtn" );
-        enable( "uncompleteBtn" );
-    }
-    else {
-        enable( "completeBtn" );
-        disable( "uncompleteBtn" );
-    }
-    hideById( 'loaderDiv' );
-    showById( 'dataEntryInfor' );
-    showById( 'entryFormContainer' );
-
-    jQuery( "#entryForm :input" ).each( function () {
-        if ( ( jQuery( this ).attr( 'options' ) != null && jQuery( this ).attr( 'options' ) == 'true' )
-            || ( jQuery( this ).attr( 'username' ) != null && jQuery( this ).attr( 'username' ) == 'true' ) ) {
-            var input = jQuery( this );
-            input.parent().width( input.width() + 200 );
-        }
-    } );
-}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-04-10 04:35:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-04-11 08:30:45 +0000
@@ -214,6 +214,7 @@
 	}
 }
 
+var followup = false;
 function getSearchParams()
 {
 	var params = "";
@@ -230,7 +231,7 @@
 		params = '&searchTexts=stat_' + getFieldValue('programIdAddPatient') 
 			   + '_' + startDueDate + '_' + endDueDate
 			   + "_" + orgunitid
-			   + '_false_' + statusEvent;
+			   + '_' + followup + '_' + statusEvent;
 	}
 	
 	var flag = false;
@@ -2025,4 +2026,30 @@
 				 byId('latitude').style.backgroundColor = SUCCESS_COLOR;
 			});
 	}
-}
\ No newline at end of file
+}
+
+// ---------------------------------------------------------------------------------
+// Followup program-instance
+// ---------------------------------------------------------------------------------
+
+function markForFollowup( programInstanceId, followup )
+{
+	jQuery.postJSON( "markForFollowup.action",
+		{ 
+			programInstanceId:programInstanceId,
+			followup: followup
+		}, 
+		function( json ) 
+		{   
+			 if( followup )
+			 {
+				showById('imgMarkFollowup');
+				hideById('imgUnmarkFollowup');
+			 }
+			 else
+			 {
+				hideById('imgMarkFollowup');
+				showById('imgUnmarkFollowup');
+			 }
+		});
+}

=== 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-03-21 08:01:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-04-11 08:30:45 +0000
@@ -59,7 +59,7 @@
 	var programId = getFieldValue('programIdAddPatient');
 	var searchTexts = "stat_" + programId + "_" 
 				+ startDate + "_" + endDate + "_" 
-				+ getFieldValue('orgunitId') + "_false_4";
+				+ getFieldValue('orgunitId') + "_true_4";
 	
 	showLoader();
 	jQuery('#listEventDiv').load('getSMSPatientRecords.action',
@@ -82,6 +82,8 @@
 // Search events
 // --------------------------------------------------------------------
 
+followup = true;
+
 function advancedSearch( params )
 {
 	setFieldValue('listAll', "false");

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2013-04-10 09:48:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitSchedule.vm	2013-04-11 08:30:45 +0000
@@ -5,6 +5,10 @@
 		<tr>
 			<td class='text-column'>$programInstance.program.dateOfEnrollmentDescription:</td>
 			<td><input name="enrollmentDate" id="enrollmentDate" readonly value="$!format.formatDate( $programInstance.enrollmentDate )" style="width:325px;"></td>
+			<td rowspan='2'>&nbsp;&nbsp;&nbsp;&nbsp;
+				<a href='javascript:markForFollowup($programInstance.id, false)' #if( $programInstance.followup == 'false') class='hidden' #end id='imgMarkFollowup' title='$i18n.getString("unmark_followup")' ><img src='../images/marked_large.png'></a>
+				<a href='javascript:markForFollowup($programInstance.id, true)' #if( $programInstance.followup == 'true') class='hidden' #end id='imgUnmarkFollowup' title='$i18n.getString("mark_followup")' ><img src='../images/unmarked_large.png'></a>
+			</td>
 		</tr>
 		<tr>
 			<td class='text-column'>$programInstance.program.dateOfIncidentDescription:</td>