From 37691680e1e03952f2395ecaf9fe7da600e45580 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Wed, 20 Mar 2024 12:27:46 +0300 Subject: [PATCH] POC-667: Clients indicated to have been done Total Abdominal hysterectomy and yet no documentation in the system --- service/cervical-cancer-screening-service.js | 43 ++++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/service/cervical-cancer-screening-service.js b/service/cervical-cancer-screening-service.js index 87fc13d81..736d213fe 100644 --- a/service/cervical-cancer-screening-service.js +++ b/service/cervical-cancer-screening-service.js @@ -48,47 +48,18 @@ function getPatientCervicalCancerScreeningSummary(patientUuId) { if (patientUuId === '' || patientUuId === null) { reject('Patient Uuid is missing'); } else { - const sql = `SELECT - person_id, - DATE_FORMAT(test_datetime, '%d-%m-%Y') AS 'test_date', - via_or_via_vili, - pap_smear, - hpv, - uuid, - CASE - WHEN via_or_via_vili IS NOT NULL THEN 'VIA or VIA/VILI' - WHEN pap_smear IS NOT NULL THEN 'PAP SMEAR' - WHEN hpv IS NOT NULL THEN 'HPV' - ELSE NULL - END AS 'test', - CASE - WHEN via_or_via_vili = 7469 THEN 'ACETOWHITE LESION' - WHEN via_or_via_vili = 1115 THEN 'NORMAL' - WHEN via_or_via_vili = 6497 THEN 'DYSFUNCTIONAL UTERINE BLEEDING' - WHEN via_or_via_vili = 703 THEN 'POSITIVE' - WHEN via_or_via_vili = 7470 THEN 'PUNCTUATED CAPILLARIES' - WHEN via_or_via_vili = 664 THEN 'NEGATIVE' - WHEN via_or_via_vili = 7472 THEN 'ATYPICAL BLOOD VESSELS' - WHEN via_or_via_vili = 7293 THEN 'ULCER' - WHEN via_or_via_vili = 9593 THEN 'FRIABLE TISSUE' - WHEN via_or_via_vili = 6971 THEN 'POSSIBLE' - ELSE NULL - END AS 'via_test_result' - FROM - etl.flat_labs_and_imaging - WHERE - (via_or_via_vili IS NOT NULL - OR pap_smear IS NOT NULL - OR hpv IS NOT NULL) - AND uuid = '${patientUuId}' - ORDER BY test_datetime DESC - LIMIT 10;`; + const sql = `CALL etl.sp_get_cacx_info('${patientUuId}')`; const queryParts = { sql: sql }; db.queryServer(queryParts, function (result) { - resolve(result); + const results = { + startIndex: result.startIndex, + size: result.result[0].length, + result: result.result[0] + }; + resolve(results); }); } });