Skip to content
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

Alert for missing CD4 after 6 months is not writen properly #541

Open
valvijo opened this issue Apr 28, 2018 · 0 comments
Open

Alert for missing CD4 after 6 months is not writen properly #541

valvijo opened this issue Apr 28, 2018 · 0 comments
Assignees

Comments

@valvijo
Copy link
Member

valvijo commented Apr 28, 2018

Actual Results

The query is not finding the patients that are more than or equal to 6 months without CD4 result.

Expected results

The query should return a cohort for those without CD4 results in the current date >= 6 months after the last CD4

Steps to reproduce

http://test.esaude.org/openmrs/module/patientflags/findFlaggedPatients.form?flagId=5

Screenshot/Attachment (Optional)

A visual description of the unexpected behaviour.

select en.patient_id
    from
    (select * from encounter e where e.encounter_type in (6, 9) and e.encounter_datetime =(select max(en.encounter_datetime) from encounter en where en.patient_id = e.patient_id and e.encounter_type in (6, 9))) as en
    where TIMESTAMPDIFF(MONTH, en.encounter_datetime, now()) >= 6 AND (select count(o.obs_id) from obs o where o.person_id = en.patient_id AND o.obs_datetime between (en.encounter_datetime and now()) AND o.concept_id IN (5497, 730, 1695)  and o.voided = 0) = 0;
@ynurmahomed ynurmahomed added the Clinic Clinic module label Jun 1, 2018
@ynurmahomed ynurmahomed changed the title [Clinic] Alert for missing CD4 after 6 months is not writen properly Alert for missing CD4 after 6 months is not writen properly Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants