dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18912
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8040: Allow search events by selected program in program tracking module.
------------------------------------------------------------
revno: 8040
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-09-12 09:49:08 +0700
message:
Allow search events by selected program in program tracking module.
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/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm
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/programTrackingList.vm
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
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
--
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-09-06 09:44:43 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2012-09-12 02:49:08 +0000
@@ -403,17 +403,20 @@
}
else if ( keys[0].equals( Patient.PREFIX_PROGRAM_EVENT_BY_STATUS ) )
{
- sql += "(select programid from patient_programs where patientid=p.patientid and programid=" + keys[1]
- + " ) as " + Patient.PREFIX_PROGRAM + "_" + id + ",";
- otherWhere += operator + Patient.PREFIX_PROGRAM + "_" + id + "=" + id;
+ sql += "pgi.programid as programid,";
+ patientGroupBy += ",pgi.programid ";
operator = " and ";
sql += " MIN( psi.programstageinstanceid ) as programstageinstanceid,";
isSearchEvent = true;
patientWhere += patientOperator + "pgi.patientid=p.patientid and ";
+ patientWhere += "programid=" + id + " and ";
patientWhere += "psi.duedate>='" + keys[3] + "' and psi.duedate<='" + keys[4] + "' and ";
- patientWhere += "psi.organisationunitid = " + keys[5] + " and ";
-
+ if ( keys.length == 6 )
+ {
+ patientWhere += "psi.organisationunitid = " + keys[5] + " and ";
+ }
+
int statusEvent = Integer.parseInt( keys[2] );
switch ( statusEvent )
{
@@ -466,7 +469,6 @@
patientWhere += " and pgi.completed=false ";
patientOperator = " and ";
-
}
}
=== 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-09-11 07:31:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-09-12 02:49:08 +0000
@@ -442,4 +442,5 @@
status = Status
skipped = Skipped
unknown = Unknown
-health_worker = Health worker
\ No newline at end of file
+health_worker = Health worker
+please_select_criteria = Please select criteria
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm 2012-09-11 13:35:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/eventMessage.vm 2012-09-12 02:49:08 +0000
@@ -24,9 +24,6 @@
#end
#end
#end
- </tbody>
-
- <tbody id='smsManagementList'>
#foreach($programStageInstance in $programStageInstances)
#foreach( $sms in $programStageInstance.outboundSms )
#if( $index < 5 )
@@ -39,13 +36,10 @@
#end
#end
#end
- </tbody>
-
- <tbody id='moreComments' class='hidden'>
#foreach($programStageInstance in $programStageInstances)
#foreach( $comment in $programStageInstance.patientComments )
#if( $index >= 5 )
- <tr id="comment_$comment.id" #alternate($mark)>
+ <tr id="comment_$comment.id" #alternate($mark) class="hidden">
<td>$format.formatDate($comment.createdDate)</td>
<td> $programStageInstance.programStage.name</td>
<td>$comment.creator - $comment.commentText</td>
=== 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 2012-09-07 09:53:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-09-12 02:49:08 +0000
@@ -206,22 +206,18 @@
var flag = true;
var dateOperator = '';
- if (getFieldValue('searchByProgramStage') == "true"
- && getFieldValue('programStageAddPatient') == ''
- && jQuery("#searchDiv :input[name=searchText]").val() == ''){
- flag = false;
+ if (getFieldValue('searchByProgramStage') == "false"){
+ jQuery("#searchDiv :input").each( function( i, item )
+ {
+ var elementName = $(this).attr('name');
+ if( elementName=='searchText' && jQuery( item ).val() == '')
+ {
+ showWarningMessage( i18n_specify_search_criteria );
+ flag = false;
+ }
+ });
}
- jQuery("#searchDiv :input").each( function( i, item )
- {
- var elementName = $(this).attr('name');
- if( elementName=='searchText' && jQuery( item ).val() == '' && !flag)
- {
- showWarningMessage( i18n_specify_search_criteria );
- flag = false;
- }
- });
-
if(flag){
contentDiv = 'listPatientDiv';
jQuery( "#loaderDiv" ).show();
@@ -238,9 +234,8 @@
var statusEvent = jQuery('#programStageAddPatientTR [id=statusEvent]').val();
var startDueDate = getFieldValue('startDueDate');
var endDueDate = getFieldValue('endDueDate');
- params += '&searchTexts=prgst_' + programStageId + '_' + statusEvent
- + '_' + startDueDate + '_' + endDueDate + "_"
- + getFieldValue('orgunitId');
+ params += '&searchTexts=stat_' + getFieldValue('programIdAddPatient')
+ + '_' + statusEvent + '_' + startDueDate + '_' + endDueDate;
}
var flag = false;
@@ -462,37 +457,21 @@
function enableBtn(){
var programIdAddPatient = getFieldValue('programIdAddPatient');
if( programIdAddPatient!='' ){
- $.getJSON( 'loadReportProgramStages.action',
- {
- programId: getFieldValue('programIdAddPatient')
- }, function( json )
- {
- clearListById('programStageAddPatient');
- $('#programStageAddPatient').append("<option value=''>" + i18n_please_select_program_stage + "</option>");
- for ( i in json.programStages )
- {
- $('#programStageAddPatient').append("<option value='" + json.programStages[i].id + "'>" + json.programStages[i].name + "</option>");
- }
- enable('listPatientBtn');
- enable('addPatientBtn');
- enable('advancedSearchBtn');
- jQuery('#advanced-search :input').each( function( idx, item ){
- enable(this.id);
- });
- jQuery('#programStageAddPatientTR [name=statusEvent]').attr("disabled", true);
+ enable('listPatientBtn');
+ enable('addPatientBtn');
+ enable('advancedSearchBtn');
+ jQuery('#advanced-search :input').each( function( idx, item ){
+ enable(this.id);
});
}
else
{
-
-
- disable('listPatientBtn');
- disable('addPatientBtn');
- disable('advancedSearchBtn');
- jQuery('#advanced-search :input').each( function( idx, item ){
- disable(this.id);
- });
-
+ disable('listPatientBtn');
+ disable('addPatientBtn');
+ disable('advancedSearchBtn');
+ jQuery('#advanced-search :input').each( function( idx, item ){
+ disable(this.id);
+ });
}
}
=== 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-09-11 13:35:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2012-09-12 02:49:08 +0000
@@ -28,9 +28,19 @@
contentDiv = 'listPatientDiv';
$('#contentDataRecord').html('');
+ var date = new Date();
+ var d = date.getDate() - 1;
+ var m = date.getMonth();
+ var y1 = date.getFullYear() - 100;
+ var y2 = date.getFullYear();
+ jQuery( '#currentDate' ).datepicker( "setDate" , new Date(y1, m, d) );
+ var startDate = jQuery( '#currentDate' ).val();
+ jQuery( '#currentDate' ).datepicker( "setDate" , new Date(y2, m, d) ).val();
+ var endDate = jQuery( '#currentDate' ).val();
+ jQuery( '#currentDate' ).val(getCurrentDate());
+
var programId = getFieldValue('programIdAddPatient');
- var searchTexts = "stat_" + programId + "_4_"
- + getFieldValue('startDueDate') + "_" + getFieldValue('endDueDate')
+ var searchTexts = "stat_" + programId + "_4_" + startDate + "_" + endDate
+ "_" + getFieldValue('orgunitId');
showLoader();
@@ -53,7 +63,6 @@
{
setFieldValue('listAll', "false");
$('#contentDataRecord').html('');
- params += "&searchTexts=prg_" + getFieldValue('programIdAddPatient');
params += "&programId=" + getFieldValue('programIdAddPatient');
$.ajax({
url: 'getSMSPatientRecords.action',
@@ -152,7 +161,14 @@
else {
showErrorMessage( json.message, 7000 );
}
- } );
+
+ if( jQuery("#commentTB tr.hidden").length > 0 ){
+ commentDivToggle(true);
+ }
+ else{
+ commentDivToggle(false);
+ }
+ });
}
function sendSmsToList()
@@ -217,9 +233,16 @@
+ "<td>" + programStageName + "</td>"
+ "<td>" + getFieldValue('currentUsername') + " - " + commentText + "</td></tr>");
field.value="";
- jQuery(field).attr('placeholder', i18n_comment_added );
+ showSuccessMessage( i18n_comment_added );
field.style.backgroundColor = SUCCESS_COLOR;
- } );
+
+ if( jQuery("#commentTB tr.hidden").length > 0 ){
+ commentDivToggle(true);
+ }
+ else{
+ commentDivToggle(false);
+ }
+ });
}
}
@@ -323,6 +346,30 @@
}
}
+function commentDivToggle(isHide)
+{
+ var index = 1;
+ jQuery("#commentTB tr").removeClass("hidden");
+ jQuery("#commentTB tr").each( function(){
+ if(isHide && index > 5){
+ jQuery(this).addClass("hidden");
+ }
+ else if(!isHide){
+ jQuery(this).removeClass("hidden");
+ }
+ index++;
+ });
+
+ if( isHide ){
+ showById('showCommentBtn');
+ hideById('hideCommentBtn');
+ }
+ else
+ {
+ hideById('showCommentBtn');
+ showById('hideCommentBtn');
+ }
+}
function onClickBackBtn()
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm 2012-09-11 07:31:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingList.vm 2012-09-12 02:49:08 +0000
@@ -40,7 +40,7 @@
</td>
</tr>
<tr>
- <td>$i18n.getString("health_worker")</td>
+ <td class="bold">$i18n.getString("health_worker")</td>
<td>
#if($!programStageInstance.programInstance.patient.healthWorker )
$!programStageInstance.programInstance.patient.healthWorker.name
@@ -129,59 +129,51 @@
<tbody id='commentTB'>
#set($index = 0)
- #set( $mark = false )
#foreach( $comment in $comments )
#if( $index < 5 )
- <tr id="comment_$comment.id" #alternate($mark)>
+ <tr id="comment_$comment.id">
<td>$format.formatDate($comment.createdDate)</td>
<td>$programStageInstance.programStage.name</td>
<td>$comment.creator - $comment.commentText</td>
#set($index = $index + 1)
- #set( $mark = !$mark)
</tr>
#end
#end
- </tbody>
-
- <tbody id='smsManagementList'>
- #foreach( $sms in $outboundSms )
+
+ #foreach( $sms in $outboundSms )
#if( $index < 5 )
- <tr id="tr${sms.id}" #alternate($mark) >
+ <tr id="tr${sms.id}" >
<td>$format.formatDate($!sms.date)</td>
<td> $programStageInstance.programStage.name</td>
<td>$sms.message</td>
- #set( $mark = !$mark)
</tr>
#end
#end
- </tbody>
-
- <tbody id='moreComments' class='hidden'>
#foreach( $comment in $comments )
#if( $index >= 5 )
- <tr id="comment_$comment.id" #alternate($mark)>
+ <tr id="comment_$comment.id" class='hidden'>
<td>$format.formatDate($comment.createdDate)</td>
<td> $programStageInstance.programStage.name</td>
<td>$comment.creator - $comment.commentText</td>
- #set( $mark = !$mark)
</tr>
#end
#end
#foreach( $sms in $outboundSms )
#if( $index >= 5 )
- <tr id="tr${sms.id}" #alternate($mark) >
+ <tr id="tr${sms.id}" class='hidden' >
<td>$format.formatDate($!sms.date)</td>
<td>$programStageInstance.programStage.name</td>
<td>$sms.message</td>
- #set( $mark = !$mark)
</tr>
#end
#end
</tbody>
</table>
<br>
- <input type='button' value='$i18n.getString("show_hide_more")' onclick='jQuery("#moreComments").toggle();'>
+ #set($count = $comments.size() + $outboundSms.size() )
+ <input type='button' id="showCommentBtn" name="showCommentBtn" value='$i18n.getString("show_hide_more")' #if($count<=5) class='hidden' #end onclick='commentDivToggle(false);'>
+ <input type='button' id="hideCommentBtn" name="hideCommentBtn" value='$i18n.getString("show_hide_more")' class='hidden' onclick='commentDivToggle(true);'>
</div>
<div id="tab-3">
=== 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 2012-09-07 07:57:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programTrackingSelect.vm 2012-09-12 02:49:08 +0000
@@ -11,6 +11,8 @@
});
jQuery("#searchObjectId [value=prg]").remove();
+ jQuery("#searchObjectId").prepend('<option value="">' + i18n_please_select_criteria + '</option>');
+ jQuery("#searchObjectId [value=]").attr("selected","selected");
hideById('addPatientBtn');
disable('advancedSearchBtn');
hideById('searchBySelectedUnitTD');
@@ -57,4 +59,5 @@
var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")';
var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")';
var i18n_comfirm_delete_event = '$encoder.jsEscape( $i18n.getString( "comfirm_delete_event" ) , "'")';
+ var i18n_please_select_criteria = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_criteria" ) , "'")' + ']';
</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 2012-09-11 09:46:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2012-09-12 02:49:08 +0000
@@ -33,20 +33,13 @@
<div id='advanced-search' class='hidden'>
<table>
<tr id='programStageAddPatientTR' class='hidden'>
- <td>
- <select id='programStageAddPatient' name='programStageAddPatient' onchange='enableRadioButton();'>
- <option value=''>[$i18n.getString('')]</option>
- #foreach($programStage in $program.programStages)
- <option value="$programStage.id">$programStage.name</option>
- #end
- </select>
- </td>
+ <td>$i18n.getString('status')</td>
<td>
<select id="statusEvent" name="statusEvent">
+ <option value='4'>$i18n.getString("overdue")</option>
+ <option value='2'>$i18n.getString("incomplete")</option>
<option value='1'>$i18n.getString("completed")</option>
- <option value='2'>$i18n.getString("incomplete")</option>
<option value='3'>$i18n.getString("scheduled_in_future")</option>
- <option value='4'>$i18n.getString("overdue")</option>
</select>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-09-04 10:10:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-09-12 02:49:08 +0000
@@ -148,6 +148,7 @@
opacity: 1.0;
border: 2px solid;
margin: 5px;
+ white-space:normal;
}
input.stage-object[type="button"]:hover