amaster507
08/08/2023, 8:45 PMreshma
08/08/2023, 10:40 PMrahul1
08/08/2023, 10:43 PMamaster507
08/09/2023, 1:27 PMamaster507
08/09/2023, 1:34 PMts
import gofer from 'gofer-engine'
// pass through HL7 v2
gofer
// received localhost:5500
.listen('tcp', 'localhost', 5500)
// send a ack response
.ack()
// save a copy to a file
.store({ file: {} })
.route(route =>
// forward to hl7.emr.example.com:5500
route.send('tcp', 'hl7.emr.example.com', 5500)
)
// start running this channel
.run()amaster507
08/09/2023, 2:20 PMts
import gofer, { genId } from `@gofer-engine/engine`
const [send, messengerId] = gofer.messenger(
(route) => route.send('tcp', 'hl7.emr.example.com', 5600)
)
export const bedUpdate = (bed: string, status: 'cleaning'|'clean', user: number) => {
const now = new Date().toISOString().split('.')[0].replace(/[^\d]/gi,'')
const statusCode = status === 'cleaning' ? '1' : '2'
return send(
new Msg('MSH|^~\\&|')
.setVersion('2.4')
.set('MSH.7', now)
.setJSON('MSH.9', ['ADT', 'A20'])
.set('MSH.10', genId('ID'))
.set('MSH.11', 'D')
.addSegment(['EVN', null, now, null, null, user])
.addSegment(['NPU', bed, statusCode])
)
}
So I can just import the bedUpdate function and give it the key elements and it will generate the HL7 and send the message.rahul1
08/09/2023, 7:07 PMrahul1
08/09/2023, 7:09 PM