← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6229: (patient) Add patient history in Tabular report

 

------------------------------------------------------------
revno: 6229
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-03-09 14:59:38 +0700
message:
  (patient) Add patient history in Tabular report
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  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/tabularReport.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTabularReportResult.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportResult.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.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/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2012-03-09 03:20:39 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2012-03-09 07:59:38 +0000
@@ -306,6 +306,8 @@
         {
             Program program = programStage.getProgram();
 
+            Boolean anonymous = program.getAnonymous();
+
             // ---------------------------------------------------------------------
             // Create a grid
             // ---------------------------------------------------------------------
@@ -323,6 +325,11 @@
                 grid.addHeader( new GridHeader( dataElement.getName(), false, false ) );
             }
 
+            if ( !anonymous )
+            {
+                grid.addHeader( new GridHeader( "", true, false ) );
+            }
+
             // ---------------------------------------------------------------------
             // Values
             // ---------------------------------------------------------------------
@@ -352,6 +359,16 @@
                         grid.addValue( "" );
                     }
                 }
+                
+                if ( programStageInstance.getProgramInstance().getPatient() != null )
+                {
+                    grid.addValue( programStageInstance.getProgramInstance().getPatient()
+                        .getId() );
+                }
+                else
+                {
+                    grid.addValue( "" );
+                }
             }
         }
 

=== 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	2012-03-09 04:46:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-03-09 07:59:38 +0000
@@ -261,16 +261,10 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-caseentry/tabularReportSelect.vm</param>
 			<param name="menu">/dhis-web-caseentry/reportsMenu.vm</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/tabularReport.js</param>
+			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/tabularReport.js,javascript/commons.js</param>
 			<param name="stylesheets">../dhis-web-caseentry/style/report.css</param>
 		</action>
 		
-		<action name="loadAllPrograms"
-			class="org.hisp.dhis.caseentry.action.report.TabularReportSelectAction">
-			<interceptor-ref name="organisationUnitTreeStack" />
-			<result name="success" type="velocity-json">/dhis-web-caseentry/responsePrograms.vm</result>
-		</action>
-		
 		<action name="loadTabularProgramStages"
 			class="org.hisp.dhis.caseentry.action.report.LoadProgramStagesAction">
 			<result name="success" type="velocity-json">/dhis-web-caseentry/responseProgramStages.vm</result>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/tabularReport.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/tabularReport.js	2012-03-09 04:46:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/tabularReport.js	2012-03-09 07:59:38 +0000
@@ -1,36 +1,13 @@
 
 function organisationUnitSelected( orgUnits, orgUnitNames )
 {
-	hideById('contentDiv');
+	setInnerHTML( 'contentDiv' , '');
 	clearListById( 'programStageId' );
 	clearListById( 'availableDataElementIds' );
-	
-	$.getJSON( 'loadAllPrograms.action',{}
-		, function( json ) 
-		{
-			clearListById( 'programId' );
-			addOptionById( 'programId', '', i18n_please_select );
-			setFieldValue('orgunitname', orgUnitNames[0]);
-			var preSelectedProgramId = getFieldValue('selectedProgramId');
-			for ( i in json.programs ) 
-			{ 
-				$('#programId').append( '<option value=' + json.programs[i].id 
-					+ ' singleevent=' + json.programs[i].singleEvent + '>' 
-					+ json.programs[i].name + '</option>' );
-			}
-
-			if( json.programs.length > 0 )
-			{
-				enable('generateBtn');
-			}
-			else
-			{
-				disable('generateBtn');
-			}
-			
-			showCriteria();
-			
-		} );
+	clearListById( 'dataElementIds' );
+	setFieldValue( 'orgunitname', orgUnitNames[0] );
+			
+	showCriteria();
 }
 
 selection.setListenerFunction( organisationUnitSelected );
@@ -196,7 +173,8 @@
 	
 	var params = getParams();
 	if( params != '' )
-	{
+	{	
+		setInnerHTML( 'contentDiv' , '');
 		$.ajax({
 			   type: "POST",
 			   url: "generateTabularReport.action",
@@ -224,7 +202,11 @@
 		contentDiv = 'gridContent';
 
 		var params = getParams();
-		if( params != '' )
+		if( params == '' )
+		{
+			hideById('loaderDiv');
+		}
+		else
 		{
 			$.ajax({
 				   type: "POST",

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm	2012-03-09 03:20:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientHistory.vm	2012-03-09 07:59:38 +0000
@@ -1,5 +1,5 @@
 
-<h3>$i18n.getString('patient_history')</h3>
+<h3>$i18n.getString('patient_details_and_history')</h3>
 
 <div style="margin-bottom:15px">
 <input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportPatientHistory( '$patient.id', 'xls' )" style="width:140px">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTabularReportResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTabularReportResult.vm	2012-03-09 04:46:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTabularReportResult.vm	2012-03-09 07:59:38 +0000
@@ -1,22 +1,32 @@
 
-	#set( $mark = false )
-	#set( $i = 1 )
-	#foreach( $row in $grid.getVisibleRows() )
-		<tr id="tr${i}" class='rowGrid'>
+#set( $mark = false )
+#set( $i = 1 )
+
+#set( $anonymous = "true")
+#if( $grid.getVisibleHeaders().size() <  $grid.getHeaders().size() )
+	#set( $anonymous = "false" )
+#end
+
+#foreach( $row in $grid.getRows() )
+	<tr id="tr${i}" class='rowGrid'>
+		<td>
+			#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
+			$nr
+		</td>
+		#foreach( $col in $row )
 			<td>
-				#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
-				$nr
-			</td>
-			#set($programStageId='')
-			#foreach( $col in $row )
 				#set( $index = ( $velocityCount - 1 ) )
-				#if( $grid.VisibleHeaders().get( $index ).meta )
-					<td>$!encoder.htmlEncode( $col )</td>
+				#if( $anonymous == "false" && ( $index == $row.size() - 1 ) )
+					#if($col)
+					<a href="javascript:showPatientHistory( '$col' )" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
+					#end
+				#elseif( $grid.getHeaders().get( $index ).meta )
+					$!encoder.htmlEncode( $col )
 				#else
-					<td>$col</td>
+					$col
 				#end
-			#end
-		</tr>
-		#set( $mark = !$mark)
-		#set( $i = $i + 1 )
-	#end
+			</td>
+		#end
+	</tr>
+	#set( $mark = !$mark)
+#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportResult.vm	2012-03-09 04:46:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportResult.vm	2012-03-09 07:59:38 +0000
@@ -13,14 +13,22 @@
 
 <h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
 
+#set( $anonymous = "true")
+#if( $grid.getVisibleHeaders().size() <  $grid.getHeaders().size() )
+	#set( $anonymous = "false" )
+#end
+
 <table class="listTable grid" id='gridTable'>
 	<tr>
-		<th></th>
+		<th>#</th>
 		#foreach( $dataElement in $dataElements )
 			<th>
 				$!encoder.htmlEncode( $dataElement.name )
 			</th>
 		#end
+		#if( $anonymous == "false" )
+			<th>$i18n.getString('operator')</th>
+		#end
 	</tr>
 	
 	<tr class='filter'>
@@ -30,6 +38,9 @@
 				<input type='text' id='$dataElement.id' title='$i18n.getString("how_to_search_tabular_report")' onkeypress='searchTabularReport( event );' #if($dataElement.optionSet) options='$dataElement.optionSet.options' #end />
 			</td>
 		#end
+		#if( $anonymous == "false" )
+			<td></td>
+		#end
 	</tr>
 	
 	<tbody id="gridContent">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.vm	2012-03-09 04:46:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.vm	2012-03-09 07:59:38 +0000
@@ -111,6 +111,7 @@
 </form>
 
 <span id="message"></span>
+<div id="detailsInfo"></div>
 
 <div id="contentDiv">
 	#parse( "dhis-web-commons/loader/loader.vm" )
@@ -125,4 +126,5 @@
 	var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
 	var i18n_syntax_error_in_search_value = '$encoder.jsEscape( $i18n.getString( "syntax_error_in_search_value" ) , "'")';
 	var i18n_remove_selected_data_elements = '$encoder.jsEscape( $i18n.getString( "remove_selected_data_elements" ) , "'")';
+	var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';
 </script>