diff --git a/data/templates/fhir/ORM_O01_TO_IPMS.hbs b/data/templates/fhir/ORM_O01_TO_IPMS.hbs index f4fed59bd..4c17dd3f1 100644 --- a/data/templates/fhir/ORM_O01_TO_IPMS.hbs +++ b/data/templates/fhir/ORM_O01_TO_IPMS.hbs @@ -1,6 +1,6 @@ {{#with msg.fhir}} -MSH|^~\&|LAB||LAB||{{date}}||ORM^O01|{{controlId}}|D|2.4|||AL|NE| +MSH|^~\&|{{orderTypeFlag}}||{{orderTypeFlag}}||{{date}}||ORM^O01|{{controlId}}|D|2.4|||AL|NE| PID|1||{{medicalRecordNumber}}^^^^MR^GGC~{{patientOmang}}^^^^SS^GGC~{{patientIdentifier}}^^^^PI^GGC~{{unknownIdentifier}}^^^^HUB^GGC||{{patientFamilyName}}^{{patientFirstName.[0]}}^^^^^L||{{patientDoB}}|{{sex}}||CT|{{patientStreetAddress}}^^{{patientCity}}^{{patientProvince}}^{{patientPostalCode}}||{{patientBusinessPhoneNumber}}|||{{maritalStatus}}||{{patientAccountNumber}}| -ORC|NW|{{labOrderId}}^LAB|{{medicalRecordNumber}}||FINAL||^^^^^R^||{{labOrderDatetime}}||| -OBR|1|{{labOrderId}}^LAB||{{labOrderMnemonic}}^{{labOrderName}}|R|{{labOrderDatetime}}|{{labOrderDatetime}}|||||||^^|{{providerId}}^{{providerLastName}}^{{providerFirstName.[0]}}^^^^^|| +ORC|NW|{{labOrderId}}^{{orderTypeFlag}}|{{medicalRecordNumber}}||FINAL||^^^^^R^||{{labOrderDatetime}}||| +OBR|1|{{labOrderId}}^{{orderTypeFlag}}||{{labOrderMnemonic}}^{{labOrderName}}|R|{{labOrderDatetime}}|{{labOrderDatetime}}||||||||SPUTUM^^^SPUTUM|{{providerId}}^{{providerLastName}}^{{providerFirstName.[0]}}^^^^^|| {{/with}} \ No newline at end of file diff --git a/data/templates/hl7v2/CodeSystem/IDType.hbs b/data/templates/hl7v2/CodeSystem/IDType.hbs index e2eb1d56f..badf0fd38 100644 --- a/data/templates/hl7v2/CodeSystem/IDType.hbs +++ b/data/templates/hl7v2/CodeSystem/IDType.hbs @@ -163,6 +163,10 @@ "code" : "IND", "display" : "Indigenous/Aboriginal", "system" : "http://terminology.hl7.org/CodeSystem/v2-0203", + {{else if (eq inCode 'LAB')}}, + "code" : "LAB", + "display" : "Laboratory Order ID", + "system" : "http://terminology.hl7.org/CodeSystem/v2-0203", {{else if (eq inCode 'LACSN')}}, "code" : "LACSN", "display" : "Laboratory Accession ID", diff --git a/data/templates/hl7v2/Resources/DiagnosticReport.hbs b/data/templates/hl7v2/Resources/DiagnosticReport.hbs index 7fd0f7949..1b81f0953 100644 --- a/data/templates/hl7v2/Resources/DiagnosticReport.hbs +++ b/data/templates/hl7v2/Resources/DiagnosticReport.hbs @@ -68,8 +68,18 @@ ], }, }, - { {{>DataType/EIIdentifier.hbs EI=OBR-2}} }, - { {{>DataType/EIIdentifier.hbs EI=OBR-3}} }, + {{#if OBR-2}}, + { + "system":"http://moh.bw.org/ext/identifier/lab-order-id", + {{>DataType/EIIdentifier.hbs EI=OBR-2}}, + }, + {{/if}}, + {{#if OBR-3}}, + { + "system":"http://moh.bw.org/ext/identifier/pi", + {{>DataType/EIIdentifier.hbs EI=OBR-3}}, + }, + {{/if}}, ], "effectiveDateTime":"{{formatAsDateTime ORC-9}}", {{#if (not OBR-8)}}, diff --git a/debug.docker-compose.yml b/debug.docker-compose.yml index be79a4b19..82aef942f 100644 --- a/debug.docker-compose.yml +++ b/debug.docker-compose.yml @@ -14,7 +14,7 @@ services: container_name: built-fhir-converter hostname: fhir-converter restart: unless-stopped - image: ghcr.io/b-techbw/openhim-mediator-fhir-converter:debug + image: itechuw/openhim-mediator-fhir-converter:debug build: ./ ports: - 2019:2019 @@ -32,4 +32,4 @@ services: networks: hie: external: true - name: hie-botswana_hie + name: openhim_public \ No newline at end of file diff --git a/src/lib/fhir/fhir.js b/src/lib/fhir/fhir.js index 6780898e6..cd988c4dd 100644 --- a/src/lib/fhir/fhir.js +++ b/src/lib/fhir/fhir.js @@ -155,8 +155,13 @@ module.exports = class fhir extends dataHandler { let ipmsCode = serviceRequest.code.coding.find(e => e.system == "https://api.openconceptlab.org/orgs/I-TECH-UW/sources/IPMSLAB/") res.labOrderMnemonic = ipmsCode && ipmsCode.code ? ipmsCode.code : ""; res.labOrderName = ipmsCode && ipmsCode.display ? ipmsCode.display : ""; + if(ipmsCode && ipmsCode.extension && ipmsCode.extension.length > 0) { + let orderTypeFlag = ipmsCode.extension.find(e => e && e.url && e.url.includes("ipms-order-type") && e.valueString) + res.orderTypeFlag = orderTypeFlag ? orderTypeFlag.valueString : "LAB"; + } } + return res; }