There is an inactive patient report which based on the last treatment date lists the patients who have not had treatment for a period of time
SQL is:-
select per.id, per.id as per_id, per.code, per.lastname, per.firstname, per.title, per.middlename, per.knownas,
per.company, per.address1, per.address2, per.address3, per.towncity, per.county, per.postcode, per.country,
per.telephone, per.worktel, per.mobile, per.fax, per.email, per.dob, per.registrationdate,
(coalesce(clinic.prefix, '') || cast(per.code as varchar(20))) as _patientcode,
per.clinic_id, clinic.name as _clinic,
per.patcat_id, patcat.name as _patient_category,
per.patstatus_id, patstatus.name as _patient_status,
per.practitioner_staff_id, staff.knownas as _practitioner,
view_nextapp.nextapp as _nextapp,
view_prevapp.prevapp as last_appointment
from per
left join clinic on (per.clinic_id=clinic.id)
left join patcat on (per.patcat_id=patcat.id)
left join patstatus on (per.patstatus_id=patstatus.id)
left join staff on (per.practitioner_staff_id=staff.id)
left join view_nextapp on (per.id=view_nextapp.per_id)
left join view_prevapp on (per.id=view_prevapp.per_id)
where (per.ispatient=true and per.deleted=false and view_nextapp.nextapp is null and view_prevapp.prevapp is not null)
We are looking to conduct a patient survey and so are looking for a list of patients who are "active" i.e. who have received treatment in the last say 12 months.
We need to exclude patients who cancelled or were DNA. So looking to select by "appointment status"
So two questions really:-
1) Managing the "active" status flag of patients
We do not currently make use of this flag and so they are currently all blank
Is this manually maintained or is there a way of automatically having this as active where a patient has had treatment in the last 12 months.
2) We are looking for a list of all patients who had treatment (aka had appointments filtered by appointment status (to remove DNAs and cancelled) giving me patient name and address details. Naturally I only need each patient to appear once on the report but could handle multiple occurences and then filter to unique in excel.
Suggestions Please
Tony Taylor
ESO Maidstone