dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18130
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7518: Search part of full-name of patient in Nested search function.
------------------------------------------------------------
revno: 7518
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-07-05 16:46:04 +0700
message:
Search part of full-name of patient in Nested search function.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java
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/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml
--
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/patient/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java 2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java 2012-07-05 09:46:04 +0000
@@ -71,7 +71,9 @@
private String middleName;
private String lastName;
-
+
+ private String fullName;
+
private String gender;
private Date birthDate;
@@ -495,8 +497,19 @@
// Getter && Setter
// -------------------------------------------------------------------------
+
public String getFullName()
{
+ return fullName;
+ }
+
+ public void setFullName( String fullName )
+ {
+ this.fullName = fullName;
+ }
+
+ /* public String getFullName()
+ {
boolean space = false;
String name = "";
@@ -528,7 +541,7 @@
}
return name;
- }
+ } */
public String getPhoneNumber()
{
=== 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-29 15:37:40 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2012-07-05 09:46:04 +0000
@@ -277,12 +277,11 @@
lastName = searchText.substring( endIndex + 1, searchText.length() );
}
}
-
+
hql += " ( SELECT p" + index + " FROM Patient as p" + index + " JOIN p" + index
+ ".identifiers as identifier" + index + " " + "WHERE lower(identifier" + index
- + ".identifier)=lower('" + searchText + "') " + "OR (lower(p" + index + ".firstName) LIKE lower('%"
- + firstName + "%') " + "AND lower(p" + index + ".middleName) = lower('" + middleName + "') "
- + "AND lower(p" + index + ".lastName) LIKE lower('%" + lastName + "%')) ";
+ + ".identifier)=lower('" + searchText + "') " + "OR (lower(p" + index + ".fullName) LIKE lower('%"
+ + searchText + "%') " + " ) ";
isSearchByAttribute = false;
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml 2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/Patient.hbm.xml 2012-07-05 09:46:04 +0000
@@ -53,5 +53,7 @@
<many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="organisationunitid"
foreign-key="fk_patient_organisationunitid" />
+ <property name="fullName" formula="concat(firstName, ' ', middleName, ' ', lastName)"/>
+
</class>
</hibernate-mapping>