From 8e9a50420355e739e8248956ac5c378d73a24471 Mon Sep 17 00:00:00 2001 From: Jerry Padgett Date: Tue, 24 May 2022 08:52:28 -0400 Subject: [PATCH] QRDA and CCDA fixes (#5372) * add desc to document_fetch * fix information recipient if empty org then grab facility name. fix custodian populate from correct json add header information recip template to generator --- .../oe-blue-button-generate/lib/documentLevel.js | 1 + .../oe-blue-button-generate/lib/headerLevel.js | 52 ++++++++++++++++++++-- ccdaservice/serveccda.js | 26 ++++++++--- .../Model/CarecoordinationTable.php | 2 +- .../Model/EncounterccdadispatchTable.php | 8 ++-- 5 files changed, 75 insertions(+), 14 deletions(-) diff --git a/ccdaservice/oe-blue-button-generate/lib/documentLevel.js b/ccdaservice/oe-blue-button-generate/lib/documentLevel.js index f400a0d74..91ba29875 100644 --- a/ccdaservice/oe-blue-button-generate/lib/documentLevel.js +++ b/ccdaservice/oe-blue-button-generate/lib/documentLevel.js @@ -91,6 +91,7 @@ exports.ccd2 = function (html_renderer) { headerLevel.headerAuthor, headerLevel.headerInformant, headerLevel.headerCustodian, + headerLevel.headerInformationRecipient, headerLevel.providers, { key: "component", content: { diff --git a/ccdaservice/oe-blue-button-generate/lib/headerLevel.js b/ccdaservice/oe-blue-button-generate/lib/headerLevel.js index e5b01d053..c79ac99f1 100644 --- a/ccdaservice/oe-blue-button-generate/lib/headerLevel.js +++ b/ccdaservice/oe-blue-button-generate/lib/headerLevel.js @@ -59,8 +59,7 @@ var patient = exports.patient = { code: function (input) { if (Object.prototype.toString.call(input) === "[object String]") { return input.substring(0, 1); - } - else { + } else { return input.code.substring(0, 1); } }, @@ -471,7 +470,6 @@ var headerInformant = exports.headerInformant = { key: "name", text: leafLevel.inputProperty("name"), dataKey: "name" - }] }] }, @@ -535,3 +533,51 @@ var headerCustodian = exports.headerCustodian = { }, dataKey: "meta.ccda_header.custodian" }; +var headerInformationRecipient = exports.headerInformationRecipient = { + key: "informationRecipient", + content: { + key: "intendedRecipient", + content: [{ + key: "informationRecipient", + content: { + key: "name", + content: [ + { + key: "family", + text: leafLevel.inputProperty("family") + }, { + key: "given", + text: leafLevel.input, + dataKey: "given" + }, { + key: "prefix", + text: leafLevel.inputProperty("prefix") + }, { + key: "suffix", + text: leafLevel.inputProperty("suffix") + }], + dataKey: "name", + dataTransform: translate.name, + }, + }, + { + key: "receivedOrganization", + content: [{ + key: "name", + text: leafLevel.inputProperty("name"), + dataKey: "organization" + }], + + }] + }, + dataKey: "meta.ccda_header.information_recipient" +} + +/* { + key: "receivedOrganization", + content: [{ + key: "name", + text: leafLevel.inputProperty("name"), + dataKey: "organization" + }], +}*/ \ No newline at end of file diff --git a/ccdaservice/serveccda.js b/ccdaservice/serveccda.js index d8de7476d..e5e34f8cf 100644 --- a/ccdaservice/serveccda.js +++ b/ccdaservice/serveccda.js @@ -2233,26 +2233,38 @@ function populateHeader(pd) { } ], "name": [ - pd.encounter_provider.facility_name + pd.custodian.organization || pd.custodian.name ], "address": [ { "street_lines": [ - pd.encounter_provider.facility_street + pd.custodian.streetAddressLine ], - "city": pd.encounter_provider.facility_city, - "state": pd.encounter_provider.facility_state, - "zip": pd.encounter_provider.facility_postal_code, - "country": pd.encounter_provider.facility_country_code || "US" + "city": pd.custodian.city, + "state": pd.custodian.state, + "zip": pd.custodian.postal_code, + "country": pd.custodian.country_code || "US" } ], "phone": [ { - "number": pd.encounter_provider.facility_phone, + "number": pd.custodian.telecom, "type": "work primary" } ] }, + "information_recipient": { + "name": { + "prefix": pd.information_recipient.prefix || "", + "suffix": pd.information_recipient.suffix || "", + "middle": [pd.information_recipient.mname] || "", + "last": pd.information_recipient.lname || "", + "first": pd.information_recipient.fname || "" + }, + "organization": { + "name": pd.information_recipient.organization || "org" + }, + }, /*"data_enterer": { "identifiers": [ { diff --git a/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/CarecoordinationTable.php b/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/CarecoordinationTable.php index 6516f04a2..b86884040 100644 --- a/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/CarecoordinationTable.php +++ b/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/CarecoordinationTable.php @@ -142,7 +142,7 @@ class CarecoordinationTable extends AbstractTableGateway LEFT JOIN patient_data pd ON pd.lname = ad.field_value AND pd.fname = ad1.field_value AND pd.DOB = DATE(ad2.field_value) LEFT JOIN users AS u ON u.id = d.owner WHERE d.audit_master_approval_status = 1 AND am.id >= 0 - ORDER BY date ASC"; + ORDER BY date DESC"; // do not change DESC $appTable = new ApplicationTable(); $result = $appTable->zQuery($query, array($data['cat_title'], $data['type'])); $records = array(); diff --git a/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/EncounterccdadispatchTable.php b/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/EncounterccdadispatchTable.php index 768fa378d..0aef6d7b5 100644 --- a/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/EncounterccdadispatchTable.php +++ b/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Model/EncounterccdadispatchTable.php @@ -265,7 +265,7 @@ class EncounterccdadispatchTable extends AbstractTableGateway $details['lname'] = ''; $details['organization'] = ''; } elseif ($recipients == 'emr_direct') { - $query = "select fname, lname, organization, street, city, state, zip, phonew1 from users where email_direct = ?"; + $query = "select fname, lname, organization, street, city, state, zip, phonew1, facility from users where email_direct = ?"; $field_name[] = $params; } elseif ($recipients == 'patient') { $query = "select fname, lname from patient_data WHERE pid = ?"; @@ -274,14 +274,16 @@ class EncounterccdadispatchTable extends AbstractTableGateway if (!$params) { $params = $_SESSION['authUserID']; } - - $query = "select fname, lname, organization, street, city, state, zip, phonew1 from users where id = ?"; + $query = "select fname, lname, organization, street, city, state, zip, phonew1, facility from users where id = ?"; $field_name[] = $params; } if ($recipients != 'hie') { $res = $appTable->zQuery($query, $field_name); $result = $res->current(); + if (empty($result['organization'])) { + $result['organization'] = $result['facility']; + } $details['fname'] = $result['fname']; $details['lname'] = $result['lname']; $details['organization'] = $result['organization']; -- 2.11.4.GIT