← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7041: (patient) Add gender, bloodgroup, phonenumber into searching function.

 

------------------------------------------------------------
revno: 7041
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-24 23:51:34 +0700
message:
  (patient) Add gender, bloodgroup, phonenumber into searching 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/webapp/dhis-web-caseentry/app/app.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/patientForm.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-05-24 14:36:15 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java	2012-05-24 16:51:34 +0000
@@ -296,7 +296,36 @@
             hql += " ( SELECT p" + index + " FROM Patient AS p" + index 
                 + " WHERE p" + index + ".birthDate " + searchText;
             isSearchByAttribute = false; 
-        }
+        } 
+        // gender
+        else if ( patientAttributeId == -2 )
+        {
+            hql += " ( SELECT p" + index + " FROM Patient AS p" + index 
+                + " WHERE p" + index + ".gender='" + searchText + "'";
+            isSearchByAttribute = false; 
+        }
+        // age
+        else if ( patientAttributeId == -3 )
+        {
+            hql += " ( SELECT p" + index + " FROM Patient AS p" + index 
+                + " WHERE p" + index + ".integerValueOfAge='" + searchText + "'";
+            isSearchByAttribute = false; 
+        }
+        // blood-group
+        else if ( patientAttributeId == -4 )
+        {
+            hql += " ( SELECT p" + index + " FROM Patient AS p" + index 
+                + " WHERE p" + index + ".bloodGroup='" + searchText + "'";
+            isSearchByAttribute = false; 
+        }
+        // phone number
+        else if ( patientAttributeId == -5 )
+        {
+            hql += " ( SELECT p" + index + " FROM Patient AS p" + index 
+                + " WHERE p" + index + ".phoneNumber='" + searchText + "'";
+            isSearchByAttribute = false; 
+        }
+        
         
         // ---------------------------------------------------------------------
         // search patients by program

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-05-24 15:32:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-05-24 16:51:34 +0000
@@ -1107,7 +1107,7 @@
 							allowBlank: true,
 							store:  new Ext.data.ArrayStore({
 								fields: ['name'],
-								data: TR.value.getSuggestedValues(index)
+								data: TR.value.TR.value.valueTypes(index)
 							})
 						}
 					};

=== 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-05-24 14:36:15 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-05-24 16:51:34 +0000
@@ -85,6 +85,14 @@
 	{
 		element.replaceWith( programComboBox );
 	}
+	else if ( attributeId=='-2' )
+	{
+		element.replaceWith( genderSelector );
+	}
+	else if ( attributeId=='-4' )
+	{
+		element.replaceWith( bloodTypeSelector );
+	}
 	else if ( valueType=='YES/NO' )
 	{
 		element.replaceWith( trueFalseBox );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2012-05-24 03:10:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2012-05-24 16:51:34 +0000
@@ -62,7 +62,7 @@
 <tr>
 	<td class='text-column'><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
 	<td class="input-column">
-		<select type="text" id="bloodGroup" name="bloodGroup">
+		<select id="bloodGroup" name="bloodGroup">
 			<option value="">[$i18n.getString( "please_select" )]</option>
 			<option value="A+">A+</option>
 			<option value="A-">A-</option>

=== 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-05-24 13:53:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2012-05-24 16:51:34 +0000
@@ -25,10 +25,14 @@
 						<option value="">$i18n.getString( "search_by_name_identifier" )</option>
 						<option value="0">$i18n.getString( "search_by_program" )</option>
 						<option value="-1">$i18n.getString( "date_of_birth" )</option>
+						<option value="-2">$i18n.getString( "gender" )</option>
+						<!-- option value="-3">$i18n.getString( "age" )</option -->
+						<option value="-4">$i18n.getString( "blood_group" )</option>
+						<option value="-5">$i18n.getString( "phone_number" )</option>
 						#foreach( $attribute in $patientAttributes )
 							<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
 						#end
-					  </select> 
+					  </select>
 					  <em title="$i18n.getString( "required" )" class="required">*</em></label>
 					</td>		
 					<td>
@@ -90,11 +94,31 @@
 	
 	
 	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" >';
+	
+	var genderSelector = '<select id="searchText" name="searchText" style="width:20.2em" >';
+		genderSelector += '<option value="M">$i18n.getString( "male" )</option>';
+		genderSelector += '<option value="F">$i18n.getString( "female" )</option>';
+		genderSelector += '</select>';
+		
+	var bloodTypeSelector  = "<select id='searchText' name='searchText' style='width:20.2em' >";
+		bloodTypeSelector += "<option value=''>[$i18n.getString( "please_select" ) ]</option>";
+		bloodTypeSelector += "<option value='A+'>A+</option>";
+		bloodTypeSelector += "<option value='A-'>A-</option>";
+		bloodTypeSelector += "<option value='AB+'>AB+</option>";
+		bloodTypeSelector += "<option value='AB-'>AB-</option>";
+		bloodTypeSelector += "<option value='B+'>B+</option>";
+		bloodTypeSelector += "<option value='B-'>B-</option>";
+		bloodTypeSelector += "<option value='O+'>O+</option>";
+		bloodTypeSelector += "<option value='O-'>O-</option>";
+		bloodTypeSelector += '</select>';
+	
 	#foreach ( $program in $programs ) 
 		programComboBox += '<option value="$program.id">$program.name</option>';
 	#end

=== 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-05-24 13:53:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm	2012-05-24 16:51:34 +0000
@@ -23,6 +23,10 @@
 					<option value="">$i18n.getString( "search_by_name_identifier" )</option>
 					<option value="0">$i18n.getString( "search_by_program" )</option>
 					<option value="-1">$i18n.getString( "date_of_birth" )</option>
+					<option value="-2">$i18n.getString( "gender" )</option>
+					<!-- option value="-3">$i18n.getString( "age" )</option -->
+					<option value="-4">$i18n.getString( "blood_group" )</option>
+					<option value="-5">$i18n.getString( "phone_number" )</option>
 					#foreach( $attribute in $patientAttributes )
 						<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
 					#end
@@ -145,6 +149,23 @@
 		trueFalseBox += '<option value="true">' + i18n_yes + '</option>';
 		trueFalseBox += '<option value="false">' + i18n_no + '</option>';
 		trueFalseBox += '</select>';
+		
+	var genderSelector = '<select id="searchText" name="searchText" style="width:20.2em" >';
+		genderSelector += '<option value="M">$i18n.getString( "male" )</option>';
+		genderSelector += '<option value="F">$i18n.getString( "female" )</option>';
+		genderSelector += '</select>';
+		
+	var bloodTypeSelector  = "<select id='searchText' name='searchText' style='width:20.2em' >";
+		bloodTypeSelector += "<option value=''>[$i18n.getString( "please_select" ) ]</option>";
+		bloodTypeSelector += "<option value='A+'>A+</option>";
+		bloodTypeSelector += "<option value='A-'>A-</option>";
+		bloodTypeSelector += "<option value='AB+'>AB+</option>";
+		bloodTypeSelector += "<option value='AB-'>AB-</option>";
+		bloodTypeSelector += "<option value='B+'>B+</option>";
+		bloodTypeSelector += "<option value='B-'>B-</option>";
+		bloodTypeSelector += "<option value='O+'>O+</option>";
+		bloodTypeSelector += "<option value='O-'>O-</option>";
+		bloodTypeSelector += '</select>';
 	
 	var programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
 	#foreach ( $program in $programs )