forked from Raxa/raxacore
-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BAH-1236 | Bug fix. Modified query to display only preferred patients… #110
Open
SooryaKumaranC-tw
wants to merge
3
commits into
master
Choose a base branch
from
BAH-1236
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
7cad12c
BAH-1236 | Bug fix. Modified query to display only preferred patients…
SooryaKumaranC-tw 9bd2251
BAH-1236 | Refactor. Display preferred patients in active tabs
SooryaKumaranC-tw 162bd9f
BAH-1374 | Add. Display preferred patients under all clinical tabs
kavitha-sundararajan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
bahmnicore-omod/src/main/resources/V1_99_PatientSearchSql.sql
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,67 @@ | ||
UPDATE global_property SET property_value = "select distinct | ||
concat(pn.given_name,' ', pn.family_name) as name, | ||
pi.identifier as identifier, | ||
concat('',p.uuid) as uuid, | ||
IF(va.value_reference = \"Admitted\", \"true\", \"false\") as hasBeenAdmitted | ||
from visit v | ||
join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 and pn.preferred = 1 | ||
join patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0 and pi.preferred = 1 | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property=\"bahmni.primaryIdentifierType\" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id and p.voided = 0 | ||
join location l on l.uuid = ${visit_location_uuid} and v.location_id = l.location_id | ||
left outer join visit_attribute va on va.visit_id = v.visit_id and va.attribute_type_id = ( | ||
select visit_attribute_type_id from visit_attribute_type where name=\"Admission Status\" | ||
) and va.voided = 0 | ||
where v.date_stopped is null AND v.voided = 0;" | ||
WHERE property = "emrapi.sqlSearch.activePatients"; | ||
|
||
UPDATE global_property SET property_value = | ||
"select distinct concat(pn.given_name,' ', pn.family_name) as name, | ||
pi.identifier as identifier, | ||
concat('',p.uuid) as uuid, | ||
IF(va.value_reference = \"Admitted\", \"true\", \"false\") as hasBeenAdmitted | ||
from | ||
visit v join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 and v.voided=0 and pn.preferred = 1 | ||
join patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0 and pi.preferred = 1 | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property=\"bahmni.primaryIdentifierType\" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id and p.voided=0 | ||
join encounter en on en.visit_id = v.visit_id and en.voided=0 | ||
join encounter_provider ep on ep.encounter_id = en.encounter_id and ep.voided=0 | ||
join provider pr on ep.provider_id=pr.provider_id and pr.retired=0 | ||
join person per on pr.person_id=per.person_id and per.voided=0 | ||
join location l on l.uuid=${visit_location_uuid} and l.location_id = v.location_id | ||
left outer join visit_attribute va on va.visit_id = v.visit_id and va.voided = 0 and va.attribute_type_id = ( | ||
select visit_attribute_type_id from visit_attribute_type where name=\"Admission Status\" | ||
) | ||
where | ||
v.date_stopped is null and | ||
pr.uuid=${provider_uuid} | ||
order by en.encounter_datetime desc" | ||
WHERE property = "emrapi.sqlSearch.activePatientsByProvider"; | ||
|
||
UPDATE global_property SET property_value = | ||
"select distinct concat(pn.given_name,' ', pn.family_name) as name, | ||
pi.identifier as identifier, | ||
concat('',p.uuid) as uuid, | ||
IF(va.value_reference = \"Admitted\", \"true\", \"false\") as hasBeenAdmitted | ||
from | ||
visit v join person_name pn on v.patient_id = pn.person_id and pn.voided = 0 and v.voided=0 and pn.preferred = 1 | ||
join patient_identifier pi on v.patient_id = pi.patient_id and pi.voided=0 and pi.preferred = 1 | ||
join patient_identifier_type pit on pi.identifier_type = pit.patient_identifier_type_id | ||
join global_property gp on gp.property=\"bahmni.primaryIdentifierType\" and gp.property_value=pit.uuid | ||
join person p on p.person_id = v.patient_id and p.voided=0 | ||
join encounter en on en.visit_id = v.visit_id and en.voided=0 | ||
left outer join location loc on en.location_id = loc.location_id | ||
join encounter_provider ep on ep.encounter_id = en.encounter_id and ep.voided=0 | ||
join provider pr on ep.provider_id=pr.provider_id and pr.retired=0 | ||
join person per on pr.person_id=per.person_id and per.voided=0 | ||
left outer join visit_attribute va on va.visit_id = v.visit_id and va.attribute_type_id = ( | ||
select visit_attribute_type_id from visit_attribute_type where name=\"Admission Status\" | ||
) | ||
where | ||
v.date_stopped is null and | ||
loc.uuid=${location_uuid} | ||
order by en.encounter_datetime desc" | ||
WHERE property = "emrapi.sqlSearch.activePatientsByLocation"; |
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 |
---|---|---|
|
@@ -3874,6 +3874,11 @@ | |
<sqlFile path="V1_98_WardsListSql.sql"/> | ||
</changeSet> | ||
|
||
<changeSet id="bahmni-PatientSearch-Update-202201250315" author="Kavitha S, Soorya Kumaran C"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please use 3 different changesets as suggested above? also please make sure that the changeset clearly says which is for which property There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay |
||
<comment>Update the property values for searching active patients based on preferred and non voided</comment> | ||
<sqlFile path="V1_99_PatientSearchSql.sql"/> | ||
</changeSet> | ||
|
||
<changeSet id="bahmni-201703061748" author="Shruthi P, Pushpa"> | ||
<preConditions onFail="MARK_RAN"> | ||
<sqlCheck expectedResult="1"> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we please break the SQL file into 3 different ones please and also create liquibase changesets that are specific to a specific property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, sure.