forked from Raxa/raxacore
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-439 | Person attributes with coded concept answers displa… (#30)
* Bindu | BAH-439 | Person attributes with coded concept answers display concept IDs on registration search * Bindu | BAH-439 | Changed concept shortName with FSN
- Loading branch information
Showing
7 changed files
with
207 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...org/bahmni/module/bahmnicore/contract/patient/search/PatientAttributeQueryHelperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.bahmni.module.bahmnicore.contract.patient.search; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
|
||
public class PatientAttributeQueryHelperTest { | ||
|
||
@Test | ||
public void codedPersonAttributeShouldReturnConceptName() { | ||
PatientAttributeQueryHelper patientAttributeQueryHelper = new PatientAttributeQueryHelper("", Arrays.asList(new Integer(1), 2), Arrays.asList(1)); | ||
String updatedSelectClause = patientAttributeQueryHelper.appendToJoinClause("''"); | ||
} | ||
|
||
@Test | ||
public void ensureSelectClauseReturnsProperSqlForAttributes() { | ||
PatientAttributeQueryHelper PatientAttributeQueryHelper = new PatientAttributeQueryHelper("", Arrays.asList(new Integer(1), 2), Arrays.asList(1)); | ||
|
||
String updatedSelectClause = PatientAttributeQueryHelper.selectClause("a"); | ||
assertNotNull(updatedSelectClause); | ||
assertEquals("a,concat('{',group_concat(DISTINCT (coalesce(concat('\"',attrt_results.name,'\":\"', REPLACE(REPLACE(coalesce(cn.name, def_loc_cn.name, pattr_results.value),'\\\\','\\\\\\\\'),'\"','\\\\\"'),'\"'))) SEPARATOR ','),'}') as customAttribute", updatedSelectClause); | ||
} | ||
|
||
@Test | ||
public void ensureAppendJoinClauseReturnsProperSqlForPersonAttributeConceptTypes() { | ||
PatientAttributeQueryHelper PatientAttributeQueryHelper = new PatientAttributeQueryHelper("", Arrays.asList(new Integer(1), 2), Arrays.asList(1)); | ||
|
||
String updatedSelectClause = PatientAttributeQueryHelper.appendToJoinClause("a"); | ||
assertNotNull(updatedSelectClause); | ||
assertEquals("a LEFT OUTER JOIN person_attribute pattrln on pattrln.person_id = p.person_id and pattrln.person_attribute_type_id in (1,2) LEFT OUTER JOIN person_attribute pattr_results on pattr_results.person_id = p.person_id and pattr_results.person_attribute_type_id in (1) LEFT OUTER JOIN person_attribute_type attrt_results on attrt_results.person_attribute_type_id = pattr_results.person_attribute_type_id and pattr_results.voided = 0 LEFT OUTER JOIN concept_name cn on cn.concept_id = pattr_results.value and cn.concept_name_type = 'FULLY_SPECIFIED' and attrt_results.format = 'org.openmrs.Concept' and cn.locale = 'en_GB' LEFT OUTER JOIN concept_name def_loc_cn on def_loc_cn.concept_id = pattr_results.value and def_loc_cn.concept_name_type = 'FULLY_SPECIFIED' and attrt_results.format = 'org.openmrs.Concept' and def_loc_cn.locale = 'en' ", updatedSelectClause); | ||
} | ||
} |
Oops, something went wrong.