dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17318
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6844: (patient) Add Birthdate into the searching patient function.
------------------------------------------------------------
revno: 6844
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-03 17:18:41 +0700
message:
(patient) Add Birthdate into the searching patient function.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.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/webapp/dhis-web-caseentry/javascript/commons.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.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/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2012-03-27 01:29:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2012-05-03 10:18:41 +0000
@@ -257,7 +257,11 @@
String firstName = searchText.toString();
String middleName = "";
String lastName = "";
-
+
+ // ---------------------------------------------------------------------
+ // search patients by full-name or identifier
+ // ---------------------------------------------------------------------
+
if ( searchText.indexOf( ' ' ) != -1 )
{
firstName = searchText.substring( 0, startIndex );
@@ -281,9 +285,21 @@
isSearchByAttribute = false;
}
- // -----------------------------------------------------------------
+
+ // ---------------------------------------------------------------------
+ // search patients by birth-date
+ // ---------------------------------------------------------------------
+
+ else if ( patientAttributeId == -1 )
+ {
+ hql += " ( SELECT p" + index + " FROM Patient AS p" + index
+ + " WHERE p" + index + ".birthDate='" + searchText+ "'";
+ isSearchByAttribute = false;
+ }
+
+ // ---------------------------------------------------------------------
// search patients by program
- // -----------------------------------------------------------------
+ // ---------------------------------------------------------------------
else if ( patientAttributeId == 0 )
{
hql += " ( SELECT p" + index + " FROM Patient AS p" + index + " " + " JOIN p" + index
=== 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 2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SearchPatientAction.java 2012-05-03 10:18:41 +0000
@@ -181,7 +181,7 @@
for ( Integer attributeId : searchingAttributeId )
{
- if ( attributeId != null && attributeId != 0 )
+ if ( attributeId != null && attributeId > 0 )
{
patientAttributes.add( patientAttributeService.getPatientAttribute( attributeId ) );
}
=== 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-03-28 09:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-05-03 10:18:41 +0000
@@ -72,7 +72,12 @@
var element = jQuery('#' + container+ ' [id=searchText]');
var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType');
- if( attributeId == '0' )
+ if( attributeId == '-1' )
+ {
+ element.replaceWith( getDateField( container ) );
+ datePickerValid( 'searchDateField-' + container + ' [id=searchText]' );
+ }
+ else if( attributeId == '0' )
{
element.replaceWith( programComboBox );
}
@@ -85,6 +90,13 @@
element.replaceWith( searchTextBox );
}
}
+
+function getDateField( container )
+{
+ var dateField = '<div id="searchDateField-' + container + '" > <input type="text" id="searchText" name="searchText" maxlength="30" style="width:18em" onkeyup="searchPatientsOnKeyUp( event );"></div>';
+ return dateField;
+}
+
//-----------------------------------------------------------------------------
// Search Patient
//-----------------------------------------------------------------------------
@@ -95,7 +107,7 @@
if ( key==13 )// Enter
{
- searchPatients();
+ searchAdvancedPatients()();
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-04-17 04:39:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-05-03 10:18:41 +0000
@@ -650,7 +650,7 @@
}
else if( statusSearching == 1 )
{
- searchPatients();
+ searchAdvancedPatients();
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2012-03-28 07:10:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2012-05-03 10:18:41 +0000
@@ -27,7 +27,7 @@
<table class="listTable" id="patientList" width='100%'>
<col width="30"/>
#foreach( $attribute in $patientAttributes )
- <col/>
+ #if($attribute)<col/>#end
#end
<col/>
<col/>
@@ -42,7 +42,9 @@
<tr>
<th>#</th>
#foreach( $attribute in $patientAttributes )
+ #if($attribute)
<th id="patientAttributeName">$attribute.name</th>
+ #end
#end
<th>$i18n.getString( "full_name" )</th>
<th>$i18n.getString( "gender" )</th>
@@ -66,14 +68,16 @@
</td>
#foreach( $attribute in $patientAttributes )
- #set ( $key = $patient.id + '-' + $attribute.id )
- <td>
- #if( $attribute.valueType == 'YES/NO')
- $i18n.getString( $mapPatientPatientAttr.get($key) )
- #else
- $mapPatientPatientAttr.get($key)
- #end
- </td>
+ #if( $attribute )
+ #set ( $key = $patient.id + '-' + $attribute.id )
+ <td>
+ #if( $attribute.valueType == 'YES/NO')
+ $i18n.getString( $mapPatientPatientAttr.get($key) )
+ #else
+ $mapPatientPatientAttr.get($key)
+ #end
+ </td>
+ #end
#end
<td>$!patient.getFullName()</td>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm 2012-03-27 09:40:11 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm 2012-05-03 10:18:41 +0000
@@ -24,9 +24,10 @@
<select id="searchingAttributeId" name="searchingAttributeId" style="width:20.2em" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchingAttributeOnChange(this)">
<option value="">$i18n.getString( "search_by_name_identifier" )</option>
<option value="0">$i18n.getString( "search_by_program" )</option>
- #foreach( $attribute in $patientAttributes )
- <option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
- #end
+ <option value="-1">$i18n.getString( "date_of_birth" )</option>
+ #foreach( $attribute in $patientAttributes )
+ <option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
+ #end
</select>
<em title="$i18n.getString( "required" )" class="required">*</em></label>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-04-17 04:39:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-05-03 10:18:41 +0000
@@ -22,9 +22,10 @@
<select id="searchingAttributeId" name="searchingAttributeId" style="width:20.2em" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchingAttributeOnChange(this)">
<option value="">$i18n.getString( "search_by_name_identifier" )</option>
<option value="0">$i18n.getString( "search_by_program" )</option>
- #foreach( $attribute in $patientAttributes )
- <option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
- #end
+ <option value="-1">$i18n.getString( "date_of_birth" )</option>
+ #foreach( $attribute in $patientAttributes )
+ <option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
+ #end
</select>
<em title="$i18n.getString( "required" )" class="required">*</em></label>
</td>
@@ -131,17 +132,27 @@
isAjax = true;
contentDiv = '';
+ // ----------------------------------------------------------------
+ // Search field
+ // ----------------------------------------------------------------
+
var searchTextBox = '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" onkeyup="searchPatientsOnKeyUp( event );">';
+
var trueFalseBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
trueFalseBox += '<option value="true">' + i18n_yes + '</option>';
trueFalseBox += '<option value="false">' + i18n_no + '</option>';
trueFalseBox += '</select>';
+
var programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
#foreach ( $program in $programs )
programComboBox += '<option value="$program.id">$program.name</option>';
#end
programComboBox += '</select>';
+ // ----------------------------------------------------------------
+ // Search field
+ // ----------------------------------------------------------------
+
#if( $status == 1 )
setFieldValue('selectedOrgunitText', i18n_please_select_village );
setInnerHTML('warnmessage', '' );