Skip to content

Commit 243ea2b

Browse files
committed
Update mexico visits query
1 parent 631e2c2 commit 243ea2b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

configuration/reports/reportdescriptors/dataexports/sql/mexicoVisits.sql

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- set @startDate = '2025-01-01';
2-
-- set @endDate = '2025-09-30';
1+
set @startDate = '2025-01-01';
2+
set @endDate = '2025-09-30';
33
SET SESSION group_concat_max_len = 1000000;
44
set @locale = global_property_value('default_locale', 'es');
55

@@ -25,6 +25,7 @@ create temporary table temp_encounters
2525
gender_display varchar(10),
2626
registration_encounter_id int,
2727
registration_location_name varchar(255),
28+
procedencia varchar(255),
2829
insurance_policy_number varchar(255),
2930
vitals_encounter_id int,
3031
weight_kg double,
@@ -122,6 +123,20 @@ create index temp_encounters_reg_enc_idx on temp_encounters(registration_encount
122123
update temp_encounters set registration_location_name = encounter_location_name(registration_encounter_id);
123124
update temp_encounters set insurance_policy_number = obs_value_text(registration_encounter_id, 'PIH', 'Insurance policy number');
124125

126+
update temp_encounters set procedencia =
127+
CASE registration_location_name
128+
when 'Honduras' then 'Casa de Salud Honduras'
129+
when 'Laguna del Cofre' then 'CSR Laguna del Cofre'
130+
when 'Capitan' then 'Unidad Médica Rural Capitán Luis A. Vidal'
131+
when 'Letrero' then 'CSR El Letrero'
132+
when 'CSR El Letrero' then 'Casa de Salud Salvador Urbina'
133+
when 'Soledad' then 'Casa de Salud La Soledad'
134+
when 'Matazano ' then 'ESI El Matasanos'
135+
when 'Plan Alta' then 'Casa de Salud Plan de la Libertad'
136+
when 'Plan Baja' then 'Casa de Salud Plan de la Libertad'
137+
when 'Reforma' then 'CSR Reforma'
138+
END;
139+
125140
-- Populate data from the most recent vitals encounter within the same visit as each consult
126141

127142
SET @vitalsEncounterType = encounter_type('4fb47712-34a6-40d2-8ed3-e153abbd25b7');
Binary file not shown.

0 commit comments

Comments
 (0)