diff --git a/app/reporting-framework/json-reports/daily-has-not-returned-base.json b/app/reporting-framework/json-reports/daily-has-not-returned-base.json index d5cf908fd..7a2fd8051 100644 --- a/app/reporting-framework/json-reports/daily-has-not-returned-base.json +++ b/app/reporting-framework/json-reports/daily-has-not-returned-base.json @@ -47,6 +47,30 @@ "joinCondition": "t2.visit_id = t20.visit_id" } }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "t2.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "t2.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "t2.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } + }, { "table": "etl.program_visit_map", "alias": "t21", @@ -93,6 +117,21 @@ "alias": "d", "column": "date_format(t2.scheduled_date,'%Y-%m-%d')" }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "simple_column", "alias": "med_pick_up_date", diff --git a/app/reporting-framework/json-reports/hiv-summary-base.json b/app/reporting-framework/json-reports/hiv-summary-base.json index 2f706de63..3e05aa281 100644 --- a/app/reporting-framework/json-reports/hiv-summary-base.json +++ b/app/reporting-framework/json-reports/hiv-summary-base.json @@ -24,6 +24,30 @@ "type": "INNER", "joinCondition": "fhs.person_id = p.person_id" } + }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "fhs.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "fhs.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "fhs.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } } ], "columns": [ @@ -56,6 +80,21 @@ "expression": "if(fhs.cur_arv_line=2,1,null)" } }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "derived_column", "alias": "on_tdf_3tc_efv_400", diff --git a/app/reporting-framework/json-reports/main-dataset-base-blue-card.json b/app/reporting-framework/json-reports/main-dataset-base-blue-card.json index ab891d5c7..22153affd 100755 --- a/app/reporting-framework/json-reports/main-dataset-base-blue-card.json +++ b/app/reporting-framework/json-reports/main-dataset-base-blue-card.json @@ -16,6 +16,30 @@ "type": "INNER", "joinCondition": "l.location_id = hmsd.location_id" } + }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } } ], "columns": [ @@ -34,6 +58,21 @@ "alias": "age", "column": "hmsd.age" }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "simple_column", "alias": "person_id", diff --git a/app/reporting-framework/json-reports/main-dataset-base.json b/app/reporting-framework/json-reports/main-dataset-base.json index a52feb8f6..7de1f3610 100755 --- a/app/reporting-framework/json-reports/main-dataset-base.json +++ b/app/reporting-framework/json-reports/main-dataset-base.json @@ -24,6 +24,30 @@ "type": "LEFT", "joinCondition": "csm.person_id = hmsd.person_id AND csm.endDate = hmsd.endDate" } + }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } } ], "columns": [ @@ -37,6 +61,21 @@ "alias": "birthdate", "column": "hmsd.birthdate" }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "simple_column", "alias": "age", diff --git a/app/reporting-framework/json-reports/ovc-in-hei-patient-list-template.json b/app/reporting-framework/json-reports/ovc-in-hei-patient-list-template.json index ba2e948d3..b282afe7b 100644 --- a/app/reporting-framework/json-reports/ovc-in-hei-patient-list-template.json +++ b/app/reporting-framework/json-reports/ovc-in-hei-patient-list-template.json @@ -56,6 +56,30 @@ "joinCondition": "t1.person_id = pa.person_id" } }, + { + "table": "amrs.patient_identifier", + "alias": "ovc_id", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = ovc_id.patient_id AND (ovc_id.voided IS NULL || ovc_id.voided = 0) AND ovc_id.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, { "table": "amrs.patient_identifier", "alias": "ovc_id", @@ -84,6 +108,16 @@ "alias": "person_id", "column": "t1.person_id" }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, { "type": "derived_column", "alias": "person_name", @@ -105,6 +139,11 @@ "alias": "ovc_identifier", "column": "ovc_id.identifier" }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovc_id.identifier" + }, { "type": "derived_column", "alias": "phone_number", diff --git a/app/reporting-framework/json-reports/patient-gains-and-losses-patient-list-template.json b/app/reporting-framework/json-reports/patient-gains-and-losses-patient-list-template.json index 3ae70aa6a..a3c81ac2e 100644 --- a/app/reporting-framework/json-reports/patient-gains-and-losses-patient-list-template.json +++ b/app/reporting-framework/json-reports/patient-gains-and-losses-patient-list-template.json @@ -24,6 +24,30 @@ "joinCondition": "t1.person_id = id.patient_id AND (id.voided IS NULL || id.voided = 0)" } }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } + }, { "table": "amrs.person_attribute", "alias": "contacts", @@ -95,6 +119,21 @@ "expression": "t1.uuid" } }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "simple_column", "alias": "person_id", diff --git a/app/reporting-framework/json-reports/patient-list-schedules-template.json b/app/reporting-framework/json-reports/patient-list-schedules-template.json index 80d24810c..f0721dc28 100644 --- a/app/reporting-framework/json-reports/patient-list-schedules-template.json +++ b/app/reporting-framework/json-reports/patient-list-schedules-template.json @@ -18,10 +18,34 @@ }, { "table": "amrs.patient_identifier", - "alias": "id", + "alias": "ccc", "join": { "type": "LEFT", - "joinCondition": "t1.person_id = id.patient_id AND (id.voided IS NULL || id.voided = 0)" + "joinCondition": "t1.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ids", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = ids.patient_id AND (ids.voided IS NULL || ids.voided = 0)" } }, { @@ -142,14 +166,29 @@ "expression": " CONCAT(COALESCE(person_name.given_name, ''), ' ', COALESCE(person_name.middle_name, ''), ' ', COALESCE(person_name.family_name, ''))" } }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, { "type": "derived_column", "alias": "identifiers", "expressionType": "simple_expression", "expressionOptions": { - "expression": " GROUP_CONCAT(DISTINCT id.identifier SEPARATOR ', ')" + "expression": "GROUP_CONCAT(DISTINCT ids.identifier SEPARATOR ', ')" } }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "derived_column", "alias": "phone_number", diff --git a/app/reporting-framework/json-reports/starting-art-base-age15.json b/app/reporting-framework/json-reports/starting-art-base-age15.json index fa70dc08d..728e22347 100755 --- a/app/reporting-framework/json-reports/starting-art-base-age15.json +++ b/app/reporting-framework/json-reports/starting-art-base-age15.json @@ -16,6 +16,30 @@ "type": "INNER", "joinCondition": "l.location_id = hmsd.location_id" } + }, + { + "table": "amrs.patient_identifier", + "alias": "upi", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = upi.patient_id AND (upi.voided IS NULL || upi.voided = 0) AND upi.identifier_type = 45" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ovcid", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = ovcid.patient_id AND (ovcid.voided IS NULL || ovcid.voided = 0) AND ovcid.identifier_type = 43" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "ccc", + "join": { + "type": "LEFT", + "joinCondition": "hmsd.person_id = ccc.patient_id AND (ccc.voided IS NULL || ccc.voided = 0) AND ccc.identifier_type = 28" + } } ], "columns": [ @@ -34,6 +58,21 @@ "alias": "age", "column": "hmsd.age" }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "ccc.identifier" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "ovcid.identifier" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "upi.identifier" + }, { "type": "simple_column", "alias": "person_id",