forked from Bahmni/default-config
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Visit Appointment Report * Appointment Reports
- Loading branch information
1 parent
ea7d10d
commit c214ab8
Showing
4 changed files
with
78 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
{ | ||
"appointmentReport": { | ||
"missedAppointmentReport": { | ||
"name": "Missed Appointment Report", | ||
"type": "MRSGeneric", | ||
"config": { | ||
"sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/missedAppointments.sql" | ||
} | ||
}, | ||
"summaryAppointmentReport": { | ||
"name": "Appointment Summary Report", | ||
"type": "MRSGeneric", | ||
"config": { | ||
"sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/summaryAppointmentReport.sql" | ||
} | ||
}, | ||
"visitAppointmentReport": { | ||
"name": "Visit Appointment Report", | ||
"type": "MRSGeneric", | ||
"config": { | ||
"sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/visitAppointmentReport.sql" | ||
} | ||
}, | ||
"walkinAppointmentReport": { | ||
"name": "WalkIn Visit Report", | ||
"type": "MRSGeneric", | ||
"config": { | ||
"sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/walkinAppointmentReport.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,17 @@ | ||
SELECT DISTINCT | ||
pai.identifier AS 'patient ID', | ||
pn.given_name AS 'First Name', | ||
ifnull(pn.family_name,'') AS 'Last Name', | ||
DATE_FORMAT(pa.start_date_time, "%d/%m/%Y") AS 'Appointment Date', | ||
pa.status AS 'Status', | ||
pMobile.telephoneNo AS 'Contact No.', | ||
p.gender AS 'Gender' | ||
FROM patient_appointment pa | ||
LEFT JOIN person p ON p.person_id = pa.patient_id AND pa.voided IS FALSE | ||
LEFT JOIN person_name pn ON p.person_id = pn.person_id AND pn.voided IS FALSE | ||
LEFT JOIN patient_identifier pai ON (pai.patient_id = pa.patient_id AND pai.preferred = 1) | ||
LEFT JOIN (select paMobile.person_id as 'pMobilePersonId', paMobile.value AS 'telephoneNo' from person_attribute paMobile | ||
JOIN person_attribute_type patMobile ON patMobile.name = "MobileNumber" AND patMobile.retired IS FALSE | ||
AND patMobile.person_attribute_type_id = paMobile.person_attribute_type_id) AS pMobile ON pa.patient_id = pMobile.pMobilePersonId | ||
WHERE pa.appointment_kind = 'Scheduled' AND pa.start_date_time BETWEEN '#startDate#' AND '#endDate#' | ||
ORDER BY pa.start_date_time DESC; |
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,22 @@ | ||
SELECT DISTINCT | ||
pai.identifier AS 'patient ID', | ||
pn.given_name AS 'First Name', | ||
ifnull(pn.family_name,'') AS 'Last Name', | ||
DATE_FORMAT(pa.start_date_time, "%d/%m/%Y") AS 'Visit Date', | ||
pa.appointment_kind AS 'Visit Type', | ||
pMobile.telephoneNo AS 'Contact No.', | ||
p.gender AS 'Gender' | ||
FROM patient_appointment pa | ||
LEFT JOIN person p ON p.person_id = pa.patient_id AND pa.voided IS FALSE | ||
LEFT JOIN person_name pn ON p.person_id = pn.person_id AND pn.voided IS FALSE | ||
LEFT JOIN patient_identifier pai ON (pai.patient_id = pa.patient_id AND pai.preferred = 1) | ||
LEFT JOIN (select paMobile.person_id as 'pMobilePersonId', paMobile.value AS 'telephoneNo' from person_attribute paMobile | ||
JOIN person_attribute_type patMobile ON patMobile.name = "MobileNumber" AND patMobile.retired IS FALSE | ||
AND patMobile.person_attribute_type_id = paMobile.person_attribute_type_id) AS pMobile ON pa.patient_id = pMobile.pMobilePersonId | ||
LEFT JOIN (SELECT v.patient_id AS 'visitPatientId', | ||
v.visit_id AS visitId, v.date_started AS visitStartDate, vt.name AS visitType FROM visit v | ||
JOIN visit_type vt ON (v.visit_type_id = vt.visit_type_id and vt.retired IS FALSE) | ||
HAVING v.visit_id = (SELECT MAX(maxV.visit_id) AS maxVisitId | ||
FROM visit maxV WHERE maxV.patient_id = v.patient_id)) AS patientVisit ON patientVisit.visitPatientId = pa.patient_id | ||
WHERE pa.start_date_time BETWEEN '#startDate#' AND '#endDate#' | ||
ORDER BY pa.start_date_time DESC; |
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,17 @@ | ||
SELECT DISTINCT | ||
pai.identifier AS 'patient ID', | ||
pn.given_name AS 'First Name', | ||
ifnull(pn.family_name,'') AS 'Last Name', | ||
DATE_FORMAT(pa.start_date_time, "%d/%m/%Y") AS 'Visit Date', | ||
pa.appointment_kind AS 'Visit Type', | ||
pMobile.telephoneNo AS 'Contact No.', | ||
p.gender AS 'Gender' | ||
FROM patient_appointment pa | ||
LEFT JOIN person p ON p.person_id = pa.patient_id AND pa.voided IS FALSE | ||
LEFT JOIN person_name pn ON p.person_id = pn.person_id AND pn.voided IS FALSE | ||
LEFT JOIN patient_identifier pai ON (pai.patient_id = pa.patient_id AND pai.preferred = 1) | ||
LEFT JOIN (select paMobile.person_id as 'pMobilePersonId', paMobile.value AS 'telephoneNo' from person_attribute paMobile | ||
JOIN person_attribute_type patMobile ON patMobile.name = "MobileNumber" AND patMobile.retired IS FALSE | ||
AND patMobile.person_attribute_type_id = paMobile.person_attribute_type_id) AS pMobile ON pa.patient_id = pMobile.pMobilePersonId | ||
WHERE pa.appointment_kind = 'WalkIn' AND pa.start_date_time BETWEEN '#startDate#' AND '#endDate#' | ||
ORDER BY pa.start_date_time DESC; |