malawi_hiv_program_reports 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6d7725bbae83b356b36e8124d6e938b16bf43ca789948da6d9a89964b97f2d8
|
4
|
+
data.tar.gz: 9cd388fee4284e632399135f1dfcd7810ffe9b6c6bc8158ff70f6b3ed8431702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcb5645fe7df71c690e0d1c4548c4ccb7dc9c261ff8fea52bc19a134354ffc0b4faa9032ab56c55597b50ab3790b45205773a1df52f41d216d55473aa55f7f8d
|
7
|
+
data.tar.gz: f66a1b98edfe2fc4ecdf4594d91a9f9a1a6bfd6c279536f9cc2f74e7c9bb4f75571d6abfbdcd718cdcb9569139beb940ef81b949996cf760ebfee8f6f5cbbba8
|
@@ -82,7 +82,7 @@ module MalawiHivProgramReports
|
|
82
82
|
|
83
83
|
ActiveRecord::Base.connection.execute <<~SQL
|
84
84
|
INSERT INTO temp_patient_outcomes
|
85
|
-
SELECT patients.patient_id, 'Patient died',
|
85
|
+
SELECT patients.patient_id, 'Patient died', patient_state.start_date, #{@location}
|
86
86
|
FROM temp_earliest_start_date AS patients
|
87
87
|
INNER JOIN patient_program
|
88
88
|
ON patient_program.patient_id = patients.patient_id
|
@@ -94,6 +94,10 @@ module MalawiHivProgramReports
|
|
94
94
|
AND patient_state.start_date < #{interval_manager(date:, value: 1, interval: 'DAY', operator: '+')}
|
95
95
|
AND patient_state.voided = 0 #{site_manager(operator: 'AND', column: 'patient_state.site_id', location: @location)}
|
96
96
|
WHERE patients.date_enrolled <= #{date} #{site_manager(operator: 'AND', column: 'patients.site_id', location: @location)}
|
97
|
+
AND patient_state.date_created = (SELECT MAX(date_created)
|
98
|
+
FROM patient_state ps#{' '}
|
99
|
+
WHERE ps.patient_program_id = patient_state.patient_program_id #{site_manager(operator: 'AND', column: 'ps.site_id', location: @location)}#{' '}
|
100
|
+
AND ps.state = patient_state.state AND ps.voided = 0)
|
97
101
|
GROUP BY patients.patient_id
|
98
102
|
SQL
|
99
103
|
end
|