UNPKG

@smarttracker/blue-button-generate

Version:
167 lines (161 loc) 4.11 kB
"use strict"; var fieldLevel = require('../fieldLevel'); var leafLevel = require('../leafLevel'); var condition = require("../condition"); var contentModifier = require("../contentModifier"); var key = contentModifier.key; var required = contentModifier.required; var dataKey = contentModifier.dataKey; var policyActivity = { key: "act", attributes: { classCode: "ACT", moodCode: "EVN" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.61"), { key: "id", attributes: { root: leafLevel.inputProperty("identifier"), extension: leafLevel.inputProperty("extension") }, dataKey: 'policy.identifiers', existsWhen: condition.keyExists('identifier'), required: true }, { key: "code", attributes: leafLevel.code, dataKey: "policy.code" }, fieldLevel.statusCodeCompleted, { key: "performer", attributes: { typeCode: "PRF" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.87"), fieldLevel.assignedEntity ], dataKey: "policy.insurance.performer" }, { key: "performer", attributes: { typeCode: "PRF" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.88"), fieldLevel.assignedEntity ], dataKey: "guarantor" }, { key: "participant", attributes: { typeCode: "COV" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.89"), [fieldLevel.effectiveTime, key("time")], { key: "participantRole", attributes: { classCode: "PAT" }, content: [ fieldLevel.id, fieldLevel.usRealmAddress, fieldLevel.telecom, { key: "code", attributes: leafLevel.code, dataKey: "code" }, { key: "playingEntity", content: fieldLevel.usRealmName } ] } ], dataKey: "participant", dataTransform: function (input) { if (input.performer) { input.identifiers = input.performer.identifiers; input.address = input.performer.address; input.phone = input.performer.phone; } return input; } }, { key: "participant", attributes: { typeCode: "HLD" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.90"), { key: "participantRole", content: [ fieldLevel.id, fieldLevel.usRealmAddress ], dataKey: "performer" } ], dataKey: "policy_holder" }, { key: "entryRelationship", attributes: { typeCode: "REFR" }, content: { key: "act", attributes: { classCode: "ACT", moodCode: "EVN" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.1.19"), fieldLevel.id, { key: "entryRelationship", attributes: { typeCode: "SUBJ" }, content: { key: "procedure", attributes: { classCode: "PROC", moodCode: "PRMS" }, content: { key: "code", attributes: leafLevel.code, dataKey: "code" } }, dataKey: "procedure" } ] }, dataKey: "authorization" } ] }; exports.coverageActivity = { key: "act", attributes: { classCode: "ACT", moodCode: "EVN" }, content: [ fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.60"), fieldLevel.uniqueId, fieldLevel.id, fieldLevel.templateCode("CoverageActivity"), fieldLevel.statusCodeCompleted, { key: "entryRelationship", attributes: { typeCode: "COMP" }, content: [ [policyActivity, required] ], required: true } ] };