Skip to content

Commit

Permalink
BAH-1374 | Add. Display preferred patients under all clinical tabs
Browse files Browse the repository at this point in the history
Co-authored-by: Soorya Kumaran C <[email protected]>
  • Loading branch information
kavitha-sundararajan and SooryaKumaranC-tw committed Jan 25, 2022
1 parent 6e26b3d commit 12edb7d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
51 changes: 50 additions & 1 deletion bahmnicore-omod/src/main/resources/V1_99_PatientSearchSql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,54 @@ UPDATE global_property SET property_value = "select distinct
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";
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";
4 changes: 2 additions & 2 deletions bahmnicore-omod/src/main/resources/liquibase.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3874,8 +3874,8 @@
<sqlFile path="V1_98_WardsListSql.sql"/>
</changeSet>

<changeSet id="bahmni-PatientSearch-Update-202201250930" author="Kavitha S, Soorya Kumaran C">
<comment>update the property value of emrapi.sqlSearch.activePatients search query to obtain active patients based on preferred and non voided</comment>
<changeSet id="bahmni-PatientSearch-Update-202201250315" author="Kavitha S, Soorya Kumaran C">
<comment>Update the property values for searching active patients based on preferred and non voided</comment>
<sqlFile path="V1_99_PatientSearchSql.sql"/>
</changeSet>

Expand Down

0 comments on commit 12edb7d

Please sign in to comment.